@conecli/cone-render 0.10.1-shop3.12 → 0.10.1-shop3.121

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 (118) 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/index.h5.tsx +1 -1
  34. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  35. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  36. package/dist/components/base/NetworkDataError/const.ts +1 -1
  37. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  38. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  39. package/dist/components/base/Price/Base/index.module.scss +12 -0
  40. package/dist/components/base/Price/Base/index.tsx +1 -1
  41. package/dist/components/base/Price/Double/index.module.scss +25 -1
  42. package/dist/components/base/Price/Double/index.tsx +1 -1
  43. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  44. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  45. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  46. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  48. package/dist/components/floorItem.tsx +1 -1
  49. package/dist/components/isv/Floor/index.tsx +1 -1
  50. package/dist/components/remoteFloorItem.tsx +1 -1
  51. package/dist/config/env.ts +1 -1
  52. package/dist/interface/common.ts +1 -1
  53. package/dist/interface/component.ts +1 -1
  54. package/dist/interface/jumpEventReport.ts +1 -1
  55. package/dist/interface/service.ts +1 -1
  56. package/dist/jumpEventReport/base.ts +1 -1
  57. package/dist/jumpEventReport/const.ts +1 -1
  58. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  59. package/dist/jumpEventReport/index.h5.ts +1 -1
  60. package/dist/jumpEventReport/index.jd.ts +1 -1
  61. package/dist/jumpEventReport/index.weapp.ts +1 -1
  62. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  63. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  64. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  65. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  66. package/dist/jumpEventReport/web/report.ts +1 -1
  67. package/dist/jumpEventReport/web.base.ts +1 -1
  68. package/dist/jumpEventReport/web.jd.ts +1 -1
  69. package/dist/jumpEventReport/web.pc.ts +1 -1
  70. package/dist/jumpEventReport/web.tjm.ts +1 -1
  71. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  72. package/dist/language/en_US.json +397 -0
  73. package/dist/language/zh_CN.json +397 -0
  74. package/dist/language/zh_HK.json +397 -0
  75. package/dist/libs/openShopBridge.js +161 -0
  76. package/dist/libs/openShopBridge.min.js +1 -0
  77. package/dist/libs/taroAppReport.js +2 -2
  78. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  79. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  80. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  81. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  82. package/dist/open/api/environment.ts +1 -1
  83. package/dist/open/api/shopMember.ts +1 -1
  84. package/dist/open/api/shopMember.weapp.ts +1 -0
  85. package/dist/open/api/track.ts +1 -1
  86. package/dist/open/api/util.ts +1 -1
  87. package/dist/open/components/index.ts +1 -1
  88. package/dist/open/index.ts +1 -1
  89. package/dist/sass/app.h5.scss +19 -2
  90. package/dist/sass/base.scss +8 -4
  91. package/dist/service/fetchGateway.ts +1 -1
  92. package/dist/service/fetchGateway.weapp.ts +1 -1
  93. package/dist/service/fetchJsonp.weapp.ts +1 -0
  94. package/dist/service/http/const.ts +1 -1
  95. package/dist/service/http/h5Http.ts +1 -1
  96. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  97. package/dist/service/requestServer.h5.ts +1 -1
  98. package/dist/service/requestServer.ts +1 -1
  99. package/dist/service/requestServer.weapp.ts +1 -1
  100. package/dist/utils/connectNativeJsBridge.ts +1 -1
  101. package/dist/utils/h5Utils.ts +1 -1
  102. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  103. package/dist/utils/harmonyCallRouter.ts +0 -0
  104. package/dist/utils/index.h5.ts +1 -1
  105. package/dist/utils/index.ts +1 -1
  106. package/dist/utils/index.weapp.ts +1 -1
  107. package/dist/utils/jumpExtMapUtil.ts +1 -0
  108. package/dist/utils/jumpExtMapUtil.weapp.ts +1 -0
  109. package/dist/utils/log.ts +1 -0
  110. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  111. package/dist/utils/sColor.weapp.ts +1 -0
  112. package/dist/utils/utils.ts +1 -1
  113. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  114. package/dist/wxapp/common/user_info.js +1 -1
  115. package/package.json +166 -141
  116. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  117. package/dist/utils/priceUtils.js +0 -1
  118. /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
  return Taro.getNetworkType().then((getRes) => {
330
330
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
331
331
  return getRes;
332
332
  });
