...
|
...
|
@@ -42,6 +42,10 @@ App({ |
|
|
}
|
|
|
this.globalData.systemInfo = sysInfo;
|
|
|
|
|
|
if (options && options.scene) {
|
|
|
this.globalData.ch = options.scene;
|
|
|
}
|
|
|
|
|
|
wx.checkSession()
|
|
|
.then(() => { // 微信登录未过期
|
|
|
this.getWechatThirdSession();
|
...
|
...
|
@@ -83,15 +87,20 @@ App({ |
|
|
// 设置微信场景
|
|
|
this.globalData.ch = options.scene;
|
|
|
|
|
|
|
|
|
yas = new Yas(this);
|
|
|
yas.report('YB_LAUNCH_APP');
|
|
|
this.getUnionShop().then(() => {
|
|
|
yas.report('YB_LAUNCH_APP');
|
|
|
});
|
|
|
},
|
|
|
onShow(options) {
|
|
|
|
|
|
// 设置微信场景
|
|
|
this.globalData.ch = options.scene;
|
|
|
|
|
|
yas.report('YB_ENTER_FOREGROUND');
|
|
|
this.getUnionShop().then(() => {
|
|
|
yas.report('YB_ENTER_FOREGROUND');
|
|
|
});
|
|
|
|
|
|
if (this.reportData.awakeReported === false) {
|
|
|
let path = options.path;
|
...
|
...
|
@@ -100,12 +109,16 @@ App({ |
|
|
path = `${path}?${stringify(options.query)}`;
|
|
|
}
|
|
|
|
|
|
yas.report('YB_AWAKE_MP', {PAGE_PATH: path});
|
|
|
this.reportData.awakeReported = true;
|
|
|
this.getUnionShop().then(() => {
|
|
|
yas.report('YB_AWAKE_MP', {PAGE_PATH: path});
|
|
|
this.reportData.awakeReported = true;
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (+options.scene === 1014 && options.query.msg_id) {
|
|
|
yas.report('YB_SERVICE_PUSH', {MSG_ID: options.query.msg_id});
|
|
|
this.getUnionShop().then(() => {
|
|
|
yas.report('YB_SERVICE_PUSH', {MSG_ID: options.query.msg_id});
|
|
|
});
|
|
|
}
|
|
|
|
|
|
verify.gen().then(() => {
|
...
|
...
|
@@ -114,7 +127,9 @@ App({ |
|
|
|
|
|
},
|
|
|
onHide() {
|
|
|
yas.report('YB_ENTER_BACKGROUND');
|
|
|
this.getUnionShop().then(() => {
|
|
|
yas.report('YB_ENTER_BACKGROUND');
|
|
|
});
|
|
|
},
|
|
|
doLogin() {
|
|
|
this.getSessionKey();
|
...
|
...
|
@@ -141,18 +156,22 @@ App({ |
|
|
}
|
|
|
},
|
|
|
getUnionShop: function() {
|
|
|
if (this.globalData.unionShop && this.globalData.unionShop.shopId) {
|
|
|
event.emit('get-union-shop-success');
|
|
|
} else {
|
|
|
commonModel.getBindShop({app_id: this.getAppId()}).then(res => {
|
|
|
if (res.code === 200 && res.data.shopId) {
|
|
|
this.globalData.unionShop = res.data;
|
|
|
event.emit('get-union-shop-success');
|
|
|
} else {
|
|
|
return Promise.reject();
|
|
|
}
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
return new Promise((resolve, reject) => {
|
|
|
if (this.globalData.unionShop && this.globalData.unionShop.shopId) {
|
|
|
event.emit('get-union-shop-success');
|
|
|
resolve();
|
|
|
} else {
|
|
|
commonModel.getBindShop({app_id: this.getAppId()}).then(res => {
|
|
|
if (res.code === 200 && res.data.shopId) {
|
|
|
this.globalData.unionShop = res.data;
|
|
|
event.emit('get-union-shop-success');
|
|
|
resolve();
|
|
|
} else {
|
|
|
reject();
|
|
|
}
|
|
|
}).catch(() => {});
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getWechatThirdSession() {
|
|
|
this.globalData.thirdSession = this._getSync('thirdSession');
|
...
|
...
|
|