@conecli/cone-render 0.10.1-shop3.10 → 0.10.1-shop3.100

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