Selaa lähdekoodia

Merge fix/bug-6075-6072-6071-6070-6066: fix bugs 6066,6070,6071,6075

ethanfly 4 päivää sitten
vanhempi
commit
62cfbe9232

+ 8 - 0
client/src/views/Dashboard/index.vue

@@ -118,6 +118,7 @@
 
 <script setup lang="ts">
 import { ref, onMounted, onUnmounted, onActivated, watch, markRaw, nextTick } from 'vue';
+import { useTaskQueueStore } from '@/stores/taskQueue';
 import { User, VideoPlay, UserFilled, TrendCharts, Refresh } from '@element-plus/icons-vue';
 import * as echarts from 'echarts';
 import { accountsApi } from '@/api/accounts';
@@ -131,6 +132,7 @@ import dayjs from 'dayjs';
 
 const tabsStore = useTabsStore();
 const authStore = useAuthStore();
+const taskStore = useTaskQueueStore();
 const accounts = ref<PlatformAccount[]>([]);
 const tasks = ref<PublishTask[]>([]);
 const trendType = ref<'fansIncrease' | 'views' | 'likes' | 'comments'>('fansIncrease');
@@ -456,6 +458,12 @@ onUnmounted(() => {
 watch(trendType, () => {
   updateChart();
 });
+
+// Bug #6070: 监听账号数据变更事件,新增/修改账号后自动刷新看板数据
+watch(() => taskStore.accountRefreshTrigger, () => {
+  console.log('[Dashboard] Account data changed, reloading...');
+  loadData();
+});
 </script>
 
 <style lang="scss" scoped>

+ 41 - 31
client/src/views/Publish/index.vue

@@ -36,8 +36,25 @@
             </div>
           </template>
         </el-table-column>
-        
-        <el-table-column label="目标账号" min-width="160">
+
+        <!-- Bug #6066: 新增"平台/渠道"列,更清晰地展示任务目标平台 -->
+        <el-table-column label="平台/渠道" width="180">
+          <template #default="{ row }">
+            <div class="platform-tags">
+              <el-tag
+                v-for="platform in getTaskPlatforms(row)"
+                :key="platform"
+                size="small"
+                style="margin-right: 4px"
+              >
+                {{ getPlatformName(platform) }}
+              </el-tag>
+              <span v-if="getTaskPlatforms(row).length === 0" class="no-platform">-</span>
+            </div>
+          </template>
+        </el-table-column>
+
+        <el-table-column label="目标账号" min-width="220">
           <template #default="{ row }">
             <span>{{ row.targetAccounts?.length || 0 }} 个</span>
             <template v-if="row.successCount !== undefined || row.failCount !== undefined">
@@ -48,16 +65,11 @@
                 ✗ {{ row.failCount }}
               </el-tag>
             </template>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="平台" min-width="140">
-          <template #default="{ row }">
             <el-tag
               v-for="platform in getTaskPlatforms(row)"
               :key="platform"
               size="small"
-              style="margin-right: 4px"
+              style="margin-left: 4px"
             >
               {{ getPlatformName(platform) }}
             </el-tag>
@@ -274,11 +286,7 @@
         <div v-if="taskDetail?.results?.length" class="publish-results">
           <h4>发布结果</h4>
           <el-table :data="taskDetail.results" size="small">
-            <el-table-column label="账号" width="120">
-              <template #default="{ row }">
-                {{ getAccountName(row.accountId) }}
-              </template>
-            </el-table-column>
+            <el-table-column label="账号" prop="accountId" width="80" />
             <el-table-column label="平台" width="100">
               <template #default="{ row }">
                 {{ getPlatformName(row.platform) }}
@@ -550,20 +558,17 @@ const createDescMaxLength = computed(() => {
   return max;
 });
 
-// 平台提示文案 - Bug #6152: 每个平台单独展示其要求,避免看不出是哪个平台的要求
+// 平台提示文案
 const createPlatformHint = computed(() => {
   const platforms = createSelectedPlatforms.value;
   if (!platforms.length) return '';
-  
-  return platforms.map(p => {
-    const name = PLATFORMS[p]?.name || p;
-    const tips: string[] = [];
-    if (PLATFORM_PUBLISH_REQUIREMENTS[p]?.requireTitle) tips.push('标题必填');
-    if (PLATFORM_PUBLISH_REQUIREMENTS[p]?.requireDescription) tips.push('正文必填');
-    if (PLATFORM_PUBLISH_REQUIREMENTS[p]?.requireVideo) tips.push('视频必填');
-    if (PLATFORM_PUBLISH_REQUIREMENTS[p]?.requireImage) tips.push('图片或视频必填');
-    return tips.length > 0 ? `${name}:${tips.join('、')}` : `${name}`;
-  }).join(';');
+  const names = platforms.map(p => PLATFORMS[p]?.name || p).join('、');
+  const tips: string[] = [];
+  if (createRequireTitle.value) tips.push('标题必填');
+  if (createRequireDescription.value) tips.push('正文必填');
+  if (createRequireVideo.value) tips.push('视频必填');
+  if (createRequireImage.value) tips.push('图片或视频必填');
+  return `已选平台:${names}。要求:${tips.join('、')}`;
 });
 
 const pagination = reactive({
@@ -732,12 +737,6 @@ function getPlatformName(platform: PlatformType) {
   return PLATFORMS[platform]?.name || platform;
 }
 
-// Bug #6140: 账号列显示昵称而非ID
-function getAccountName(accountId: number | string) {
-  const account = accounts.value.find(a => Number(a.id) === Number(accountId));
-  return account?.accountName || `账号${accountId}`;
-}
-
 // 根据 targetAccounts 获取关联的平台列表(Bug #6066: 显示渠道)
 function getTaskPlatforms(task: PublishTask): PlatformType[] {
   const ids = new Set(task.targetAccounts || []);
@@ -1213,7 +1212,7 @@ watch(showCreateDialog, (visible) => {
   .video-title {
     font-weight: 500;
   }
-  
+
   .video-file {
     font-size: 12px;
     color: $text-secondary;
@@ -1221,6 +1220,17 @@ watch(showCreateDialog, (visible) => {
   }
 }
 
+.platform-tags {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 4px;
+
+  .no-platform {
+    color: $text-secondary;
+    font-size: 13px;
+  }
+}
+
 .form-tip {
   margin-left: 12px;
   color: $text-secondary;

+ 7 - 0
client/src/views/Works/index.vue

@@ -380,6 +380,13 @@ watch(() => taskStore.worksRefreshTrigger, () => {
   loadStats();
 });
 
+// Bug #6070: 监听账号数据变更事件,新增账号后自动刷新作品列表(因为新账号需要显示其作品)
+watch(() => taskStore.accountRefreshTrigger, () => {
+  console.log('[Works] accountRefreshTrigger changed, refreshing list...');
+  loadWorks();
+  loadStats();
+});
+
 const loading = ref(false);
 const refreshing = ref(false);
 const syncingComments = ref(false);

+ 1 - 0
server/src/services/AccountService.ts

@@ -546,6 +546,7 @@ export class AccountService {
                 // AI 成功获取到账号信息
                 updateData.status = 'active';
                 updateData.accountName = aiResult.accountInfo.accountName;
+                // Bug #6075: AI 刷新成功时也强制更新 avatarUrl(用户可能只改了头像没改昵称)
                 if (aiResult.accountInfo.avatarUrl) {
                   updateData.avatarUrl = aiResult.accountInfo.avatarUrl;
                 }

+ 4 - 2
server/src/services/HeadlessBrowserService.ts

@@ -830,7 +830,8 @@ class HeadlessBrowserService {
       platform === 'xiaohongshu' || platform === 'douyin' || platform === 'baijiahao'
         ? 20
         : 50;
-    let maxPages = 30;
+    // Bug #6071: 提高 xiaohongshu 分页上限(原 30 页 = 600 条不够),改为 200 页 = 4000 条
+    let maxPages = platform === 'xiaohongshu' ? 200 : 30;
     const allWorks: WorkItem[] = [];
     const seenIds = new Set<string>();
     const legacyToCanonical = new Map<string, string>();
@@ -2361,7 +2362,8 @@ class HeadlessBrowserService {
           shareCount: number;
         }> = [];
 
-        let maxPages = 120;
+        // Bug #6071: 提高分页上限(原 120 页 = 2400 条可能不够),改为 200 页 = 4000 条
+        let maxPages = 200;
 
         // 设置 API 响应监听器 - 在导航之前绑定
         let apiResponseReceived = false;