feat: add useCrudSchemas hook

This commit is contained in:
陈凯龙
2022-04-26 15:03:48 +08:00
parent ab0f59ac91
commit 00d947e2f8
11 changed files with 468 additions and 162 deletions

View File

@@ -5,12 +5,16 @@ import type { RouteRecordRaw } from 'vue-router'
import { useTitle } from '@/hooks/web/useTitle'
import { useNProgress } from '@/hooks/web/useNProgress'
import { usePermissionStoreWithOut } from '@/store/modules/permission'
import { useDictStoreWithOut } from '@/store/modules/dict'
import { usePageLoading } from '@/hooks/web/usePageLoading'
import { getDictApi } from '@/api/common'
const permissionStore = usePermissionStoreWithOut()
const appStore = useAppStoreWithOut()
const dictStore = useDictStoreWithOut()
const { wsCache } = useCache()
const { start, done } = useNProgress()
@@ -31,6 +35,15 @@ router.beforeEach(async (to, from, next) => {
return
}
if (!dictStore.getIsSetDict) {
// 获取所有字典
const res = await getDictApi()
if (res) {
dictStore.setDictObj(res.data)
dictStore.setIsSetDict(true)
}
}
// 开发者可根据实际情况进行修改
const roleRouters = wsCache.get('roleRouters') || []
const userInfo = wsCache.get(appStore.getUserInfo)