|
@@ -3,7 +3,7 @@
|
|
<div class="logo"></div>
|
|
<div class="logo"></div>
|
|
<div class="menu">
|
|
<div class="menu">
|
|
<el-menu :default-active="currentPath" ref="menuRef" class="el-menu-demo" mode="horizontal">
|
|
<el-menu :default-active="currentPath" ref="menuRef" class="el-menu-demo" mode="horizontal">
|
|
- <el-menu-item :index="item.path" v-for="item in routeList" :key="item.name"
|
|
|
|
|
|
+ <el-menu-item :index="item.path" v-for="item in menuStore.routeList" :key="item.name"
|
|
:class="{ 'external-link-item': isExternalLink(item.path) }" @click="handleMenuClick(item.path)">{{ item.title
|
|
:class="{ 'external-link-item': isExternalLink(item.path) }" @click="handleMenuClick(item.path)">{{ item.title
|
|
}}</el-menu-item>
|
|
}}</el-menu-item>
|
|
</el-menu>
|
|
</el-menu>
|
|
@@ -46,7 +46,8 @@ const router = useRouter()
|
|
let timer
|
|
let timer
|
|
let editPassShow = ref(false)
|
|
let editPassShow = ref(false)
|
|
const menuRef = ref()
|
|
const menuRef = ref()
|
|
-const { routeList, updateRouteList } = useMenuStore()
|
|
|
|
|
|
+// const { routeList, updateRouteList } = useMenuStore()
|
|
|
|
+const menuStore = useMenuStore()
|
|
// console.log(operationPermissions)
|
|
// console.log(operationPermissions)
|
|
const user = ref({
|
|
const user = ref({
|
|
id: "0",
|
|
id: "0",
|
|
@@ -87,7 +88,7 @@ const changeOrg = async (orgId) => {
|
|
saveSessionVar("knowledageSystem", '');
|
|
saveSessionVar("knowledageSystem", '');
|
|
saveSessionVar('routeList', '')
|
|
saveSessionVar('routeList', '')
|
|
// 可选:刷新页面或重新拉取权限/菜单等
|
|
// 可选:刷新页面或重新拉取权限/菜单等
|
|
- updateRouteList([]);
|
|
|
|
|
|
+ menuStore.updateRouteList([]);
|
|
let knowledageSystem = '';
|
|
let knowledageSystem = '';
|
|
let routeList = [{
|
|
let routeList = [{
|
|
path: '/kmplatform/home',
|
|
path: '/kmplatform/home',
|
|
@@ -116,25 +117,23 @@ const changeOrg = async (orgId) => {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- console.log("knowledageSystem", knowledageSystem);
|
|
|
|
|
|
+ // console.log("knowledageSystem", knowledageSystem);
|
|
saveSessionVar("knowledageSystem", knowledageSystem);
|
|
saveSessionVar("knowledageSystem", knowledageSystem);
|
|
saveSessionVar('routeList', JSON.stringify(routeList))
|
|
saveSessionVar('routeList', JSON.stringify(routeList))
|
|
- updateRouteList(routeList);
|
|
|
|
|
|
+ menuStore.updateRouteList(routeList);
|
|
|
|
|
|
// 刷新页面
|
|
// 刷新页面
|
|
- window.location.href = '/kmplatform/home';
|
|
|
|
|
|
+ // window.location.href = '/kmplatform/home';
|
|
|
|
+ router.push({ path: menuStore.routeList[0].path })
|
|
}
|
|
}
|
|
-// function isNotLogin() {
|
|
|
|
-// return getSessionVar("session_id") == null &&
|
|
|
|
-// getSessionVar("username") == null
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
|
|
const currentPath = computed(() => {
|
|
const currentPath = computed(() => {
|
|
// console.log('当前路由:', route)
|
|
// console.log('当前路由:', route)
|
|
let temp = ""
|
|
let temp = ""
|
|
- for (let i = 0; i < routeList.length; i++) {
|
|
|
|
|
|
+ for (let i = 0; i < menuStore.routeList.length; i++) {
|
|
for (let j = 0; j < route.matched.length; j++) {
|
|
for (let j = 0; j < route.matched.length; j++) {
|
|
- if (routeList[i].path === route.matched[j].path) {
|
|
|
|
|
|
+ if (menuStore.routeList[i].path === route.matched[j].path) {
|
|
temp = route.matched[j].path
|
|
temp = route.matched[j].path
|
|
break
|
|
break
|
|
}
|
|
}
|
|
@@ -174,7 +173,7 @@ onMounted(() => {
|
|
window.addEventListener('message', handleLogin);
|
|
window.addEventListener('message', handleLogin);
|
|
(!isNotLogin()) && fetchOrgList()
|
|
(!isNotLogin()) && fetchOrgList()
|
|
if (route.name === 'kmplatform') {
|
|
if (route.name === 'kmplatform') {
|
|
- router.push({ path: routeList[0].path })
|
|
|
|
|
|
+ router.push({ path: menuStore.routeList[0].path })
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|