|
@@ -215,8 +215,20 @@ export default {
|
|
setCookie('accessToken', res.data.accessToken, cookieTime, '/');
|
|
setCookie('accessToken', res.data.accessToken, cookieTime, '/');
|
|
setCookie('refreshToken', res.data.refreshToken, cookieTime, '/');
|
|
setCookie('refreshToken', res.data.refreshToken, cookieTime, '/');
|
|
setCookie('loginName', this.loginForm.loginName);
|
|
setCookie('loginName', this.loginForm.loginName);
|
|
|
|
+ setCookie('userId', res.data.user.userId);
|
|
setCookie('userInfo', JSON.stringify(res.data.user));
|
|
setCookie('userInfo', JSON.stringify(res.data.user));
|
|
|
|
+ setCookie('account', res.data.user.userName);
|
|
let sRedirect = this.$route.query.redirect;
|
|
let sRedirect = this.$route.query.redirect;
|
|
|
|
+ let userInfo = res.data.user;
|
|
|
|
+ if (userInfo.sysCompanys) {
|
|
|
|
+ // 公司列表过多时cookie存放失败,存至localStorage
|
|
|
|
+ // setCookie('companys', JSON.stringify(userInfo.sysCompanys));
|
|
|
|
+ // window.localStorage.setItem('sysGroup', JSON.stringify(userInfo.sysGroup));
|
|
|
|
+ // window.localStorage.setItem('companys', JSON.stringify(userInfo.sysCompanys));
|
|
|
|
+ if (userInfo.hasOwnProperty('sysCompanys')) {
|
|
|
|
+ window.localStorage.setItem('companyId', userInfo.sysCompanys[0].id);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
console.log(sRedirect);
|
|
console.log(sRedirect);
|
|
if (sRedirect) {
|
|
if (sRedirect) {
|
|
this.$router.push({ path: sRedirect });
|
|
this.$router.push({ path: sRedirect });
|