@conecli/cone-render 0.8.20-beta.0 → 0.8.20-beta.2

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