li.shaoyi 2 vuotta sitten
vanhempi
commit
bcd4fd3000

+ 0 - 1
package.json

@@ -70,7 +70,6 @@
     "@vue/eslint-config-typescript": "^9.1.0",
     "compression-webpack-plugin": "^10.0.0",
     "copy-webpack-plugin": "^11.0.0",
-    "electron": "^22.0.0",
     "eslint": "^7.32.0",
     "eslint-plugin-vue": "^8.0.3",
     "less": "^4.0.0",

+ 16 - 17
src/packages/pc/components/layouts/header/components/notice/index.vue

@@ -1,7 +1,7 @@
 <!-- 系统公告 -->
 <template>
     <app-drawer class="app-notice" title="系统公告" :width="800" v-model:show="show">
-        <el-tabs class="app-notice__tabs" v-model="selectedTab">
+        <el-tabs class="app-notice__tabs" v-model="selectedTab" @tab-change="tabChange">
             <el-tab-pane label="公告" name="notice" />
             <el-tab-pane label="消息" name="message" />
         </el-tabs>
@@ -30,7 +30,7 @@
 </template>
 
 <script lang="ts" setup>
-import { shallowRef, computed, onMounted } from 'vue'
+import { shallowRef, onMounted } from 'vue'
 import { formatDate, formatHtmlString } from '@/filters'
 import { useNoticeStore } from '@/stores'
 import AppDrawer from '@pc/components/base/drawer/index.vue'
@@ -39,32 +39,31 @@ const noticeStore = useNoticeStore()
 const show = shallowRef(true)
 const selectedTab = shallowRef('notice')
 const activeId = shallowRef(0)
+const dataList = shallowRef<Model.NoticeRsp[]>([])
 
-const dataList = computed(() => {
-    switch (selectedTab.value) {
+const tabChange = (tab: string) => {
+    switch (tab) {
         case 'notice': {
-            return noticeStore.noticeList.filter((e) => e.msgtype === 1)
+            dataList.value = noticeStore.noticeList.filter((e) => e.msgtype === 1)
+            break
         }
         case 'message': {
-            return noticeStore.noticeList.filter((e) => e.msgtype === 2)
-        }
-        default: {
-            return []
+            dataList.value = noticeStore.noticeList.filter((e) => e.msgtype === 2)
+            break
         }
     }
-})
-
-const collapseChange = (id: number) => {
-    noticeStore.updateNoticeReaded(id)
-}
-
-onMounted(() => {
     const [firstItem] = dataList.value
     if (firstItem) {
         activeId.value = firstItem.autoid
         collapseChange(activeId.value)
     }
-})
+}
+
+const collapseChange = (id: number) => {
+    noticeStore.updateNoticeReaded(id)
+}
+
+onMounted(() => tabChange(selectedTab.value))
 </script>
 
 <style lang="less">