From af92a5138042c26b6460bcdbe4746caebc6f0b4b Mon Sep 17 00:00:00 2001 From: zhaochongyi <11111> Date: 星期一, 02 九月 2024 10:10:02 +0800 Subject: [PATCH] 修改初始化 --- frontend/src/layouts/AppSider.vue | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 44 insertions(+), 7 deletions(-) diff --git a/frontend/src/layouts/AppSider.vue b/frontend/src/layouts/AppSider.vue index 784620a..f6dd870 100644 --- a/frontend/src/layouts/AppSider.vue +++ b/frontend/src/layouts/AppSider.vue @@ -8,6 +8,12 @@ :selectedKeys="[current]" @click="menuHandle" ></a-menu> + <div class="sb"> + <a-tag :color="getServerStatusColor" > + {{ getServerStatusText }} + </a-tag> + <span class="tip">璇诲啓鍣�</span> + </div> </a-layout-sider> <a-layout-content> <router-view /> @@ -15,13 +21,17 @@ </a-layout> </template> <script setup> -import {ref, h, watch} from "vue"; - import {CloudServerOutlined,CreditCardOutlined,SettingOutlined} from '@ant-design/icons-vue'; +import {ref, h, watch, computed} from "vue"; +import {ipc} from '@/utils/ipcRenderer' + + import {CloudServerOutlined,CreditCardOutlined,SettingOutlined,SyncOutlined} from '@ant-design/icons-vue'; import router from "@/router"; +import {useRoute} from "vue-router"; + const route = useRoute(); const menu = ref([ {label: '閫氳璁剧疆', key: 'Communication',icon: h(CloudServerOutlined)}, {label: '鍗$墖璁剧疆', key: 'Card', icon: h(CreditCardOutlined)}, - {label: '楂樼骇璁剧疆', key: 'Advanced', icon: h(SettingOutlined)}, + // {label: '楂樼骇璁剧疆', key: 'Advanced', icon: h(SettingOutlined)}, ]) const current = ref('Communication'); @@ -30,12 +40,30 @@ current.value = e ? e.key: current.value; router.push({name: current.value}); } - current.value = router.currentRoute.value.name?router.currentRoute.value.name :'Communication' + const status = ref(0); + const getServerStatusColor = computed(()=>{ + if (status.value === 0){ + return 'error' + }else if (status.value === 1){ + return 'success' + } + }) +const getServerStatusText = computed(()=>{ + if (status.value === 0){ + return '鏈繛鎺�' + }else if (status.value === 1){ + return '宸茶繛鎺�' + } + }) - - - + ipc.on('controller.icrf.service',(event,result)=>{ + console.log(result) + status.value = result.status >0?1:0; + }) + watch(()=>route.name,(val)=>{ + current.value = val; + }) </script> <style scoped lang="less"> #app-layout-sider{ @@ -52,4 +80,13 @@ } } +.sb{ + position: absolute; + bottom: 10px; + text-align: center; + width: 100%; + .tip{ + font-size: 12px; + } +} </style> \ No newline at end of file -- Gitblit v1.8.0