'admin-21.02.04:处理菜单权限、优化部分界面用户体验等'

This commit is contained in:
lyt-Top 2021-02-04 08:37:20 +08:00
parent 741ce08183
commit 9586a55808
18 changed files with 157 additions and 113 deletions

View File

@ -7,7 +7,7 @@
}, },
"dependencies": { "dependencies": {
"clipboard": "^2.0.6", "clipboard": "^2.0.6",
"element-plus": "^1.0.2-beta.30", "element-plus": "^1.0.2-beta.31",
"mitt": "^2.1.0", "mitt": "^2.1.0",
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"screenfull": "^5.1.0", "screenfull": "^5.1.0",

View File

@ -165,20 +165,6 @@ export const dynamicRoutes = [
isIframe: false, isIframe: false,
auth: ['admin', 'test'] auth: ['admin', 'test']
} }
},
{
path: '/limits/backEnd/btn',
name: 'limitsBackEndEndBtn',
component: () => import('/@/views/limits/backEnd/btn/index.vue'),
meta: {
title: '按钮权限',
isLink: '',
isHide: false,
isKeepAlive: true,
isAffix: false,
isIframe: false,
auth: ['admin', 'test']
}
} }
] ]
} }
@ -190,7 +176,7 @@ export const dynamicRoutes = [
component: () => import('/@/views/layout/routerView/parent.vue'), component: () => import('/@/views/layout/routerView/parent.vue'),
redirect: '/menu/menu1', redirect: '/menu/menu1',
meta: { meta: {
title: '路由嵌套', title: '菜单嵌套',
isLink: '', isLink: '',
isHide: false, isHide: false,
isKeepAlive: true, isKeepAlive: true,
@ -600,6 +586,7 @@ export function initAllFun() {
const token = getSession('token') const token = getSession('token')
if (!token) return false if (!token) return false
store.dispatch('setAuths') store.dispatch('setAuths')
store.dispatch('setUserInfos')
setAddRoute() // 添加动态路由 setAddRoute() // 添加动态路由
setFilterMenu() // 过滤权限菜单 setFilterMenu() // 过滤权限菜单
setCacheTagsViewRoutes() // 添加 keepAlive 缓存 setCacheTagsViewRoutes() // 添加 keepAlive 缓存

View File

@ -47,7 +47,8 @@ export interface RootStateTypes {
routes: Array<object>, routes: Array<object>,
caches: Array<string>, caches: Array<string>,
tagsViewRoutes: Array<object>, tagsViewRoutes: Array<object>,
auths: Array<string> auths: Array<string>,
userInfos: object
} }
export const key: InjectionKey<Store<RootStateTypes>> = Symbol() export const key: InjectionKey<Store<RootStateTypes>> = Symbol()
@ -58,7 +59,8 @@ export const store = createStore<RootStateTypes>({
routes: [], routes: [],
caches: [], caches: [],
tagsViewRoutes: [], tagsViewRoutes: [],
auths: [] auths: [],
userInfos: {}
}, },
mutations: { mutations: {
// 设置布局配置 // 设置布局配置
@ -80,7 +82,11 @@ export const store = createStore<RootStateTypes>({
// 设置权限 // 设置权限
getAuths(state: any, data: Array<string>) { getAuths(state: any, data: Array<string>) {
state.auths = data state.auths = data
} },
// 设置用户信息
getUserInfos(state: any, data: object) {
state.userInfos = data
},
}, },
actions: { actions: {
// 设置布局配置 // 设置布局配置
@ -102,15 +108,19 @@ export const store = createStore<RootStateTypes>({
// 设置权限 // 设置权限
async setAuths({ commit }, data: Array<string>) { async setAuths({ commit }, data: Array<string>) {
// 模拟权限,实际项目中,请通过直接走接口获取权限标识 // 模拟权限,实际项目中,请通过直接走接口获取权限标识
let authList: Array<string> = [] if (data && data.length > 0) {
if (getSession('defaultAuthList')) { commit('getAuths', data)
authList = getSession('defaultAuthList')
} else { } else {
let defaultAuthList: Array<string> = ['admin', 'btn.add', 'btn.del', 'btn.edit'] if (getSession('userInfo')) commit('getAuths', getSession('userInfo').authList)
if (data && data.length > 0) authList = data }
else authList = defaultAuthList },
// 设置用户信息
async setUserInfos({ commit }, data: object) {
if (data) {
commit('getUserInfos', data)
} else {
if (getSession('userInfo')) commit('getUserInfos', getSession('userInfo'))
} }
commit('getAuths', authList)
}, },
} }
}) })

View File

@ -60,7 +60,7 @@ $--color-danger-light-8: mix($--color-whites, $--color-danger, 80%) !default;
$--color-danger-light-9: mix($--color-whites, $--color-danger, 90%) !default; $--color-danger-light-9: mix($--color-whites, $--color-danger, 90%) !default;
$--bg-topBar: #ffffff; $--bg-topBar: #ffffff;
$--bg-menuBar: #545c64; $--bg-menuBar: #545c64;
$--bg-columnsMenuBar: #4276ab; $--bg-columnsMenuBar: #545c64;
$--bg-topBarColor: #606266; $--bg-topBarColor: #606266;
$--bg-menuBarColor: #eaeaea; $--bg-menuBarColor: #eaeaea;
$--bg-columnsMenuBarColor: #e6e6e6; $--bg-columnsMenuBarColor: #e6e6e6;

View File

@ -8,7 +8,7 @@ export default {
danger: "#f56c6c", danger: "#f56c6c",
topBar: "#ffffff", topBar: "#ffffff",
menuBar: "#545c64", menuBar: "#545c64",
columnsMenuBar: '#4276ab', columnsMenuBar: '#545c64',
topBarColor: "#606266", topBarColor: "#606266",
menuBarColor: "#eaeaea", menuBarColor: "#eaeaea",
columnsMenuBarColor: '#e6e6e6', columnsMenuBarColor: '#e6e6e6',

View File

@ -105,6 +105,11 @@ export default {
proxy.$refs.layoutAsideScrollbarRef.update(); proxy.$refs.layoutAsideScrollbarRef.update();
} }
}); });
//
watch(store.state, (val) => {
if (val.routes.length === state.menuList.length) return false;
setFilterRoutes();
});
// //
onBeforeMount(() => { onBeforeMount(() => {
initMenuFixed(document.body.clientWidth); initMenuFixed(document.body.clientWidth);

View File

@ -162,24 +162,24 @@
</div> </div>
<div class="layout-breadcrumb-seting-bar-flex mt15" <div class="layout-breadcrumb-seting-bar-flex mt15"
:style="{opacity:getThemeConfig.layout === 'transverse' ? 0.5 : 1}"> :style="{opacity:getThemeConfig.layout === 'transverse' ? 0.5 : 1}">
<div class="layout-breadcrumb-seting-bar-flex-label">面包屑 Breadcrumb</div> <div class="layout-breadcrumb-seting-bar-flex-label">开启 Breadcrumb</div>
<div class="layout-breadcrumb-seting-bar-flex-value"> <div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isBreadcrumb" :disabled="getThemeConfig.layout === 'transverse'" <el-switch v-model="getThemeConfig.isBreadcrumb" :disabled="getThemeConfig.layout === 'transverse'"
@change="onIsBreadcrumbChange"></el-switch> @change="onIsBreadcrumbChange"></el-switch>
</div> </div>
</div> </div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">开启 Tagsview</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isTagsview" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15"> <div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">开启 Breadcrumb 图标</div> <div class="layout-breadcrumb-seting-bar-flex-label">开启 Breadcrumb 图标</div>
<div class="layout-breadcrumb-seting-bar-flex-value"> <div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isBreadcrumbIcon" @change="setLocalThemeConfig"></el-switch> <el-switch v-model="getThemeConfig.isBreadcrumbIcon" @change="setLocalThemeConfig"></el-switch>
</div> </div>
</div> </div>
<div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">开启 Tagsview</div>
<div class="layout-breadcrumb-seting-bar-flex-value">
<el-switch v-model="getThemeConfig.isTagsview" @change="setLocalThemeConfig"></el-switch>
</div>
</div>
<div class="layout-breadcrumb-seting-bar-flex mt15"> <div class="layout-breadcrumb-seting-bar-flex mt15">
<div class="layout-breadcrumb-seting-bar-flex-label">开启 Tagsview 图标</div> <div class="layout-breadcrumb-seting-bar-flex-label">开启 Tagsview 图标</div>
<div class="layout-breadcrumb-seting-bar-flex-value"> <div class="layout-breadcrumb-seting-bar-flex-value">
@ -573,7 +573,7 @@ export default defineComponent({
} else { } else {
getThemeConfig.value.isShowLogo = false; getThemeConfig.value.isShowLogo = false;
getThemeConfig.value.isBreadcrumb = true; getThemeConfig.value.isBreadcrumb = true;
getThemeConfig.value.isCollapse = true; getThemeConfig.value.isCollapse = false;
getThemeConfig.value.isTagsview = true; getThemeConfig.value.isTagsview = true;
getThemeConfig.value.isClassicSplitMenu = false; getThemeConfig.value.isClassicSplitMenu = false;
getThemeConfig.value.menuBar = "#545c64"; getThemeConfig.value.menuBar = "#545c64";

View File

@ -20,9 +20,8 @@
:title="isScreenfull ? '开全屏' : '关全屏'" :class="!isScreenfull?'icon-fullscreen':'icon-tuichuquanping'"></i></div> :title="isScreenfull ? '开全屏' : '关全屏'" :class="!isScreenfull?'icon-fullscreen':'icon-tuichuquanping'"></i></div>
<el-dropdown :show-timeout="70" :hide-timeout="50" @command="onHandleCommandClick"> <el-dropdown :show-timeout="70" :hide-timeout="50" @command="onHandleCommandClick">
<span class="layout-navbars-breadcrumb-user-link"> <span class="layout-navbars-breadcrumb-user-link">
<img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg" <img :src="getUserInfos.photo" class="layout-navbars-breadcrumb-user-link-photo mr5" />
class="layout-navbars-breadcrumb-user-link-photo mr5" /> {{getUserInfos.userName === '' ? 'test' : getUserInfos.userName}}
{{userInfo.userName === '' ? 'test' : userInfo.userName}}
<i class="el-icon-arrow-down el-icon--right"></i> <i class="el-icon-arrow-down el-icon--right"></i>
</span> </span>
<template #dropdown> <template #dropdown>
@ -48,7 +47,6 @@ import {
toRefs, toRefs,
toRef, toRef,
ref, ref,
onMounted,
} from "vue"; } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { ElMessageBox, ElMessage } from "element-plus"; import { ElMessageBox, ElMessage } from "element-plus";
@ -69,7 +67,6 @@ export default {
const state = reactive({ const state = reactive({
isScreenfull: false, isScreenfull: false,
isShowUserNewsPopover: false, isShowUserNewsPopover: false,
userInfo: {},
}); });
// //
const setFlexAutoStyle = computed(() => { const setFlexAutoStyle = computed(() => {
@ -80,6 +77,10 @@ export default {
) )
return { flex: 1 }; return { flex: 1 };
}); });
// vuex
const getUserInfos = computed(() => {
return store.state.userInfos;
});
// //
const onScreenfullClick = () => { const onScreenfullClick = () => {
if (!screenfull.isEnabled) { if (!screenfull.isEnabled) {
@ -140,24 +141,15 @@ export default {
const onUserNewsPopoverClick = () => { const onUserNewsPopoverClick = () => {
state.isShowUserNewsPopover = !state.isShowUserNewsPopover; state.isShowUserNewsPopover = !state.isShowUserNewsPopover;
}; };
// sessionStorage
const initUserInfo = () => {
if (!getSession("userInfo")) return false;
state.userInfo = getSession("userInfo");
};
//
onMounted(() => {
initUserInfo();
});
return { return {
setFlexAutoStyle, setFlexAutoStyle,
getUserInfos,
onLayoutSetingClick, onLayoutSetingClick,
onHandleCommandClick, onHandleCommandClick,
onScreenfullClick, onScreenfullClick,
onSearchClick, onSearchClick,
onUserNewsPopoverClick, onUserNewsPopoverClick,
searchRef, searchRef,
initUserInfo,
...toRefs(state), ...toRefs(state),
}; };
}, },

View File

@ -35,10 +35,11 @@ import {
onBeforeMount, onBeforeMount,
onUnmounted, onUnmounted,
getCurrentInstance, getCurrentInstance,
watch,
} from "vue"; } from "vue";
import { useRoute, useRouter, onBeforeRouteUpdate } from "vue-router"; import { useRoute, useRouter, onBeforeRouteUpdate } from "vue-router";
import { useStore } from "/@/store/index.ts"; import { useStore } from "/@/store/index.ts";
import { setSession, getSession } from "/@/utils/storage.ts"; import { setSession, getSession, removeSession } from "/@/utils/storage.ts";
import Sortable from "sortablejs"; import Sortable from "sortablejs";
import Contextmenu from "/@/views/layout/navBars/tagsView/contextmenu.vue"; import Contextmenu from "/@/views/layout/navBars/tagsView/contextmenu.vue";
import Scroll from "/@/views/layout/navBars/tagsView/scroll.vue"; import Scroll from "/@/views/layout/navBars/tagsView/scroll.vue";
@ -55,13 +56,11 @@ export default {
const router = useRouter(); const router = useRouter();
const state = reactive({ const state = reactive({
routePath: route.path, routePath: route.path,
dropdown: { dropdown: { x: "", y: "" },
x: "",
y: "",
},
tagsRefsIndex: 0, tagsRefsIndex: 0,
tagsViewList: [], tagsViewList: [],
sortable: "", sortable: "",
tagsViewRoutesList: [],
}); });
// tagsView // tagsView
const setTagsStyle = computed(() => { const setTagsStyle = computed(() => {
@ -80,6 +79,13 @@ export default {
const addBrowserSetSession = (tagsViewList: Array<object>) => { const addBrowserSetSession = (tagsViewList: Array<object>) => {
setSession("tagsViewList", tagsViewList); setSession("tagsViewList", tagsViewList);
}; };
// vuex tagsViewRoutes
const getTagsViewRoutes = () => {
state.tagsViewList = [];
removeSession("tagsViewList");
state.tagsViewRoutesList = store.state.tagsViewRoutes;
initTagsView();
};
// vuex isAffix // vuex isAffix
const initTagsView = () => { const initTagsView = () => {
if ( if (
@ -88,7 +94,7 @@ export default {
) { ) {
state.tagsViewList = getSession("tagsViewList"); state.tagsViewList = getSession("tagsViewList");
} else { } else {
store.state.tagsViewRoutes.map((v) => { state.tagsViewRoutesList.map((v) => {
if (v.meta.isAffix && !v.meta.isHide) if (v.meta.isAffix && !v.meta.isHide)
state.tagsViewList.push({ ...v }); state.tagsViewList.push({ ...v });
}); });
@ -102,7 +108,7 @@ export default {
// 1 tagsViewisHide tagsView // 1 tagsViewisHide tagsView
const addTagsView = (path: string) => { const addTagsView = (path: string) => {
if (state.tagsViewList.some((v) => v.path === path)) return false; if (state.tagsViewList.some((v) => v.path === path)) return false;
const item = store.state.tagsViewRoutes.find((v) => v.path === path); const item = state.tagsViewRoutesList.find((v) => v.path === path);
if (item.meta.isLink && !item.meta.isIframe) return false; if (item.meta.isLink && !item.meta.isIframe) return false;
if (!item.meta.isHide) state.tagsViewList.push({ ...item }); if (!item.meta.isHide) state.tagsViewList.push({ ...item });
addBrowserSetSession(state.tagsViewList); addBrowserSetSession(state.tagsViewList);
@ -128,7 +134,7 @@ export default {
// 4 tagsViewisAffix // 4 tagsViewisAffix
const closeOtherTagsView = (path: string) => { const closeOtherTagsView = (path: string) => {
state.tagsViewList = []; state.tagsViewList = [];
store.state.tagsViewRoutes.map((v) => { state.tagsViewRoutesList.map((v) => {
if (v.meta.isAffix && !v.meta.isHide) state.tagsViewList.push({ ...v }); if (v.meta.isAffix && !v.meta.isHide) state.tagsViewList.push({ ...v });
}); });
addTagsView(path); addTagsView(path);
@ -136,7 +142,7 @@ export default {
// 5 tagsViewisAffix // 5 tagsViewisAffix
const closeAllTagsView = (path: string) => { const closeAllTagsView = (path: string) => {
state.tagsViewList = []; state.tagsViewList = [];
store.state.tagsViewRoutes.map((v) => { state.tagsViewRoutesList.map((v) => {
if (v.meta.isAffix && !v.meta.isHide) { if (v.meta.isAffix && !v.meta.isHide) {
state.tagsViewList.push({ ...v }); state.tagsViewList.push({ ...v });
if (state.tagsViewList.some((v) => v.path === path)) if (state.tagsViewList.some((v) => v.path === path))
@ -221,7 +227,13 @@ export default {
}); });
} }
}; };
// // tagsView
watch(store.state, (val) => {
if (val.tagsViewRoutes.length === state.tagsViewRoutesList.length)
return false;
getTagsViewRoutes();
});
//
onBeforeMount(() => { onBeforeMount(() => {
// 0 1 2 3 // 0 1 2 3
proxy.mittBus.on("onCurrentContextmenuClick", (data: object) => { proxy.mittBus.on("onCurrentContextmenuClick", (data: object) => {
@ -239,14 +251,15 @@ export default {
// / // /
proxy.mittBus.off("openOrCloseSortable"); proxy.mittBus.off("openOrCloseSortable");
}); });
// //
onBeforeUpdate(() => { onBeforeUpdate(() => {
tagsRefs.value = []; tagsRefs.value = [];
}); });
// //
onMounted(() => { onMounted(() => {
// vuex tagsViewRoutes
getTagsViewRoutes();
initSortable(); initSortable();
initTagsView();
}); });
// //
onBeforeRouteUpdate((to) => { onBeforeRouteUpdate((to) => {
@ -258,6 +271,7 @@ export default {
return { return {
isActive, isActive,
onContextmenu, onContextmenu,
getTagsViewRoutes,
onTagsClick, onTagsClick,
tagsRefs, tagsRefs,
contextmenuRef, contextmenuRef,

View File

@ -22,11 +22,7 @@ import {
onUnmounted, onUnmounted,
nextTick, nextTick,
} from "vue"; } from "vue";
import { import { useRoute, useRouter } from "vue-router";
useRoute,
useRouter,
onBeforeRouteUpdate,
} from "vue-router";
import { useStore } from "/@/store/index.ts"; import { useStore } from "/@/store/index.ts";
export default defineComponent({ export default defineComponent({
name: "layoutParentView", name: "layoutParentView",
@ -37,7 +33,7 @@ export default defineComponent({
const store = useStore(); const store = useStore();
const state = reactive({ const state = reactive({
transitionName: "slide-right", transitionName: "slide-right",
refreshRouterViewKey: route.path, refreshRouterViewKey: null,
}); });
// //
const setTransitionName = computed(() => { const setTransitionName = computed(() => {
@ -57,10 +53,6 @@ export default defineComponent({
const getCaches = computed(() => { const getCaches = computed(() => {
return store.state.caches; return store.state.caches;
}); });
//
onBeforeRouteUpdate((to) => {
state.refreshRouterViewKey = to.path;
});
// //
onBeforeMount(() => { onBeforeMount(() => {
proxy.mittBus.on("onTagsViewRefreshRouterView", (path: string) => { proxy.mittBus.on("onTagsViewRefreshRouterView", (path: string) => {

View File

@ -1,21 +0,0 @@
<template>
<div>
limitsBackEndEndBtn
<el-input v-model="val"></el-input>
</div>
</template>
<script lang="ts">
import { toRefs, reactive } from "vue";
export default {
name: "limitsBackEndEndBtn",
setup() {
const state = reactive({
val: "",
});
return {
...toRefs(state),
};
},
};
</script>

View File

@ -1,19 +1,83 @@
<template> <template>
<div> <div>
limitsFrontEndPage <el-alert :title="`当前用户权限:[${getAuthList}]`" type="success" :closable="false"></el-alert>
<el-input v-model="val"></el-input> <el-card shadow="hover" header="切换用户演示,前端控制不同用户显示不同页面权限" class="mt15">
<el-radio-group v-model="userAuth" size="small" @change="onRadioChange">
<el-radio-button label="admin"></el-radio-button>
<el-radio-button label="test"></el-radio-button>
</el-radio-group>
</el-card>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { toRefs, reactive } from "vue"; import { toRefs, reactive, computed, onMounted } from "vue";
import { useRouter } from "vue-router";
import { useStore } from "/@/store/index.ts";
import {
resetRoute,
setAddRoute,
setFilterMenu,
setCacheTagsViewRoutes,
} from "/@/router/index.ts";
import { setSession } from "/@/utils/storage.ts";
export default { export default {
name: "limitsFrontEndPage", name: "limitsFrontEndPage",
setup() { setup() {
const store = useStore();
const router = useRouter();
const state = reactive({ const state = reactive({
val: "", val: "",
userAuth: "",
});
//
const getAuthList = computed(() => {
return store.state.auths;
});
//
const initUserAuth = () => {
state.userAuth = store.state.auths[0];
};
//
const initAllFun = () => {
setAddRoute();
setFilterMenu();
setCacheTagsViewRoutes();
};
//
const onRadioChange = () => {
resetRoute();
let defaultAuthList: Array<string> = [];
let adminAuthList: Array<string> = [
"admin",
"btn.add",
"btn.del",
"btn.edit",
];
let testAuthList: Array<string> = ["test", "btn.add"];
if (state.userAuth === "admin") defaultAuthList = adminAuthList;
else defaultAuthList = testAuthList;
const userInfos = {
userName: state.userAuth,
photo:
state.userAuth === "admin"
? "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg"
: "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg",
time: new Date().getTime(),
authList: defaultAuthList,
};
setSession("userInfo", userInfos);
store.dispatch("setAuths", defaultAuthList); // (vuex)
store.dispatch("setUserInfos", userInfos); // (vuex)
initAllFun(); //
};
//
onMounted(() => {
initUserAuth();
}); });
return { return {
getAuthList,
onRadioChange,
...toRefs(state), ...toRefs(state),
}; };
}, },

View File

@ -78,14 +78,20 @@ export default defineComponent({
let testAuthList: Array<string> = ["test", "btn.add"]; let testAuthList: Array<string> = ["test", "btn.add"];
if (state.ruleForm.userName === "admin") defaultAuthList = adminAuthList; if (state.ruleForm.userName === "admin") defaultAuthList = adminAuthList;
else defaultAuthList = testAuthList; else defaultAuthList = testAuthList;
store.dispatch("setAuths", defaultAuthList); const userInfos = {
initAllFun();
setSession("defaultAuthList", defaultAuthList);
setSession("token", Math.random().toString(36).substr(0));
setSession("userInfo", {
userName: state.ruleForm.userName, userName: state.ruleForm.userName,
photo:
state.ruleForm.userName === "admin"
? "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg"
: "https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg",
time: new Date().getTime(), time: new Date().getTime(),
}); authList: defaultAuthList,
};
setSession("token", Math.random().toString(36).substr(0));
setSession("userInfo", userInfos);
store.dispatch("setAuths", defaultAuthList); // (vuex)
store.dispatch("setUserInfos", userInfos); // (vuex)
initAllFun(); //
router.push("/"); router.push("/");
setTimeout(() => { setTimeout(() => {
ElMessage.success(`${currentTimeInfo},欢迎回来!`); ElMessage.success(`${currentTimeInfo},欢迎回来!`);

View File

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
menu11 <el-input v-model="val" placeholder="menu11请输入内容测试路由缓存"></el-input>
<el-input v-model="val"></el-input>
</div> </div>
</template> </template>

View File

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
menu121 <el-input v-model="val" placeholder="menu121请输入内容测试路由缓存"></el-input>
<el-input v-model="val"></el-input>
</div> </div>
</template> </template>

View File

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
menu122 <el-input v-model="val" placeholder="menu122请输入内容测试路由缓存"></el-input>
<el-input v-model="val"></el-input>
</div> </div>
</template> </template>

View File

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
menu13 <el-input v-model="val" placeholder="menu13请输入内容测试路由缓存"></el-input>
<el-input v-model="val"></el-input>
</div> </div>
</template> </template>

View File

@ -1,7 +1,6 @@
<template> <template>
<div> <div>
menu2 <el-input v-model="val" placeholder="menu2请输入内容测试路由缓存"></el-input>
<el-input v-model="val"></el-input>
</div> </div>
</template> </template>