@conecli/cone-render 0.10.1-shop3.14 → 0.10.1-shop3.140

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/README.md +1 -1
  2. package/dist/api/index.ts +1 -1
  3. package/dist/common/accessibility.h5.ts +1 -0
  4. package/dist/common/accessibility.ts +1 -0
  5. package/dist/common/const.ts +1 -1
  6. package/dist/common/index.h5.ts +1 -1
  7. package/dist/common/index.jd.ts +1 -1
  8. package/dist/common/index.ts +1 -1
  9. package/dist/common/index.weapp.ts +1 -1
  10. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  11. package/dist/common/jssdk.ts +1 -1
  12. package/dist/common/jssdk.weapp.ts +1 -0
  13. package/dist/common/pageType.ts +1 -1
  14. package/dist/common/token/index.h5.ts +1 -1
  15. package/dist/common/token/token.jd.ts +1 -1
  16. package/dist/common/wxappApi.ascf.ts +1 -0
  17. package/dist/common/wxappApi.ts +1 -1
  18. package/dist/components/ErrorBoundary.tsx +1 -1
  19. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  20. package/dist/components/base/CountDown/index.tsx +1 -1
  21. package/dist/components/base/CountDownForApp/index.module.scss +52 -0
  22. package/dist/components/base/CountDownForApp/index.tsx +1 -0
  23. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  24. package/dist/components/base/CustomVideo/index.tsx +1 -1
  25. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  26. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  29. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  30. package/dist/components/base/InViewRender/index.tsx +1 -1
  31. package/dist/components/base/LazyLayoutLoad/index.module.scss +9 -9
  32. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  33. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  34. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  35. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  36. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  37. package/dist/components/base/NetworkDataError/const.ts +1 -1
  38. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  39. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  40. package/dist/components/base/Price/Base/index.module.scss +12 -0
  41. package/dist/components/base/Price/Base/index.tsx +1 -1
  42. package/dist/components/base/Price/Double/index.module.scss +26 -2
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  45. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  46. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  47. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  48. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  49. package/dist/components/floorItem.tsx +1 -1
  50. package/dist/components/isv/Floor/index.tsx +1 -1
  51. package/dist/components/remoteFloorItem.tsx +1 -1
  52. package/dist/config/env.ts +1 -1
  53. package/dist/interface/common.ts +1 -1
  54. package/dist/interface/component.ts +1 -1
  55. package/dist/interface/jumpEventReport.ts +1 -1
  56. package/dist/interface/service.ts +1 -1
  57. package/dist/jumpEventReport/base.ts +1 -1
  58. package/dist/jumpEventReport/const.ts +1 -1
  59. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  60. package/dist/jumpEventReport/index.h5.ts +1 -1
  61. package/dist/jumpEventReport/index.jd.ts +1 -1
  62. package/dist/jumpEventReport/index.weapp.ts +1 -1
  63. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  64. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  65. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  66. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  67. package/dist/jumpEventReport/web/report.ts +1 -1
  68. package/dist/jumpEventReport/web.base.ts +1 -1
  69. package/dist/jumpEventReport/web.jd.ts +1 -1
  70. package/dist/jumpEventReport/web.pc.ts +1 -1
  71. package/dist/jumpEventReport/web.tjm.ts +1 -1
  72. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  73. package/dist/language/en_US.json +398 -0
  74. package/dist/language/zh_CN.json +398 -0
  75. package/dist/language/zh_HK.json +398 -0
  76. package/dist/libs/openShopBridge.js +161 -0
  77. package/dist/libs/openShopBridge.min.js +1 -0
  78. package/dist/libs/taroAppReport.js +2 -2
  79. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  80. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  81. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  82. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  83. package/dist/open/api/environment.ts +1 -1
  84. package/dist/open/api/shopMember.ts +1 -1
  85. package/dist/open/api/shopMember.weapp.ts +1 -0
  86. package/dist/open/api/track.ts +1 -1
  87. package/dist/open/api/util.ts +1 -1
  88. package/dist/open/components/index.ts +1 -1
  89. package/dist/open/index.ts +1 -1
  90. package/dist/sass/app.h5.scss +12 -1
  91. package/dist/sass/base.scss +8 -4
  92. package/dist/service/fetchGateway.ts +1 -1
  93. package/dist/service/fetchGateway.weapp.ts +1 -1
  94. package/dist/service/fetchJsonp.weapp.ts +1 -0
  95. package/dist/service/http/const.ts +1 -1
  96. package/dist/service/http/h5Http.ts +1 -1
  97. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  98. package/dist/service/requestServer.h5.ts +1 -1
  99. package/dist/service/requestServer.ts +1 -1
  100. package/dist/service/requestServer.weapp.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/h5Utils.ts +1 -1
  104. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  105. package/dist/utils/harmonyCallRouter.ts +0 -0
  106. package/dist/utils/index.h5.ts +1 -1
  107. package/dist/utils/index.ts +1 -1
  108. package/dist/utils/index.weapp.ts +1 -1
  109. package/dist/utils/jumpExtMapUtil.ts +1 -0
  110. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  111. package/dist/utils/log.ts +1 -0
  112. package/dist/utils/sColor.weapp.ts +1 -0
  113. package/dist/utils/utils.ts +1 -1
  114. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  115. package/dist/wxapp/common/user_info.js +1 -1
  116. package/dist/wxapp/pages/shopx/prefetch.js +1 -0
  117. package/package.json +169 -141
  118. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  119. package/dist/utils/priceUtils.js +0 -1
  120. /package/dist/utils/{jumpExtMapUtil.js → jumpExtMapUtil.h5.ts} +0 -0
  121. /package/dist/utils/{sColor.js → sColor.ts} +0 -0
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro'
2
1
  abTestLabels: {},
