v2.0代码提交

This commit is contained in:
zhuoda
2022-10-27 22:54:37 +08:00
parent 5593e3d2f8
commit 97f65a9d6e
1846 changed files with 128720 additions and 15512 deletions

View File

@@ -0,0 +1,25 @@
import cookie from '@/lib/cookie';
import { userApi } from 'api/user';
/**
* 此 mixin为登录以后的页面用的因为所有的有效路由排除登录、注册、404,500 这个几个特殊页面)都会走 App.vue里的router
* @author zhuoda
*/
export default {
created: function() {
const token = cookie.getToken();
// 如果登录过获取token
if (token && !this.$store.state.user.isHaveGotSessionInfo) {
(async() => {
try {
console.debug(' request session info ');
const res = await userApi.getSession();
const loginInfo = res.data;
this.$store.commit('user/updateSession', loginInfo);
} catch (e) {
this.$smartSentry.captureException(e);
}
})();
}
}
};