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