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