|
@@ -48,7 +48,7 @@ cc.Class({
|
|
|
this.preloadRes = true
|
|
|
// 正在加载图片资源中...
|
|
|
this.preloadProgress.progress = completeCount / totalCount;
|
|
|
- if(this.preloadProgress.progress) {
|
|
|
+ if (this.preloadProgress.progress) {
|
|
|
this.preloadLabel.string = (this.preloadProgress.progress * 100).toFixed(0) + '%';
|
|
|
}
|
|
|
|
|
@@ -58,7 +58,7 @@ cc.Class({
|
|
|
// 加载完成, 开始进入游戏
|
|
|
this.endPreload();
|
|
|
|
|
|
- if(CC_WECHATGAME) {
|
|
|
+ if (CC_WECHATGAME) {
|
|
|
this._startWxLogin();
|
|
|
} else {
|
|
|
Global.user = {
|
|
@@ -68,7 +68,7 @@ cc.Class({
|
|
|
avatar: "",
|
|
|
gender: 1
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
this._getUserInfoAndStartGame();
|
|
|
}
|
|
|
});
|
|
@@ -86,7 +86,7 @@ cc.Class({
|
|
|
dis = dis < 0.002 ? 0.002 : dis - 0.0001;
|
|
|
this.preloadProgress.progress += dis;
|
|
|
}
|
|
|
- if(!this.preloadRes) {
|
|
|
+ if (!this.preloadRes) {
|
|
|
this.preloadLabel.string = (this.preloadProgress.progress * 100).toFixed(0) + '%'
|
|
|
}
|
|
|
}
|
|
@@ -100,7 +100,7 @@ cc.Class({
|
|
|
endPreload() {
|
|
|
this.preloadProgress.progress = 1;
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
_startWxLogin() {
|
|
|
this.loginLabel.node.active = false
|
|
|
this.updateUI.active = false;
|
|
@@ -129,22 +129,26 @@ cc.Class({
|
|
|
},
|
|
|
|
|
|
_getUserInfoAndStartGame() {
|
|
|
- LoginApi.getUserInfoPromise().then(({ data, msg }) => {
|
|
|
- Global.needLogin = false;
|
|
|
- Global.userData = data
|
|
|
- Global.devCityId = data.cityId;
|
|
|
-
|
|
|
- // 获取存在服务端的用户guideState
|
|
|
- Api.httpGet({
|
|
|
- url: "/direct/me.do",
|
|
|
- data: {},
|
|
|
- success: res => {
|
|
|
- if(res) {
|
|
|
- window.guideState = JSON.parse(res)
|
|
|
+ LoginApi.getUserInfoPromise().then(({ code, data }) => {
|
|
|
+ if (code == 0) {
|
|
|
+ Global.needLogin = false;
|
|
|
+ Global.userData = data
|
|
|
+ Global.devCityId = data.cityId;
|
|
|
+
|
|
|
+ // 获取存在服务端的用户guideState
|
|
|
+ Api.httpGet({
|
|
|
+ url: "/direct/me.do",
|
|
|
+ data: {},
|
|
|
+ success: res => {
|
|
|
+ if (res) {
|
|
|
+ window.guideState = JSON.parse(res)
|
|
|
+ }
|
|
|
+ cc.director.loadScene("game");
|
|
|
}
|
|
|
- cc.director.loadScene("game");
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ console.log(data.msg);
|
|
|
+ }
|
|
|
}).catch(({ code, msg }) => {
|
|
|
if (msg) {
|
|
|
console.log(msg);
|