Commit e3e851bb by caoyanzhi

update: 调整获取用户信息的接口

parent 69d640cf
...@@ -2,19 +2,12 @@ import getFetch from './get-fetch'; ...@@ -2,19 +2,12 @@ import getFetch from './get-fetch';
let api = { let api = {
// 获取用户信息 // 获取用户信息
getUserInfo: '/user/userinfo', getUserInfo: '/loginuser',
// 登出 // 登出
getLoginOut: '/logout' getLoginOut: '/logout'
}; };
let api1 = {
isLogin: {
url: '/login',
useIntercept: false
}
};
api = getFetch(api, '/gic-operation-web'); api = getFetch(api, '/gic-authcenter');
api1 = getFetch(api1, '/hb-manage-operation-web');
export default { ...api, ...api1 }; export default api;
\ 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, succCode } from '@/config'; import { origin } from '@/config';
import fetch from '@/api'; import fetch from '@/api';
const { getUserInfo, getLoginOut, isLogin } = fetch; const { getUserInfo, getLoginOut } = fetch;
export default { export default {
name: 'YwHeader', name: 'YwHeader',
data() { data() {
...@@ -55,18 +55,10 @@ export default { ...@@ -55,18 +55,10 @@ export default {
methods: { methods: {
// 获取用户信息 // 获取用户信息
getUserInfo() { getUserInfo() {
isLogin().then(res => { getUserInfo().then(res => {
if (res.code != succCode) { const result = res.result || {};
window.location.href = `${origin}/hb-manage-operation-web/authcenter`; this.userInfo = Object.assign({}, result);
return; this.$emit('updateAsideMenu', result.menuTree || []);
}
getUserInfo().then(res => {
const result = res.result || {};
this.userInfo = Object.assign({}, result);
this.$emit('updateAsideMenu', result.menuTree || []);
}).catch(e => {
window.location.reload();
});
}); });
}, },
// 退出登录 // 退出登录
......
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