From afe2fbc5b0375c7c06853fc981deec74e04fd630 Mon Sep 17 00:00:00 2001 From: 杨磊 <505174330@qq.com> Date: 星期日, 24 八月 2025 11:30:40 +0800 Subject: [PATCH] Merge branch 'master' of http://182.92.203.7:2001/r/xiehe_website --- src/views/personalCenter/index.vue | 76 ++++++++++++++++++------------------- 1 files changed, 37 insertions(+), 39 deletions(-) diff --git a/src/views/personalCenter/index.vue b/src/views/personalCenter/index.vue index 53e00c3..bccd08a 100644 --- a/src/views/personalCenter/index.vue +++ b/src/views/personalCenter/index.vue @@ -41,58 +41,56 @@ </template> <script setup lang="ts"> -import { ArrowRight } from "@element-plus/icons-vue"; -import { menu } from "./config.ts"; -import { useRouter, onBeforeRouteUpdate } from "vue-router"; -import { ref, onMounted, inject } from "vue"; -const router = useRouter(); -const routerVal = router.currentRoute.value; -const path = ref(routerVal.path); -const label = ref(""); -const listMenu: any = ref([]); -const MG: any = inject("MG"); -const config: any = inject("config"); +import { ArrowRight } from '@element-plus/icons-vue' +import { menu } from './config' +import { useRouter, onBeforeRouteUpdate } from 'vue-router' +import { ref, onMounted, inject } from 'vue' +const router = useRouter() +const routerVal = router.currentRoute.value +const path = ref(routerVal.path) +const label = ref('') +const listMenu: any = ref([]) +const MG: any = inject('MG') +const config: any = inject('config') onBeforeRouteUpdate(async (to, from) => { - path.value = to.fullPath; -}); + path.value = to.fullPath +}) onMounted(() => { menu.forEach((item) => { - if ("/" + item.path === path.value) { - label.value = item.label; + if ('/' + item.path === path.value) { + label.value = item.label } - }); - const userCache: any = localStorage.getItem(config.userInfoKey); - const userInfo = JSON.parse(userCache); + }) + const userCache: any = localStorage.getItem(config.userInfoKey) + const userInfo = JSON.parse(userCache) if (!userInfo) { router.push({ - path: "/", - }); - return false; + path: '/', + }) + return false } - if (userInfo.role == "Teacher") { - const data: any = menu.filter((item) => item.path != "myClass"); - listMenu.value = data; - } else { - const data: any = menu.filter((item) => item.path != "myCourse"); - listMenu.value = data; - } -}); + // if (userInfo.role == 'Teacher') { + // const data: any = menu.filter((item) => item.path != 'myClass') + // listMenu.value = data + // } else { + // const data: any = menu.filter((item) => item.path != 'myCourse') + // listMenu.value = data + // } + listMenu.value = menu +}) const goRouter = (item: any) => { - if ( - !localStorage.getItem(config.tokenKey) || - localStorage.getItem(config.tokenKey) == null - ) { + if (!localStorage.getItem(config.tokenKey) || localStorage.getItem(config.tokenKey) == null) { router.push({ - path: "/home", + path: '/home', query: { - showLogin: "1", + showLogin: '1', }, - }); + }) } else { - label.value = item.label; - router.push({ path: item.path }); + label.value = item.label + router.push({ path: item.path }) } -}; +} </script> <style lang="less" scoped> .breadcrumbBox { -- Gitblit v1.9.1