Parcourir la source

fix #6070: 新增账号后监听accountRefreshTrigger自动刷新数据

ethanfly il y a 4 jours
Parent
commit
d780ef81a1
2 fichiers modifiés avec 15 ajouts et 0 suppressions
  1. 8 0
      client/src/views/Dashboard/index.vue
  2. 7 0
      client/src/views/Works/index.vue

+ 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>

+ 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);