333
333
  }
334
334
  getAPPUseStraightCorner() {
335
335
  return Promise.resolve(false);
336
336
  }
337
337
  checkStatusAndLogin(options = {}) {
338
338
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
339
339
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
340
340
  this.toLogin(options)
341
341
  .then((res) => {
342
342
  console.log('微信小程序登录状态结果,成功', res);
343
343
  this.info.loginState = true;
344
344
  resolve(res);
345
345
  })
346
346
  .catch((err) => {
347
347
  console.log('微信小程序登录异常状态结果', err);
348
348
  this.doLogin(options)
349
349
  .then((res2) => {
350
350
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
351
351
  this.info.loginState = true;
352
352
  resolve(res2);
353
353
  })
354
354
  .catch((err2) => {
355
355
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
356
356
  this.checkStatusAndLoginPromise = null;
357
357
  reject(err2);
358
358
  });
359
359
  });
360
360
  });
361
361
  return this.checkStatusAndLoginPromise;
362
362
  }
363
363
 
364
364
  checkJdStatusAndLogin(options) {
365
365
  return this.checkStatusAndLogin(options);
366
366
  }
367
367
 
368
368
  toLogin(options = {}): Promise<any> {
369
369
  return this.wxAppLoginInstance
370
370
  .getLoginPromise({
371
371
  mode: 'silent',
372
372
  loginColor: {
373
373
  biz: WXAPP_BIZ_KEY,
374
374
  dpin: 0,
375
375
  },
376
376
  ...options,
377
377
  })
378
378
  .then((res) => {
379
379
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
380
380
  this.getLoginCookie();
381
381
  })
382
382
  .catch((err) => {
383
383
  console.log('微信app登录异常返回信息', err);
384
384
  });
385
385
  }
386
386
 
387
387
  doLogin(options = {}) {
388
388
  return this.wxAppLoginInstance
389
389
  .doLogin({
390
390
  loginColor: {
391
391
  biz: WXAPP_BIZ_KEY,
392
392
  dpin: 0,
393
393
  },
394
394
  ...options,
395
395
  })
396
396
  .then((res) => {
397
397
  this.getLoginCookie();
398
398
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
399
399
  return res;
400
400
  });
401
401
  }
402
402
 
403
403
  doLoginForJdPin(options = {}) {
404
404
  return this.doLogin(options);
405
405
  }
406
406
 
407
407
  getLoginCookie(updateKey = 'wxapp') {
408
408
  return new Promise((resolve) => {
409
409
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
410
410
  if (
411
411
  this.config.wqCookie &&
412
412
  this.config.wqCookieStr &&
413
413
  this.config.getWqCookieKey === updateKey
414
414
  ) {
415
415
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
416
416
  resolve({
417
417
  wqCookie: this.config.wqCookie,
418
418
  wqCookieStr: this.config.wqCookieStr,
419
419
  });
420
420
  } else {
421
421
  if (isPublishToWxapp) {
422
422
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
423
423
  if (getWxappCookieObj) {
424
424
  const getCookieObj = getWxappCookieObj['_data'];
425
425
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
426
426
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
427
427
  this.info.loginState = true;
428
428
  this.info.userInfo.wqCookie = wqCookieStr;
429
429
  this.info.userInfo.wqVisitkey = visitkey;
430
430
  console.log('获取用户完整cookie信息', getCookieObj);
431
431
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
432
432
  console.log('获取微信用户地址信息', getUserAddress);
433
433
  if (getUserAddress) {
434
434
  this.info.pageInfo.address = getUserAddress?.areaId;
435
435
  this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
436
436
  ? this.info.pageInfo.address.replace(/_/g, ',')
437
437
  : '';
438
438
  this.info.pageInfo.un_area = this.info.pageInfo.address;
439
439
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
440
440
  area: this.info.pageInfo.address,
441
441
  });
442
442
  }
443
443
  if (this.miniAppLogInstance) {
444
444
  this.miniAppLogInstance.set({
445
445
  account: pin,
446
446
  unionid: wq_unionid,
447
447
  openid: wxapp_openid,
448
448
  });
449
449
  }
450
450
  this.config.wqCookie = wqCookie;
451
451
  this.config.wqCookieStr = wqCookieStr;
452
452
  this.config.getWqCookieKey = updateKey;
453
453
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
454
454
  resolve({
455
455
  wqCookie,
456
456
  wqCookieStr,
457
457
  });
458
458
  } else {
459
459
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
460
460
  resolve({
461
461
  wqCookie: false,
462
462
  wqCookieStr: false,
463
463
  });
464
464
  }
465
465
  } else {
466
466
  resolve({
467
467
  wqCookie: false,
468
468
  wqCookieStr: false,
469
469
  });
470
470
  }
471
471
  }
472
472
  });
