Commit 2dcc8b96 authored by 罗成兵's avatar 罗成兵

用户id获取

parent 7959da1d
...@@ -50,14 +50,14 @@ export default { ...@@ -50,14 +50,14 @@ export default {
}, },
methods: { methods: {
init() { init() {
if (process.env.NODE_ENV == "dev1") { if (process.env.NODE_ENV == "dev") {
let userInfo = { let userInfo = {
account: '18487125843', account: '18487125843',
token: 'd2e2c11475a04436bbcf1ca96a7ee056', token: 'd2e2c11475a04436bbcf1ca96a7ee056',
userId: null, userId: null,
domain: window.location.href domain: window.location.href
}; };
this.initUserInfo(userInfo); this.initUserInfo(userInfo,true);
this.getUserByToken(userInfo); this.getUserByToken(userInfo);
} else { } else {
let query = this.$route.query; let query = this.$route.query;
...@@ -67,7 +67,7 @@ export default { ...@@ -67,7 +67,7 @@ export default {
userId: null, userId: null,
domain: window.location.href domain: window.location.href
}; };
this.initUserInfo(userInfo); this.initUserInfo(userInfo,true);
if (!userInfo.token && !userInfo.account) { if (!userInfo.token && !userInfo.account) {
this.msg = "用户信息获取失败!" this.msg = "用户信息获取失败!"
callMobile('init', {}); callMobile('init', {});
...@@ -88,7 +88,7 @@ export default { ...@@ -88,7 +88,7 @@ export default {
getUserByToken(userInfo.token).then(res => { getUserByToken(userInfo.token).then(res => {
if (res.code == 'SUCCESS') { if (res.code == 'SUCCESS') {
userInfo.userId = res.data userInfo.userId = res.data
this.initUserInfo(userInfo) this.initUserInfo(userInfo,false);
this.showMsg(); this.showMsg();
} else { } else {
this.msg = "用户id获取失败!" this.msg = "用户id获取失败!"
...@@ -98,8 +98,8 @@ export default { ...@@ -98,8 +98,8 @@ export default {
handleBack() { handleBack() {
callMobile('goIndex', {}); callMobile('goIndex', {});
}, },
initUserInfo(val) { initUserInfo(val,isPc) {
if (process.env.NODE_ENV == "dev") { if (isPc) {
window.sessionStorage.setItem('userInfo', JSON.stringify(val)); window.sessionStorage.setItem('userInfo', JSON.stringify(val));
return; return;
} }
......
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