|
|
@@ -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">
|