From 1288a7890deb3b180b1e8df7015b1036514c4e71 Mon Sep 17 00:00:00 2001 From: pengwei <2071057782@qq.com> Date: 星期四, 27 三月 2025 09:07:12 +0800 Subject: [PATCH] 3.27优化 --- 项目代码/client/src/layout/index.vue | 113 +++++++++++++++++++++++++++++++------------------------- 1 files changed, 62 insertions(+), 51 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/layout/index.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/layout/index.vue" index ce51688..f5a744c 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/layout/index.vue" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/client/src/layout/index.vue" @@ -79,12 +79,12 @@ > <div> <span style="color: rgb(255, 255, 255); font-size: 0.88rem" - >瑙掕壊锛氳秴绾х鐞嗗憳</span + >瑙掕壊锛歿{ acountInfo.roleName }}</span > </div> <div style="margin-left: 2rem"> <span style="color: rgb(255, 255, 255); font-size: 0.88rem" - >濮撳悕锛氳秴绾х鐞嗗憳</span + >濮撳悕锛歿{ acountInfo.userTrueName }}</span > </div> <img @@ -179,15 +179,14 @@ @import "./index.less"; </style> <script> -import { getTreeMenu } from "@/api/menu.js"; +// import { getTreeMenu } from "@/api/menu.js"; import { baseUrl } from "../utils"; - -import loading from "@/components/basic/RouterLoading"; -import VolMenu from "@/components/basic/VolElementMenu.vue"; +import loading from "../components/basic/RouterLoading.vue"; +// import VolMenu from "@/components/basic/VolElementMenu.vue"; import Message from "@/views/index/Message.vue"; -import MessageConfig from "@/views/index/MessageConfig.js"; +// import MessageConfig from "@/views/index/MessageConfig.js"; -var imgUrl = require("@/assets/imgs/wms_x.png"); +var imgUrl = new URL("../assets/imgs/wms_x.png", import.meta.url).href; var $this; var $interval; var $indexDate; @@ -202,9 +201,11 @@ import { useRouter, useRoute } from "vue-router"; import store from "../store/index"; import http from "@/../src/api/http.js"; +import { GetUserInfo } from "@/api/user"; + export default defineComponent({ components: { - VolMenu, + // VolMenu, loading, Message, }, @@ -256,7 +257,9 @@ }, ]); const errorImg = ref( - 'this.src="' + require("@/assets/imgs/error-img.png") + '"' + 'this.src="' + + new URL("../assets/imgs/error-img.png", import.meta.url).href + + '"' ); const selectId = ref("1"); // 銆愰椤点�戞爣绛惧簭鍙�(褰撳墠鍙抽敭閫変腑鐨勮彍鍗�) @@ -556,53 +559,60 @@ } } Object.assign(_config.$tabs, { open: open, close: close }); + getUser(); //鍒濆鍖栬彍鍗� - getTreeMenu().then((res) => { - console.log("meanu", res); - res.push({ id: "1", name: "棣栭〉", url: "/home" }); // 涓轰簡鑾峰彇閫変腑id浣跨敤 - res.forEach((d) => { - d.path = (d.url || "").replace("/Manager", ""); - d.to = (d.url || "").replace("/Manager", ""); - if (!d.icon || d.icon.substring(0, 3) != "el-") { - d.icon = "el-icon-menu"; - } - }); + // getTreeMenu().then((res) => { + // console.log("meanu", res); + // res.push({ id: "1", name: "棣栭〉", url: "/home" }); // 涓轰簡鑾峰彇閫変腑id浣跨敤 + // res.forEach((d) => { + // d.path = (d.url || "").replace("/Manager", ""); + // d.to = (d.url || "").replace("/Manager", ""); + // if (!d.icon || d.icon.substring(0, 3) != "el-") { + // d.icon = "el-icon-menu"; + // } + // }); - store.dispatch("setPermission", res); + // store.dispatch("setPermission", res); - console.log("鏉冮檺", store.state); - menuOptions.value = res; - permissionInited.value = true; + // console.log("鏉冮檺", store.state); + // menuOptions.value = res; + // permissionInited.value = true; - //寮�鍚秷鎭帹閫侊紙main.js涓缃槸鍚﹀紑鍚痵ignalR锛�2022.05.05 - if (_config.$global.signalR) { - MessageConfig(http, (result) => { - messageList.unshift(result); - // console.log(result) - }); - } + // //寮�鍚秷鎭帹閫侊紙main.js涓缃槸鍚﹀紑鍚痵ignalR锛�2022.05.05 + // if (_config.$global.signalR) { + // MessageConfig(http, (result) => { + // messageList.unshift(result); + // // console.log(result) + // }); + // } - //褰撳墠鍒锋柊鏄笉鏄椤� - if (router.currentRoute.value.path != navigation[0].path) { - //鏌ユ壘绯荤粺鑿滃崟 - let item = menuOptions.value.find((x) => { - return x.path == router.currentRoute.value.path; //this.$route.path; - }); - if (item) return onSelect(item.id); - //鏌ユ壘椤堕儴蹇嵎杩炴帴 - item = links.value.find((x) => { - return x.path == router.currentRoute.value.path; //this.$route.path; - }); - //鏌ユ壘鏈�鍚庝竴娆¤烦杞殑椤甸潰 - if (!item) { - item = getItem(); - } - if (item) { - return open(item, false); - } - } - selectId.value = "1"; + // //褰撳墠鍒锋柊鏄笉鏄椤� + // if (router.currentRoute.value.path != navigation[0].path) { + // //鏌ユ壘绯荤粺鑿滃崟 + // let item = menuOptions.value.find((x) => { + // return x.path == router.currentRoute.value.path; //this.$route.path; + // }); + // if (item) return onSelect(item.id); + // //鏌ユ壘椤堕儴蹇嵎杩炴帴 + // item = links.value.find((x) => { + // return x.path == router.currentRoute.value.path; //this.$route.path; + // }); + // //鏌ユ壘鏈�鍚庝竴娆¤烦杞殑椤甸潰 + // if (!item) { + // item = getItem(); + // } + // if (item) { + // return open(item, false); + // } + // } + // selectId.value = "1"; + // }); + }; + const acountInfo = ref({}); + const getUser = () => { + GetUserInfo({}).then((res) => { + acountInfo.value = res.data; }); }; created(); @@ -639,6 +649,7 @@ closeTabs, currentMenuId, router, + acountInfo, }; }, /** -- Gitblit v1.9.3