@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.91

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