@conecli/cone-render 0.8.38 → 0.8.40

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