473
473
  }
474
474
 
475
475
 
476
476
  checkLoginStatus() {
477
477
  return this.getLoginCookie();
478
478
  }
479
479
 
480
480
  getAddressCachePromise() {
481
481
  return Promise.reject('该方法只在APP内适用');
482
482
  }
483
483
 
484
484
  getLbsAddressCachePromise() {
485
485
  return Promise.resolve({
486
486
  status: '-1005',
487
487
  msg: '暂未实现,获取失败',
488
488
  });
489
489
  }
490
490
 
491
491
  getDynamicConfig(key: string) {
492
492
  console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!');
493
493
  return null;
494
494
  }
495
495
 
496
496
  updatePageAndLogInfo(updateQuery = {}) {
497
497
  const createUpdateQueryInfo: {
498
498
  query: {
499
499
  shopId?: string | number;
500
500
  venderId?: string | number;
501
501
  };
502
502
  updateShopInfoState: boolean;
503
503
  } = Object.assign(
504
504
  {},
505
505
  {
506
506
  query: {},
507
507
  updateShopInfoState: false,
508
508
  },
509
509
  updateQuery,
510
510
  );
511
511
  console.log(
512
512
  '获取当前下发的店铺查询参数',
513
513
  updateQuery,
514
514
  '获取之前保存的shopInfo店铺查询参数',
515
515
  this.info?.shopInfo,
516
516
  );
517
517
  const { query, updateShopInfoState } = createUpdateQueryInfo;
518
518
  const { shopId, venderId } = query;
519
519
  if (updateShopInfoState) {
520
520
  this.info.queryInfo = {
521
521
  ...this.info.queryInfo,
522
522
  ...query,
523
523
  };
524
524
  if (shopId && venderId) {
525
525
  this.info.shopInfo = {
526
526
  shopId: `${shopId}`,
527
527
  venderId: `${venderId}`,
528
528
  };
529
529
  }
530
530
  } else {
531
531
  this.info.queryInfo = {
532
532
  ...query,
533
533
  };
534
534
  if (
535
535
  this.info.shopInfo?.shopId &&
536
536
  this.info.shopInfo?.venderId &&
537
537
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
538
538
  ) {
539
539
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
540
540
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
541
541
  console.log(
542
542
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
543
543
  this.info.queryInfo,
544
544
  );
545
545
  }
546
546
  }
547
547
  this.info.queryInfo['shopId'] &&
548
548
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
549
549
  this.info.queryInfo['venderId'] &&
550
550
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
551
551
  console.log(
552
552
  '默认==获取店铺下发查询参数\n',
553
553
  query,
554
554
  '\n获取店铺最后查询参数\n',
555
555
  this.info.queryInfo,
556
556
  '\n是否为更新店铺状态\n',
557
557
  updateShopInfoState,
558
558
  );
559
559
  }
560
560
 
561
561
  checkJingGouWxappEnv() {
562
562
  return false;
563
563
  }
564
564
  renderNextTickLoadSdk(_delayTime = 1000, _callback) {
565
565
  console.warn('暂未实现 index.ts');
566
566
  }
567
567
  loadOtherSdk() {
568
568
  console.warn('暂未实现 index.ts');
569
569
  }
570
570
  loadItemSdkPromise(jsInfo = {}) {
571
571
  console.warn('暂未实现 index.ts');
572
572
  }
573
573
  createLanguageProimse() {
574
574
  return Promise.reject({
575
575
  msg: '暂未实现',
576
576
  });
577
577
  }