From 99ed1be27102368dd3ca6f3dfcbccf7068bb2cad Mon Sep 17 00:00:00 2001 From: qsh <> Date: Wed, 11 Jun 2025 11:44:00 +0800 Subject: [PATCH] sc --- .env | 2 +- .env.base | 4 +- src/permission.js | 93 +++-- src/store/modules/user.ts | 1 + src/views/Basic/Dict/DictTypeForm.vue | 122 +++++++ src/views/Basic/Dict/data/DictDataForm.vue | 181 +++++++++ src/views/Basic/Dict/data/index.vue | 207 +++++++++++ src/views/Basic/Dict/index.vue | 229 ++++++++++++ src/views/Basic/Role/Comp/RoleEmployee.vue | 83 +++++ src/views/Basic/Role/RoleAssignMenuForm.vue | 99 +++++ .../Basic/Role/RoleDataPermissionForm.vue | 166 +++++++++ src/views/Basic/Role/RoleForm.vue | 96 +++++ src/views/Basic/Role/index.vue | 147 ++++++++ src/views/Basic/User/DeptTree.vue | 56 +++ src/views/Basic/User/UserForm.vue | 228 ++++++++++++ src/views/Basic/User/index.vue | 209 +++++++++++ .../Database/Components/QuestionAddForm.vue | 344 ++++++++++++++++++ src/views/Question/Database/index.vue | 228 ++++++++++++ src/views/Question/Setting/index.vue | 7 + src/views/Question/UAV/index.vue | 7 + src/views/Question/UAVVip/index.vue | 7 + .../VipData/conponents/SecretData.vue | 310 ++++++++++++++++ .../VipData/conponents/SimpleData.vue | 211 +++++++++++ src/views/Question/VipData/index.vue | 30 ++ 24 files changed, 3014 insertions(+), 53 deletions(-) create mode 100644 src/views/Basic/Dict/DictTypeForm.vue create mode 100644 src/views/Basic/Dict/data/DictDataForm.vue create mode 100644 src/views/Basic/Dict/data/index.vue create mode 100644 src/views/Basic/Dict/index.vue create mode 100644 src/views/Basic/Role/Comp/RoleEmployee.vue create mode 100644 src/views/Basic/Role/RoleAssignMenuForm.vue create mode 100644 src/views/Basic/Role/RoleDataPermissionForm.vue create mode 100644 src/views/Basic/Role/RoleForm.vue create mode 100644 src/views/Basic/Role/index.vue create mode 100644 src/views/Basic/User/DeptTree.vue create mode 100644 src/views/Basic/User/UserForm.vue create mode 100644 src/views/Basic/User/index.vue create mode 100644 src/views/Question/Database/Components/QuestionAddForm.vue create mode 100644 src/views/Question/Database/index.vue create mode 100644 src/views/Question/Setting/index.vue create mode 100644 src/views/Question/UAV/index.vue create mode 100644 src/views/Question/UAVVip/index.vue create mode 100644 src/views/Question/VipData/conponents/SecretData.vue create mode 100644 src/views/Question/VipData/conponents/SimpleData.vue create mode 100644 src/views/Question/VipData/index.vue diff --git a/.env b/.env index 7314a4b..ff88912 100644 --- a/.env +++ b/.env @@ -5,7 +5,7 @@ VITE_APP_TITLE=刷题后台 VITE_NODE_ENV=development # 项目本地运行端口号 -VITE_PORT=8000 +VITE_PORT=8001 # open 运行 npm run dev 时自动打开浏览器 VITE_OPEN=true diff --git a/.env.base b/.env.base index 0552a5a..5a22736 100644 --- a/.env.base +++ b/.env.base @@ -6,9 +6,9 @@ VITE_DEV=true # 请求路径 # VITE_BASE_URL='http://localhost:48080' -# VITE_BASE_URL='http://47.98.161.246:48080' +VITE_BASE_URL='http://47.98.161.246:48080' # VITE_BASE_URL='http://114.55.169.15:48080' -VITE_BASE_URL='http://114.215.207.150:48080' +# VITE_BASE_URL='http://114.215.207.150:48080' # 上传路径 VITE_UPLOAD_URL='http://47.98.161.246:48080/admin-api/system/file/upload' diff --git a/src/permission.js b/src/permission.js index a16415e..67096b5 100644 --- a/src/permission.js +++ b/src/permission.js @@ -1,6 +1,6 @@ import router from './router' import { isRelogin } from '@/config/axios/service' -import { getAccessToken, removeToken } from '@/utils/auth' +import { getAccessToken } from '@/utils/auth' import { useTitle } from '@/hooks/web/useTitle' import { useNProgress } from '@/hooks/web/useNProgress' import { usePageLoading } from '@/hooks/web/usePageLoading' @@ -9,7 +9,6 @@ import { useUserStoreWithOut } from '@/store/modules/user' import { usePermissionStoreWithOut } from '@/store/modules/permission' import { useAppStoreWithOut } from '@/store/modules/app' import { getTenantId, getAppId, setTenantId, setAppId } from '@/utils/auth' -import cache from '@/plugins/cache' const { start, done } = useNProgress() @@ -21,58 +20,52 @@ const whiteList = ['/login', '/social-login', '/auth-redirect', '/bind', '/regis router.beforeEach(async (to, from, next) => { start() loadStart() - if (getAppId() && to.query?.appId && getAppId() != to.query?.appId) { - removeToken() - cache?.local?.delete('appInfo') - cache?.local?.delete('roleRouters') - cache?.local?.delete('user') - cache?.local?.delete('App_ID') - next(`/login?tenantId=${to.query?.tenantId}&appId=${to.query?.appId}`) - } else { - if (getAccessToken()) { - if (to.path === '/login') { - // next({ path: '/' }) - if (to.query?.tenantId && to.query?.appId) { - setApp(to.query.tenantId, to.query.appId) - await waitTime(1500) - } - next({ path: '/' }) - } else { - // 获取所有字典 - const dictStore = useDictStoreWithOut() - const userStore = useUserStoreWithOut() - const permissionStore = usePermissionStoreWithOut() - if (!dictStore.getIsSetDict) { - await dictStore.setDictMap() - } - if (!userStore.getIsSetUser) { - isRelogin.show = true - await userStore.setUserInfoAction() - isRelogin.show = false - // 后端过滤菜单 - await permissionStore.generateRoutes() - permissionStore.getAddRouters.forEach((route) => { - router.addRoute(route) // 动态添加可访问路由表 - }) - const redirectPath = from.query.redirect || to.path - const redirect = decodeURIComponent(redirectPath) - const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } - next(nextData) - } else { - next() - } + const userStore = useUserStoreWithOut() + if (to.path == '/login') { + userStore.resetState() // 重置用户信息状态 + } + if (getAccessToken()) { + if (to.path === '/login') { + // next({ path: '/' }) + if (to.query?.tenantId && to.query?.appId) { + setApp(to.query.tenantId, to.query.appId) + await waitTime(1500) } + next({ path: '/' }) } else { - if (whiteList.indexOf(to.path) !== -1) { + // 获取所有字典 + const dictStore = useDictStoreWithOut() + const permissionStore = usePermissionStoreWithOut() + if (!dictStore.getIsSetDict) { + await dictStore.setDictMap() + } + if (!userStore.getIsSetUser) { + isRelogin.show = true + await userStore.setUserInfoAction() + isRelogin.show = false + // 后端过滤菜单 + await permissionStore.generateRoutes() + permissionStore.getAddRouters.forEach((route) => { + router.addRoute(route) // 动态添加可访问路由表 + }) + const redirectPath = from.query.redirect || to.path + const redirect = decodeURIComponent(redirectPath) + const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect } + next(nextData) + } else { next() + } + } + } else { + if (whiteList.indexOf(to.path) !== -1) { + next() + } else { + const tenantId = getTenantId() + const appId = getAppId() + if (tenantId && appId) { + next(`/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页 } else { - const tenantId = getTenantId() - const appId = getAppId() - if (tenantId && appId) { - next(`/tiku/login?tenantId=${tenantId}&appId=${appId}&redirect=${to.fullPath}`) // 否则全部重定向到登录页 - } else { - next(`/tiku/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 - } + next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 } } } diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index baa1797..5857c78 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -75,6 +75,7 @@ export const useUserStore = defineStore('admin-user', { avatar: '', nickname: '' } + cache.local.delete(CACHE_KEY.USER) }, refresh() { cache.local.delete(CACHE_KEY.USER) diff --git a/src/views/Basic/Dict/DictTypeForm.vue b/src/views/Basic/Dict/DictTypeForm.vue new file mode 100644 index 0000000..d789785 --- /dev/null +++ b/src/views/Basic/Dict/DictTypeForm.vue @@ -0,0 +1,122 @@ + + diff --git a/src/views/Basic/Dict/data/DictDataForm.vue b/src/views/Basic/Dict/data/DictDataForm.vue new file mode 100644 index 0000000..5f093d1 --- /dev/null +++ b/src/views/Basic/Dict/data/DictDataForm.vue @@ -0,0 +1,181 @@ + + diff --git a/src/views/Basic/Dict/data/index.vue b/src/views/Basic/Dict/data/index.vue new file mode 100644 index 0000000..cb4c076 --- /dev/null +++ b/src/views/Basic/Dict/data/index.vue @@ -0,0 +1,207 @@ + + diff --git a/src/views/Basic/Dict/index.vue b/src/views/Basic/Dict/index.vue new file mode 100644 index 0000000..755b941 --- /dev/null +++ b/src/views/Basic/Dict/index.vue @@ -0,0 +1,229 @@ + + + diff --git a/src/views/Basic/Role/Comp/RoleEmployee.vue b/src/views/Basic/Role/Comp/RoleEmployee.vue new file mode 100644 index 0000000..d14f7f6 --- /dev/null +++ b/src/views/Basic/Role/Comp/RoleEmployee.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/views/Basic/Role/RoleAssignMenuForm.vue b/src/views/Basic/Role/RoleAssignMenuForm.vue new file mode 100644 index 0000000..1ac26ed --- /dev/null +++ b/src/views/Basic/Role/RoleAssignMenuForm.vue @@ -0,0 +1,99 @@ + + + diff --git a/src/views/Basic/Role/RoleDataPermissionForm.vue b/src/views/Basic/Role/RoleDataPermissionForm.vue new file mode 100644 index 0000000..9d68235 --- /dev/null +++ b/src/views/Basic/Role/RoleDataPermissionForm.vue @@ -0,0 +1,166 @@ + + diff --git a/src/views/Basic/Role/RoleForm.vue b/src/views/Basic/Role/RoleForm.vue new file mode 100644 index 0000000..9ed4e84 --- /dev/null +++ b/src/views/Basic/Role/RoleForm.vue @@ -0,0 +1,96 @@ + + diff --git a/src/views/Basic/Role/index.vue b/src/views/Basic/Role/index.vue new file mode 100644 index 0000000..6ba9419 --- /dev/null +++ b/src/views/Basic/Role/index.vue @@ -0,0 +1,147 @@ + + + + diff --git a/src/views/Basic/User/DeptTree.vue b/src/views/Basic/User/DeptTree.vue new file mode 100644 index 0000000..c7bc14b --- /dev/null +++ b/src/views/Basic/User/DeptTree.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/views/Basic/User/UserForm.vue b/src/views/Basic/User/UserForm.vue new file mode 100644 index 0000000..0356e15 --- /dev/null +++ b/src/views/Basic/User/UserForm.vue @@ -0,0 +1,228 @@ + + diff --git a/src/views/Basic/User/index.vue b/src/views/Basic/User/index.vue new file mode 100644 index 0000000..4d62af0 --- /dev/null +++ b/src/views/Basic/User/index.vue @@ -0,0 +1,209 @@ + + diff --git a/src/views/Question/Database/Components/QuestionAddForm.vue b/src/views/Question/Database/Components/QuestionAddForm.vue new file mode 100644 index 0000000..5e03dc0 --- /dev/null +++ b/src/views/Question/Database/Components/QuestionAddForm.vue @@ -0,0 +1,344 @@ + + + diff --git a/src/views/Question/Database/index.vue b/src/views/Question/Database/index.vue new file mode 100644 index 0000000..836e15f --- /dev/null +++ b/src/views/Question/Database/index.vue @@ -0,0 +1,228 @@ + + + + + diff --git a/src/views/Question/Setting/index.vue b/src/views/Question/Setting/index.vue new file mode 100644 index 0000000..6bf55a5 --- /dev/null +++ b/src/views/Question/Setting/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/Question/UAV/index.vue b/src/views/Question/UAV/index.vue new file mode 100644 index 0000000..921a40f --- /dev/null +++ b/src/views/Question/UAV/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/Question/UAVVip/index.vue b/src/views/Question/UAVVip/index.vue new file mode 100644 index 0000000..461b99f --- /dev/null +++ b/src/views/Question/UAVVip/index.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/src/views/Question/VipData/conponents/SecretData.vue b/src/views/Question/VipData/conponents/SecretData.vue new file mode 100644 index 0000000..1eefd92 --- /dev/null +++ b/src/views/Question/VipData/conponents/SecretData.vue @@ -0,0 +1,310 @@ + + + + + diff --git a/src/views/Question/VipData/conponents/SimpleData.vue b/src/views/Question/VipData/conponents/SimpleData.vue new file mode 100644 index 0000000..38ddb3d --- /dev/null +++ b/src/views/Question/VipData/conponents/SimpleData.vue @@ -0,0 +1,211 @@ + + + + + diff --git a/src/views/Question/VipData/index.vue b/src/views/Question/VipData/index.vue new file mode 100644 index 0000000..b2526a6 --- /dev/null +++ b/src/views/Question/VipData/index.vue @@ -0,0 +1,30 @@ + + + + +