3
2
  floorVideInfo: {},
4
3
  productVideInfo: {},
5
4
  isVipShop: false,
6
5
  isJdShowNativeImmersivePlayer: false,
7
6
  pageIdxHeightInfo: {
8
7
  list: []
9
8
  },
10
9
  jdBottomBarHeight: 0,
11
10
  jdNativeHeaderHeight: 0,
12
11
  openAppData: {}
13
12
  public config: {
14
13
  [key: string]: any
15
14
  }
16
15
  public lazyContainer: CommonInterFace.lazyContainer
17
16
  public renderedIsvComponents: CommonInterFace.renderedIsvComponents
18
17
  public loadJsSdkList: Array<any>
19
18
  public loadJsSdkListCachePromise: any
20
19
  this.config = {}
21
20
  this.loadJsSdkList = []
22
21
  this.loadJsSdkListCachePromise = {}
23
22
  this.renderedIsvComponents = {}
24
23
 
25
24
  taskTimeoutPromise(callBack, timeout = 2000){
26
25
  return new Promise((resolve) => {
27
26
  setTimeout(() => {
28
27
  const getCallBackRes = typeof callBack === 'function' && callBack()
29
28
  return resolve(getCallBackRes || false)
30
29
  }, timeout)
31
30
  })
32
31
  }
33
32
  removeJdAndroidRquestEventForTouchStart(){}
34
33
  this.info.sysInfo['wifiVideoAutoPlay'] = false
35
34
  getAPPUseStraightCorner () {
36
35
  return Promise.resolve(false)
37
36
  }
