提交 | 用户 | age
|
d98d05
|
1 |
//app.js |
S |
2 |
// import {Http} from "/utils/http-p.js" |
|
3 |
import { promisifyAll } from './utils/wx-promise-pro' |
|
4 |
import { Request } from './utils/http' |
|
5 |
import { updateManager } from './utils/appExtends' |
|
6 |
import {webSocket, socketReconnect} from './utils/websocket' |
a50a5b
|
7 |
// let livePlayer = requirePlugin('live-player-plugin'); |
d98d05
|
8 |
// promisify all wx‘s api |
S |
9 |
promisifyAll(); |
|
10 |
|
|
11 |
App({ |
|
12 |
onLaunch: async function (options) { |
|
13 |
console.log('小程序onLaunch事件', options); |
|
14 |
this.isFirstOpenApp = true; |
|
15 |
var FromUserId = this.getFromUserId(options); |
|
16 |
this.globalData.FromOpenId = options.query.FromOpenId || ''; |
|
17 |
// this.globalData.ReferrerOpenId = options.query.ReferrerOpenId || ''; |
|
18 |
this.globalData.FromUserId = FromUserId || ''; |
|
19 |
this.globalData.tempFromUserId = this.globalData.FromUserId; |
|
20 |
|
|
21 |
console.log('FromOpenId是', this.globalData.FromOpenId); |
|
22 |
console.log('FromUserId是', this.globalData.FromUserId); |
|
23 |
console.log('ReferrerOpenId是', this.globalData.FromOpenId); |
|
24 |
|
|
25 |
var HttpHost = wx.getExtConfigSync().HttpHost; |
245dd6
|
26 |
console.log('HttpHost',HttpHost); |
d98d05
|
27 |
this.globalData.cartIndex = wx.getExtConfigSync().FooterNumPosition; |
S |
28 |
HttpHost.indexOf('https://') > -1 ? HttpHost : (HttpHost = 'https://' + HttpHost); |
|
29 |
var WssHost = wx.getExtConfigSync().WssHost; |
|
30 |
WssHost.indexOf('wss://') > -1 ? WssHost : (WssHost = 'wss://' + WssHost); |
245dd6
|
31 |
console.log('HttpHost',HttpHost); |
S |
32 |
console.log('WssHost',WssHost); |
d98d05
|
33 |
this.globalData.socketHost = WssHost; |
S |
34 |
this.globalData.reqBase = HttpHost; |
92f679
|
35 |
|
d98d05
|
36 |
// 版本管理 |
S |
37 |
updateManager(this); |
|
38 |
wx.$http = new Request(this); |
92f679
|
39 |
|
d98d05
|
40 |
// 获取状态栏高度 |
92f679
|
41 |
|
d98d05
|
42 |
wx.getSystemInfo({ |
S |
43 |
success: e => { |
|
44 |
//状态栏 |
|
45 |
let statusBarHeight= e.statusBarHeight; |
|
46 |
// 右上角胶囊 |
|
47 |
let menuButton = wx.getMenuButtonBoundingClientRect(); |
|
48 |
//胶囊宽度加上左右边距的新宽度【即自定义导航栏时,左边元素的margin-right的值】 |
|
49 |
menuButton.extendWidth=menuButton.width+2*(e.windowWidth-menuButton.right); |
|
50 |
menuButton.marginRight=e.windowWidth-menuButton.right;//胶囊的右边距。用于设置返回的左边距。对称 |
|
51 |
// 保存 |
|
52 |
this.globalData.statusBarHeight =statusBarHeight |
92f679
|
53 |
this.globalData.menuButton = menuButton; |
d98d05
|
54 |
this.globalData.customNavBarHeight= menuButton.bottom + menuButton.top - statusBarHeight; |
S |
55 |
console.log(statusBarHeight,menuButton,this.globalData.customNavBarHeight) |
|
56 |
// console.log('系统信息。。。。。',wx.getSystemInfo()) |
|
57 |
} |
|
58 |
}) |
92f679
|
59 |
|
d98d05
|
60 |
|
S |
61 |
//第一次登陆 |
|
62 |
this.getSessionID(); |
|
63 |
//获取sessionid并定时刷新 |
|
64 |
// if(this.globalData.openID==''){ |
|
65 |
// this.getSession(); |
|
66 |
// } |
|
67 |
// let abc = await this.wxLogin(); |
|
68 |
// console.log('wxLogin code.....',abc) |
|
69 |
|
92f679
|
70 |
|
d98d05
|
71 |
// this.getSession().then((res)=>{ |
S |
72 |
|
|
73 |
// console.log('this.globalData.FromOpenId.........',this.globalData.FromOpenId) |
|
74 |
// // this.saveReferrerReward(); |
|
75 |
// if (this.globalData.FromOpenId!=''&&this.globalData.FromOpenId!=this.globalData.openID){ |
92f679
|
76 |
|
d98d05
|
77 |
// this.saveReferrerReward(); |
S |
78 |
// } |
|
79 |
// return this.getSettings() |
|
80 |
// }) |
|
81 |
|
|
82 |
// await this.appOnLoad(); |
0da8db
|
83 |
let login = await this.getSession(options); |
d98d05
|
84 |
console.log('this.globalData.FromOpenId.........',this.globalData.FromOpenId) |
S |
85 |
// this.saveReferrerReward(); |
|
86 |
if (this.globalData.FromOpenId!=undefined&&this.globalData.FromOpenId!=''&&this.globalData.FromOpenId!=this.globalData.openID){ |
92f679
|
87 |
|
d98d05
|
88 |
this.saveReferrerReward(); |
S |
89 |
} |
|
90 |
|
|
91 |
this.appOnLoad(); |
|
92 |
|
|
93 |
this.refresh(); |
|
94 |
|
|
95 |
console.log('小程序初次打开onLaunch事件执行完毕'); |
|
96 |
|
|
97 |
}, |
|
98 |
|
|
99 |
appOnLoad(){ |
65c4a6
|
100 |
console.log('开始发送setting请求'); |
92f679
|
101 |
|
d98d05
|
102 |
this.getSettings().then((res) => { |
S |
103 |
|
|
104 |
console.log('res.data.isPullUserInfo......', res.data.isPullUserInfo); |
|
105 |
if(res.data.isPullUserInfo){ |
|
106 |
console.log(res); |
|
107 |
this.getUserInfo(res); |
|
108 |
} |
|
109 |
|
|
110 |
this.getFromUserIdForRequest().then((res) => { |
|
111 |
console.log('获取名片用户数据UserData完成'); |
|
112 |
this.globalData.getCardCallback(res); |
|
113 |
// 发送websocket |
|
114 |
this.websocketReconnect(); |
|
115 |
}); |
|
116 |
this.userInfoReadyCallback(res); |
92f679
|
117 |
|
d98d05
|
118 |
this.getShareMsg(); |
S |
119 |
|
|
120 |
//判断用户是否授权 获取用户信息 |
|
121 |
wx.getSetting({ |
|
122 |
success: res => { |
|
123 |
console.log('getSetting成功数据', res); |
|
124 |
if (res.authSetting['scope.userInfo']) { |
|
125 |
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框 |
|
126 |
//this.globalData.isAuthorize = true; |
|
127 |
|
|
128 |
// console.log(res) |
|
129 |
// this.globalData.userInfo = res.authSetting['scope.userInfo'] |
|
130 |
wx.getUserInfo({ |
|
131 |
success: res => { |
|
132 |
console.log('用户信息是', res.userInfo); |
|
133 |
this.globalData.userInfo = res.userInfo; |
|
134 |
wx.setStorageSync("userInfo", res.userInfo); |
|
135 |
|
|
136 |
this.globalData.messageCallback(res); |
|
137 |
// 发送websocket |
|
138 |
// this.webSocket(); |
|
139 |
// this.listeningSocket() |
|
140 |
|
|
141 |
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 |
|
142 |
// 所以此处加入 callback 以防止这种情况 |
|
143 |
// if (this.userInfoReadyCallback) { |
|
144 |
// this.userInfoReadyCallback(res); |
|
145 |
// } |
|
146 |
} |
|
147 |
}); |
|
148 |
} else { |
|
149 |
//this.globalData.isAuthorize = false; |
|
150 |
} |
|
151 |
} |
|
152 |
}); |
|
153 |
this.globalData.indexCallback(res); |
|
154 |
this.globalData.classifyCallback(res); |
|
155 |
this.globalData.idcardCallback(res); |
|
156 |
|
|
157 |
|
|
158 |
}); |
|
159 |
}, |
|
160 |
|
|
161 |
//第一次获取FromUserId,目的是小程序启动时FromUserId为空值时拿到后台传来的默认参数 |
|
162 |
getFromUserIdForRequest() { |
|
163 |
let utils = require('./utils/util'); |
|
164 |
return new Promise((resolve, reject) => { |
|
165 |
wx.request({ |
|
166 |
url: utils.getUrl('/wx/getCardUserInfo.do'), |
|
167 |
// url: this.globalData.reqBase + '/wx/getCardUserInfo.do', |
|
168 |
header: { |
|
169 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
170 |
}, |
|
171 |
// data: { |
|
172 |
// FromUserId: this.globalData.FromUserId, |
|
173 |
// AppId: this.globalData.AppId, |
|
174 |
// wx: 3 |
|
175 |
// }, |
|
176 |
success: res => { |
|
177 |
if(!utils.requestError(res)){ |
|
178 |
return false; |
|
179 |
} |
|
180 |
console.log('第一次getFromUserIdForRequest。。。', res.data); |
|
181 |
this.globalData.FromUserId = res.data.UserId || ''; |
|
182 |
// this.globalData.URID = res.data.URID || ''; |
|
183 |
|
|
184 |
// 第一次更新 |
|
185 |
this.globalData.tempFromUserId = res.data.UserId || ''; |
|
186 |
this.globalData.cardUserData = res.data; |
|
187 |
resolve(res); |
|
188 |
}, |
|
189 |
fail: function (errmsg) { |
|
190 |
console.log('/wx/getCardUserInfo.do', errmsg); |
|
191 |
utils.requestFail(errmsg, '/wx/getCardUserInfo.do'); |
|
192 |
reject(errmsg); |
|
193 |
} |
|
194 |
}); |
|
195 |
}); |
|
196 |
}, |
|
197 |
|
|
198 |
//获取设置数据 |
|
199 |
getSettings() { |
|
200 |
let utils = require('./utils/util'); |
|
201 |
return new Promise((resolve, reject) => { |
|
202 |
wx.request({ |
|
203 |
url: utils.getUrl( '/shopping/getSettingEntity.do'), |
|
204 |
// data: { |
|
205 |
// FromUserId: this.globalData.FromUserId, |
|
206 |
// AppId: this.globalData.AppId, |
|
207 |
// wx: 3 |
|
208 |
// }, |
|
209 |
header: { |
|
210 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
211 |
}, |
|
212 |
success: res => { |
|
213 |
if(!utils.requestError(res)){ |
|
214 |
return false; |
|
215 |
} |
|
216 |
console.log('设置数据获取完毕。。。',res) |
|
217 |
// console.log(777) |
|
218 |
this.globalData.generateOrderProcess = res.data.generateOrderProcess || 0; |
|
219 |
this.globalData.shoppingGroupName = res.data.shoppingGroupName || ''; |
|
220 |
this.globalData.RewardStatus = res.data.RewardStatus; |
|
221 |
this.globalData.CouponStatus = res.data.CouponStatus; |
|
222 |
this.globalData.VoucherStatus = res.data.VoucherStatus; |
|
223 |
this.globalData.isAllowRecharge = res.data.isAllowRecharge; |
|
224 |
this.globalData.isAllowWithdraw = res.data.isAllowWithdraw; |
|
225 |
this.globalData.isShowMatCode = res.data.isShowMatCode; |
|
226 |
this.globalData.isShowMatName = res.data.isShowMatName; |
|
227 |
this.globalData.isShowPrice = res.data.isShowPrice; |
|
228 |
this.globalData.isShowSpecial = res.data.isShowSpecial; |
|
229 |
this.globalData.isStartupLeagueShopCcCode = res.data.isStartupLeagueShopCcCode; |
|
230 |
this.globalData.cardStyle = res.data.cardStyle; |
|
231 |
this.globalData.aiMessageDefaultTemplateId = res.data.aiMessageDefaultTemplateId; |
|
232 |
this.globalData.couponsBuyReminderTemplateIdForMiniApp = res.data.couponsBuyReminderTemplateIdForMiniApp; |
|
233 |
this.globalData.orderNoticeTemplateIdList = res.data.orderNoticeTemplateIdList[120230]; |
|
234 |
this.globalData.shopName = res.data.name || ''; |
|
235 |
this.globalData.logoUrl = res.data.logoUrl || ''; |
|
236 |
this.globalData.isShowPoster = res.data.isShowPoster || ''; |
|
237 |
this.globalData.parallelNumberForInnerMenuOnHomePage = res.data.parallelNumberForInnerMenuOnHomePage || 4; |
|
238 |
this.globalData.ProductListStyle = res.data.productListStyle || 0; |
|
239 |
this.globalData.isShowPostcode = res.data.isShowPostcode || 0; |
|
240 |
this.globalData.categoryListStyle = res.data.categoryListStyle||0; |
|
241 |
this.globalData.withdrawType = res.data.withdrawType; |
|
242 |
this.globalData.isAllowSelectDeliveryMethod = res.data.isAllowSelectDeliveryMethod||false; |
|
243 |
this.globalData.deliveryMethod = res.data.deliveryMethod||''; |
492b82
|
244 |
this.globalData.isShowBannerPhotoOnHomePageForLiveUser = res.data.isShowBannerPhotoOnHomePageForLiveUser||false; |
65c4a6
|
245 |
this.globalData.isShowMatGroupInHomePage = res.data.isShowMatGroupInHomePage||false; |
92f679
|
246 |
|
d98d05
|
247 |
resolve(res); |
S |
248 |
}, |
|
249 |
fail: function(errmsg) { |
|
250 |
utils.requestFail(errmsg, '/shopping/getSettingEntity.do'); |
|
251 |
reject(errmsg); |
|
252 |
} |
|
253 |
}) |
|
254 |
}); |
|
255 |
}, |
|
256 |
|
|
257 |
saveReferrerReward(){ |
|
258 |
let utils = require('./utils/util'); |
|
259 |
wx.request({ |
|
260 |
url: utils.getUrl('/shopping/pay/saveReferrerReward.do'), |
|
261 |
data: { |
|
262 |
FromOpenId: this.globalData.FromOpenId, |
|
263 |
// FromUserId: this.globalData.FromUserId, |
|
264 |
// AppId: this.globalData.AppId, |
|
265 |
// wx: 3 |
|
266 |
}, |
|
267 |
header: { |
|
268 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
269 |
}, |
|
270 |
success: res => { |
|
271 |
if(!utils.requestError(res)){ |
|
272 |
return false; |
|
273 |
} |
|
274 |
}, |
|
275 |
fail: function(errmsg) { |
|
276 |
utils.requestFail(errmsg,'/shopping/pay/saveReferrerReward'); |
|
277 |
} |
|
278 |
}) |
92f679
|
279 |
|
d98d05
|
280 |
}, |
S |
281 |
|
|
282 |
async wxLogin(){ |
|
283 |
return new Promise((resolve,reject)=>{ |
|
284 |
wx.login({ |
|
285 |
success: (res) => { |
|
286 |
resolve(res) |
|
287 |
}, |
|
288 |
fail:(err)=>{ |
|
289 |
reject(err) |
|
290 |
} |
|
291 |
}) |
|
292 |
}) |
|
293 |
}, |
|
294 |
|
|
295 |
//获取session |
0da8db
|
296 |
async getSession(options) { |
d98d05
|
297 |
var that = this; |
S |
298 |
// var utils = require('./utils/util') |
|
299 |
let doLogin = (res)=>{ |
|
300 |
return new Promise((resolve,reject)=>{ |
|
301 |
wx.request({ |
|
302 |
url: that.globalData.reqBase + '/wx/miniapp/user/login.do', |
|
303 |
header: { |
|
304 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
305 |
}, |
|
306 |
data: { |
|
307 |
FromUserId: that.globalData.FromUserId, |
|
308 |
code: res.code, |
|
309 |
AppId: that.globalData.AppId, |
0da8db
|
310 |
wx: 3, |
S |
311 |
SceneCode:options?options.scene:'', |
|
312 |
FromOpenId: this.globalData.FromOpenId?this.globalData.FromOpenId:'' |
d98d05
|
313 |
}, |
S |
314 |
success: function (res) { |
|
315 |
if (res.data['error'] && res.data['error']['warning']) { |
|
316 |
wx.showModal({ |
|
317 |
title: '提示', |
|
318 |
content: res.data['error']['warning'], |
|
319 |
showCancel: false |
|
320 |
}); |
|
321 |
return false; |
|
322 |
} |
|
323 |
let data = res.data; |
|
324 |
console.log('login.do获取到数据', res); |
|
325 |
wx.setStorageSync('shopName', res.data.shopccname); |
92f679
|
326 |
|
d98d05
|
327 |
wx.setStorageSync("sessionID", data.JSESSIONID); |
S |
328 |
// wx.setStorageSync("openID", data.OpenId || ''); //o6Df10LmkJZnWPFY3jiLrVY_3mb8 |
|
329 |
that.globalData.openID = data.OpenId || ''; |
|
330 |
if (res.data && res.data.UserId){ |
|
331 |
that.globalData.FromUserId = res.data.UserId; |
|
332 |
} else { |
|
333 |
that.globalData.FromUserId = ''; |
|
334 |
} |
|
335 |
that.globalData.SessionKey = res.data.SessionKey || ''; |
|
336 |
that.globalData.isShopGuide = res.data.isShopGuide || false; |
|
337 |
that.globalData.ReferralsName = res.data.ReferralsName || ''; |
|
338 |
that.globalData.UserName = res.data.UserName; |
92f679
|
339 |
that.globalData.avatarUrl = res.data.avatarUrl; |
d98d05
|
340 |
that.globalData.nickName = res.data.nickName; |
S |
341 |
that.globalData.tabBarList = res.data.tabBarList; |
|
342 |
// that.globalData.shopccname = res.data.shopccname; |
|
343 |
console.log('that.globalData.isShopGuide',that.globalData.isShopGuide) |
|
344 |
resolve(res); |
|
345 |
}, |
|
346 |
fail: function (errmsg) { |
|
347 |
console.log('/wx/miniapp/user/login.do', errmsg); |
|
348 |
wx.showModal({ |
|
349 |
title: '/wx/miniapp/user/login.do', |
|
350 |
content: errmsg.errMsg, |
|
351 |
showCancel: false |
|
352 |
}); |
|
353 |
reject(errmsg); |
|
354 |
} |
|
355 |
}); |
|
356 |
}) |
|
357 |
} |
|
358 |
let wxLoginRes = await this.wxLogin(); |
|
359 |
let doLoginRes = await doLogin(wxLoginRes); |
|
360 |
return doLoginRes; |
|
361 |
// return this.wxLogin().then((res)=>{ |
|
362 |
// return doLogin(res); |
|
363 |
// }) |
|
364 |
return new Promise(function (resolve, reject) { |
|
365 |
|
|
366 |
wx.login({ |
|
367 |
success: res => { |
|
368 |
if (res.code) { |
|
369 |
console.log('code.....', res); |
|
370 |
//发起网络请求 |
|
371 |
wx.request({ |
|
372 |
url: that.globalData.reqBase + '/wx/miniapp/user/login.do', |
|
373 |
header: { |
|
374 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
375 |
}, |
|
376 |
data: { |
|
377 |
FromUserId: that.globalData.FromUserId, |
|
378 |
code: res.code, |
|
379 |
AppId: that.globalData.AppId, |
|
380 |
wx: 3 |
|
381 |
}, |
|
382 |
success: function (res) { |
|
383 |
if (res.data['error'] && res.data['error']['warning']) { |
|
384 |
wx.showModal({ |
|
385 |
title: '提示', |
|
386 |
content: res.data['error']['warning'], |
|
387 |
showCancel: false |
|
388 |
}); |
|
389 |
return false; |
|
390 |
} |
|
391 |
let data = res.data; |
|
392 |
console.log('login.do获取到数据', res); |
|
393 |
wx.setStorageSync('shopName', res.data.shopccname); |
|
394 |
|
|
395 |
wx.setStorageSync("sessionID", data.JSESSIONID); |
|
396 |
wx.setStorageSync("openID", data.OpenId || ''); //o6Df10LmkJZnWPFY3jiLrVY_3mb8 |
|
397 |
that.globalData.openID = data.OpenId || ''; |
|
398 |
if (res.data && res.data.UserId){ |
|
399 |
that.globalData.FromUserId = res.data.UserId; |
|
400 |
} else { |
|
401 |
that.globalData.FromUserId = ''; |
|
402 |
} |
|
403 |
that.globalData.SessionKey = res.data.SessionKey || ''; |
|
404 |
that.globalData.isShopGuide = res.data.isShopGuide || false; |
|
405 |
that.globalData.ReferralsName = res.data.ReferralsName || ''; |
|
406 |
that.globalData.UserName = res.data.UserName; |
|
407 |
that.globalData.nickName = res.data.nickName; |
|
408 |
that.globalData.tabBarList = res.data.tabBarList; |
|
409 |
// that.globalData.shopccname = res.data.shopccname; |
|
410 |
console.log('that.globalData.isShopGuide',that.globalData.isShopGuide) |
|
411 |
resolve(res); |
|
412 |
}, |
|
413 |
fail: function (errmsg) { |
|
414 |
console.log('/wx/miniapp/user/login.do', errmsg); |
|
415 |
wx.showModal({ |
|
416 |
title: '/wx/miniapp/user/login.do', |
|
417 |
content: errmsg.errMsg, |
|
418 |
showCancel: false |
|
419 |
}); |
|
420 |
} |
|
421 |
}); |
|
422 |
} else { |
|
423 |
console.log('登录失败!' + res.errMsg); |
|
424 |
reject('error'); |
|
425 |
} |
|
426 |
} |
|
427 |
}); |
|
428 |
|
|
429 |
}); |
|
430 |
|
|
431 |
}, |
|
432 |
|
|
433 |
// 每20分钟刷新sessionid |
|
434 |
refresh: function () { |
|
435 |
setInterval(() => { |
|
436 |
this.getSession(); |
|
437 |
}, 20 * 60 * 1000); |
|
438 |
}, |
|
439 |
|
|
440 |
// 第一次登录 |
|
441 |
getSessionID: function () { |
|
442 |
// let utils = require('./utils/util') |
|
443 |
wx.request({ |
|
444 |
url: this.globalData.reqBase + '/wx/miniapp/user/getSessionId.do', |
|
445 |
header: { |
|
446 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
447 |
}, |
|
448 |
data: { |
|
449 |
AppId: this.globalData.AppId, |
|
450 |
wx: 3 |
|
451 |
}, |
|
452 |
success: res => { |
|
453 |
if (res.data['error'] && res.data['error']['warning']) { |
|
454 |
wx.showModal({ |
|
455 |
title: '提示', |
|
456 |
content: res.data['error']['warning'], |
|
457 |
showCancel: false |
|
458 |
}); |
|
459 |
return false; |
|
460 |
} |
|
461 |
let data = res.data; |
|
462 |
console.log('第一次登录sessionID', res); |
|
463 |
wx.setStorageSync("sessionID", data.JSESSIONID); |
|
464 |
}, |
|
465 |
fail: function (errmsg) { |
|
466 |
console.log('/wx/miniapp/user/getSessionId.do', errmsg); |
|
467 |
wx.showModal({ |
|
468 |
title: '/wx/miniapp/user/getSessionId.do', |
|
469 |
content: errmsg.errMsg, |
|
470 |
showCancel: false |
|
471 |
}); |
|
472 |
} |
|
473 |
}); |
|
474 |
}, |
|
475 |
|
|
476 |
getShareMsg(){ |
|
477 |
wx.request({ |
|
478 |
url: this.globalData.reqBase + '/shopping/share.do?m=getShareHitMessageForMiniApp', |
|
479 |
header: { |
|
480 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
481 |
}, |
|
482 |
data: { |
|
483 |
AppId: this.globalData.AppId, |
|
484 |
wx: 3 |
|
485 |
}, |
|
486 |
success: res => { |
|
487 |
if (res.data['error'] && res.data['error']['warning']) { |
|
488 |
wx.showModal({ |
|
489 |
title: '提示', |
|
490 |
content: res.data['error']['warning'], |
|
491 |
showCancel: false |
|
492 |
}); |
|
493 |
return false; |
|
494 |
} |
|
495 |
console.log('分享标题。。。', res.data); |
|
496 |
this.globalData.shareTitles = res.data.List; |
|
497 |
}, |
|
498 |
fail: function (errmsg) { |
|
499 |
console.log('/wx/miniapp/user/getSessionId.do', errmsg); |
|
500 |
wx.showModal({ |
|
501 |
title: '/wx/miniapp/user/getSessionId.do', |
|
502 |
content: errmsg.errMsg, |
|
503 |
showCancel: false |
|
504 |
}); |
|
505 |
} |
|
506 |
}); |
|
507 |
}, |
|
508 |
|
|
509 |
// 用户信息获取之后 |
|
510 |
userInfoReadyCallback: function (res) { |
|
511 |
wx.request({ |
|
512 |
url: this.globalData.reqBase + '/shopping/account.do?m=accountInfo', |
|
513 |
header: { |
|
514 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
515 |
}, |
|
516 |
data: { |
|
517 |
FromUserId: this.globalData.FromUserId, |
|
518 |
AppId: this.globalData.AppId, |
|
519 |
wx: 3 |
|
520 |
}, |
|
521 |
success: res => { |
|
522 |
if (res.data['error'] && res.data['error']['warning']) { |
|
523 |
wx.showModal({ |
|
524 |
title: '提示', |
|
525 |
content: res.data['error']['warning'], |
|
526 |
showCancel: false |
|
527 |
}); |
|
528 |
return false; |
|
529 |
} |
|
530 |
// console.log('cltcode', res.data.UserInfo.CltCode); |
|
531 |
console.log('// 用户信息获取之后'); |
|
532 |
this.globalData.Cltcode = res.data.UserInfo.CltCode |
|
533 |
}, |
|
534 |
fail: function (errmsg) { |
|
535 |
console.log('/shopping/account.do', errmsg); |
|
536 |
wx.showModal({ |
|
537 |
title: '/shopping/account.do', |
|
538 |
content: errmsg.errMsg, |
|
539 |
showCancel: false |
|
540 |
}); |
|
541 |
} |
|
542 |
}); |
|
543 |
// Request.request() |
|
544 |
// wx.request({ |
|
545 |
// url: utils.getUrl('/shopping/account.do?m=accountInfo'), |
|
546 |
// header: { |
|
547 |
// "Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
548 |
// }, |
|
549 |
// success: res => { |
|
550 |
// |
|
551 |
// utils.requestError(res); |
|
552 |
// if(res.data['error']){ |
|
553 |
// if(res.data['error']['warning']){ |
|
554 |
// this.showModal(res.data['error']['warning'],'提示',false); |
|
555 |
// }else{ |
|
556 |
// for (let key in res.data['error']) { |
|
557 |
// this.showModal(res.data['error'][key],'提示',false); |
|
558 |
// } |
|
559 |
// } |
|
560 |
// } |
|
561 |
// // console.log(res) |
|
562 |
// this.setData({ |
|
563 |
// userData: res.data.UserInfo |
|
564 |
// }) |
|
565 |
// |
|
566 |
// }, |
|
567 |
|
|
568 |
}, |
|
569 |
|
|
570 |
// |
|
571 |
getUserInfo(res){ |
|
572 |
// 必须是在用户已经授权的情况下调用 |
|
573 |
wx.getUserInfo({ |
|
574 |
|
|
575 |
success: res => { |
|
576 |
console.log('getUserInfo',res); |
|
577 |
// 把用户信息发送到后台 |
|
578 |
wx.request({ |
|
579 |
url: this.globalData.reqBase + '/wx/miniapp/user/info.do', |
|
580 |
header: { |
|
581 |
"Cookie": "JSESSIONID=" + wx.getStorageSync('sessionID') |
|
582 |
}, |
|
583 |
data: { |
|
584 |
FromUserId: this.globalData.FromUserId, |
|
585 |
AppId: this.globalData.AppId, |
|
586 |
wx: 3, |
|
587 |
signature: res.signature, |
|
588 |
rawData: res.rawData, |
|
589 |
encryptedData: res.encryptedData, |
|
590 |
iv: res.iv, |
|
591 |
SessionKey: this.globalData.SessionKey |
|
592 |
}, |
|
593 |
success: (res) => { |
|
594 |
if (res.data['error'] && res.data['error']['warning']) { |
|
595 |
wx.showModal({ |
|
596 |
title: '提示', |
|
597 |
content: res.data['error']['warning'], |
|
598 |
showCancel: false |
|
599 |
}); |
|
600 |
return false; |
|
601 |
} |
|
602 |
|
|
603 |
}, |
|
604 |
fail: function (errmsg) { |
|
605 |
this.requestFail(errmsg, '/wx/miniapp/user/info.do'); |
|
606 |
} |
|
607 |
}) |
|
608 |
} |
|
609 |
}) |
|
610 |
}, |
|
611 |
|
|
612 |
// 解析启动时的url |
|
613 |
|
|
614 |
getUrlkey(url) { |
|
615 |
var params = {}; |
|
616 |
// var arr = url.split("="); console.log('3_遍历 arr 并分割后赋值给a:', arr) |
|
617 |
var arr = url.split("&"); |
|
618 |
for (var i = 0, l = arr.length; i < l; i++) { |
|
619 |
var a = arr[i].split("="); |
|
620 |
params[a[0]] = a[1]; |
|
621 |
} |
|
622 |
console.log('scene处理后的结果:', params); |
|
623 |
return params; |
|
624 |
}, |
|
625 |
|
|
626 |
webSocket: function(){ |
|
627 |
webSocket(this); |
|
628 |
}, |
|
629 |
socketReconnect:function(){ |
|
630 |
socketReconnect(this) |
|
631 |
}, |
|
632 |
|
|
633 |
|
|
634 |
|
|
635 |
// 获取scene内的参数 |
|
636 |
getFromUserId(options) { |
|
637 |
let FromUserId; |
|
638 |
// 从url直接取值 |
92f679
|
639 |
|
d98d05
|
640 |
// if ((!FromUserId || FromUserId == '') && options.scene) { |
S |
641 |
// FromUserId = this.getUrlkey(decodeURIComponent(options.scene))['FromUserId']; |
|
642 |
// } |
92f679
|
643 |
|
d98d05
|
644 |
// 从小程序码进入 |
S |
645 |
if (options.scene == 1047||options.scene == 1048||options.scene == 1049) { |
|
646 |
|
|
647 |
let params = this.getUrlkey(decodeURIComponent(options.query.scene)); |
|
648 |
FromUserId = params.FromUserId || options.query.FromUserId; |
|
649 |
let roomid = params.roomid || options.query.roomid; |
|
650 |
console.log('扫码进入小程序, 地址上的FromUserId为',FromUserId ); |
|
651 |
if (roomid) { |
|
652 |
console.log('扫码进入小程序直播间, 地址上的roomid为',roomid,',FromUserId为',FromUserId ); |
|
653 |
let customParams = encodeURIComponent(JSON.stringify({ |
|
654 |
FromUserId: FromUserId |
|
655 |
})) |
|
656 |
console.log(`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomid}&custom_params=${customParams}`) |
|
657 |
wx.reLaunch({ |
|
658 |
url: `plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${roomid}&custom_params=${customParams}` |
|
659 |
}) |
|
660 |
} |
|
661 |
|
|
662 |
// // 直播二维码 |
|
663 |
// if(options.path.includes('/pages/live-player-plugin')){ |
|
664 |
// FromUserId = JSON.parse(decodeURIComponent(options.query.custom_params)).FromUserId; |
|
665 |
// // let URID = JSON.parse(decodeURIComponent(options.query.custom_params)).RowId; |
|
666 |
// // console.log('扫码进入小程序直播间, 地址上的URID为',URID ); |
|
667 |
// // await this.getFromUserIdForRequest(); |
|
668 |
// // FromUserId = this.globalData.FromUserId; |
|
669 |
// // if (URID!=this.globalData.URID) { |
|
670 |
// // this.globalData.URID = URID; |
|
671 |
// // this.getFromUserIdForRequest().then(()=>{ |
|
672 |
// // this.websocketReconnect(); |
|
673 |
// // this.getSession(); |
|
674 |
// // this.getSettings(); |
|
675 |
// // }); |
|
676 |
// // } |
|
677 |
// console.log('扫码进入小程序直播间, 地址上的FromUserId为',FromUserId ); |
92f679
|
678 |
// } |
d98d05
|
679 |
// // 普通二维码 |
S |
680 |
// else{ |
|
681 |
|
92f679
|
682 |
// } |
S |
683 |
|
|
684 |
} |
|
685 |
|
|
686 |
|
d98d05
|
687 |
|
S |
688 |
if(!FromUserId){ |
|
689 |
FromUserId = options.query.FromUserId; |
|
690 |
} |
|
691 |
return FromUserId; |
|
692 |
}, |
|
693 |
|
|
694 |
// 获取scene内的参数 |
|
695 |
getPathUrl(options) { |
|
696 |
let pathUrl; |
|
697 |
// 通过扫码进入 |
|
698 |
if (options.scene == 1047||options.scene == 1048||options.scene == 1049) { |
|
699 |
// 直播二维码 |
|
700 |
if(options.path.includes('/pages/live-player-plugin')){ |
|
701 |
pathUrl = `${options.path}?`; |
|
702 |
for (const key in options.query) { |
|
703 |
if (options.query.hasOwnProperty(key)) { |
|
704 |
const element = options.query[key]; |
|
705 |
pathUrl+=`${key}=${element}&` |
|
706 |
} |
|
707 |
} |
|
708 |
console.log('扫码进入小程序直播间, 二维码地址为', pathUrl); |
92f679
|
709 |
|
S |
710 |
} |
d98d05
|
711 |
// 普通二维码 |
S |
712 |
else{ |
|
713 |
|
|
714 |
pathUrl = `/${options.path}?${decodeURIComponent(options.query.scene)}`; |
92f679
|
715 |
|
d98d05
|
716 |
} |
92f679
|
717 |
|
d98d05
|
718 |
} |
S |
719 |
|
|
720 |
if (!pathUrl) { |
|
721 |
pathUrl = `/${options.path}?`; |
|
722 |
for (const key in options.query) { |
|
723 |
if (options.query.hasOwnProperty(key)) { |
|
724 |
const element = options.query[key]; |
|
725 |
pathUrl+=`${key}=${element}&` |
|
726 |
} |
|
727 |
} |
|
728 |
} |
92f679
|
729 |
|
d98d05
|
730 |
return pathUrl; |
S |
731 |
}, |
|
732 |
|
|
733 |
|
|
734 |
// 小程序显示时 |
|
735 |
async onShow(options) { |
92f679
|
736 |
|
d98d05
|
737 |
// wx.redirectTo({ |
S |
738 |
// url:'/pages/index/index', |
|
739 |
// }) |
|
740 |
console.log('发生了小程序app onShow事件', options); |
|
741 |
if (!this.isFirstOpenApp) { |
0da8db
|
742 |
this.getSession(options); |
d98d05
|
743 |
console.log('小程序非初次加载进入onShow,重新login一次'); |
0da8db
|
744 |
if (options.query.FromOpenId) { |
S |
745 |
this.globalData.FromOpenId = options.query.FromOpenId; |
|
746 |
console.log('...小程序非初次加载进入onShow,FromOpenId更新为链接中的值 ',this.globalData.FromOpenId); |
|
747 |
} |
d98d05
|
748 |
// return; |
S |
749 |
} |
92f679
|
750 |
|
d98d05
|
751 |
// let pathUrl = this.getPathUrl(options); |
S |
752 |
|
|
753 |
// 分享卡片入口进入小程序 |
|
754 |
// 直播间 |
|
755 |
if((options.scene == 1007 || options.scene == 1008 || options.scene == 1044)&&options.path.includes('/pages/live-player-plugin')){ |
|
756 |
console.log('通过直播分享卡片进入小程序', options); |
a50a5b
|
757 |
// livePlayer.getShareParams() |
S |
758 |
// .then((res)=>{ |
|
759 |
// console.log('获取直播 room id', res.room_id); // 房间号 |
|
760 |
// console.log('获取直播 openid', res.openid); // 用户openid |
|
761 |
// console.log('获取直播 share openid', res.share_openid); // 分享者openid,分享卡片进入场景才有 |
|
762 |
// console.log('获取 custom params', res.custom_params); // 开发者在跳转进入直播间页面时,页面路径上携带的自定义参数,这里传回给开发者 |
|
763 |
// let FromUserId = res.custom_params.FromUserId || ''; |
|
764 |
// this.handleFromUserIdChange(FromUserId); |
|
765 |
// }).catch(err => { |
|
766 |
// console.log('获取直播 share params', err) |
|
767 |
// }) |
92f679
|
768 |
} |
d98d05
|
769 |
// 不是初次打开 |
S |
770 |
else if(!this.isFirstOpenApp){ |
|
771 |
let FromUserId = this.getFromUserId(options); |
|
772 |
this.handleFromUserIdChange(FromUserId); |
92f679
|
773 |
|
d98d05
|
774 |
} |
92f679
|
775 |
|
d98d05
|
776 |
}, |
S |
777 |
|
|
778 |
handleFromUserIdChange(FromUserId){ |
|
779 |
console.log('原来的this.globalData.FromUserId.........',this.globalData.FromUserId) |
|
780 |
console.log('链接中的FromUserId.......', FromUserId) |
|
781 |
this.globalData.tempFromUserId = FromUserId || this.globalData.tempFromUserId; |
|
782 |
// this.globalData.FromUserId = FromUserId; |
|
783 |
console.log('切前台事件后tempFromUserId值为', this.globalData.tempFromUserId); |
92f679
|
784 |
|
d98d05
|
785 |
if((this.globalData.FromUserId!=''&&this.globalData.FromUserId!=undefined)&&(FromUserId!=''&&FromUserId!=undefined)&&this.globalData.FromUserId != FromUserId){ |
S |
786 |
this.globalData.openID = ''; |
|
787 |
this.globalData.FromUserId = this.globalData.tempFromUserId; |
|
788 |
console.log('小程序app onshow 事件发生时 两个FromUserId不相等', this.globalData.FromUserId); |
0da8db
|
789 |
this.getSession(options).then(()=>{ |
d98d05
|
790 |
// this.websocketReconnect(); |
S |
791 |
// this.getFromUserIdForRequest(); |
|
792 |
// this.getSettings(); |
|
793 |
this.appOnLoad(); |
|
794 |
}); |
92f679
|
795 |
|
d98d05
|
796 |
} |
S |
797 |
}, |
|
798 |
// } |
92f679
|
799 |
|
d98d05
|
800 |
// // 通过二维码进入小程序 |
S |
801 |
// else if (options.scene == 1017||options.scene == 1047||options.scene == 1048||options.scene == 1049) { |
|
802 |
// // 直播二维码 |
|
803 |
// if(options.path.includes('/pages/live-player-plugin')){ |
|
804 |
// let url = `${options.path}?`; |
|
805 |
// // if(!url.includes('plugin-private://wx2b03c6e691cd7370')){ |
|
806 |
// // url = `plugin-private://wx2b03c6e691cd7370${options.path}?`; |
|
807 |
// // } |
|
808 |
// for (const key in options.query) { |
|
809 |
// if (options.query.hasOwnProperty(key)) { |
|
810 |
// const element = options.query[key]; |
|
811 |
// url+=`${key}=${element}&` |
|
812 |
// } |
|
813 |
// } |
92f679
|
814 |
|
S |
815 |
|
d98d05
|
816 |
// this.globalData.FromUserId = FromUserId; |
S |
817 |
// this.handleFromUserId(FromUserId); |
|
818 |
// wx.redirectTo({ |
|
819 |
// url:url, |
|
820 |
// }) |
92f679
|
821 |
// } |
d98d05
|
822 |
// // 普通二维码 |
S |
823 |
// else{ |
|
824 |
// let url = `/${options.path}?${decodeURIComponent(options.query.scene)}`; |
|
825 |
// this.handleFromUserId(this.getFromUserId(options)); |
|
826 |
// console.log('扫码进入小程序, 二维码地址为', url); |
|
827 |
|
|
828 |
// if (this.isTabbar(options.path)) { |
|
829 |
// wx.switchTab({ |
|
830 |
// url:`/${options.path}`, |
|
831 |
// }) |
|
832 |
// } else{ |
|
833 |
// wx.redirectTo({ |
|
834 |
// url, |
|
835 |
// }) |
|
836 |
// } |
92f679
|
837 |
|
d98d05
|
838 |
// } |
92f679
|
839 |
|
d98d05
|
840 |
// } |
S |
841 |
|
|
842 |
// else{ |
|
843 |
// this.handleFromUserId(this.getFromUserId(options)); |
|
844 |
// } |
92f679
|
845 |
|
d98d05
|
846 |
// // var FromUserId = this.getScene(options); |
92f679
|
847 |
|
d98d05
|
848 |
// var OpenFrom = options.query.OpenFrom; //decodeURIComponent(options.query.OpenFrom); |
S |
849 |
// console.log(OpenFrom); |
|
850 |
// if (OpenFrom == 'TemplateMsg' || OpenFrom == 'fromShare') { |
|
851 |
// this.globalData.isRedirectTo = true; |
|
852 |
// } |
|
853 |
|
92f679
|
854 |
|
d98d05
|
855 |
// }, |
S |
856 |
|
|
857 |
websocketReconnect(){ |
92f679
|
858 |
|
d98d05
|
859 |
// // 扫码时小程序会重启 重启会使用启动时拿到的FromOpenId |
S |
860 |
// // 在从分享连接打开时,小程序不会重启 |
|
861 |
// this.globalData.tempFromUserId = FromUserId || this.globalData.tempFromUserId; |
|
862 |
// // this.globalData.FromUserId = options.query.FromUserId || this.globalData.FromUserId; |
|
863 |
// console.log('切前台事件后tempFromUserId值为', this.globalData.tempFromUserId); |
|
864 |
// console.log('切前台事件后FromUserId值为', this.globalData.FromUserId); |
|
865 |
|
|
866 |
// // 判断临时变量tempFromUserId与原FromUserId是否相等 |
|
867 |
// // 不相等说明用户切换了客服,需要重获名片数据并重连websocket,相等则不处理 |
|
868 |
// // tempFromUserId最初与FromUserId相等,会在选择名片夹时与切后台后显示时更新 |
|
869 |
// if (this.globalData.tempFromUserId !== this.globalData.FromUserId) { |
|
870 |
// this.globalData.FromUserId = this.globalData.tempFromUserId; |
|
871 |
// this.globalData.SocketTask.close({ |
|
872 |
// success: (res) => { |
|
873 |
// console.log('主动关闭 WebSocket 连接。', res); |
|
874 |
// } |
|
875 |
// }); |
|
876 |
// // 把上个联系人的消息清空并重连 |
|
877 |
// this.globalData.allContentList = []; |
|
878 |
// this.globalData.unreadMsgNum = 0; |
|
879 |
// this.socketReconnect(); |
|
880 |
// } |
|
881 |
if (this.globalData.SocketTask) { |
|
882 |
this.globalData.SocketTask.close({ |
|
883 |
success: (res) => { |
|
884 |
console.log('主动关闭 WebSocket 连接。', res); |
|
885 |
} |
|
886 |
}); |
|
887 |
// 把上个联系人的消息清空并重连 |
|
888 |
this.globalData.allContentList = []; |
|
889 |
this.globalData.unreadMsgNum = 0; |
|
890 |
this.socketReconnect(); |
|
891 |
} else { |
|
892 |
this.webSocket(); |
|
893 |
} |
92f679
|
894 |
|
S |
895 |
|
d98d05
|
896 |
}, |
S |
897 |
|
|
898 |
isTabbar(url){ |
|
899 |
console.log('url......',url) |
|
900 |
console.log('tabBarList......',this.globalData.tabBarList) |
|
901 |
if (this.globalData.tabBarList instanceof Array) { |
|
902 |
// return this.globalData.tabBarList.forEach((item,index)=>{ |
|
903 |
// console.log(item); |
|
904 |
// console.log('tabBarList是否包含参数url',item.includes(url)); |
|
905 |
// if(item.includes(url)){ |
|
906 |
// return true; |
|
907 |
// } |
|
908 |
// }) |
|
909 |
for (let i = 0; i < this.globalData.tabBarList.length; i++) { |
|
910 |
const item = this.globalData.tabBarList[i]; |
|
911 |
if(item.includes(url)){ |
|
912 |
return true; |
|
913 |
} |
|
914 |
} |
|
915 |
} |
92f679
|
916 |
|
d98d05
|
917 |
return false; |
S |
918 |
}, |
|
919 |
|
|
920 |
|
|
921 |
globalData: { |
|
922 |
URID:'', |
|
923 |
ReferrerOpenId: '', |
|
924 |
SessionKey: '', |
|
925 |
titleName: '', |
|
926 |
categoryListStyle: 0, |
|
927 |
isAuthorize: false, //是否授权 |
|
928 |
userInfo: {}, |
|
929 |
openID: '', // ||'o6Df10LmkJZnWPFY3jiLrVY_3mb8', //用户openid,固定不变 //wx.getStorageSync("openID") |
|
930 |
FromOpenId: '', //'', //wx.getStorageSync('FromOpenId'), //'' || 'o6Df10LmkJZnWPFY3jiLrVY_3mb8', |
|
931 |
FromUserId: '', // |
|
932 |
nickName: '', |
|
933 |
Cltcode: '', // 用户是否用手机号登录 |
|
934 |
cardUserData: {}, //名片信息 |
|
935 |
tempFromUserId: '', //存储临时FromUserId,最初与FromUserId相等,会在选择名片时与切后台后显示时更新 |
|
936 |
AppId: wx.getExtConfigSync().AppId, |
245dd6
|
937 |
TengXunMapLocationServiceKey: wx.getExtConfigSync().TengXunMapLocationServiceKey, |
d98d05
|
938 |
cartNum: 0, //购物车商品数 |
S |
939 |
cartIndex: 2, //购物车页面在tabbar的index值 |
|
940 |
reqBase: '', //"https://mp.onbus.cn", |
|
941 |
// socketMethod: "wss://", |
|
942 |
socketHost: '', //"wss://mp.onbus.cn", |
|
943 |
SocketTask: '', //websocket任务 |
|
944 |
socketOpen: false, //是否已连接 |
|
945 |
allContentList: [], //所有消息 |
|
946 |
errorList: [], //错误消息 |
|
947 |
dbid: 0, //数据源 |
|
948 |
groupId: '', // |
|
949 |
newMsg: '', //最新消息 |
|
950 |
msgCallback: function () { |
|
951 |
}, //()=> {} //接收消息后处理消息的回调函数 |
|
952 |
newMsgCallback: function () { |
|
953 |
}, //()=> {} //接收最新消息后处理消息的回调函数 |
|
954 |
//errorMsgCallback: function() { }, //()=> {} //接收错误消息后处理消息的回调函数 |
|
955 |
unreadMsgNum: 0, //未读消息数量 |
|
956 |
indexCallback: function () { |
|
957 |
}, //()=> {} //login.do成功后的回调函数,在首页调用 |
|
958 |
classifyCallback: function () { |
|
959 |
}, //()=> {} //login.do成功后的回调函数,在分类页调用 |
|
960 |
idcardCallback: function () { |
|
961 |
}, //()=> {} //login.do成功后的回调函数,在名片页调用 |
|
962 |
messageCallback: function () { |
|
963 |
}, //()=> {} //login.do成功后的回调函数,在消息页调用 |
|
964 |
getCardCallback: function () { |
|
965 |
}, //()=> {} //login.do成功后的回调函数,在名片页调用 |
|
966 |
isReconnect: false, //websocket是否重连过 |
|
967 |
isRedirectTo: false, //是否有重定向 |
|
968 |
normalSearchKey: '', |
|
969 |
ChooseFloorId: '', |
|
970 |
//自定义导航相关的 |
|
971 |
statusBarHeight:0,//状态栏高度 |
|
972 |
menuButton:{},//胶囊相关数据 @obj,{width,height,top,left,right,bottom} |
|
973 |
customNavBarHeight:0,//自定义导航栏的高度【导航栏包括了状态栏】 |
|
974 |
}, |
|
975 |
|
|
976 |
// 页面onshow时FromUserId改变 |
|
977 |
// fromUserIdOnChange(callback){ |
|
978 |
// if((this.globalData.FromUserId!=''&&this.globalData.FromUserId!=undefined)&&(this.globalData.tempFromUserId!=''&&this.globalData.tempFromUserId!=undefined)&&this.globalData.FromUserId !== this.globalData.tempFromUserId){ |
|
979 |
// this.globalData.FromUserId = this.globalData.tempFromUserId; |
|
980 |
// console.log('两个FromUserId不相等,页面onshow事件发生', this.globalData.FromUserId); |
92f679
|
981 |
|
d98d05
|
982 |
// if(this.globalData.isStartupLeagueShopCcCode){ |
S |
983 |
// typeof callback === 'function'&& callback(); |
|
984 |
// } |
92f679
|
985 |
|
d98d05
|
986 |
// } |
S |
987 |
// }, |
|
988 |
// unionFromUserIdChangeOnShow(){ |
|
989 |
|
|
990 |
// }, |
|
991 |
|
|
992 |
// onShow : function(){ |
|
993 |
// var num = wx.getStorageSync("cartNum"); |
|
994 |
// wx.setTabBarBadge({ |
|
995 |
// index: 2, |
|
996 |
// text: num.toString() |
|
997 |
// }) |
|
998 |
// } |
|
999 |
onHide () { |
|
1000 |
// Do something when hide. |
|
1001 |
// wx.reLaunch({ |
|
1002 |
// url: '/pages/logs/logs', |
|
1003 |
// }) |
|
1004 |
this.isFirstOpenApp = false; |
|
1005 |
}, |
|
1006 |
}); |