This commit is contained in:
lz_db
2026-10-17 19:04:05 +08:00
parent 28b11b4365
commit 1253c159f5
43 changed files with 2652 additions and 114 deletions
+34 -1
View File
@@ -7,6 +7,7 @@
<div>
<el-input v-model="keyword" placeholder="搜索系列标题" clearable
style="width: 200px; margin-right: 8px" @keyup.enter="load" />
<el-button :loading="syncAllLoading" @click="syncAll">同步新剧</el-button>
<el-button type="primary" @click="showCreate">+ 新建系列</el-button>
</div>
</div>
@@ -23,6 +24,12 @@
</template>
</el-table-column>
<el-table-column prop="total_episodes" label="集数" width="90" />
<el-table-column label="来源" width="80">
<template #default="{ row }">
<el-tag v-if="row.source_id" size="small" type="warning">采集</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="状态" width="80">
<template #default="{ row }">
<el-tag :type="row.status === 1 ? 'success' : 'info'" size="small">
@@ -31,9 +38,11 @@
</template>
</el-table-column>
<el-table-column prop="created_at" label="创建时间" width="170" />
<el-table-column label="操作" width="180" fixed="right">
<el-table-column label="操作" width="230" fixed="right">
<template #default="{ row }">
<el-button link type="primary" @click="showEdit(row)">编辑</el-button>
<el-button v-if="row.source_id" link type="warning"
:loading="syncingId === row.id" @click="syncOne(row)">更新</el-button>
<el-button link type="primary" @click="toggleStatus(row)">
{{ row.status === 1 ? '隐藏' : '恢复' }}
</el-button>
@@ -116,6 +125,8 @@ const dialogVisible = ref(false)
const editing = ref(null)
const submitting = ref(false)
const coverUploading = ref(false)
const syncAllLoading = ref(false)
const syncingId = ref(0)
const form = reactive({
title: '', cover_url: '', description: '', category_id: 0,
@@ -224,6 +235,28 @@ async function del(row) {
load()
} catch (e) {}
}
async function syncOne(row) {
syncingId.value = row.id
try {
const r = await request({ url: `/admin/collection/sync/${row.id}`, method: 'post' })
ElMessage.success(`同步完成:新增 ${r.episodes_created} 集,已存在 ${r.episodes_skipped} 集`)
load()
} catch (e) {} finally {
syncingId.value = 0
}
}
async function syncAll() {
syncAllLoading.value = true
try {
await request({ url: '/admin/collection/sync-all', method: 'post', data: { pages: 2 } })
ElMessage.success('已触发后台同步,稍后刷新查看')
setTimeout(load, 15000)
} catch (e) {} finally {
syncAllLoading.value = false
}
}
</script>
<style scoped>