bug修复

This commit is contained in:
jianzhichu
2025-11-30 21:33:18 +08:00
parent e42a004765
commit 50149a280b
57 changed files with 766 additions and 317 deletions
+7 -38
View File
@@ -19,10 +19,10 @@
</div>
</transition>
<!-- 同步按钮请求期间禁用 -->
<!-- <a-button type="primary" class="sync-btn" @click="handleSyncAll" :disabled="isSyncDisabled">
<a-button type="primary" class="sync-btn" @click="handleSyncAll" :disabled="isSyncDisabled">
<SyncOutlined />
<span class="sync-btn-text">同步</span>
</a-button> -->
<span class="sync-btn-text">立即同步</span>
</a-button>
</div>
</div>
<!-- 卡片列表区域 -->
@@ -67,7 +67,7 @@
</template>
<template v-else>
<span class="path-text" :class="{ 'path-empty': !item.savePath }">
{{ item.savePath || '未设置存储文件夹名称' }}
{{ item.savePath || '默认用作者名字' }}
</span>
<!-- 编辑按钮禁用item.isSaving true -->
<a-button type="text" class="edit-btn" @click="() => handleEditPath(item)" title="编辑文件夹名称" :disabled="item.isSaving">
@@ -95,7 +95,7 @@
<div v-if="noMoreData && followData.length > 0" class="no-more-container">暂无更多数据</div>
<!-- 空状态 -->
<div v-if="followData.length === 0 && !loading" class="empty-container">
<Empty description="暂无关注用户" />
<Empty description="暂无关注用户,或Cookie设置中未设置SecUserId" />
</div>
</div>
</div>
@@ -305,15 +305,7 @@ const handleScroll = () => {
// 开关状态变更(启用/禁用用户)
const handleSwitchChange = (item, checked) => {
item.openSync = checked;
if (!checked) item.isEditing = false; // 禁用时关闭编辑状态
if (!checked) {
uploadSyncStatus(item);
} else {
if (item.savePath.length > 0) {
uploadSyncStatus(item);
}
}
uploadSyncStatus(item);
};
// 全量同步开关变更
@@ -342,7 +334,6 @@ const handleSavePath = (item) => {
uploadSyncStatus(item);
};
const uploadSyncStatus = (item) => {
item.isSaving = true;
useApiStore()
.OpenOrCloseSync({
Id: item.id,
@@ -371,29 +362,7 @@ const uploadSyncStatus = (item) => {
//全量同步开关
const uploadFullSyncStatus = (item) => {
item.isSaving = true;
useApiStore()
.OpenOrCloseFullSync({
Id: item.id,
OpenSync: item.openSync,
FullSync: item.fullSync,
SavePath: item.savePath, // 保持原有逻辑:提交 savePath
})
.then((res) => {
if (res.code === 0) {
message.success(`保存成功,将在下次任务执行时生效`);
item.isEditing = false; // 保存成功后关闭编辑状态
} else {
message.error('保存失败' + (res.msg || '未知错误'));
}
})
.catch((err) => {
console.error('保存失败', err);
message.error('保存失败,请重试');
})
.finally(() => {
// 接口响应结束:解除禁用(无论成功失败)
item.isSaving = false;
});
uploadSyncStatus(item);
};
// 批量同步所有用户
+36 -11
View File
@@ -44,10 +44,14 @@
<!-- 模板相关配置只有关闭"标题当文件名"时才显示 -->
<a-form-item has-feedback label="定义标题模板" name="FollowedTitleTemplate" :wrapper-col="{ span: 12 }" v-if="!formState.UperUseViedoTitle">
<a-select v-model:value="formState.FollowedTitleTemplate" :options="template_options" mode="multiple" size="middle" placeholder="请选择"></a-select>
<a-select v-model:value="formState.FollowedTitleTemplate" :options="template_options" mode="multiple" size="middle" placeholder="请选择占位符组合"></a-select>
<div class="flex items-start mt-1 text-sm text-gray-500">
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
<span>选择生成文件名的占位符顺序即为文件名顺序需配合分隔符使用</span>
<span>
选择生成文件名的占位符顺序即为文件名顺序需配合分隔符使用<br />
<strong class="text-gray-700">占位符说明</strong>
{Id}=视频ID{VideoTitle}=视频标题{ReleaseTime}=发布时间{Author}=博主名称{FileHash}=文件哈希{Resolution}=分辨率
</span>
</div>
</a-form-item>
@@ -55,13 +59,23 @@
<a-input v-model:value="formState.FollowedTitleSeparator" placeholder="请输入分隔符(如 - _ 或空)" style="width: 200px" />
<div class="flex items-start mt-1 text-sm text-gray-500">
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
<span>占位符之间的连接符-_为空则直接拼接</span>
<span>
占位符之间的连接符-_.为空则直接拼接<br />
<strong class="text-gray-700">示例</strong>选择{Author}{VideoTitle}分隔符填-将生成博主名称-视频标题格式文件名
</span>
</div>
</a-form-item>
<!-- 完整模板预览只有关闭"标题当文件名"时才显示 -->
<a-form-item label="完整模板预览" :wrapper-col="{ span: 12 }" v-if="!formState.UperUseViedoTitle">
<a-input v-model:value="formState.FullFollowedTitleTemplate" placeholder="最终的模板" disabled style="background: #f5f5f5" />
<div class="flex items-start mt-1 text-sm text-gray-500">
<InfoCircleOutlined class="text-blue-400 mr-1 mt-0.5" />
<span>
实时展示您选择的占位符和分隔符组合效果<br />
<strong class="text-gray-700">示例</strong>选择{Author}{ReleaseTime}{Id}分隔符填_预览结果为博主名称_20250101_123456
</span>
</div>
</a-form-item>
</div>
@@ -150,20 +164,19 @@ import type { Rule } from 'ant-design-vue/es/form';
import type { FormInstance } from 'ant-design-vue';
import { useApiStore } from '@/store';
import { message } from 'ant-design-vue';
import { InfoCircleOutlined } from '@ant-design/icons-vue';
import { InfoCircleOutlined, SaveOutlined, CheckOutlined } from '@ant-design/icons-vue';
// 表单引用
const formRef = ref<FormInstance>();
// 模板字段:结构化数组
const template_options = [
{ label: '{Id}', value: '{Id}' },
{ label: '{VideoTitle}', value: '{VideoTitle}' },
{ label: '{FileHash}', value: '{FileHash}' },
// { label: '{FileSize}', value: '{FileSize}' },
{ label: '{Resolution}', value: '{Resolution}' },
// { label: '{SyncTime}', value: '{SyncTime}' },
{ label: '{ReleaseTime}', value: '{ReleaseTime}' },
{ label: '{Id} (视频ID)', value: '{Id}' },
{ label: '{VideoTitle} (视频标题)', value: '{VideoTitle}' },
{ label: '{ReleaseTime} (发布时间)', value: '{ReleaseTime}' },
{ label: '{Author} (博主名称)', value: '{Author}' },
{ label: '{FileHash} (文件哈希)', value: '{FileHash}' },
{ label: '{Resolution} (分辨率)', value: '{Resolution}' },
];
// 状态定义
@@ -415,4 +428,16 @@ const onCancel = () => {
:deep(.ant-input-disabled) {
color: #666 !important;
}
// 模板选择器选项样式优化
:deep(.ant-select-item-option-content) {
display: flex;
align-items: center;
}
// 提示信息中的强调文本样式
:deep(.text-gray-700) {
color: #444 !important;
font-weight: 500;
}
</style>