@conecli/cone-render 0.9.1-isv2.0 → 0.9.1-isv2.1

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