@conecli/cone-render 0.10.1-shop-beta.5 → 0.10.1-shop-beta.7

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