chore: update

This commit is contained in:
xiaoxian521 2022-12-09 12:45:47 +08:00
parent 0b1bd19179
commit 30af2b78fe
14 changed files with 49 additions and 47 deletions

View File

@ -31,8 +31,8 @@
"dependencies": {
"@ctrl/tinycolor": "^3.4.1",
"@pureadmin/descriptions": "^1.1.0",
"@pureadmin/table": "^1.8.3",
"@pureadmin/utils": "^1.7.5",
"@pureadmin/table": "^1.9.0",
"@pureadmin/utils": "^1.8.2",
"@vueuse/core": "^9.6.0",
"@vueuse/motion": "2.0.0-beta.12",
"animate.css": "^4.1.1",

20
pnpm-lock.yaml generated
View File

@ -8,9 +8,9 @@ specifiers:
"@iconify-icons/ri": ^1.2.3
"@iconify/vue": ^4.0.0
"@pureadmin/descriptions": ^1.1.0
"@pureadmin/table": ^1.8.3
"@pureadmin/table": ^1.9.0
"@pureadmin/theme": ^2.4.0
"@pureadmin/utils": ^1.7.5
"@pureadmin/utils": ^1.8.2
"@types/element-resize-detector": 1.1.3
"@types/js-cookie": ^3.0.1
"@types/lodash": ^4.14.180
@ -90,8 +90,8 @@ specifiers:
dependencies:
"@ctrl/tinycolor": 3.4.1
"@pureadmin/descriptions": 1.1.1_element-plus@2.2.26
"@pureadmin/table": 1.8.3_element-plus@2.2.26
"@pureadmin/utils": 1.7.5_aotapuqn7htzdjltsyimavekky
"@pureadmin/table": 1.9.0_element-plus@2.2.26
"@pureadmin/utils": 1.8.2_echarts@5.4.0+vue@3.2.45
"@vueuse/core": 9.6.0_vue@3.2.45
"@vueuse/motion": 2.0.0-beta.12_vue@3.2.45
animate.css: 4.1.1
@ -1041,10 +1041,10 @@ packages:
vue: 3.2.45
dev: false
/@pureadmin/table/1.8.3_element-plus@2.2.26:
/@pureadmin/table/1.9.0_element-plus@2.2.26:
resolution:
{
integrity: sha512-M+I+CDu74s/ffNybbDg0rHhiMHTdkgVIaksfmmrEwjuLB2nEaz7R0tob2qC5rKE96U2Z246meDHBidyQNx2z9w==
integrity: sha512-3cGbQc5QV0E7i1h0QZJWVuwJKXn1Kk2Ae6T/Z/pxEVRbwE0L+vixI/x9WO31/yZEL7qNz2lD+OIOtUU+HjTbYA==
}
peerDependencies:
element-plus: ^2.0.0
@ -1064,24 +1064,20 @@ packages:
string-hash: 1.1.3
dev: true
/@pureadmin/utils/1.7.5_aotapuqn7htzdjltsyimavekky:
/@pureadmin/utils/1.8.2_echarts@5.4.0+vue@3.2.45:
resolution:
{
integrity: sha512-WqjtvMD67egsIJuPYx9V9aaXG3iYOTMj48XPfYxBzWTuUSvGkEj9M+3P1IrgG6GZQlK8dCPqaog8B0vujLjYJA==
integrity: sha512-9mr/y3RZJZGCYpKuRVngR6XVumdMjRNPLkFfljwU9KS5UQio70cfqsH6TQ8uL/Oh0eepDym+/KkSVTMx2EsOyQ==
}
peerDependencies:
dayjs: "*"
echarts: "*"
vue: "*"
peerDependenciesMeta:
dayjs:
optional: true
echarts:
optional: true
vue:
optional: true
dependencies:
dayjs: 1.11.6
echarts: 5.4.0
vue: 3.2.45
dev: false

View File

@ -132,8 +132,8 @@ const multiTagsCacheChange = () => {
/** 清空缓存并返回登录页 */
function onReset() {
removeToken();
storageLocal.clear();
storageSession.clear();
storageLocal().clear();
storageSession().clear();
const { Grey, Weak, MultiTagsCache, EpThemeColor, Layout } = getConfig();
useAppStoreHook().setLayout(Layout);
setEpThemeColor(EpThemeColor);

View File

@ -99,6 +99,7 @@ watch(
:deep(.el-loading-mask) {
opacity: 0.45;
}
.logout {
max-width: 120px;

View File

@ -131,6 +131,7 @@ watch(
:deep(.el-loading-mask) {
opacity: 0.45;
}
.logout {
max-width: 120px;

View File

@ -12,7 +12,8 @@ import { usePermissionStoreHook } from "@/store/modules/permission";
const route = useRoute();
const showLogo = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showLogo ?? true
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showLogo ??
true
);
const { routers, device, pureApp, isCollapse, menuSelect, toggleSideBar } =

View File

@ -40,13 +40,13 @@ export function useTags() {
/** 显示模式,默认灵动模式 */
const showModel = ref(
storageLocal.getItem<StorageConfigs>("responsive-configure")?.showModel ||
storageLocal().getItem<StorageConfigs>("responsive-configure")?.showModel ||
"smart"
);
/** 是否隐藏标签页,默认显示 */
const showTags =
ref(
storageLocal.getItem<StorageConfigs>("responsive-configure").hideTabs
storageLocal().getItem<StorageConfigs>("responsive-configure").hideTabs
) ?? ref("false");
const multiTags: any = computed(() => {
return useMultiTagsStoreHook().multiTags;
@ -194,11 +194,11 @@ export function useTags() {
onMounted(() => {
if (!showModel.value) {
const configure = storageLocal.getItem<StorageConfigs>(
const configure = storageLocal().getItem<StorageConfigs>(
"responsive-configure"
);
configure.showModel = "card";
storageLocal.setItem("responsive-configure", configure);
storageLocal().setItem("responsive-configure", configure);
}
});

View File

@ -105,7 +105,7 @@ router.beforeEach((to: toRouteType, _from, next) => {
handleAliveRoute(newMatched);
}
}
const userInfo = storageSession.getItem<DataInfo<number>>(sessionKey);
const userInfo = storageSession().getItem<DataInfo<number>>(sessionKey);
NProgress.start();
const externalLink = isUrl(to?.name as string);
if (!externalLink) {

View File

@ -84,7 +84,7 @@ function isOneOfArray(a: Array<string>, b: Array<string>) {
/** 从sessionStorage里取出当前登陆用户的角色roles过滤无权限的菜单 */
function filterNoPermissionTree(data: RouteComponent[]) {
const currentRoles =
storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
const newTree = cloneDeep(data).filter((v: any) =>
isOneOfArray(v.meta?.roles, currentRoles)
);
@ -196,7 +196,7 @@ function initRouter() {
if (getConfig()?.CachingAsyncRoutes) {
// 开启动态路由缓存本地sessionStorage
const key = "async-routes";
const asyncRouteList = storageSession.getItem(key) as any;
const asyncRouteList = storageSession().getItem(key) as any;
if (asyncRouteList && asyncRouteList?.length > 0) {
return new Promise(resolve => {
handleAsyncRoutes(asyncRouteList);
@ -206,7 +206,7 @@ function initRouter() {
return new Promise(resolve => {
getAsyncRoutes().then(({ data }) => {
handleAsyncRoutes(cloneDeep(data));
storageSession.setItem(key, data);
storageSession().setItem(key, data);
resolve(router);
});
});

View File

@ -9,14 +9,14 @@ export const useAppStore = defineStore({
state: (): appType => ({
sidebar: {
opened:
storageLocal.getItem<StorageConfigs>("responsive-layout")
storageLocal().getItem<StorageConfigs>("responsive-layout")
?.sidebarStatus ?? getConfig().SidebarStatus,
withoutAnimation: false,
isClickCollapse: false
},
// 这里的layout用于监听容器拖拉后恢复对应的导航模式
layout:
storageLocal.getItem<StorageConfigs>("responsive-layout")?.layout ??
storageLocal().getItem<StorageConfigs>("responsive-layout")?.layout ??
getConfig().Layout,
device: deviceDetection() ? "mobile" : "desktop"
}),
@ -30,7 +30,8 @@ export const useAppStore = defineStore({
},
actions: {
TOGGLE_SIDEBAR(opened?: boolean, resize?: string) {
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
const layout =
storageLocal().getItem<StorageConfigs>("responsive-layout");
if (opened && resize) {
this.sidebar.withoutAnimation = true;
this.sidebar.opened = true;
@ -45,7 +46,7 @@ export const useAppStore = defineStore({
this.sidebar.isClickCollapse = !this.sidebar.opened;
layout.sidebarStatus = this.sidebar.opened;
}
storageLocal.setItem("responsive-layout", layout);
storageLocal().setItem("responsive-layout", layout);
},
async toggleSideBar(opened?: boolean, resize?: string) {
await this.TOGGLE_SIDEBAR(opened, resize);

View File

@ -7,10 +7,10 @@ export const useEpThemeStore = defineStore({
id: "pure-epTheme",
state: () => ({
epThemeColor:
storageLocal.getItem<StorageConfigs>("responsive-layout")?.epThemeColor ??
getConfig().EpThemeColor,
storageLocal().getItem<StorageConfigs>("responsive-layout")
?.epThemeColor ?? getConfig().EpThemeColor,
epTheme:
storageLocal.getItem<StorageConfigs>("responsive-layout")?.theme ??
storageLocal().getItem<StorageConfigs>("responsive-layout")?.theme ??
getConfig().Theme
}),
getters: {
@ -30,12 +30,13 @@ export const useEpThemeStore = defineStore({
},
actions: {
setEpThemeColor(newColor: string): void {
const layout = storageLocal.getItem<StorageConfigs>("responsive-layout");
const layout =
storageLocal().getItem<StorageConfigs>("responsive-layout");
this.epTheme = layout?.theme;
this.epThemeColor = newColor;
if (!layout) return;
layout.epThemeColor = newColor;
storageLocal.setItem("responsive-layout", layout);
storageLocal().setItem("responsive-layout", layout);
}
}
});

View File

@ -9,12 +9,13 @@ export const useMultiTagsStore = defineStore({
id: "pure-multiTags",
state: () => ({
// 存储标签页信息(路由信息)
multiTags: storageLocal.getItem<StorageConfigs>("responsive-configure")
multiTags: storageLocal().getItem<StorageConfigs>("responsive-configure")
?.multiTagsCache
? storageLocal.getItem<StorageConfigs>("responsive-tags")
? storageLocal().getItem<StorageConfigs>("responsive-tags")
: [...routerArrays],
multiTagsCache: storageLocal.getItem<StorageConfigs>("responsive-configure")
?.multiTagsCache
multiTagsCache: storageLocal().getItem<StorageConfigs>(
"responsive-configure"
)?.multiTagsCache
}),
getters: {
getMultiTagsCache() {
@ -25,14 +26,14 @@ export const useMultiTagsStore = defineStore({
multiTagsCacheChange(multiTagsCache: boolean) {
this.multiTagsCache = multiTagsCache;
if (multiTagsCache) {
storageLocal.setItem("responsive-tags", this.multiTags);
storageLocal().setItem("responsive-tags", this.multiTags);
} else {
storageLocal.removeItem("responsive-tags");
storageLocal().removeItem("responsive-tags");
}
},
tagsCache(multiTags) {
this.getMultiTagsCache &&
storageLocal.setItem("responsive-tags", multiTags);
storageLocal().setItem("responsive-tags", multiTags);
},
handleTags<T>(
mode: string,

View File

@ -14,9 +14,9 @@ export const useUserStore = defineStore({
state: (): userType => ({
// 用户名
username:
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "",
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "",
// 页面级别权限
roles: storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? []
roles: storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? []
}),
actions: {
/** 存储用户名 */

View File

@ -23,7 +23,7 @@ export function getToken(): DataInfo<number> {
// 此处与`TokenKey`相同,此写法解决初始化时`Cookies`中不存在`TokenKey`报错
return Cookies.get(TokenKey)
? JSON.parse(Cookies.get(TokenKey))
: storageSession.getItem(sessionKey);
: storageSession().getItem(sessionKey);
}
/**
@ -47,7 +47,7 @@ export function setToken(data: DataInfo<Date>) {
function setSessionKey(username: string, roles: Array<string>) {
useUserStoreHook().SET_USERNAME(username);
useUserStoreHook().SET_ROLES(roles);
storageSession.setItem(sessionKey, {
storageSession().setItem(sessionKey, {
refreshToken,
expires,
username,
@ -60,9 +60,9 @@ export function setToken(data: DataInfo<Date>) {
setSessionKey(username, roles);
} else {
const username =
storageSession.getItem<DataInfo<number>>(sessionKey)?.username ?? "";
storageSession().getItem<DataInfo<number>>(sessionKey)?.username ?? "";
const roles =
storageSession.getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
storageSession().getItem<DataInfo<number>>(sessionKey)?.roles ?? [];
setSessionKey(username, roles);
}
}