@conecli/cone-render 0.10.1-shop3.13 → 0.10.1-shop3.131

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 (120) 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.js → sColor.ts} +1 -1
  113. package/dist/utils/sColor.weapp.ts +1 -0
  114. package/dist/utils/utils.ts +1 -1
  115. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  116. package/dist/wxapp/common/user_info.js +1 -1
  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
@@ -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
  async updateMPaasConfig() {}
329
329
 
330
330
  getNetWorkType() {
331
331
  return Taro.getNetworkType().then((getRes) => {
332
332
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
333
333
  return getRes;
334
334
  });
335
335
  }
336
336
  getAPPUseStraightCorner() {
337
337
  return Promise.resolve(false);
338
338
  }
339
339
  checkStatusAndLogin(options = {}) {
340
340
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
341
341
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
342
342
  this.toLogin(options)
343
343
  .then((res) => {
344
344
  console.log('微信小程序登录状态结果,成功', res);
345
345
  this.info.loginState = true;
346
346
  resolve(res);
347
347
  })
348
348
  .catch((err) => {
349
349
  console.log('微信小程序登录异常状态结果', err);
350
350
  this.doLogin(options)
351
351
  .then((res2) => {
352
352
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
353
353
  this.info.loginState = true;
354
354
  resolve(res2);
355
355
  })
356
356
  .catch((err2) => {
357
357
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
358
358
  this.checkStatusAndLoginPromise = null;
359
359
  reject(err2);
360
360
  });
361
361
  });
362
362
  });
363
363
  return this.checkStatusAndLoginPromise;
364
364
  }
365
365
 
366
366
  checkJdStatusAndLogin(options) {
367
367
  return this.checkStatusAndLogin(options);
368
368
  }
369
369
 
370
370
  toLogin(options = {}): Promise<any> {
371
371
  return this.wxAppLoginInstance
372
372
  .getLoginPromise({
373
373
  mode: 'silent',
374
374
  loginColor: {
375
375
  biz: WXAPP_BIZ_KEY,
376
376
  dpin: 0,
377
377
  },
378
378
  ...options,
379
379
  })
380
380
  .then((res) => {
381
381
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
382
382
  this.getLoginCookie();
383
383
  })
384
384
  .catch((err) => {
385
385
  console.log('微信app登录异常返回信息', err);
386
386
  });
387
387
  }
388
388
 
389
389
  doLogin(options = {}) {
390
390
  return this.wxAppLoginInstance
391
391
  .doLogin({
392
392
  loginColor: {
393
393
  biz: WXAPP_BIZ_KEY,
394
394
  dpin: 0,
395
395
  },
396
396
  ...options,
397
397
  })
398
398
  .then((res) => {
399
399
  this.getLoginCookie();
400
400
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
401
401
  return res;
402
402
  });
403
403
  }
404
404
 
405
405
  doLoginForJdPin(options = {}) {
406
406
  return this.doLogin(options);
407
407
  }
408
408
 
409
409
  getLoginCookie(updateKey = 'wxapp') {
410
410
  return new Promise((resolve) => {
411
411
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
412
412
  if (
413
413
  this.config.wqCookie &&
414
414
  this.config.wqCookieStr &&
415
415
  this.config.getWqCookieKey === updateKey
416
416
  ) {
417
417
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
418
418
  resolve({
419
419
  wqCookie: this.config.wqCookie,
420
420
  wqCookieStr: this.config.wqCookieStr,
421
421
  });
422
422
  } else {
423
423
  if (isPublishToWxapp) {
424
424
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
425
425
  if (getWxappCookieObj) {
426
426
  const getCookieObj = getWxappCookieObj['_data'];
427
427
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
428
428
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
429
429
  this.info.loginState = true;
430
430
  this.info.userInfo.wqCookie = wqCookieStr;
431
431
  this.info.userInfo.wqVisitkey = visitkey;
432
432
  console.log('获取用户完整cookie信息', getCookieObj);
433
433
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
434
434
  console.log('获取微信用户地址信息', getUserAddress);
435
435
  if (getUserAddress) {
436
436
  this.info.pageInfo.address = getUserAddress?.areaId;
437
437
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
438
438
  ? this.info.pageInfo.address.replace(/_/g, ',')
439
439
  : '';
440
440
  this.info.pageInfo.un_area = this.info.pageInfo.address;
441
441
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
442
442
  area: this.info.pageInfo.address,
443
443
  });
444
444
  }
445
445
  if (this.miniAppLogInstance) {
446
446
  this.miniAppLogInstance.set({
447
447
  account: pin,
448
448
  unionid: wq_unionid,
449
449
  openid: wxapp_openid,
450
450
  });
451
451
  }
452
452
  this.config.wqCookie = wqCookie;
453
453
  this.config.wqCookieStr = wqCookieStr;
454
454
  this.config.getWqCookieKey = updateKey;
455
455
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
456
456
  resolve({
457
457
  wqCookie,
458
458
  wqCookieStr,
459
459
  });
460
460
  } else {
461
461
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
462
462
  resolve({
463
463
  wqCookie: false,
464
464
  wqCookieStr: false,
465
465
  });
466
466
  }
467
467
  } else {
468
468
  resolve({
469
469
  wqCookie: false,
470
470
  wqCookieStr: false,
471
471
  });
472
472
  }
473
473
  }
474
474
  });