38
37
  checkStatusAndLogin(options = {}) {
39
38
 
40
39
  checkJdStatusAndLogin(options){
41
40
  return this.checkStatusAndLogin(options)
42
41
  }
43
42
 
44
43
  doLoginForJdPin(options = {}) {
45
44
  return this.doLogin(options)
46
45
  }
47
46
 
48
47
  getLoginCookie(updateKey = 'wxapp') {
49
48
  return new Promise((resolve) => {
50
49
  console.log("开始获取更新wxapp中的cookie信息", updateKey)
51
50
  if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
52
51
  console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
53
52
  resolve({
54
53
  wqCookie: this.config.wqCookie,
55
54
  wqCookieStr: this.config.wqCookieStr,
56
55
  })
57
56
  }else {
58
57
  if (isPublishToWxapp) {
59
58
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
60
59
  if (getWxappCookieObj) {
61
60
  const getCookieObj = getWxappCookieObj['_data']
62
61
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
63
62
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
64
63
  this.info.loginState = true
65
64
  this.info.userInfo.wqCookie = wqCookieStr
66
65
  this.info.userInfo.wqVisitkey = visitkey
67
66
  console.log('获取用户完整cookie信息', getCookieObj)
68
67
  const getUserAddress = this.wxAppUserInfoInstance.getAddress()
69
68
  console.log('获取微信用户地址信息', getUserAddress)
70
69
  if (getUserAddress) {
71
70
  this.info.pageInfo.address = getUserAddress?.areaId
72
71
  this.info.pageInfo.addressCommaStr = this.info.pageInfo
73
72
  .address
74
73
  ? this.info.pageInfo.address.replace(/_/g, ',')
75
74
  : ''
76
75
  this.info.pageInfo.un_area = this.info.pageInfo.address
77
76
  Taro.eventCenter.trigger(
78
77
  TaroEventType.USER_AREA_UPDATE,
79
78
  this.info.pageInfo.address,
80
79
  )
81
80
  }
82
81
  if(this.miniAppLogInstance){
83
82
  this.miniAppLogInstance.set({
84
83
  account: pin,
85
84
  unionid: wq_unionid,
86
85
  openid: wxapp_openid,
87
86
  })
88
87
  }
89
88
  this.config.wqCookie = wqCookie
90
89
  this.config.wqCookieStr = wqCookieStr
91
90
  this.config.getWqCookieKey = updateKey
92
91
  console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
93
92
  resolve({
94
93
  wqCookie,
95
94
  wqCookieStr,
96
95
  })
97
96
  }else {
98
97
  console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
99
98
  resolve({
100
99
  wqCookie: false,
101
100
  wqCookieStr: false,
102
101
  })
103
102
  }
104
103
  }else {
105
104
  resolve({
106
105
  wqCookie: false,
107
106
  wqCookieStr: false,
108
107
  })
109
108
  }
110
109
  }
111
110
  })
112
111
  }
113
112
  return this.getLoginCookie()
114
113
 
115
114
  getAddressCachePromise = () => {
116
115
  return Promise.reject("该方法只在APP内适用")
117
116
  }
118
117
 
119
118
  getDynamicConfig(key: string){
120
119
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!')
121
120
  return null
122
121
  }
123
122
  renderNextTickLoadSdk(){
124
123
  console.warn("暂未实现 index.ts")
125
124
  }
126
125
  loadOtherSdk(){
127
126
  console.warn("暂未实现 index.ts")
128
127
  }
129
128
  loadItemSdkPromise(jsInfo = {}) {
130
129
  console.warn('暂未实现 index.ts')
131
130
  }
131
+ import Taro from '@tarojs/taro';
132
132
  WXAPP_LOGIN,
133
133
  WXAPP_BIZ,
134
134
  WXAPP_USER_INFO,
135
135
  WXAPP_NAVIGATOR,
136
136
  WXAPP_REPORT_GDT,
137
137
  WXAPP_PARAMS_SIGN,
138
138
  BUSINESS_TYPE,
139
139
  SHOP_MENU_ID_TYPE,
140
140
  SHOP_MENU_ID_NAME,
141
141
  SECTION_HOME_TAB_NAME_TYPE,
142
142
  SECTION_HOME_TAB_TYPE,
143
143
  WXAPP_BIZ_KEY,
144
144
  WX_BUSINESS_TYPE,
145
145
  TaroEventType,
146
146
  getSystemInfos,
