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