Authored by 李奇

Merge branch 'feature/report-ch' into 'master'

Feature/report ch



See merge request !5
... ... @@ -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');
... ...
... ... @@ -15,7 +15,6 @@ export default class yas {
res: '', // 屏幕大小
osv: '', // 系统版本
ak: 'yohobrand_mp',
ch: this.app.getUnionType(),
udid: this.app.globalData.udid
};
... ... @@ -67,8 +66,10 @@ export default class yas {
if (this.app) {
Object.assign(userInfo, {
UNION_ID: this.app.getUnionID(),
APP_ID: this.app.getAppId()
APP_ID: this.app.getAppId(),
SHOP_ID: this.app.globalData.unionShop && this.app.globalData.unionShop.shopId
});
self.deviceInfo.ch = this.app.globalData.ch + '';
}
if (!userInfo.PV_ID) {
... ...
... ... @@ -4,12 +4,12 @@
<view class="field">
<span class="area-code" bindtap="chooseArea">+{{areaCode}}</span>
<input bindinput="phoneInput" class="field-input" value="{{phoneNum}}"
type="number" maxlength="20" placeholder="请输入手机号"></input>
type="number" maxlength="20" placeholder="请输入手机号" placeholder-class="holder-class"></input>
</view>
<view class="field">
<label class="label">验证码</label>
<input bindinput="codeInput" class="field-input code" type="number" maxlength="10"
placeholder="请输入验证码"></input>
placeholder="请输入验证码" placeholder-class="holder-class"></input>
<span class="{{'send-code ' + activeClass}}" bindtap="sendCode">{{btnText}}</span>
</view>
<image-check wx:if="{{isNeedImgCheck}}" class="image-check" bindrefreshCode="onRefreshCode"></image-check>
... ...
... ... @@ -10,6 +10,7 @@
color: #444;
letter-spacing: 0;
line-height: 66rpx;
font-weight: bold;
}
.pg-sub-tip {
... ... @@ -155,3 +156,7 @@
display: block;
margin-top: 20rpx;
}
.holder-class {
color: #b0b0b0;
}
... ...
... ... @@ -33,8 +33,10 @@ Page({
yas = new Yas(app);
},
onShow: function() {
yas.pageOpenReport();
yas.report('YB_MAIN_TAB_C', {TAB_ID: 1});
app.getUnionShop().then(() => {
yas.pageOpenReport();
yas.report('YB_MAIN_TAB_C', {TAB_ID: 1});
});
const shopId = app.getShopId();
... ...