147
147
  getTaroStorageKeyValue,
148
148
  getWxAppCookieStr,
149
149
  languageNowType,
150
150
  accessibilityRunning: false,
151
151
  abTestLabels: {},
152
152
  nonSellableSkuids: {},
153
153
  loginState: jdUserLoginState,
154
154
  cookiesStr: '',
155
155
  userInfo: userPinKey,
156
156
  isImmersive: false,
157
157
  baseAddCartSwitch: true,
158
158
  pageInfo: {
159
159
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
160
160
  address: '',
161
161
  addressCommaStr: '',
162
162
  fullAddress: '',
163
163
  un_area: '',
164
164
  userLbsAddress: '',
165
165
  vapptype: '1',
166
166
  pageType: 'home',
167
167
  dataType: BUSINESS_TYPE.ONLINE,
168
168
  floorExposureInfo: {},
169
169
  floorVideInfo: {},
170
170
  productVideInfo: {},
171
171
  tabsLoadAllDataInfo: {
172
172
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
173
173
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
174
174
  },
175
175
  updateShopInfosAllState: false,
176
176
  isVipShop: false,
177
177
  isJdShowNativeImmersivePlayer: false,
178
178
  isSuperBrandShop: false,
179
179
  ...shopConfig,
180
180
  pageScrollTop: 0,
181
181
  pageIdxHeightInfo: {
182
182
  list: [],
183
183
  },
184
184
  isScanPreview: false,
185
185
  shopNavBarHeight: 0,
186
186
  },
187
187
  defaultQueryLogInfo: {
188
188
  sourceType: 'JDshop',
189
189
  sourceValue: '',
190
190
  moduleId: 'none',
191
191
  entrance: 'none',
192
192
  },
193
193
  sysInfo: {
194
194
  windowWidth: 0,
195
195
  windowHeight: 0,
196
196
  netWorkType: '4g',
197
197
  jdBottomBarHeight: 0,
198
198
  jdNativeHeaderHeight: 0,
199
199
  },
200
200
  queryInfo: {},
201
201
  shopInfo: {},
202
202
  openAppData: {},
203
203
  public info: CommonInterFace.BaseConfigInfo;
204
204
  public config: {
205
205
  [key: string]: any;
206
206
  };
207
207
  public lazyContainer: CommonInterFace.lazyContainer;
208
208
  public renderedIsvComponents: CommonInterFace.renderedIsvComponents;
209
209
  public rootEleNode: HTMLElement | null;
210
210
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
211
211
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
212
212
  public checkStatusAndLoginPromise: object | null;
213
213
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
214
214
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
215
215
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
216
216
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
217
217
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
218
218
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
219
219
  public loadJsSdkList: Array<any>;
220
220
  public loadJsSdkListCachePromise: any;
221
221
  public languageJsonData: any | null;
222
222
  public businessWorkerReady: boolean;
223
223
  public jdWorkerReadyPromise: any | null;
224
224
  constructor(opt) {
225
225
  this.info = this._getConfig(opt);
226
226
  this.config = {};
227
227
  this.lazyContainer = {
228
228
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
229
229
  appLazyContainerList: [],
230
230
  appLazyFinishContainerList: [],
231
231
  },
232
232
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
233
233
  appLazyContainerList: [],
234
234
  appLazyFinishContainerList: [],
235
235
  },
236
236
  };
237
237
  this.loadJsSdkList = [];
238
238
  this.loadJsSdkListCachePromise = {};
239
239
  this.renderedIsvComponents = {};
240
240
  this.rootEleNode = null;
241
241
  this.miniApplogUtil = MiniAppLogUtil;
242
242
  this.miniAppLogInstance = null;
243
243
  this.checkStatusAndLoginPromise = null;
244
244
  this.wxAppLoginInstance = WXAPP_LOGIN;
245
245
  this.wxAppBizInstance = WXAPP_BIZ;
