@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.50

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