diff --git a/src/api/authorization.js b/src/api/authorization.js new file mode 100644 index 0000000..f7265c7 --- /dev/null +++ b/src/api/authorization.js @@ -0,0 +1,9 @@ +import request from '@/router/axios'; + +export const getUserinfo = params => { + return request({ + url: '/smartpark/user/getUserInfo', + method: 'get', + params: params + }) +} diff --git a/src/page/login/authorization.vue b/src/page/login/authorization.vue new file mode 100644 index 0000000..adea52e --- /dev/null +++ b/src/page/login/authorization.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/src/page/login/userlogin.vue b/src/page/login/userlogin.vue index 294d586..01c16df 100644 --- a/src/page/login/userlogin.vue +++ b/src/page/login/userlogin.vue @@ -334,15 +334,7 @@ if (this.website.switchMode) { const deptId = this.userInfo.dept_id; const roleId = this.userInfo.role_id; - if (deptId.includes(",") || roleId.includes(",")) { - this.loginForm.deptId = deptId; - this.loginForm.roleId = roleId; - this.userBox = true; - this.$store.dispatch("LogOut").then(() => { - loading.close(); - }); - return false; - } + } this.$router.push({path: this.tagWel.value}); loading.close(); diff --git a/src/router/page/index.js b/src/router/page/index.js index 1136402..59d3f39 100644 --- a/src/router/page/index.js +++ b/src/router/page/index.js @@ -10,72 +10,82 @@ export default [{ isTab: false, isAuth: false } +},{ + path: '/authorization', + name: '鉴权页面', + component: () => + import( /* webpackChunkName: "page" */ '@/page/login/authorization'), + meta: { + keepAlive: true, + isTab: false, + isAuth: false + } }, - { - path: '/lock', - name: '锁屏页', - component: () => - import( /* webpackChunkName: "page" */ '@/page/lock/index'), - meta: { - keepAlive: true, - isTab: false, - isAuth: false - } - }, - { - path: '/404', - component: () => - import( /* webpackChunkName: "page" */ '@/components/error-page/404'), - name: '404', - meta: { - keepAlive: true, - isTab: false, - isAuth: false - } +{ + path: '/lock', + name: '锁屏页', + component: () => + import( /* webpackChunkName: "page" */ '@/page/lock/index'), + meta: { + keepAlive: true, + isTab: false, + isAuth: false + } +}, +{ + path: '/404', + component: () => + import( /* webpackChunkName: "page" */ '@/components/error-page/404'), + name: '404', + meta: { + keepAlive: true, + isTab: false, + isAuth: false + } - }, - { - path: '/403', - component: () => - import( /* webpackChunkName: "page" */ '@/components/error-page/403'), - name: '403', - meta: { - keepAlive: true, - isTab: false, - isAuth: false - } - }, - { - path: '/500', +}, +{ + path: '/403', + component: () => + import( /* webpackChunkName: "page" */ '@/components/error-page/403'), + name: '403', + meta: { + keepAlive: true, + isTab: false, + isAuth: false + } +}, +{ + path: '/500', + component: () => + import( /* webpackChunkName: "page" */ '@/components/error-page/500'), + name: '500', + meta: { + keepAlive: true, + isTab: false, + isAuth: false + } +}, +{ + path: '/', + name: '主页', + redirect: '/wel' +}, +{ + path: '/myiframe', + component: Layout, + redirect: '/myiframe', + children: [{ + path: ":routerPath", + name: 'iframe', component: () => - import( /* webpackChunkName: "page" */ '@/components/error-page/500'), - name: '500', - meta: { - keepAlive: true, - isTab: false, - isAuth: false - } - }, - { - path: '/', - name: '主页', - redirect: '/wel' - }, - { - path: '/myiframe', - component: Layout, - redirect: '/myiframe', - children: [{ - path: ":routerPath", - name: 'iframe', - component: () => - import( /* webpackChunkName: "page" */ '@/components/iframe/main'), - props: true - }] + import( /* webpackChunkName: "page" */ '@/components/iframe/main'), + props: true + }] - }, - { - path: '*', - redirect: '/404' - } +}, +{ + path: '*', + redirect: '/404' +} ] diff --git a/src/store/getters.js b/src/store/getters.js index e6fcd6f..fe3bf09 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -3,6 +3,7 @@ const getters = { language: state => state.common.language, website: state => state.common.website, userInfo: state => state.user.userInfo, + userAuthInfo: state => state.user.userAuthInfo, colorName: state => state.common.colorName, themeName: state => state.common.themeName, isShade: state => state.common.isShade, diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 45f5979..d56ea83 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -53,6 +53,7 @@ const user = { menuAll: getStore({name: 'menuAll'}) || [], token: getStore({name: 'token'}) || '', refreshToken: getStore({name: 'refreshToken'}) || '', + userAuthInfo:getStore({name: 'userAuthInfo'}) || [], }, actions: { //根据用户名登录 @@ -78,6 +79,31 @@ const user = { reject(error); }) }) + }, + //获取用户信息之后进行存储 + AuthLoginByUsername({commit}, userInfo) { + return new Promise((resolve, reject) => { + // loginByUsername(userInfo.tenantId, userInfo.deptId, userInfo.roleId, userInfo.username, encrypt(userInfo.password), userInfo.type, userInfo.key, userInfo.code).then(res => { + // const data = res.data; + // if (data.error_description) { + // Message({ + // message: data.error_description, + // type: 'error' + // }) + // } else { + // commit('SET_TOKEN', data.access_token); + // commit('SET_REFRESH_TOKEN', data.refresh_token); + // commit('SET_TENANT_ID', data.tenant_id); + console.log('userInfo',userInfo); + commit('SET_USER_AUTH_INFO', userInfo); + // commit('DEL_ALL_TAG'); + // commit('CLEAR_LOCK'); + // } + resolve(); + // }).catch(error => { + // reject(error); + // }) + }) }, //根据手机信息登录 LoginByPhone({ commit }, userInfo) { @@ -328,6 +354,11 @@ const user = { } setStore({name: 'userInfo', content: state.userInfo}) }, + SET_USER_AUTH_INFO: (state, userInfo) => { + console.log('userInfo') + state.userInfo = userInfo; + setStore({name: 'userInfo', content: state.userInfo}) + }, SET_ROLES: (state, roles) => { state.roles = roles; },