246
246
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
247
247
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
248
248
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
249
249
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
250
250
  this.languageJsonData = langeJsonDataForCn;
251
251
  this.businessWorkerReady = false;
252
252
  this.jdWorkerReadyPromise = Promise.resolve(false);
253
253
  }
254
254
  _getConfig(opt) {
255
255
  return Object.assign({}, DefaultConfig, opt);
256
256
  }
257
257
  loadApiSafeSteadyReayPromise() {
258
258
  return Promise.resolve(true);
259
259
  }
260
260
  loadH5tagReayPromise() {
261
261
  return Promise.resolve(true);
262
262
  }
263
263
 
264
264
  jmfeReayPromise(): Promise<any> {
265
265
  return Promise.reject(false);
266
266
  }
267
267
 
268
268
  taskTimeoutPromise(callBack, timeout = 2000) {
269
269
  return new Promise((resolve) => {
270
270
  setTimeout(() => {
271
271
  const getCallBackRes = typeof callBack === 'function' && callBack();
272
272
  return resolve(getCallBackRes || false);
273
273
  }, timeout);
274
274
  });
275
275
  }
276
276
  removeJdAndroidRquestEventForTouchStart() {}
277
277
 
278
278
  updateBusinessDomainAndApi(domain, api) {
279
279
  }
280
280
 
281
281
  getFullScreenHeight(systemInfo) {
282
282
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
283
283
  let result = screenHeight;
284
284
  if (statusBarHeight > 20 && isAndroid) {
285
285
  result = screenHeight + statusBarHeight;
286
286
  }
287
287
  return result;
288
288
  }
289
289
 
290
290
  getTabBarHeight(systemInfo) {
291
291
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
292
292
  let result = 50;
293
293
  if (statusBarHeight > 20) {
294
294
  if (isIOS) {
295
295
  result = 84;
296
296
  } else if (isAndroid) {
297
297
  result = 53;
298
298
  }
299
299
  }
300
300
  return result;
301
301
  }
302
302
 
303
303
  getSystemInfo() {
304
304
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
305
305
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
306
306
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
307
307
  const fullScreenHeight = this.getFullScreenHeight(info);
308
308
  const tabBarHeight = this.getTabBarHeight(info);
309
309
  const safeContentHeight = fullScreenHeight - headerHeight;
310
310
  this.info.sysInfo = {
311
311
  ...this.info.sysInfo,
312
312
  ...info,
313
313
  actualNavBarHeight,
314
314
  headerHeight,
315
315
  fullScreenHeight,
316
316
  tabBarHeight,
317
317
  safeContentHeight,
318
318
  languageType: languageNowType,
319
319
  };
320
320
  if (this.info.sysInfo['hostVersionName']) {
321
321
  this.info.sysInfo['hostAppVersion'] = Number(
322
322
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
323
323
  );
324
324
  }
325
325
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
326
326
  this.getNetWorkType();
327
327
  }
328
328
 
329
329
  getSysInfoReadyPromise(): Promise<any> {
330
330
  (this.info.sysInfo?.windowWidth || 0) <= 0 && this.getSystemInfo();
331
331
  return Promise.resolve(this.info.sysInfo);
332
332
  }
333
333
  async updateMPaasConfig() {}
334
334
 
335
335
  getNetWorkType() {
336
336
  return Taro.getNetworkType().then((getRes) => {
337
337
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
338
338
  return getRes;
339
339
  });
340
340
  }
341
341
  getAPPUseStraightCorner() {
342
342
  return Promise.resolve(false);
343
343
  }
344
344
  getIsGlassNavEnable() {
345
345
  return Promise.resolve(false);
346
346
  }
347
347
  checkStatusAndLogin(options = {}) {
348
348
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
349
349
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
350
350
  this.toLogin(options)
351
351
  .then((res) => {
352
352
  console.log('微信小程序登录状态结果,成功', res);
353
353
  this.info.loginState = true;
354
354
  resolve(res);
355
355
  })
356
356
  .catch((err) => {
357
357
  console.log('微信小程序登录异常状态结果', err);
358
358
  this.doLogin(options)
359
359
  .then((res2) => {
360
360
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
361
361
  this.info.loginState = true;
362
362
  resolve(res2);
363
363
  })
364
364
  .catch((err2) => {
365
365
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
366
366
  this.checkStatusAndLoginPromise = null;
367
367
  reject(err2);
368
368
  });
369
369
  });
370
370
  });
371
371
  return this.checkStatusAndLoginPromise;
372
372
  }
373
373
 
374
374
  checkJdStatusAndLogin(options) {
375
375
  return this.checkStatusAndLogin(options);
376
376
  }
377
377
 
378
378
  toLogin(options = {}): Promise<any> {
379
379
  return this.wxAppLoginInstance
380
380
  .getLoginPromise({
381
381
  mode: 'silent',
382
382
  loginColor: {
383
383
  biz: WXAPP_BIZ_KEY,
384
384
  dpin: 0,
385
385
  },
386
386
  ...options,
387
387
  })
388
388
  .then((res) => {
389
389
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
390
390
  this.getLoginCookie();
391
391
  })
392
392
  .catch((err) => {
393
393
  console.log('微信app登录异常返回信息', err);
394
394
  });
395
395
  }
396
396
 
397
397
  doLogin(options = {}) {
398
398
  return this.wxAppLoginInstance
399
399
  .doLogin({
400
400
  loginColor: {
401
401
  biz: WXAPP_BIZ_KEY,
402
402
  dpin: 0,
403
403
  },
404
404
  ...options,
405
405
  })
406
406
  .then((res) => {
407
407
  this.getLoginCookie();
408
408
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
409
409
  return res;
410
410
  });
411
411
  }
412
412
 
413
413
  doLoginForJdPin(options = {}) {
414
414
  return this.doLogin(options);
415
415
  }
416
416
 
417
417
  getLoginCookie(updateKey = 'wxapp') {
418
418
  return new Promise((resolve) => {
419
419
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
420
420
  if (
421
421
  this.config.wqCookie &&
422
422
  this.config.wqCookieStr &&
423
423
  this.config.getWqCookieKey === updateKey
424
424
  ) {
425
425
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
426
426
  resolve({
427
427
  wqCookie: this.config.wqCookie,
428
428
  wqCookieStr: this.config.wqCookieStr,
429
429
  });
430
430
  } else {
431
431
  if (isPublishToWxapp) {
432
432
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
433
433
  if (getWxappCookieObj) {
434
434
  const getCookieObj = getWxappCookieObj['_data'];
435
435
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
436
436
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
437
437
  this.info.loginState = true;
438
438
  this.info.userInfo.wqCookie = wqCookieStr;
439
439
  this.info.userInfo.wqVisitkey = visitkey;
440
440
  console.log('获取用户完整cookie信息', getCookieObj);
441
441
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
442
442
  console.log('获取微信用户地址信息', getUserAddress);
443
443
  if (getUserAddress) {
444
444
  this.info.pageInfo.address = getUserAddress?.areaId;
445
445
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
446
446
  ? this.info.pageInfo.address.replace(/_/g, ',')
447
447
  : '';
448
448
  this.info.pageInfo.un_area = this.info.pageInfo.address;
449
449
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
450
450
  area: this.info.pageInfo.address,
451
451
  });
452
452
  }
453
453
  if (this.miniAppLogInstance) {
454
454
  this.miniAppLogInstance.set({
455
455
  account: pin,
456
456
  unionid: wq_unionid,
457
457
  openid: wxapp_openid,
458
458
  });
459
459
  }
460
460
  this.config.wqCookie = wqCookie;
461
461
  this.config.wqCookieStr = wqCookieStr;
462
462
  this.config.getWqCookieKey = updateKey;
463
463
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
464
464
  resolve({
465
465
  wqCookie,
466
466
  wqCookieStr,
467
467
  });
468
468
  } else {
469
469
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
470
470
  resolve({
471
471
  wqCookie: false,
472
472
  wqCookieStr: false,
473
473
  });
474
474
  }
475
475
  } else {
476
476
  resolve({
477
477
  wqCookie: false,
478
478
  wqCookieStr: false,
479
479
  });
480
480
  }
481
481
  }
482
482
  });
