@conecli/cone-render 0.8.20-shop.21 → 0.8.20-shop.211

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