Commit 44bfd2ad by caoyanzhi

update:调整登录流程

parent f5a44b6d
...@@ -6,7 +6,15 @@ let api = { ...@@ -6,7 +6,15 @@ let api = {
// 登出 // 登出
getLoginOut: '/logout' getLoginOut: '/logout'
} }
let api1 = {
isLogin: {
url: '/login',
useIntercept: false
}
}
api = getFetch(api, '/gic-operation-web'); api = getFetch(api, '/gic-operation-web');
api1 = getFetch(api1, '/hb-manage-operation-web')
export default api; export default { ...api, ...api1 };
\ No newline at end of file \ No newline at end of file
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
</template> </template>
<script> <script>
import { origin } from '@/config' import { origin, succCode } from '@/config'
import fetch from '@/api'; import fetch from '@/api';
const { getUserInfo, getLoginOut } = fetch; const { getUserInfo, getLoginOut, isLogin } = fetch;
export default { export default {
name: 'ywHeader', name: 'ywHeader',
data() { data() {
...@@ -55,13 +55,18 @@ export default { ...@@ -55,13 +55,18 @@ export default {
methods: { methods: {
// 获取用户信息 // 获取用户信息
getUserInfo() { getUserInfo() {
isLogin().then(res => {
if (res.code != succCode) {
window.location.href = `${origin}/hb-manage-operation-web/authcenter`;
return;
}
getUserInfo().then(res => { getUserInfo().then(res => {
const result = res.result || {}; const result = res.result || {};
this.userInfo = Object.assign({}, result); this.userInfo = Object.assign({}, result);
this.$emit('updateAsideMenu', result.menuTree || []); this.$emit('updateAsideMenu', result.menuTree || []);
}).catch(e => { }).catch(e => {
// 登录异常时需要跳转到这个地址重新授权 window.location.reload();
window.location.href = `${origin}/hb-manage-operation-web/authcenter`; })
}) })
}, },
// 退出登录 // 退出登录
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment