Skip to content

Commit

Permalink
Merge branch 'release/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vclass committed May 12, 2024
2 parents 7c70ed1 + d44f3e9 commit 50ce3f2
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 79 deletions.
7 changes: 7 additions & 0 deletions src/apis/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ export const qrCodeStatus = (qrCodeId: string) => {
method: 'GET'
})
}

export const getAccountSettings = (mid: number)=>{
return $http({
url: '/account/settings/' + mid,
method: 'GET'
})
}
53 changes: 5 additions & 48 deletions src/components/account/AccountList.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<template>
<el-dialog v-model="dialogSettingsVisible" title="同步设置" :before-close="handleFavClose" :destroy-on-close="true">
<AccountSettings
:fatherFavTableData="favDataRef" :fatherFavTotal="favCountRef"
:fatherCollectedTableData="collectedDataRef" :fatherCollectedTotal="collectedTotalRef"
:fatherMid="favMidRef" :fatherWatchLaterSync="watchLaterSyncRef" />
<AccountSettings :fatherMid="favMidRef" />
</el-dialog>
<el-table :data="tableData">
<!-- <el-table-column prop="mid" label="id" /> -->
Expand All @@ -30,11 +27,9 @@
<el-button size="small" @click="JumpDirExplorer(scope.row.mid)">查看文件夹</el-button>
</el-row>
<el-row>
<el-button
size="small"
@click="ShowSettings(scope.row.mid, scope.row.folders, scope.row.folders_count, scope.row.collected, scope.row.collected_count, scope.row.watch_later_sync)"
>同步设置</el-button
>
<el-button size="small" @click="ShowSettings(scope.row.mid)">
同步设置
</el-button>
</el-row>
<el-divider />
<el-row>
Expand Down Expand Up @@ -104,32 +99,14 @@ const deleteOperation = (row: User) => {
})
}
interface Folder {
mlid: number
fid: number
title: string
media_count: number
sync: number
}
interface Collected{
coll_id:number
title:string
media_count: number
sync: number
}
interface User {
mid: number
status: number
face: string
uname: string
folders_count: number
folders: Folder[]
collected: Collected[]
collected_count: number
watch_later_count: number
watch_later_sync: number
}
const tableData = ref<User[]>([])
Expand All @@ -148,30 +125,10 @@ const saveOperation = () => {
GetUserList()
const favDataRef = ref<Folder[]>([])
const favCountRef = ref<number>(0)
const collectedDataRef = ref<Collected[]>([])
const collectedTotalRef = ref<number>(0)
const favMidRef = ref<number>(0)
const watchLaterSyncRef = ref<number>(0)
const dialogSettingsVisible = ref(false)
const ShowSettings = (
favMid: number,
favData: Folder[], favCount: number,
collectedData: Collected[], collectedTotal: number,
watchLaterSync:number
) => {
favDataRef.value = favData
favCountRef.value = favCount
collectedDataRef.value = collectedData
collectedTotalRef.value = collectedTotal
const ShowSettings = (favMid: number) => {
favMidRef.value = favMid
watchLaterSyncRef.value = watchLaterSync
dialogSettingsVisible.value = true
}
Expand Down
66 changes: 40 additions & 26 deletions src/components/account/AccountSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@
</el-row>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { defineProps, ref } from 'vue'
import { setSyncFav, setNotSyncFav } from '@/apis/favour'
import { setSyncWatchLater, setNotSyncWatchLater } from '@/apis/watch_later'
import { setSyncCollected, setNotSyncCollected } from '@/apis/collected'
import { getAccountSettings } from '@/apis/account'
interface Folder {
mlid: number
Expand All @@ -105,26 +107,37 @@ media_count: number
sync: number
}
interface AccountSettings {
mid: number
folders: Folder[]
watch_later_sync: number
collected: Collected[]
}
interface Props {
fatherFavTableData: Folder[]
fatherFavTotal: number
fatherCollectedTableData: Collected[]
fatherCollectedTotal: number
fatherMid: number
fatherWatchLaterSync: number
}
const propsData = defineProps<Props>()
const accountSettings = ref<AccountSettings>({
mid: 0,
folders: [],
watch_later_sync: 0,
collected: []
})
const watchLaterSync = ref<number>(0)
const favTableData = ref<Folder[]>([])
const favQuery = ref({
page: 1,
page_size: 10
})
const favTotal = ref<number>(0)
const GetFavourList = () => {
if (propsData.fatherFavTotal == 0) return
favTableData.value = propsData.fatherFavTableData.slice(
if (favTotal.value == 0) return
favTableData.value = accountSettings.value.folders.slice(
(favQuery.value.page - 1) * favQuery.value.page_size,
favQuery.value.page * favQuery.value.page_size
)
Expand All @@ -138,49 +151,50 @@ const collectedQuery = ref({
})
const collectedTotal = ref<number>(0)
const GetCollectedList = () => {
if (propsData.fatherCollectedTotal == 0) return
collectedTableData.value = propsData.fatherCollectedTableData.slice(
if (collectedTotal.value == 0) return
collectedTableData.value = accountSettings.value.collected.slice(
(collectedQuery.value.page - 1) * collectedQuery.value.page_size,
collectedQuery.value.page * collectedQuery.value.page_size
)
}
const mid = ref<number>(0)
const watchLaterSync = ref<number>(0)
const InitSettings = () => {
mid.value = propsData.fatherMid
watchLaterSync.value = propsData.fatherWatchLaterSync
getAccountSettings(propsData.fatherMid).then(res => {
accountSettings.value = res.data
watchLaterSync.value = accountSettings.value.watch_later_sync
collectedTotal.value = propsData.fatherCollectedTotal
GetCollectedList()
collectedTotal.value = accountSettings.value.collected.length
collectedTableData.value = accountSettings.value.collected
favTotal.value = propsData.fatherFavTotal
GetFavourList()
favTotal.value = accountSettings.value.folders.length
favTableData.value = accountSettings.value.folders
GetCollectedList()
GetFavourList()
})
}
const SetFavSync = (mlid: number, targetSync: number) => {
if (targetSync == 1) {
setSyncFav({ mid: mid.value, mlid: mlid })
setSyncFav({ mid: propsData.fatherMid, mlid: mlid })
} else {
setNotSyncFav({ mid: mid.value, mlid: mlid })
setNotSyncFav({ mid: propsData.fatherMid, mlid: mlid })
}
}
const SetCollectedSync = (coll_id: number, targetSync: number) => {
if (targetSync == 1) {
setSyncCollected({ mid:mid.value, coll_id: coll_id })
setSyncCollected({ mid:propsData.fatherMid, coll_id: coll_id })
} else {
setNotSyncCollected({ mid:mid.value, coll_id: coll_id })
setNotSyncCollected({ mid:propsData.fatherMid, coll_id: coll_id })
}
}
const SetWatchLaterSync = () => {
if (watchLaterSync.value == 1) {
setSyncWatchLater({ mid: mid.value })
setSyncWatchLater({ mid: propsData.fatherMid })
} else {
setNotSyncWatchLater({ mid: mid.value })
setNotSyncWatchLater({ mid: propsData.fatherMid })
}
}
Expand Down
21 changes: 16 additions & 5 deletions src/views/VideosView.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
<template>
<div class="videos">
<el-tabs type="card">
<el-tab-pane label="待同步"><VideoList :status="0" /></el-tab-pane>
<el-tab-pane label="正在同步"><VideoList :status="1" /></el-tab-pane>
<el-tab-pane label="同步完成"><VideoList :status="2" /></el-tab-pane>
<el-tab-pane label="同步失败"><VideoList :status="3" /></el-tab-pane>
<el-tabs type="card" v-model="activate">
<el-tab-pane label="待同步" name="toBeSync" :key="'toBeSync'">
<VideoList :status="0" v-if="activate == 'toBeSync'" />
</el-tab-pane>
<el-tab-pane label="正在同步" name="syncing" :key="'syncing'">
<VideoList :status="1" v-if="activate == 'syncing'" />
</el-tab-pane>
<el-tab-pane label="同步完成" name="synced" :key="'synced'" >
<VideoList :status="2" v-if="activate == 'synced'" />
</el-tab-pane>
<el-tab-pane label="同步失败" name="syncFail" :key="'syncFail'" >
<VideoList :status="3" v-if="activate == 'syncFail'" />
</el-tab-pane>
</el-tabs>
</div>
</template>

<script lang="ts" setup>
import VideoList from '@/components/video/VideoList.vue'
import { ref } from 'vue';
const activate = ref('toBeSync')
</script>

<style lang="scss" scoped></style>

0 comments on commit 50ce3f2

Please sign in to comment.