yangdr 3 тижнів тому
батько
коміт
6b63b8b6ea
1 змінених файлів з 8 додано та 13 видалено
  1. 8 13
      src/components/LayoutHeader.vue

+ 8 - 13
src/components/LayoutHeader.vue

@@ -35,7 +35,7 @@
 import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue'
 import { useMenuStore } from "@/stores/menu.js"
 import { useRoute, useRouter } from "vue-router";
-import { getSessionVar, clearSessionVar, saveSessionVar } from '@/utils/session'
+import { getSessionVar, clearSessionVar, saveSessionVar, deleteSessionVar } from '@/utils/session'
 import EditPasswordDialog from "@/components/EditPasswordDialog.vue"
 import { knowledgeGraphAddr } from "@/utils/config"
 import { isNotLogin } from "@/utils/app"
@@ -50,19 +50,14 @@ const menuRef = ref()
 const menuStore = useMenuStore()
 // console.log(operationPermissions)
 const user = ref({
-  id: "0",
-  full_name: 'John Doe',
-  username: 'johndoe',
-})
-user.value = {
   id: getSessionVar('user_id') || "0",
   full_name: getSessionVar('full_name') || 'John Doe',
   username: getSessionVar('username') || 'johndoe',
-}
+})
 
 // 机构相关
 const orgList = ref([])
-let currentOrg = ref(getSessionVar('org_id') || '') // 当前机构id
+let currentOrg = ref() // 当前机构id
 
 // 获取机构列表
 const fetchOrgList = async () => {
@@ -73,7 +68,7 @@ const fetchOrgList = async () => {
   const res = await proxy.$http.get('/open-platform/sys/currSURO')
   // console.log('当前机构11:', res)
   currentOrg.value = +res
-  saveSessionVar('org_id', +res)
+
 
   // console.log('机构列表:', orgList.value)
   // console.log('当前机构:', currentOrg.value)
@@ -84,11 +79,11 @@ const changeOrg = async (orgId) => {
   // 可调用后端切换机构接口
   const res = await proxy.$http.post(`/open-platform/sys/changeSURO/${orgId}`)
   // console.log('切换机构结果:', res)
-  saveSessionVar('org_id', orgId)
-  saveSessionVar("knowledageSystem", '');
-  saveSessionVar('routeList', '')
+  // saveSessionVar('org_id', orgId)
+  deleteSessionVar("knowledageSystem");
+  deleteSessionVar('routeList', '')
   // 可选:刷新页面或重新拉取权限/菜单等
-  menuStore.updateRouteList([]);
+  // menuStore.updateRouteList([]);
   let knowledageSystem = '';
   let routeList = [{
     path: '/kmplatform/home',