483
483
  }
484
484
 
485
485
 
486
486
  checkLoginStatus() {
487
487
  return this.getLoginCookie();
488
488
  }
489
489
 
490
490
  getAddressCachePromise() {
491
491
  return Promise.reject('该方法只在APP内适用');
492
492
  }
493
493
 
494
494
  getLbsAddressCachePromise() {
495
495
  return Promise.resolve({
496
496
  status: '-1005',
497
497
  msg: '暂未实现,获取失败',
498
498
  });
499
499
  }
500
500
 
501
501
  getDynamicConfig(key: string) {
502
502
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!');
503
503
  return null;
504
504
  }
505
505
 
506
506
  updatePageAndLogInfo(updateQuery = {}) {
507
507
  const createUpdateQueryInfo: {
508
508
  query: {
509
509
  shopId?: string | number;
510
510
  venderId?: string | number;
511
511
  };
512
512
  updateShopInfoState: boolean;
513
513
  } = Object.assign(
514
514
  {},
515
515
  {
516
516
  query: {},
517
517
  updateShopInfoState: false,
518
518
  },
519
519
  updateQuery,
520
520
  );
521
521
  console.log(
522
522
  '获取当前下发的店铺查询参数',
523
523
  updateQuery,
524
524
  '获取之前保存的shopInfo店铺查询参数',
525
525
  this.info?.shopInfo,
526
526
  );
527
527
  const { query, updateShopInfoState } = createUpdateQueryInfo;
528
528
  const { shopId, venderId } = query;
529
529
  if (updateShopInfoState) {
530
530
  this.info.queryInfo = {
531
531
  ...this.info.queryInfo,
532
532
  ...query,
533
533
  };
534
534
  if (shopId && venderId) {
535
535
  this.info.shopInfo = {
536
536
  shopId: `${shopId}`,
537
537
  venderId: `${venderId}`,
538
538
  };
539
539
  }
540
540
  } else {
541
541
  this.info.queryInfo = {
542
542
  ...query,
543
543
  };
544
544
  if (
545
545
  this.info.shopInfo?.shopId &&
546
546
  this.info.shopInfo?.venderId &&
547
547
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
548
548
  ) {
549
549
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
550
550
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
551
551
  console.log(
552
552
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
553
553
  this.info.queryInfo,
554
554
  );
555
555
  }
556
556
  }
557
557
  this.info.queryInfo['shopId'] &&
558
558
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
559
559
  this.info.queryInfo['venderId'] &&
560
560
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
561
561
  console.log(
562
562
  '默认==获取店铺下发查询参数\n',
563
563
  query,
564
564
  '\n获取店铺最后查询参数\n',
565
565
  this.info.queryInfo,
566
566
  '\n是否为更新店铺状态\n',
567
567
  updateShopInfoState,
568
568
  );
569
569
  }
570
570
 
571
571
  checkJingGouWxappEnv() {
572
572
  return false;
573
573
  }
574
574
  renderNextTickLoadSdk(_delayTime = 1000, _callback) {
575
575
  console.warn('暂未实现 index.ts');
576
576
  }
577
577
  loadOtherSdk() {
578
578
  console.warn('暂未实现 index.ts');
579
579
  }
580
580
  loadItemSdkPromise(jsInfo = {}) {
581
581
  console.warn('暂未实现 index.ts');
582
582
  }
583
583
  createLanguageProimse() {
584
584
  return Promise.reject({
585
585
  msg: '暂未实现',
586
586
  });
587
587
  }