diff --git a/src/App.vue b/src/App.vue index 6a6f39c0..34e2c921 100644 --- a/src/App.vue +++ b/src/App.vue @@ -28,8 +28,8 @@ import BreadCrumb from "@/components/BreadCrumb"; import zhCN from "ant-design-vue/es/locale/zh_CN"; import * as api1 from "@/api/index1"; import * as api2 from "@/api/index"; -import {boeRequest, request} from "@/api/request"; -import {USER_PERMISSION} from "@/api/apis"; +import {request} from "@/api/request"; +import {USER_PERMISSION, VALIDATE_TOKEN} from "@/api/apis"; const store = useStore(); const isLogin = ref(false); @@ -37,13 +37,11 @@ const isLogin = ref(false); console.log("版本3.1.2------------"); - // 监听关闭浏览器 let time1 = ref(0); let time2 = ref(0); onMounted(() => { - init() window.addEventListener('beforeunload', e => beforeunloadHandler(e)); window.addEventListener('unload', e => unloadHandler(e)); }) @@ -53,18 +51,7 @@ function beforeunloadHandler() { time1.value = new Date().getTime(); } -function init() { - getUserInfo(); - getUserPermission(); - initDict("content_type"); //内容分类 - initDict("project_level"); //项目级别 - initDict("project_sys"); //培训分类 - initDict("project_pic"); //项目封面 - initDict("router_pic"); //路径图封面 - initDict("course_pic"); //课程封面 - initDict("job_type"); //岗位 - initDict("band"); //band -} + function unloadHandler() { time2.value = new Date().getTime() - time1.value; @@ -74,23 +61,6 @@ function unloadHandler() { } } -async function getUserInfo() { - const userInfo = await api2.userInfo(); - store.commit("SET_USER", userInfo.data.data); -} - -async function initDict(key) { - const list = await getDictList(key); - store.commit("SET_DICT", {key, data: list}); -} - -function getUserPermission(){ - request(USER_PERMISSION,{permissionType:'PAGE'}).then(res=>{ - store.commit("SET_PERMISSION", res.result.flatMap(t=>t?.permissionPageList.map(s=>s.url))); - }) -} - -const getDictList = (param) => api1.getDictTree({code: param,}).then((res) => res.data.data);