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