Authored by 李奇

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

Feature/report ch



See merge request !5
@@ -42,6 +42,10 @@ App({ @@ -42,6 +42,10 @@ App({
42 } 42 }
43 this.globalData.systemInfo = sysInfo; 43 this.globalData.systemInfo = sysInfo;
44 44
  45 + if (options && options.scene) {
  46 + this.globalData.ch = options.scene;
  47 + }
  48 +
45 wx.checkSession() 49 wx.checkSession()
46 .then(() => { // 微信登录未过期 50 .then(() => { // 微信登录未过期
47 this.getWechatThirdSession(); 51 this.getWechatThirdSession();
@@ -83,15 +87,20 @@ App({ @@ -83,15 +87,20 @@ App({
83 // 设置微信场景 87 // 设置微信场景
84 this.globalData.ch = options.scene; 88 this.globalData.ch = options.scene;
85 89
  90 +
86 yas = new Yas(this); 91 yas = new Yas(this);
87 - yas.report('YB_LAUNCH_APP'); 92 + this.getUnionShop().then(() => {
  93 + yas.report('YB_LAUNCH_APP');
  94 + });
88 }, 95 },
89 onShow(options) { 96 onShow(options) {
90 97
91 // 设置微信场景 98 // 设置微信场景
92 this.globalData.ch = options.scene; 99 this.globalData.ch = options.scene;
93 100
94 - yas.report('YB_ENTER_FOREGROUND'); 101 + this.getUnionShop().then(() => {
  102 + yas.report('YB_ENTER_FOREGROUND');
  103 + });
95 104
96 if (this.reportData.awakeReported === false) { 105 if (this.reportData.awakeReported === false) {
97 let path = options.path; 106 let path = options.path;
@@ -100,12 +109,16 @@ App({ @@ -100,12 +109,16 @@ App({
100 path = `${path}?${stringify(options.query)}`; 109 path = `${path}?${stringify(options.query)}`;
101 } 110 }
102 111
103 - yas.report('YB_AWAKE_MP', {PAGE_PATH: path});  
104 - this.reportData.awakeReported = true; 112 + this.getUnionShop().then(() => {
  113 + yas.report('YB_AWAKE_MP', {PAGE_PATH: path});
  114 + this.reportData.awakeReported = true;
  115 + });
105 } 116 }
106 117
107 if (+options.scene === 1014 && options.query.msg_id) { 118 if (+options.scene === 1014 && options.query.msg_id) {
108 - yas.report('YB_SERVICE_PUSH', {MSG_ID: options.query.msg_id}); 119 + this.getUnionShop().then(() => {
  120 + yas.report('YB_SERVICE_PUSH', {MSG_ID: options.query.msg_id});
  121 + });
109 } 122 }
110 123
111 verify.gen().then(() => { 124 verify.gen().then(() => {
@@ -114,7 +127,9 @@ App({ @@ -114,7 +127,9 @@ App({
114 127
115 }, 128 },
116 onHide() { 129 onHide() {
117 - yas.report('YB_ENTER_BACKGROUND'); 130 + this.getUnionShop().then(() => {
  131 + yas.report('YB_ENTER_BACKGROUND');
  132 + });
118 }, 133 },
119 doLogin() { 134 doLogin() {
120 this.getSessionKey(); 135 this.getSessionKey();
@@ -141,18 +156,22 @@ App({ @@ -141,18 +156,22 @@ App({
141 } 156 }
142 }, 157 },
143 getUnionShop: function() { 158 getUnionShop: function() {
144 - if (this.globalData.unionShop && this.globalData.unionShop.shopId) {  
145 - event.emit('get-union-shop-success');  
146 - } else {  
147 - commonModel.getBindShop({app_id: this.getAppId()}).then(res => {  
148 - if (res.code === 200 && res.data.shopId) {  
149 - this.globalData.unionShop = res.data;  
150 - event.emit('get-union-shop-success');  
151 - } else {  
152 - return Promise.reject();  
153 - }  
154 - }).catch(() => {});  
155 - } 159 + return new Promise((resolve, reject) => {
  160 + if (this.globalData.unionShop && this.globalData.unionShop.shopId) {
  161 + event.emit('get-union-shop-success');
  162 + resolve();
  163 + } else {
  164 + commonModel.getBindShop({app_id: this.getAppId()}).then(res => {
  165 + if (res.code === 200 && res.data.shopId) {
  166 + this.globalData.unionShop = res.data;
  167 + event.emit('get-union-shop-success');
  168 + resolve();
  169 + } else {
  170 + reject();
  171 + }
  172 + }).catch(() => {});
  173 + }
  174 + });
156 }, 175 },
157 getWechatThirdSession() { 176 getWechatThirdSession() {
158 this.globalData.thirdSession = this._getSync('thirdSession'); 177 this.globalData.thirdSession = this._getSync('thirdSession');
@@ -15,7 +15,6 @@ export default class yas { @@ -15,7 +15,6 @@ export default class yas {
15 res: '', // 屏幕大小 15 res: '', // 屏幕大小
16 osv: '', // 系统版本 16 osv: '', // 系统版本
17 ak: 'yohobrand_mp', 17 ak: 'yohobrand_mp',
18 - ch: this.app.getUnionType(),  
19 udid: this.app.globalData.udid 18 udid: this.app.globalData.udid
20 }; 19 };
21 20
@@ -67,8 +66,10 @@ export default class yas { @@ -67,8 +66,10 @@ export default class yas {
67 if (this.app) { 66 if (this.app) {
68 Object.assign(userInfo, { 67 Object.assign(userInfo, {
69 UNION_ID: this.app.getUnionID(), 68 UNION_ID: this.app.getUnionID(),
70 - APP_ID: this.app.getAppId() 69 + APP_ID: this.app.getAppId(),
  70 + SHOP_ID: this.app.globalData.unionShop && this.app.globalData.unionShop.shopId
71 }); 71 });
  72 + self.deviceInfo.ch = this.app.globalData.ch + '';
72 } 73 }
73 74
74 if (!userInfo.PV_ID) { 75 if (!userInfo.PV_ID) {
@@ -4,12 +4,12 @@ @@ -4,12 +4,12 @@
4 <view class="field"> 4 <view class="field">
5 <span class="area-code" bindtap="chooseArea">+{{areaCode}}</span> 5 <span class="area-code" bindtap="chooseArea">+{{areaCode}}</span>
6 <input bindinput="phoneInput" class="field-input" value="{{phoneNum}}" 6 <input bindinput="phoneInput" class="field-input" value="{{phoneNum}}"
7 - type="number" maxlength="20" placeholder="请输入手机号"></input> 7 + type="number" maxlength="20" placeholder="请输入手机号" placeholder-class="holder-class"></input>
8 </view> 8 </view>
9 <view class="field"> 9 <view class="field">
10 <label class="label">验证码</label> 10 <label class="label">验证码</label>
11 <input bindinput="codeInput" class="field-input code" type="number" maxlength="10" 11 <input bindinput="codeInput" class="field-input code" type="number" maxlength="10"
12 - placeholder="请输入验证码"></input> 12 + placeholder="请输入验证码" placeholder-class="holder-class"></input>
13 <span class="{{'send-code ' + activeClass}}" bindtap="sendCode">{{btnText}}</span> 13 <span class="{{'send-code ' + activeClass}}" bindtap="sendCode">{{btnText}}</span>
14 </view> 14 </view>
15 <image-check wx:if="{{isNeedImgCheck}}" class="image-check" bindrefreshCode="onRefreshCode"></image-check> 15 <image-check wx:if="{{isNeedImgCheck}}" class="image-check" bindrefreshCode="onRefreshCode"></image-check>
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 color: #444; 10 color: #444;
11 letter-spacing: 0; 11 letter-spacing: 0;
12 line-height: 66rpx; 12 line-height: 66rpx;
  13 + font-weight: bold;
13 } 14 }
14 15
15 .pg-sub-tip { 16 .pg-sub-tip {
@@ -155,3 +156,7 @@ @@ -155,3 +156,7 @@
155 display: block; 156 display: block;
156 margin-top: 20rpx; 157 margin-top: 20rpx;
157 } 158 }
  159 +
  160 +.holder-class {
  161 + color: #b0b0b0;
  162 +}
@@ -33,8 +33,10 @@ Page({ @@ -33,8 +33,10 @@ Page({
33 yas = new Yas(app); 33 yas = new Yas(app);
34 }, 34 },
35 onShow: function() { 35 onShow: function() {
36 - yas.pageOpenReport();  
37 - yas.report('YB_MAIN_TAB_C', {TAB_ID: 1}); 36 + app.getUnionShop().then(() => {
  37 + yas.pageOpenReport();
  38 + yas.report('YB_MAIN_TAB_C', {TAB_ID: 1});
  39 + });
38 40
39 const shopId = app.getShopId(); 41 const shopId = app.getShopId();
40 42