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