diff --git a/src/apis/modules/user.js b/src/apis/modules/user.js index 3c7c022..b5233f7 100644 --- a/src/apis/modules/user.js +++ b/src/apis/modules/user.js @@ -10,4 +10,4 @@ export const updateUser = (_, params) => request.basic.put(`/api/v1/current/user // 更新用户密码 export const updatePassword = (_, params) => request.basic.put(`/api/v1/current/password`, params) // 用户权限菜单 -export const getUserMenu = () => request.basic.get('/api/v1/current/menus') +export const getUserMenu = (params) => request.basic.get('/api/v1/current/menus', params) diff --git a/src/router/config.js b/src/router/config.js index eb88482..ab777fa 100644 --- a/src/router/config.js +++ b/src/router/config.js @@ -3,7 +3,7 @@ import * as layouts from '@/layouts' * 白名单 * @type {string[]} */ -export const whiteList = ['login', 'logout', '404', 'users','plateform'] // no redirect whitelist +export const whiteList = ['login', 'logout', '404', 'users','platform'] // no redirect whitelist /** * 未找到页面路由 @@ -48,8 +48,8 @@ export const constantRoutes = [ component: () => import('@/views/exception/404.vue'), }, { - path: '/plateform', - name: 'plateform', + path: '/platform', + name: 'platform', component: () => import('@/views/login/platForm.vue'), meta: { title: '平台选择', diff --git a/src/router/routes/index.js b/src/router/routes/index.js index 2ad09f0..c6489d2 100644 --- a/src/router/routes/index.js +++ b/src/router/routes/index.js @@ -6,6 +6,7 @@ import home from './home' // import exception from './exception' // import admin from './admin' import system from './system' +import platform from './platform' // import link from './link' // import iframe from './iframe' // import other from './other' @@ -19,6 +20,7 @@ export default [ // ...exception, // ...admin, ...system, + ...platform, // ...link, // ...iframe, // ...other, diff --git a/src/router/routes/platform.js b/src/router/routes/platform.js new file mode 100644 index 0000000..763b12d --- /dev/null +++ b/src/router/routes/platform.js @@ -0,0 +1,10 @@ +export default [ + { + path: '/platform', + name: 'platform', + component: () => import('@/views/login/platForm.vue'), + meta: { + title: '平台选择', + }, + }, +] \ No newline at end of file diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 5f46606..26f743a 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -37,10 +37,10 @@ const useAppStore = defineStore('app', { * 初始化 * @returns {Promise} */ - init() { + init(params) { const routerStore = useRouterStore() return new Promise((resolve) => { - Promise.all([routerStore.getRouterList()]) + Promise.all([routerStore.getRouterList(params)]) .then(() => { this.complete = true resolve() diff --git a/src/store/modules/router.js b/src/store/modules/router.js index b118604..b289e00 100644 --- a/src/store/modules/router.js +++ b/src/store/modules/router.js @@ -20,11 +20,12 @@ const useRouterStore = defineStore('router', { * 获取路由列表 * @returns {Promise} */ - getRouterList() { + getRouterList(params) { return new Promise((resolve, reject) => { ;(async () => { try { - const { success, data } = await apis.user.getUserMenu().catch(() => { + + const { success, data } = await apis.user.getUserMenu(params).catch(() => { throw new Error() }) if (config('http.code.success') === success) { @@ -42,6 +43,7 @@ const useRouterStore = defineStore('router', { }) this.routes = routes this.menuList = menuList + console.log(indexRoute) this.indexRoute = indexRoute resolve() } diff --git a/src/views/login/index.vue b/src/views/login/index.vue index a458608..7d08b7b 100644 --- a/src/views/login/index.vue +++ b/src/views/login/index.vue @@ -117,13 +117,7 @@ async function handleLogin() { }) loading.value = false if (config('http.code.success') === success) { - // 加载完成 - if (appStore.complete) { - goIndex() - } else { - await appStore.init() - goIndex() - } + router.push('/platform') } }) } @@ -150,10 +144,13 @@ function getFirstValidRoute() { * 去首页 */ function goIndex() { + console.log('goIndex') + // router.replace({path:'/platform'}) if (redirect.value) { location.href = redirect.value } else { const indexRoute = getFirstValidRoute() + console.log(indexRoute) if (!indexRoute) return router.push(indexRoute) } diff --git a/src/views/login/platForm.vue b/src/views/login/platForm.vue index ad92cd6..633207e 100644 --- a/src/views/login/platForm.vue +++ b/src/views/login/platForm.vue @@ -39,15 +39,15 @@
呼叫中心
-监管平台
运营平台