@conecli/cone-render 0.10.1-shop3.138 → 0.10.1-shop3.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/components/base/Price/Double/index.module.scss +0 -4
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/open/api/track.ts +1 -1
- package/dist/service/requestServer.h5.ts +1 -1
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/package.json +1 -1
package/dist/common/index.jd.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro';
|
|
2
1
|
WXAPP_LOGIN,
|
|
3
2
|
WXAPP_BIZ,
|
|
4
3
|
WXAPP_USER_INFO,
|
|
5
4
|
WXAPP_NAVIGATOR,
|
|
6
5
|
WXAPP_REPORT_GDT,
|
|
7
6
|
WXAPP_PARAMS_SIGN,
|
|
8
7
|
WXAPP_FINGER_REPORT,
|
|
9
8
|
WXAPP_REPORT_MANAGE,
|
|
10
9
|
BUSINESS_TYPE,
|
|
11
10
|
SHOP_MENU_ID_TYPE,
|
|
12
11
|
SHOP_MENU_ID_NAME,
|
|
13
12
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
14
13
|
SECTION_HOME_TAB_TYPE,
|
|
15
14
|
TaroEventType,
|
|
16
15
|
WX_BUSINESS_TYPE,
|
|
17
16
|
WXAPP_BIZ_KEY,
|
|
18
17
|
getSystemInfos,
|
|
19
18
|
getTaroStorageKeyValue,
|
|
20
19
|
removeTaroStorageKey,
|
|
21
20
|
setTaroStorage,
|
|
22
21
|
getWxAppCookieStr,
|
|
23
22
|
objectToUrlEncode,
|
|
24
23
|
languageNowType,
|
|
25
24
|
accessibilityRunning: false,
|
|
26
25
|
abTestLabels: {},
|
|
27
26
|
nonSellableSkuids: {},
|
|
28
27
|
loginState: jdUserLoginState,
|
|
29
28
|
cookiesStr: '',
|
|
30
29
|
userInfo: userPinKey,
|
|
31
30
|
isImmersive: false,
|
|
32
31
|
baseAddCartSwitch: true,
|
|
33
32
|
pageInfo: {
|
|
34
33
|
wxBusinessType: WX_BUSINESS_TYPE.SHOP,
|
|
35
34
|
address: '',
|
|
36
35
|
addressCommaStr: '',
|
|
37
36
|
fullAddress: '',
|
|
38
37
|
un_area: '',
|
|
39
38
|
userLbsAddress: '',
|
|
40
39
|
vapptype: '1',
|
|
41
40
|
pageType: 'home',
|
|
42
41
|
dataType: BUSINESS_TYPE.ONLINE,
|
|
43
42
|
floorExposureInfo: {},
|
|
44
43
|
floorVideInfo: {},
|
|
45
44
|
productVideInfo: {},
|
|
46
45
|
tabsLoadAllDataInfo: {
|
|
47
46
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
|
|
48
47
|
[SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
|
|
49
48
|
},
|
|
50
49
|
updateShopInfosAllState: false,
|
|
51
50
|
isVipShop: false,
|
|
52
51
|
isJdShowNativeImmersivePlayer: false,
|
|
53
52
|
isSuperBrandShop: false,
|
|
54
53
|
...shopConfig,
|
|
55
54
|
pageScrollTop: 0,
|
|
56
55
|
pageIdxHeightInfo: {
|
|
57
56
|
list: [],
|
|
58
57
|
},
|
|
59
58
|
isScanPreview: false,
|
|
60
59
|
shopNavBarHeight: 0,
|
|
61
60
|
},
|
|
62
61
|
defaultQueryLogInfo: {
|
|
63
62
|
sourceType: 'JDshop',
|
|
64
63
|
sourceValue: '',
|
|
65
64
|
moduleId: 'none',
|
|
66
65
|
entrance: 'none',
|
|
67
66
|
},
|
|
68
67
|
originQueryInfo: {},
|
|
69
68
|
sysInfo: {
|
|
70
69
|
windowWidth: 0,
|
|
71
70
|
windowHeight: 0,
|
|
72
71
|
eid: appEid,
|
|
73
72
|
netWorkType: '4g',
|
|
74
73
|
jdBottomBarHeight: 0,
|
|
75
74
|
jdNativeHeaderHeight: 0,
|
|
76
75
|
},
|
|
77
76
|
queryInfo: {},
|
|
78
77
|
shopInfo: {},
|
|
79
78
|
openAppData: {},
|
|
80
79
|
public info: CommonInterFace.BaseConfigInfo;
|
|
81
80
|
public config: {
|
|
82
81
|
[key: string]: any;
|
|
83
82
|
};
|
|
84
83
|
public lazyContainer: CommonInterFace.lazyContainer;
|
|
85
84
|
public rootEleNode: HTMLElement | null;
|
|
86
85
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil;
|
|
87
86
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
|
|
88
87
|
public checkStatusAndLoginPromise: object | null;
|
|
89
88
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin;
|
|
90
89
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
|
|
91
90
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
|
|
92
91
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
|
|
93
92
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
|
|
94
93
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
|
|
95
94
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
|
|
96
95
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
|
|
97
96
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
|
|
98
97
|
public loadJsSdkList: Array<any>;
|
|
99
98
|
public loadJsSdkListCachePromise: any;
|
|
100
99
|
public languageJsonData: any | null;
|
|
101
100
|
public businessWorkerReady: boolean;
|
|
102
101
|
public jdWorkerReadyPromise: any | null;
|
|
103
102
|
constructor(opt) {
|
|
104
103
|
this.info = this._getConfig(opt);
|
|
105
104
|
this.config = {};
|
|
106
105
|
this.lazyContainer = {
|
|
107
106
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
|
|
108
107
|
appLazyContainerList: [],
|
|
109
108
|
appLazyFinishContainerList: [],
|
|
110
109
|
},
|
|
111
110
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
|
|
112
111
|
appLazyContainerList: [],
|
|
113
112
|
appLazyFinishContainerList: [],
|
|
114
113
|
},
|
|
115
114
|
};
|
|
116
115
|
this.loadJsSdkList = [];
|
|
117
116
|
this.loadJsSdkListCachePromise = {};
|
|
118
117
|
this.rootEleNode = null;
|
|
119
118
|
this.miniApplogUtil = MiniAppLogUtil;
|
|
120
119
|
this.miniAppLogInstance = null;
|
|
121
120
|
this.checkStatusAndLoginPromise = null;
|
|
122
121
|
this.wxAppLoginInstance = WXAPP_LOGIN;
|
|
123
122
|
this.wxAppBizInstance = WXAPP_BIZ;
|
|
124
123
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO;
|
|
125
124
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
|
|
126
125
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
|
|
127
126
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
|
|
128
127
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
|
|
129
128
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
|
|
130
129
|
this.wxAppSubsGuider = null;
|
|
131
130
|
this.languageJsonData = langeJsonDataForCn;
|
|
132
131
|
this.businessWorkerReady = false;
|
|
133
132
|
this.jdWorkerReadyPromise = Promise.resolve(false);
|
|
134
133
|
}
|
|
135
134
|
_getConfig(opt) {
|
|
136
135
|
return Object.assign({}, DefaultConfig, opt);
|
|
137
136
|
}
|
|
138
137
|
loadApiSafeSteadyReayPromise() {
|
|
139
138
|
return Promise.resolve(true);
|
|
140
139
|
}
|
|
141
140
|
loadH5tagReayPromise() {
|
|
142
141
|
return Promise.resolve(true);
|
|
143
142
|
}
|
|
144
143
|
|
|
145
144
|
jmfeReayPromise(): Promise<any> {
|
|
146
145
|
return Promise.reject(false);
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
taskTimeoutPromise(callBack, timeout = 2000) {
|
|
150
149
|
return new Promise((resolve) => {
|
|
151
150
|
setTimeout(() => {
|
|
152
151
|
const getCallBackRes = typeof callBack === 'function' && callBack();
|
|
153
152
|
return resolve(getCallBackRes || false);
|
|
154
153
|
}, timeout);
|
|
155
154
|
});
|
|
156
155
|
}
|
|
157
156
|
|
|
158
157
|
updateBusinessDomainAndApi(domain, api) {
|
|
159
158
|
}
|
|
160
159
|
|
|
161
160
|
getFullScreenHeight(systemInfo) {
|
|
162
161
|
const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
|
|
163
162
|
let result = screenHeight;
|
|
164
163
|
if (statusBarHeight > 20 && isAndroid) {
|
|
165
164
|
result = screenHeight + statusBarHeight;
|
|
166
165
|
}
|
|
167
166
|
return result;
|
|
168
167
|
}
|
|
169
168
|
|
|
170
169
|
getTabBarHeight(systemInfo) {
|
|
171
170
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo;
|
|
172
171
|
let result = 50;
|
|
173
172
|
if (statusBarHeight > 20) {
|
|
174
173
|
if (isIOS) {
|
|
175
174
|
result = 84;
|
|
176
175
|
} else if (isAndroid) {
|
|
177
176
|
result = 53;
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
return result;
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
getSystemInfo() {
|
|
184
183
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
|
|
185
184
|
const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
|
|
186
185
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
|
|
187
186
|
const fullScreenHeight = this.getFullScreenHeight(info);
|
|
188
187
|
const tabBarHeight = this.getTabBarHeight(info);
|
|
189
188
|
const safeContentHeight = fullScreenHeight - headerHeight;
|
|
190
189
|
this.info.sysInfo = {
|
|
191
190
|
...this.info.sysInfo,
|
|
192
191
|
...info,
|
|
193
192
|
actualNavBarHeight,
|
|
194
193
|
headerHeight,
|
|
195
194
|
fullScreenHeight,
|
|
196
195
|
tabBarHeight,
|
|
197
196
|
safeContentHeight,
|
|
198
197
|
languageType: languageNowType,
|
|
199
198
|
};
|
|
200
199
|
this.getEid().then((res: { eid: string }) => {
|
|
201
200
|
res && res.eid && (this.info.sysInfo['eid'] = res.eid);
|
|
202
201
|
});
|
|
203
202
|
if (this.info.sysInfo['hostVersionName']) {
|
|
204
203
|
this.info.sysInfo['hostAppVersion'] = Number(
|
|
205
204
|
this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
|
|
206
205
|
);
|
|
207
206
|
}
|
|
208
207
|
this.info.sysInfo['wifiVideoAutoPlay'] = false;
|
|
209
208
|
this.getNetWorkType();
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
getSysInfoReadyPromise(): Promise<any> {
|
|
213
212
|
(this.info.sysInfo?.windowWidth || 0) <= 0 && this.getSystemInfo();
|
|
214
213
|
return Promise.resolve(this.info.sysInfo);
|
|
215
214
|
}
|
|
216
215
|
async updateMPaasConfig() {}
|
|
217
216
|
|
|
218
217
|
getNetWorkType() {
|
|
219
218
|
return Taro.getNetworkType().then((getRes) => {
|
|
220
219
|
getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
|
|
221
220
|
return getRes;
|
|
222
221
|
});
|
|
223
222
|
}
|
|
224
223
|
getAPPUseStraightCorner() {
|
|
225
224
|
return Promise.resolve(false);
|
|
226
225
|
}
|
|
227
226
|
|
|
228
227
|
checkStatusAndLogin(options = {}) {
|
|
229
228
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
230
229
|
console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
|
|
231
230
|
this.toLogin(options)
|
|
232
231
|
.then((res) => {
|
|
233
232
|
console.log('微信小程序登录状态结果,成功', res);
|
|
234
233
|
this.info.loginState = true;
|
|
235
234
|
resolve(res);
|
|
236
235
|
})
|
|
237
236
|
.catch((err) => {
|
|
238
237
|
console.log('微信小程序登录异常状态结果', err);
|
|
239
238
|
this.doLogin(options)
|
|
240
239
|
.then((res2) => {
|
|
241
240
|
console.log('微信小程序wxDoLogin强制登陆成功:', res2);
|
|
242
241
|
this.info.loginState = true;
|
|
243
242
|
resolve(res2);
|
|
244
243
|
})
|
|
245
244
|
.catch((err2) => {
|
|
246
245
|
console.log('微信小程序wxDoLogin强制登陆失败:', err2);
|
|
247
246
|
this.checkStatusAndLoginPromise = null;
|
|
248
247
|
reject(err2);
|
|
249
248
|
});
|
|
250
249
|
});
|
|
251
250
|
});
|
|
252
251
|
return this.checkStatusAndLoginPromise;
|
|
253
252
|
}
|
|
254
253
|
|
|
255
254
|
checkJdStatusAndLogin(options) {
|
|
256
255
|
return this.checkStatusAndLogin(options);
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
|
|
260
259
|
doLoginForJdPin(options = {}) {
|
|
261
260
|
return this.doLogin(options);
|
|
262
261
|
}
|
|
263
262
|
|
|
264
263
|
getEid() {
|
|
265
264
|
if (typeof jd !== 'undefined' && jd.getEid) {
|
|
266
265
|
return new Promise((resolve, reject) => {
|
|
267
266
|
jd.getEid({
|
|
268
267
|
success: (res: { eid: string }) => {
|
|
269
268
|
resolve(res);
|
|
270
269
|
},
|
|
271
270
|
fail: (err: any) => {
|
|
272
271
|
reject(err);
|
|
273
272
|
},
|
|
274
273
|
});
|
|
275
274
|
});
|
|
276
275
|
} else {
|
|
277
276
|
return Promise.resolve(false);
|
|
278
277
|
}
|
|
279
278
|
}
|
|
280
279
|
|
|
281
280
|
toLogin(options = {}): Promise<any> {
|
|
282
281
|
return this.wxAppLoginInstance
|
|
283
282
|
.getLoginPromise({
|
|
284
283
|
mode: 'silent',
|
|
285
284
|
loginColor: {
|
|
286
285
|
biz: WXAPP_BIZ_KEY,
|
|
287
286
|
dpin: 0,
|
|
288
287
|
},
|
|
289
288
|
...options,
|
|
290
289
|
})
|
|
291
290
|
.then((res) => {
|
|
292
291
|
console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
|
|
293
292
|
setTimeout(() => {
|
|
294
293
|
console.log(
|
|
295
294
|
'微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
|
|
296
295
|
);
|
|
297
296
|
this.getLoginCookie(`${Date.now()}`);
|
|
298
297
|
}, 500);
|
|
299
298
|
})
|
|
300
299
|
.catch((err) => {
|
|
301
300
|
console.log('微信app登录异常返回信息,也获取cookie', err);
|
|
302
301
|
this.getLoginCookie(`${Date.now()}`);
|
|
303
302
|
});
|
|
304
303
|
}
|
|
305
304
|
|
|
306
305
|
doLogin(options) {
|
|
307
306
|
console.log('触发松果小程序 doLogin() new new');
|
|
308
307
|
return new Promise((resolve, reject) => {
|
|
309
308
|
jd.login({
|
|
310
309
|
success: (res) => {
|
|
311
310
|
if (res.code) {
|
|
312
311
|
console.log('[common]松果小程序登录成功', res.code);
|
|
313
312
|
jd.redirectTo({
|
|
314
313
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
315
314
|
...this.info.originQueryInfo,
|
|
316
315
|
})}`,
|
|
317
316
|
});
|
|
318
317
|
resolve(res);
|
|
319
318
|
} else {
|
|
320
319
|
console.error('[common]松果小程序登录失败', res.errMsg);
|
|
321
320
|
reject();
|
|
322
321
|
}
|
|
323
322
|
},
|
|
324
323
|
fail: (res) => {
|
|
325
324
|
console.error('[common]松果小程序登录失败', res.errMsg);
|
|
326
325
|
reject();
|
|
327
326
|
},
|
|
328
327
|
});
|
|
329
328
|
});
|
|
330
329
|
}
|
|
331
330
|
|
|
332
331
|
getLoginCookie(updateKey = 'wxapp') {
|
|
333
332
|
return new Promise((resolve) => {
|
|
334
333
|
console.log('开始获取更新wxapp中的cookie信息', updateKey);
|
|
335
334
|
if (
|
|
336
335
|
this.config.wqCookie &&
|
|
337
336
|
this.config.wqCookieStr &&
|
|
338
337
|
this.config.getWqCookieKey === updateKey
|
|
339
338
|
) {
|
|
340
339
|
console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
|
|
341
340
|
resolve({
|
|
342
341
|
wqCookie: this.config.wqCookie,
|
|
343
342
|
wqCookieStr: this.config.wqCookieStr,
|
|
344
343
|
});
|
|
345
344
|
} else {
|
|
346
345
|
if (isPublishToWxapp) {
|
|
347
346
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
|
|
348
347
|
if (getWxappCookieObj) {
|
|
349
348
|
const getCookieObj = getWxappCookieObj['_data'];
|
|
350
349
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
|
|
351
350
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
|
|
352
351
|
this.info.loginState = true;
|
|
353
352
|
this.info.userInfo.wqCookie = wqCookieStr;
|
|
354
353
|
this.info.userInfo.wqVisitkey = visitkey;
|
|
355
354
|
console.log('获取用户完整cookie信息', getCookieObj);
|
|
356
355
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress();
|
|
357
356
|
console.log('获取微信用户地址信息', getUserAddress);
|
|
358
357
|
if (getUserAddress) {
|
|
359
358
|
this.info.pageInfo.address = getUserAddress?.areaId;
|
|
360
359
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
|
|
361
360
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
362
361
|
: '';
|
|
363
362
|
this.info.pageInfo.un_area = this.info.pageInfo.address;
|
|
364
363
|
Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
|
|
365
364
|
area: this.info.pageInfo.address,
|
|
366
365
|
});
|
|
367
366
|
}
|
|
368
367
|
if (this.miniAppLogInstance) {
|
|
369
368
|
this.miniAppLogInstance.set({
|
|
370
369
|
account: pin,
|
|
371
370
|
unionid: wq_unionid,
|
|
372
371
|
openid: wxapp_openid,
|
|
373
372
|
});
|
|
374
373
|
}
|
|
375
374
|
this.config.wqCookie = wqCookie;
|
|
376
375
|
this.config.wqCookieStr = wqCookieStr;
|
|
377
376
|
this.config.getWqCookieKey = updateKey;
|
|
378
377
|
console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
|
|
379
378
|
resolve({
|
|
380
379
|
wqCookie,
|
|
381
380
|
wqCookieStr,
|
|
382
381
|
});
|
|
383
382
|
} else {
|
|
384
383
|
console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
|
|
385
384
|
resolve({
|
|
386
385
|
wqCookie: false,
|
|
387
386
|
wqCookieStr: false,
|
|
388
387
|
});
|
|
389
388
|
}
|
|
390
389
|
} else {
|
|
391
390
|
resolve({
|
|
392
391
|
wqCookie: false,
|
|
393
392
|
wqCookieStr: false,
|
|
394
393
|
});
|
|
395
394
|
}
|
|
396
395
|
}
|
|
397
396
|
});
|
|
398
397
|
}
|
|
399
398
|
|
|
400
399
|
|
|
401
400
|
checkLoginStatus() {
|
|
402
401
|
return this.getLoginCookie();
|
|
403
402
|
}
|
|
404
403
|
|
|
405
404
|
getAddressCachePromise() {
|
|
406
405
|
return Promise.reject('该方法只在APP内适用');
|
|
407
406
|
}
|
|
408
407
|
|
|
409
408
|
getLbsAddressCachePromise() {
|
|
410
409
|
return Promise.resolve({
|
|
411
410
|
status: '-1005',
|
|
412
411
|
msg: '暂未实现,获取失败',
|
|
413
412
|
});
|
|
414
413
|
}
|
|
415
414
|
|
|
416
415
|
getDynamicConfig(key: string) {
|
|
417
416
|
console.warn('调用松果小程序的 getDynamicConfig(),注意,此方法还未实现!');
|
|
418
417
|
return null;
|
|
419
418
|
}
|
|
420
419
|
|
|
421
420
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
422
421
|
const createUpdateQueryInfo: {
|
|
423
422
|
query: {
|
|
424
423
|
shopId?: string | number;
|
|
425
424
|
venderId?: string | number;
|
|
426
425
|
};
|
|
427
426
|
updateShopInfoState: boolean;
|
|
428
427
|
} = Object.assign(
|
|
429
428
|
{},
|
|
430
429
|
{
|
|
431
430
|
query: {},
|
|
432
431
|
updateShopInfoState: false,
|
|
433
432
|
},
|
|
434
433
|
updateQuery,
|
|
435
434
|
);
|
|
436
435
|
console.log(
|
|
437
436
|
'获取当前下发的店铺查询参数',
|
|
438
437
|
updateQuery,
|
|
439
438
|
'获取之前保存的shopInfo店铺查询参数',
|
|
440
439
|
this.info?.shopInfo,
|
|
441
440
|
);
|
|
442
441
|
const { query, updateShopInfoState } = createUpdateQueryInfo;
|
|
443
442
|
const { shopId, venderId } = query;
|
|
444
443
|
if (updateShopInfoState) {
|
|
445
444
|
this.info.queryInfo = {
|
|
446
445
|
...this.info.queryInfo,
|
|
447
446
|
...query,
|
|
448
447
|
};
|
|
449
448
|
if (shopId && venderId) {
|
|
450
449
|
this.info.shopInfo = {
|
|
451
450
|
shopId: `${shopId}`,
|
|
452
451
|
venderId: `${venderId}`,
|
|
453
452
|
};
|
|
454
453
|
}
|
|
455
454
|
} else {
|
|
456
455
|
this.info.queryInfo = {
|
|
457
456
|
...query,
|
|
458
457
|
};
|
|
459
458
|
this.info.originQueryInfo = {
|
|
460
459
|
...query,
|
|
461
460
|
};
|
|
462
461
|
if (
|
|
463
462
|
this.info.shopInfo?.shopId &&
|
|
464
463
|
this.info.shopInfo?.venderId &&
|
|
465
464
|
(this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
|
|
466
465
|
) {
|
|
467
466
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId;
|
|
468
467
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId;
|
|
469
468
|
console.log(
|
|
470
469
|
'当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
|
|
471
470
|
this.info.queryInfo,
|
|
472
471
|
);
|
|
473
472
|
}
|
|
474
473
|
}
|
|
475
474
|
this.info.queryInfo['shopId'] &&
|
|
476
475
|
(this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
|
|
477
476
|
this.info.queryInfo['venderId'] &&
|
|
478
477
|
(this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
|
|
479
478
|
console.log(
|
|
480
479
|
'weapp===获取店铺下发查询参数\n',
|
|
481
480
|
query,
|
|
482
481
|
'\n获取店铺最后查询参数\n',
|
|
483
482
|
this.info.queryInfo,
|
|
484
483
|
'\n是否为更新店铺状态\n',
|
|
485
484
|
updateShopInfoState,
|
|
486
485
|
);
|
|
487
486
|
}
|
|
488
487
|
renderNextTickLoadSdk() {
|
|
489
488
|
console.warn('暂未实现 index.jd.ts');
|
|
490
489
|
}
|
|
491
490
|
loadOtherSdk() {
|
|
492
491
|
console.warn('暂未实现 index.jd.ts');
|
|
493
492
|
}
|
|
494
493
|
loadItemSdkPromise(jsInfo = {}) {
|
|
495
494
|
console.warn('暂未实现 index.jd.ts');
|
|
496
495
|
}
|
|
497
496
|
createLanguageProimse() {
|
|
498
497
|
return Promise.reject({
|
|
499
498
|
msg: '暂未实现',
|
|
500
499
|
});
|
|
501
500
|
}
|
|
501
|
+
import Taro from '@tarojs/taro';
|
|
502
502
|
WXAPP_LOGIN,
|
|
503
503
|
WXAPP_BIZ,
|
|
504
504
|
WXAPP_USER_INFO,
|
|
505
505
|
WXAPP_NAVIGATOR,
|
|
506
506
|
WXAPP_REPORT_GDT,
|
|
507
507
|
WXAPP_PARAMS_SIGN,
|
|
508
508
|
WXAPP_FINGER_REPORT,
|
|
509
509
|
WXAPP_REPORT_MANAGE,
|
|
510
510
|
BUSINESS_TYPE,
|
|
511
511
|
SHOP_MENU_ID_TYPE,
|
|
512
512
|
SHOP_MENU_ID_NAME,
|
|
513
513
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
514
514
|
SECTION_HOME_TAB_TYPE,
|
|
515
515
|
TaroEventType,
|
|
516
516
|
WX_BUSINESS_TYPE,
|
|
517
517
|
WXAPP_BIZ_KEY,
|
|
518
518
|
getSystemInfos,
|
|
519
519
|
getTaroStorageKeyValue,
|
|
520
520
|
removeTaroStorageKey,
|
|
521
521
|
setTaroStorage,
|
|
522
522
|
getWxAppCookieStr,
|
|
523
523
|
objectToUrlEncode,
|
|
524
524
|
languageNowType,
|
|
525
525
|
accessibilityRunning: false,
|
|
526
526
|
abTestLabels: {},
|
|
527
527
|
nonSellableSkuids: {},
|
|
528
528
|
loginState: jdUserLoginState,
|
|
529
529
|
cookiesStr: '',
|
|
530
530
|
userInfo: userPinKey,
|
|
531
531
|
isImmersive: false,
|
|
532
532
|
baseAddCartSwitch: true,
|
|
533
533
|
pageInfo: {
|
|
534
534
|
wxBusinessType: WX_BUSINESS_TYPE.SHOP,
|
|
535
535
|
address: '',
|
|
536
536
|
addressCommaStr: '',
|
|
537
537
|
fullAddress: '',
|
|
538
538
|
un_area: '',
|
|
539
539
|
userLbsAddress: '',
|
|
540
540
|
vapptype: '1',
|
|
541
541
|
pageType: 'home',
|
|
542
542
|
dataType: BUSINESS_TYPE.ONLINE,
|
|
543
543
|
floorExposureInfo: {},
|
|
544
544
|
floorVideInfo: {},
|
|
545
545
|
productVideInfo: {},
|
|
546
546
|
tabsLoadAllDataInfo: {
|
|
547
547
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
|
|
548
548
|
[SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
|
|
549
549
|
},
|
|
550
550
|
updateShopInfosAllState: false,
|
|
551
551
|
isVipShop: false,
|
|
552
552
|
isJdShowNativeImmersivePlayer: false,
|
|
553
553
|
isSuperBrandShop: false,
|
|
554
554
|
...shopConfig,
|
|
555
555
|
pageScrollTop: 0,
|
|
556
556
|
pageIdxHeightInfo: {
|
|
557
557
|
list: [],
|
|
558
558
|
},
|
|
559
559
|
isScanPreview: false,
|
|
560
560
|
shopNavBarHeight: 0,
|
|
561
561
|
},
|
|
562
562
|
defaultQueryLogInfo: {
|
|
563
563
|
sourceType: 'JDshop',
|
|
564
564
|
sourceValue: '',
|
|
565
565
|
moduleId: 'none',
|
|
566
566
|
entrance: 'none',
|
|
567
567
|
},
|
|
568
568
|
originQueryInfo: {},
|
|
569
569
|
sysInfo: {
|
|
570
570
|
windowWidth: 0,
|
|
571
571
|
windowHeight: 0,
|
|
572
572
|
eid: appEid,
|
|
573
573
|
netWorkType: '4g',
|
|
574
574
|
jdBottomBarHeight: 0,
|
|
575
575
|
jdNativeHeaderHeight: 0,
|
|
576
576
|
},
|
|
577
577
|
queryInfo: {},
|
|
578
578
|
shopInfo: {},
|
|
579
579
|
openAppData: {},
|
|
580
580
|
public info: CommonInterFace.BaseConfigInfo;
|
|
581
581
|
public config: {
|
|
582
582
|
[key: string]: any;
|
|
583
583
|
};
|
|
584
584
|
public lazyContainer: CommonInterFace.lazyContainer;
|
|
585
585
|
public rootEleNode: HTMLElement | null;
|
|
586
586
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil;
|
|
587
587
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
|
|
588
588
|
public checkStatusAndLoginPromise: object | null;
|
|
589
589
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin;
|
|
590
590
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
|
|
591
591
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
|
|
592
592
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
|
|
593
593
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
|
|
594
594
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
|
|
595
595
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
|
|
596
596
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
|
|
597
597
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
|
|
598
598
|
public loadJsSdkList: Array<any>;
|
|
599
599
|
public loadJsSdkListCachePromise: any;
|
|
600
600
|
public languageJsonData: any | null;
|
|
601
601
|
public businessWorkerReady: boolean;
|
|
602
602
|
public jdWorkerReadyPromise: any | null;
|
|
603
603
|
constructor(opt) {
|
|
604
604
|
this.info = this._getConfig(opt);
|
|
605
605
|
this.config = {};
|
|
606
606
|
this.lazyContainer = {
|
|
607
607
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
|
|
608
608
|
appLazyContainerList: [],
|
|
609
609
|
appLazyFinishContainerList: [],
|
|
610
610
|
},
|
|
611
611
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
|
|
612
612
|
appLazyContainerList: [],
|
|
613
613
|
appLazyFinishContainerList: [],
|
|
614
614
|
},
|
|
615
615
|
};
|
|
616
616
|
this.loadJsSdkList = [];
|
|
617
617
|
this.loadJsSdkListCachePromise = {};
|
|
618
618
|
this.rootEleNode = null;
|
|
619
619
|
this.miniApplogUtil = MiniAppLogUtil;
|
|
620
620
|
this.miniAppLogInstance = null;
|
|
621
621
|
this.checkStatusAndLoginPromise = null;
|
|
622
622
|
this.wxAppLoginInstance = WXAPP_LOGIN;
|
|
623
623
|
this.wxAppBizInstance = WXAPP_BIZ;
|
|
624
624
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO;
|
|
625
625
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
|
|
626
626
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
|
|
627
627
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
|
|
628
628
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
|
|
629
629
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
|
|
630
630
|
this.wxAppSubsGuider = null;
|
|
631
631
|
this.languageJsonData = langeJsonDataForCn;
|
|
632
632
|
this.businessWorkerReady = false;
|
|
633
633
|
this.jdWorkerReadyPromise = Promise.resolve(false);
|
|
634
634
|
}
|
|
635
635
|
_getConfig(opt) {
|
|
636
636
|
return Object.assign({}, DefaultConfig, opt);
|
|
637
637
|
}
|
|
638
638
|
loadApiSafeSteadyReayPromise() {
|
|
639
639
|
return Promise.resolve(true);
|
|
640
640
|
}
|
|
641
641
|
loadH5tagReayPromise() {
|
|
642
642
|
return Promise.resolve(true);
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
jmfeReayPromise(): Promise<any> {
|
|
646
646
|
return Promise.reject(false);
|
|
647
647
|
}
|
|
648
648
|
|
|
649
649
|
taskTimeoutPromise(callBack, timeout = 2000) {
|
|
650
650
|
return new Promise((resolve) => {
|
|
651
651
|
setTimeout(() => {
|
|
652
652
|
const getCallBackRes = typeof callBack === 'function' && callBack();
|
|
653
653
|
return resolve(getCallBackRes || false);
|
|
654
654
|
}, timeout);
|
|
655
655
|
});
|
|
656
656
|
}
|
|
657
657
|
|
|
658
658
|
updateBusinessDomainAndApi(domain, api) {
|
|
659
659
|
}
|
|
660
660
|
|
|
661
661
|
getFullScreenHeight(systemInfo) {
|
|
662
662
|
const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
|
|
663
663
|
let result = screenHeight;
|
|
664
664
|
if (statusBarHeight > 20 && isAndroid) {
|
|
665
665
|
result = screenHeight + statusBarHeight;
|
|
666
666
|
}
|
|
667
667
|
return result;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
getTabBarHeight(systemInfo) {
|
|
671
671
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo;
|
|
672
672
|
let result = 50;
|
|
673
673
|
if (statusBarHeight > 20) {
|
|
674
674
|
if (isIOS) {
|
|
675
675
|
result = 84;
|
|
676
676
|
} else if (isAndroid) {
|
|
677
677
|
result = 53;
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
return result;
|
|
681
681
|
}
|
|
682
682
|
|
|
683
683
|
getSystemInfo() {
|
|
684
684
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
|
|
685
685
|
const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
|
|
686
686
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
|
|
687
687
|
const fullScreenHeight = this.getFullScreenHeight(info);
|
|
688
688
|
const tabBarHeight = this.getTabBarHeight(info);
|
|
689
689
|
const safeContentHeight = fullScreenHeight - headerHeight;
|
|
690
690
|
this.info.sysInfo = {
|
|
691
691
|
...this.info.sysInfo,
|
|
692
692
|
...info,
|
|
693
693
|
actualNavBarHeight,
|
|
694
694
|
headerHeight,
|
|
695
695
|
fullScreenHeight,
|
|
696
696
|
tabBarHeight,
|
|
697
697
|
safeContentHeight,
|
|
698
698
|
languageType: languageNowType,
|
|
699
699
|
};
|
|
700
700
|
this.getEid().then((res: { eid: string }) => {
|
|
701
701
|
res && res.eid && (this.info.sysInfo['eid'] = res.eid);
|
|
702
702
|
});
|
|
703
703
|
if (this.info.sysInfo['hostVersionName']) {
|
|
704
704
|
this.info.sysInfo['hostAppVersion'] = Number(
|
|
705
705
|
this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
|
|
706
706
|
);
|
|
707
707
|
}
|
|
708
708
|
this.info.sysInfo['wifiVideoAutoPlay'] = false;
|
|
709
709
|
this.getNetWorkType();
|
|
710
710
|
}
|
|
711
711
|
|
|
712
712
|
getSysInfoReadyPromise(): Promise<any> {
|
|
713
713
|
(this.info.sysInfo?.windowWidth || 0) <= 0 && this.getSystemInfo();
|
|
714
714
|
return Promise.resolve(this.info.sysInfo);
|
|
715
715
|
}
|
|
716
716
|
async updateMPaasConfig() {}
|
|
717
717
|
|
|
718
718
|
getNetWorkType() {
|
|
719
719
|
return Taro.getNetworkType().then((getRes) => {
|
|
720
720
|
getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
|
|
721
721
|
return getRes;
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
724
|
getAPPUseStraightCorner() {
|
|
725
725
|
return Promise.resolve(false);
|
|
726
726
|
}
|
|
727
727
|
getIsGlassNavEnable() {
|
|
728
728
|
return Promise.resolve(false);
|
|
729
729
|
}
|
|
730
730
|
|
|
731
731
|
checkStatusAndLogin(options = {}) {
|
|
732
732
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
733
733
|
console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
|
|
734
734
|
this.toLogin(options)
|
|
735
735
|
.then((res) => {
|
|
736
736
|
console.log('微信小程序登录状态结果,成功', res);
|
|
737
737
|
this.info.loginState = true;
|
|
738
738
|
resolve(res);
|
|
739
739
|
})
|
|
740
740
|
.catch((err) => {
|
|
741
741
|
console.log('微信小程序登录异常状态结果', err);
|
|
742
742
|
this.doLogin(options)
|
|
743
743
|
.then((res2) => {
|
|
744
744
|
console.log('微信小程序wxDoLogin强制登陆成功:', res2);
|
|
745
745
|
this.info.loginState = true;
|
|
746
746
|
resolve(res2);
|
|
747
747
|
})
|
|
748
748
|
.catch((err2) => {
|
|
749
749
|
console.log('微信小程序wxDoLogin强制登陆失败:', err2);
|
|
750
750
|
this.checkStatusAndLoginPromise = null;
|
|
751
751
|
reject(err2);
|
|
752
752
|
});
|
|
753
753
|
});
|
|
754
754
|
});
|
|
755
755
|
return this.checkStatusAndLoginPromise;
|
|
756
756
|
}
|
|
757
757
|
|
|
758
758
|
checkJdStatusAndLogin(options) {
|
|
759
759
|
return this.checkStatusAndLogin(options);
|
|
760
760
|
}
|
|
761
761
|
|
|
762
762
|
|
|
763
763
|
doLoginForJdPin(options = {}) {
|
|
764
764
|
return this.doLogin(options);
|
|
765
765
|
}
|
|
766
766
|
|
|
767
767
|
getEid() {
|
|
768
768
|
if (typeof jd !== 'undefined' && jd.getEid) {
|
|
769
769
|
return new Promise((resolve, reject) => {
|
|
770
770
|
jd.getEid({
|
|
771
771
|
success: (res: { eid: string }) => {
|
|
772
772
|
resolve(res);
|
|
773
773
|
},
|
|
774
774
|
fail: (err: any) => {
|
|
775
775
|
reject(err);
|
|
776
776
|
},
|
|
777
777
|
});
|
|
778
778
|
});
|
|
779
779
|
} else {
|
|
780
780
|
return Promise.resolve(false);
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
783
|
|
|
784
784
|
toLogin(options = {}): Promise<any> {
|
|
785
785
|
return this.wxAppLoginInstance
|
|
786
786
|
.getLoginPromise({
|
|
787
787
|
mode: 'silent',
|
|
788
788
|
loginColor: {
|
|
789
789
|
biz: WXAPP_BIZ_KEY,
|
|
790
790
|
dpin: 0,
|
|
791
791
|
},
|
|
792
792
|
...options,
|
|
793
793
|
})
|
|
794
794
|
.then((res) => {
|
|
795
795
|
console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
|
|
796
796
|
setTimeout(() => {
|
|
797
797
|
console.log(
|
|
798
798
|
'微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
|
|
799
799
|
);
|
|
800
800
|
this.getLoginCookie(`${Date.now()}`);
|
|
801
801
|
}, 500);
|
|
802
802
|
})
|
|
803
803
|
.catch((err) => {
|
|
804
804
|
console.log('微信app登录异常返回信息,也获取cookie', err);
|
|
805
805
|
this.getLoginCookie(`${Date.now()}`);
|
|
806
806
|
});
|
|
807
807
|
}
|
|
808
808
|
|
|
809
809
|
doLogin(options) {
|
|
810
810
|
console.log('触发松果小程序 doLogin() new new');
|
|
811
811
|
return new Promise((resolve, reject) => {
|
|
812
812
|
jd.login({
|
|
813
813
|
success: (res) => {
|
|
814
814
|
if (res.code) {
|
|
815
815
|
console.log('[common]松果小程序登录成功', res.code);
|
|
816
816
|
jd.redirectTo({
|
|
817
817
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
818
818
|
...this.info.originQueryInfo,
|
|
819
819
|
})}`,
|
|
820
820
|
});
|
|
821
821
|
resolve(res);
|
|
822
822
|
} else {
|
|
823
823
|
console.error('[common]松果小程序登录失败', res.errMsg);
|
|
824
824
|
reject();
|
|
825
825
|
}
|
|
826
826
|
},
|
|
827
827
|
fail: (res) => {
|
|
828
828
|
console.error('[common]松果小程序登录失败', res.errMsg);
|
|
829
829
|
reject();
|
|
830
830
|
},
|
|
831
831
|
});
|
|
832
832
|
});
|
|
833
833
|
}
|
|
834
834
|
|
|
835
835
|
getLoginCookie(updateKey = 'wxapp') {
|
|
836
836
|
return new Promise((resolve) => {
|
|
837
837
|
console.log('开始获取更新wxapp中的cookie信息', updateKey);
|
|
838
838
|
if (
|
|
839
839
|
this.config.wqCookie &&
|
|
840
840
|
this.config.wqCookieStr &&
|
|
841
841
|
this.config.getWqCookieKey === updateKey
|
|
842
842
|
) {
|
|
843
843
|
console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
|
|
844
844
|
resolve({
|
|
845
845
|
wqCookie: this.config.wqCookie,
|
|
846
846
|
wqCookieStr: this.config.wqCookieStr,
|
|
847
847
|
});
|
|
848
848
|
} else {
|
|
849
849
|
if (isPublishToWxapp) {
|
|
850
850
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
|
|
851
851
|
if (getWxappCookieObj) {
|
|
852
852
|
const getCookieObj = getWxappCookieObj['_data'];
|
|
853
853
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
|
|
854
854
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
|
|
855
855
|
this.info.loginState = true;
|
|
856
856
|
this.info.userInfo.wqCookie = wqCookieStr;
|
|
857
857
|
this.info.userInfo.wqVisitkey = visitkey;
|
|
858
858
|
console.log('获取用户完整cookie信息', getCookieObj);
|
|
859
859
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress();
|
|
860
860
|
console.log('获取微信用户地址信息', getUserAddress);
|
|
861
861
|
if (getUserAddress) {
|
|
862
862
|
this.info.pageInfo.address = getUserAddress?.areaId;
|
|
863
863
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
|
|
864
864
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
865
865
|
: '';
|
|
866
866
|
this.info.pageInfo.un_area = this.info.pageInfo.address;
|
|
867
867
|
Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
|
|
868
868
|
area: this.info.pageInfo.address,
|
|
869
869
|
});
|
|
870
870
|
}
|
|
871
871
|
if (this.miniAppLogInstance) {
|
|
872
872
|
this.miniAppLogInstance.set({
|
|
873
873
|
account: pin,
|
|
874
874
|
unionid: wq_unionid,
|
|
875
875
|
openid: wxapp_openid,
|
|
876
876
|
});
|
|
877
877
|
}
|
|
878
878
|
this.config.wqCookie = wqCookie;
|
|
879
879
|
this.config.wqCookieStr = wqCookieStr;
|
|
880
880
|
this.config.getWqCookieKey = updateKey;
|
|
881
881
|
console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
|
|
882
882
|
resolve({
|
|
883
883
|
wqCookie,
|
|
884
884
|
wqCookieStr,
|
|
885
885
|
});
|
|
886
886
|
} else {
|
|
887
887
|
console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
|
|
888
888
|
resolve({
|
|
889
889
|
wqCookie: false,
|
|
890
890
|
wqCookieStr: false,
|
|
891
891
|
});
|
|
892
892
|
}
|
|
893
893
|
} else {
|
|
894
894
|
resolve({
|
|
895
895
|
wqCookie: false,
|
|
896
896
|
wqCookieStr: false,
|
|
897
897
|
});
|
|
898
898
|
}
|
|
899
899
|
}
|
|
900
900
|
});
|
|
901
901
|
}
|
|
902
902
|
|
|
903
903
|
|
|
904
904
|
checkLoginStatus() {
|
|
905
905
|
return this.getLoginCookie();
|
|
906
906
|
}
|
|
907
907
|
|
|
908
908
|
getAddressCachePromise() {
|
|
909
909
|
return Promise.reject('该方法只在APP内适用');
|
|
910
910
|
}
|
|
911
911
|
|
|
912
912
|
getLbsAddressCachePromise() {
|
|
913
913
|
return Promise.resolve({
|
|
914
914
|
status: '-1005',
|
|
915
915
|
msg: '暂未实现,获取失败',
|
|
916
916
|
});
|
|
917
917
|
}
|
|
918
918
|
|
|
919
919
|
getDynamicConfig(key: string) {
|
|
920
920
|
console.warn('调用松果小程序的 getDynamicConfig(),注意,此方法还未实现!');
|
|
921
921
|
return null;
|
|
922
922
|
}
|
|
923
923
|
|
|
924
924
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
925
925
|
const createUpdateQueryInfo: {
|
|
926
926
|
query: {
|
|
927
927
|
shopId?: string | number;
|
|
928
928
|
venderId?: string | number;
|
|
929
929
|
};
|
|
930
930
|
updateShopInfoState: boolean;
|
|
931
931
|
} = Object.assign(
|
|
932
932
|
{},
|
|
933
933
|
{
|
|
934
934
|
query: {},
|
|
935
935
|
updateShopInfoState: false,
|
|
936
936
|
},
|
|
937
937
|
updateQuery,
|
|
938
938
|
);
|
|
939
939
|
console.log(
|
|
940
940
|
'获取当前下发的店铺查询参数',
|
|
941
941
|
updateQuery,
|
|
942
942
|
'获取之前保存的shopInfo店铺查询参数',
|
|
943
943
|
this.info?.shopInfo,
|
|
944
944
|
);
|
|
945
945
|
const { query, updateShopInfoState } = createUpdateQueryInfo;
|
|
946
946
|
const { shopId, venderId } = query;
|
|
947
947
|
if (updateShopInfoState) {
|
|
948
948
|
this.info.queryInfo = {
|
|
949
949
|
...this.info.queryInfo,
|
|
950
950
|
...query,
|
|
951
951
|
};
|
|
952
952
|
if (shopId && venderId) {
|
|
953
953
|
this.info.shopInfo = {
|
|
954
954
|
shopId: `${shopId}`,
|
|
955
955
|
venderId: `${venderId}`,
|
|
956
956
|
};
|
|
957
957
|
}
|
|
958
958
|
} else {
|
|
959
959
|
this.info.queryInfo = {
|
|
960
960
|
...query,
|
|
961
961
|
};
|
|
962
962
|
this.info.originQueryInfo = {
|
|
963
963
|
...query,
|
|
964
964
|
};
|
|
965
965
|
if (
|
|
966
966
|
this.info.shopInfo?.shopId &&
|
|
967
967
|
this.info.shopInfo?.venderId &&
|
|
968
968
|
(this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
|
|
969
969
|
) {
|
|
970
970
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId;
|
|
971
971
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId;
|
|
972
972
|
console.log(
|
|
973
973
|
'当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
|
|
974
974
|
this.info.queryInfo,
|
|
975
975
|
);
|
|
976
976
|
}
|
|
977
977
|
}
|
|
978
978
|
this.info.queryInfo['shopId'] &&
|
|
979
979
|
(this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
|
|
980
980
|
this.info.queryInfo['venderId'] &&
|
|
981
981
|
(this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
|
|
982
982
|
console.log(
|
|
983
983
|
'weapp===获取店铺下发查询参数\n',
|
|
984
984
|
query,
|
|
985
985
|
'\n获取店铺最后查询参数\n',
|
|
986
986
|
this.info.queryInfo,
|
|
987
987
|
'\n是否为更新店铺状态\n',
|
|
988
988
|
updateShopInfoState,
|
|
989
989
|
);
|
|
990
990
|
}
|
|
991
991
|
renderNextTickLoadSdk() {
|
|
992
992
|
console.warn('暂未实现 index.jd.ts');
|
|
993
993
|
}
|
|
994
994
|
loadOtherSdk() {
|
|
995
995
|
console.warn('暂未实现 index.jd.ts');
|
|
996
996
|
}
|
|
997
997
|
loadItemSdkPromise(jsInfo = {}) {
|
|
998
998
|
console.warn('暂未实现 index.jd.ts');
|
|
999
999
|
}
|
|
1000
1000
|
createLanguageProimse() {
|
|
1001
1001
|
return Promise.reject({
|
|
1002
1002
|
msg: '暂未实现',
|
|
1003
1003
|
});
|
|
1004
1004
|
}
|