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