Commit 39d457e9 authored by 李维's avatar 李维

修复未登录用户无法打开应用的问题

parent 57197efc
...@@ -65,13 +65,23 @@ export default class NewClass extends cc.Component { ...@@ -65,13 +65,23 @@ export default class NewClass extends cc.Component {
return this.getStatus("userInfo") return this.getStatus("userInfo")
} else { } else {
const userInfo = await global.middleLayer.getUserInfo(); const userInfo = await global.middleLayer.getUserInfo();
this.setStatus("userInfo", { if(userInfo) {
phone: userInfo.phone, // 已登录用户
isIOSReview: userInfo.phone == "15500000001", this.setStatus("userInfo", {
isAnonymous: userInfo.phone == "15500000002", phone: userInfo.phone,
detail: userInfo, isIOSReview: userInfo.phone == "15500000001",
updateTime: new Date().getTime() isAnonymous: userInfo.phone == "15500000002",
}) detail: userInfo,
updateTime: new Date().getTime()
})
} else {
// 未登录用户 默认空信息
this.setStatus("userInfo", {
phone: "",
isAnonymous: false,
isIOSReview: false,
})
}
return this.getStatus("userInfo") return this.getStatus("userInfo")
} }
} }
...@@ -102,7 +112,7 @@ export default class NewClass extends cc.Component { ...@@ -102,7 +112,7 @@ export default class NewClass extends cc.Component {
async start () { async start () {
const userInfo = await this.getUserInfo(); const userInfo = await this.getUserInfo();
if (!userInfo) { if (!userInfo.phone) {
this._currentViewNode = this.loginPage; this._currentViewNode = this.loginPage;
this._currentViewName = "LoginPage" this._currentViewName = "LoginPage"
} else { } else {
...@@ -115,7 +125,7 @@ export default class NewClass extends cc.Component { ...@@ -115,7 +125,7 @@ export default class NewClass extends cc.Component {
this._currentViewNode.active = true; this._currentViewNode.active = true;
if (userInfo){ if (userInfo.phone){
this.justShowView("homePage") this.justShowView("homePage")
} else { } else {
this.justShowView("LoginPage") this.justShowView("LoginPage")
......
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