@conecli/cone-render 0.10.1-shop-beta.22 → 0.10.1-shop-beta.24

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