yanghao 2 週間 前
コミット
0dc9f5d960
1 ファイル変更36 行追加59 行削除
  1. 36 59
      src/views/index.vue

+ 36 - 59
src/views/index.vue

@@ -685,15 +685,14 @@ const showDingTalkLoginMask = ref(
   isDingTalkClient() && !userStore.getUser.username && !getAccessToken(),
 );
 
-const todoPanelTitle = t("home.todoCenter");
-const newsPanelTitle = t("home.news");
-const noticeTabs = ref([
+const todoPanelTitle = computed(() => t("home.todoCenter"));
+const newsPanelTitle = computed(() => t("home.news"));
+type NoticeTabKey = "redHead" | "notice";
+const noticeTabs = computed<{ key: NoticeTabKey; label: string }[]>(() => [
   { key: "redHead", label: t("home.red") },
   { key: "notice", label: t("home.notice") },
 ]);
 
-type NoticeTabKey = (typeof noticeTabs)[number]["key"];
-
 const portalSections: PortalSection[] = [
   {
     code: "数",
@@ -873,61 +872,39 @@ const filteredSections = computed(() => {
     .filter((section) => section.apps && section.apps.length > 0); // 移除没有匹配应用的空板块
 });
 
-watch(
-  () => themeStore.theme,
-  () => {
-    if (themeStore.theme === "light") {
-      slides.value = [
-        {
-          image: banner2_white,
-          text: t("banner.banner1"),
-        },
-        {
-          image: banner1_white,
-          text: t("banner.banner2"),
-        },
-
-        {
-          image: banner1_white,
-          text: t("banner.banner3"),
-        },
-      ];
-    } else {
-      slides.value = [
-        {
-          image: banner2,
-          text: t("banner.banner1"),
-        },
-        {
-          image: banner1,
-          text: t("banner.banner2"),
-        },
-
-        {
-          image: banner1,
-          text: t("banner.banner3"),
-        },
-      ];
-    }
-  },
-);
-
-// 添加轮播数据
-const slides = ref([
-  {
-    image: themeStore.theme === "light" ? banner2_white : banner2,
-    text: t("banner.banner1"),
-  },
-  {
-    image: themeStore.theme === "light" ? banner1_white : banner1,
-    text: t("banner.banner2"),
-  },
+const slides = computed(() => {
+  if (themeStore.theme === "light") {
+    return [
+      {
+        image: banner2_white,
+        text: t("banner.banner1"),
+      },
+      {
+        image: banner1_white,
+        text: t("banner.banner2"),
+      },
+      {
+        image: banner1_white,
+        text: t("banner.banner3"),
+      },
+    ];
+  }
 
-  {
-    image: themeStore.theme === "light" ? banner1_white : banner1,
-    text: t("banner.banner3"),
-  },
-]);
+  return [
+    {
+      image: banner2,
+      text: t("banner.banner1"),
+    },
+    {
+      image: banner1,
+      text: t("banner.banner2"),
+    },
+    {
+      image: banner1,
+      text: t("banner.banner3"),
+    },
+  ];
+});
 
 // 当前索引
 const currentIndex = ref(0);