475
475
  }
476
476
 
477
477
 
478
478
  checkLoginStatus() {
479
479
  return this.getLoginCookie();
480
480
  }
481
481
 
482
482
  getAddressCachePromise() {
483
483
  return Promise.reject('该方法只在APP内适用');
484
484
  }
485
485
 
486
486
  getLbsAddressCachePromise() {
487
487
  return Promise.resolve({
488
488
  status: '-1005',
489
489
  msg: '暂未实现,获取失败',
490
490
  });
491
491
  }
492
492
 
493
493
  getDynamicConfig(key: string) {
494
494
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!');
495
495
  return null;
496
496
  }
497
497
 
498
498
  updatePageAndLogInfo(updateQuery = {}) {
499
499
  const createUpdateQueryInfo: {
500
500
  query: {
501
501
  shopId?: string | number;
502
502
  venderId?: string | number;
503
503
  };
504
504
  updateShopInfoState: boolean;
505
505
  } = Object.assign(
506
506
  {},
507
507
  {
508
508
  query: {},
509
509
  updateShopInfoState: false,
510
510
  },
511
511
  updateQuery,
512
512
  );
513
513
  console.log(
514
514
  '获取当前下发的店铺查询参数',
515
515
  updateQuery,
516
516
  '获取之前保存的shopInfo店铺查询参数',
517
517
  this.info?.shopInfo,
518
518
  );
519
519
  const { query, updateShopInfoState } = createUpdateQueryInfo;
520
520
  const { shopId, venderId } = query;
521
521
  if (updateShopInfoState) {
522
522
  this.info.queryInfo = {
523
523
  ...this.info.queryInfo,
524
524
  ...query,
525
525
  };
526
526
  if (shopId && venderId) {
527
527
  this.info.shopInfo = {
528
528
  shopId: `${shopId}`,
529
529
  venderId: `${venderId}`,
530
530
  };
531
531
  }
532
532
  } else {
533
533
  this.info.queryInfo = {
534
534
  ...query,
535
535
  };
536
536
  if (
537
537
  this.info.shopInfo?.shopId &&
538
538
  this.info.shopInfo?.venderId &&
539
539
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
540
540
  ) {
541
541
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
542
542
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
543
543
  console.log(
544
544
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
545
545
  this.info.queryInfo,
546
546
  );
547
547
  }
548
548
  }
549
549
  this.info.queryInfo['shopId'] &&
550
550
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
551
551
  this.info.queryInfo['venderId'] &&
552
552
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
553
553
  console.log(
554
554
  '默认==获取店铺下发查询参数\n',
555
555
  query,
556
556
  '\n获取店铺最后查询参数\n',
557
557
  this.info.queryInfo,
558
558
  '\n是否为更新店铺状态\n',
559
559
  updateShopInfoState,
560
560
  );
561
561
  }
562
562
 
563
563
  checkJingGouWxappEnv() {
564
564
  return false;
565
565
  }
566
566
  renderNextTickLoadSdk(_delayTime = 1000, _callback) {
567
567
  console.warn('暂未实现 index.ts');
568
568
  }
569
569
  loadOtherSdk() {
570
570
  console.warn('暂未实现 index.ts');
571
571
  }
572
572
  loadItemSdkPromise(jsInfo = {}) {
573
573
  console.warn('暂未实现 index.ts');
574
574
  }
575
575
  createLanguageProimse() {
576
576
  return Promise.reject({
577
577
  msg: '暂未实现',
578
578
  });
579
579
  }