功能:新增 OpenList 同步按钮及相关 API,优化样式
This commit is contained in:
parent
d9f87f72b5
commit
a889b83959
50
src/App.vue
50
src/App.vue
@ -424,6 +424,15 @@
|
||||
>
|
||||
🔄 重新刮削
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="folder-tree-actions__btn folder-tree-actions__btn--sync"
|
||||
@click="handleSyncOpenList"
|
||||
:disabled="syncingOpenList"
|
||||
:title="syncingOpenList ? '正在同步...' : '同步 OpenList 文件夹列表'"
|
||||
>
|
||||
📡 {{ syncingOpenList ? '同步中...' : '同步 OpenList' }}
|
||||
</button>
|
||||
<button
|
||||
v-if="multiSelectMode"
|
||||
type="button"
|
||||
@ -899,6 +908,7 @@ import {
|
||||
fetchIconList,
|
||||
fetchLoginLogs,
|
||||
fetchMovieDuplicates,
|
||||
fetchOpenListSyncProgress,
|
||||
fetchRecommendMovies,
|
||||
fetchScrapeStatus,
|
||||
fetchScraperLogs,
|
||||
@ -907,6 +917,7 @@ import {
|
||||
resetData,
|
||||
saveTmdbConfig as apiSaveTmdbConfig,
|
||||
scrapeMovie,
|
||||
syncOpenList,
|
||||
updateDrive,
|
||||
updateFolderInDrive,
|
||||
updateMovieInDrive,
|
||||
@ -1048,6 +1059,11 @@ let featuredAutoplayTimer = 0
|
||||
const successMessage = ref('')
|
||||
const errorMessage = ref('')
|
||||
|
||||
// OpenList 同步状态
|
||||
const syncingOpenList = ref(false)
|
||||
const openListSyncProgress = ref(null) // { syncing, total, synced, failed, message }
|
||||
let syncProgressTimer = null // 轮询同步进度的定时器
|
||||
|
||||
// 每日推荐电影数据(从后端接口获取)
|
||||
const recommendMovies = ref([])
|
||||
const loadingRecommend = ref(false)
|
||||
@ -2886,6 +2902,40 @@ async function handleScrapeMovie(node) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步 OpenList 文件夹列表
|
||||
*/
|
||||
async function handleSyncOpenList() {
|
||||
if (syncingOpenList.value) {
|
||||
setErrorMessage('同步正在进行中,请稍候...')
|
||||
return
|
||||
}
|
||||
|
||||
syncingOpenList.value = true
|
||||
openListSyncProgress.value = null
|
||||
|
||||
try {
|
||||
const result = await syncOpenList()
|
||||
|
||||
if (result?.code === 200) {
|
||||
setSuccessMessage(result?.message || '同步完成')
|
||||
|
||||
// 同步完成后重新加载文件夹列表
|
||||
if (activeSheetId.value) {
|
||||
await loadDriveFolders(activeSheetId.value)
|
||||
}
|
||||
} else {
|
||||
setErrorMessage(result?.message || '同步失败')
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('同步 OpenList 失败', err)
|
||||
setErrorMessage(err?.payload?.message || err?.message || '同步失败')
|
||||
} finally {
|
||||
syncingOpenList.value = false
|
||||
openListSyncProgress.value = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量刮削选中的电影文件
|
||||
*/
|
||||
|
||||
@ -877,4 +877,26 @@ export function unbindOpenList() {
|
||||
return request(`${API_BASE_URL}/openlist/unbind`, {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== OpenList 同步 API ====================
|
||||
|
||||
/**
|
||||
* 同步 OpenList 文件夹列表
|
||||
* @returns {Promise} 返回格式:{ code: 200, message: "同步完成", data: { total, synced, failed } }
|
||||
*/
|
||||
export function syncOpenList() {
|
||||
return request(`${API_BASE_URL}/openlist/sync`, {
|
||||
method: 'POST',
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 OpenList 同步进度
|
||||
* @returns {Promise} 返回格式:{ code: 200, data: { syncing: boolean, total: number, synced: number, failed: number, message: string } }
|
||||
*/
|
||||
export function fetchOpenListSyncProgress() {
|
||||
return request(`${API_BASE_URL}/openlist/sync-progress`, {
|
||||
method: 'GET',
|
||||
})
|
||||
}
|
||||
|
||||
@ -1726,6 +1726,11 @@ canvas {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* 同步OpenList按钮靠右显示 */
|
||||
.folder-tree-actions__btn--sync {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
/* 刮削状态面板 - 新增字段样式 */
|
||||
.scrape-status-overview {
|
||||
margin-top: 12px;
|
||||
@ -3996,6 +4001,22 @@ body.dark-mode .quick-icons__manage:hover {
|
||||
background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
|
||||
}
|
||||
|
||||
body.dark-mode .quick-icons__fallback {
|
||||
color: #a5b4fc;
|
||||
}
|
||||
|
||||
body.dark-mode .quick-icons__thumb img {
|
||||
filter: brightness(0.9) contrast(1.1);
|
||||
}
|
||||
|
||||
body.dark-mode .quick-access-panel .quick-icons__fallback {
|
||||
color: #a5b4fc;
|
||||
}
|
||||
|
||||
body.dark-mode .quick-access-panel .quick-icons__thumb img {
|
||||
filter: brightness(0.9) contrast(1.1);
|
||||
}
|
||||
|
||||
body.dark-mode .user-menu__trigger {
|
||||
background: #1e293b;
|
||||
border-color: #334155;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user