@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: {
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
  WXAPP_ADDRESS_V2_API,
90
90
  BUSINESS_TYPE,
91
91
  SHOP_MENU_ID_TYPE,
92
92
  SHOP_MENU_ID_NAME,
93
93
  SECTION_HOME_TAB_NAME_TYPE,
94
94
  SECTION_HOME_TAB_TYPE,
95
95
  TaroEventType,
96
96
  WX_BUSINESS_TYPE,
97
97
  WXAPP_BIZ_KEY,
98
98
  WXAPP_BIZ_SHOP_LIGHT_KEY,
99
99
  getSystemInfos,
100
100
  getTaroStorageKeyValue,
101
101
  getWxAppCookieStr,
102
102
  objectToUrlEncode,
103
103
  languageNowType,
104
104
  abTestLabels: {},
105
105
  nonSellableSkuids: {},
106
106
  loginState: jdUserLoginState,
107
107
  cookiesStr: '',
108
108
  userInfo: userPinKey,
109
109
  isImmersive: false,
110
110
  pageInfo: {
111
111
  wxBusinessType: WX_BUSINESS_TYPE.SHOP,
112
112
  address: '',
113
113
  addressCommaStr: '',
114
114
  un_area: '',
115
115
  userLbsAddress: '',
116
116
  vapptype: '1',
117
117
  pageType: 'home',
118
118
  dataType: BUSINESS_TYPE.ONLINE,
119
119
  floorExposureInfo: {},
120
120
  floorVideInfo: {},
121
121
  productVideInfo: {},
122
122
  tabsLoadAllDataInfo: {
123
123
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: false,
124
124
  [SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
125
125
  },
126
126
  updateShopInfosAllState: false,
127
127
  isVipShop: false,
128
128
  isJdShowNativeImmersivePlayer: false,
129
129
  ...shopConfig,
130
130
  pageScrollTop: 0,
131
131
  pageIdxHeightInfo: {
132
132
  list: [],
133
133
  },
134
134
  shopNavBarHeight: 0,
135
135
  },
136
136
  defaultQueryLogInfo: {
137
137
  sourceType: 'JDshop',
138
138
  sourceValue: '',
139
139
  moduleId: 'none',
140
140
  entrance: 'none',
141
141
  },
142
142
  originQueryInfo: {},
143
143
  sysInfo: {
144
144
  windowWidth: 0,
145
145
  windowHeight: 0,
146
146
  netWorkType: '4g',
147
147
  jdBottomBarHeight: 0,
148
148
  jdNativeHeaderHeight: 0,
149
149
  },
150
150
  queryInfo: {},
151
151
  shopInfo: {},
152
152
  openAppData: {},
153
153
  public info: CommonInterFace.BaseConfigInfo;
154
154
  public config: {
155
155
  [key: string]: any;
156
156
  };
157
157
  public lazyContainer: CommonInterFace.lazyContainer;
158
158
  public rootEleNode: HTMLElement | null;
159
159
  public miniApplogUtil: CommonInterFace.MiniApplogUtil;
160
160
  public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
161
161
  public checkStatusAndLoginPromise: object | null;
162
162
  public wxAppLoginInstance: CommonInterFace.WxAppLogin;
163
163
  public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
164
164
  public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
165
165
  public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
166
166
  public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
167
167
  public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
168
168
  public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
169
169
  public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
170
170
  public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
171
171
  public wxAppAddressV2apiInstance: CommonInterFace.wxAppAddressV2api;
172
172
  public loadJsSdkList: Array<any>;
173
173
  public loadJsSdkListCachePromise: any;
174
174
  public lbsAddressCachePromise: Promise<any> | null;
175
175
  public languageJsonData: any | null;
176
176
  constructor(opt) {
177
177
  this.info = this._getConfig(opt);
178
178
  this.config = {};
179
179
  this.lazyContainer = {
180
180
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
181
181
  appLazyContainerList: [],
182
182
  appLazyFinishContainerList: [],
183
183
  },
184
184
  [SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
185
185
  appLazyContainerList: [],
186
186
  appLazyFinishContainerList: [],
187
187
  },
188
188
  };
189
189
  this.loadJsSdkList = [];
190
190
  this.loadJsSdkListCachePromise = {};
191
191
  this.rootEleNode = null;
192
192
  this.miniApplogUtil = MiniAppLogUtil;
193
193
  this.miniAppLogInstance = null;
194
194
  this.checkStatusAndLoginPromise = null;
195
195
  this.wxAppLoginInstance = WXAPP_LOGIN;
196
196
  this.wxAppBizInstance = WXAPP_BIZ;
197
197
  this.wxAppUserInfoInstance = WXAPP_USER_INFO;
198
198
  this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
199
199
  this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
200
200
  this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
201
201
  this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
202
202
  this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT ? new WXAPP_FINGER_REPORT() : {};
203
203
  this.wxAppSubsGuider = WXAPP_SUBS_GUIDER;
204
204
  this.wxAppAddressV2apiInstance = WXAPP_ADDRESS_V2_API;
205
205
  this.lbsAddressCachePromise = null;
206
206
  this.languageJsonData = langeJsonDataForCn;
207
207
  }
208
208
  _getConfig(opt) {
209
209
  return Object.assign({}, DefaultConfig, opt);
210
210
  }
211
211
 
212
212
  taskTimeoutPromise(callBack, timeout = 2000) {
213
213
  return new Promise((resolve) => {
214
214
  setTimeout(() => {
215
215
  const getCallBackRes = typeof callBack === 'function' && callBack();
216
216
  return resolve(getCallBackRes || false);
217
217
  }, timeout);
218
218
  });
219
219
  }
220
220
 
221
221
  updateBusinessDomainAndApi(domain, api) {
222
222
  console.log('=================>', 'updateBusinessDomainAndApi');
223
223
  }
224
224
 
225
225
  getFullScreenHeight(systemInfo) {
226
226
  const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
227
227
  let result = screenHeight;
228
228
  if (statusBarHeight > 20 && isAndroid) {
229
229
  result = screenHeight + statusBarHeight;
230
230
  }
231
231
  return result;
232
232
  }
233
233
 
234
234
  getTabBarHeight(systemInfo) {
235
235
  const { statusBarHeight, isAndroid, isIOS } = systemInfo;
236
236
  let result = 50;
237
237
  if (statusBarHeight > 20) {
238
238
  if (isIOS) {
239
239
  result = 84;
240
240
  } else if (isAndroid) {
241
241
  result = 53;
242
242
  }
243
243
  }
244
244
  return result;
245
245
  }
246
246
 
247
247
  getSystemInfo() {
248
248
  const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {};
249
249
  const actualNavBarHeight = (info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
250
250
  const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
251
251
  const fullScreenHeight = this.getFullScreenHeight(info);
252
252
  const tabBarHeight = this.getTabBarHeight(info);
253
253
  const safeContentHeight = fullScreenHeight - headerHeight;
254
254
  this.info.sysInfo = {
255
255
  ...this.info.sysInfo,
256
256
  ...info,
257
257
  actualNavBarHeight,
258
258
  headerHeight,
259
259
  fullScreenHeight,
260
260
  tabBarHeight,
261
261
  safeContentHeight,
262
262
  languageType: languageNowType,
263
263
  };
264
264
  if (this.info.sysInfo['hostVersionName']) {
265
265
  this.info.sysInfo['hostAppVersion'] = Number(
266
266
  this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
267
267
  );
268
268
  }
269
269
  if (isPublishToWxapp) {
270
270
  this.getAddressCachePromise();
271
271
  this.getLbsAddressCachePromise();
272
272
  }
273
273
  this.info.sysInfo['wifiVideoAutoPlay'] = false;
274
274
  this.getNetWorkType();
275
275
  console.log('获取系统信息', this.info.sysInfo);
276
276
  }
277
277
  async updateMPaasConfig() {}
278
278
 
279
279
  getNetWorkType() {
280
280
  Taro.getNetworkType().then((getRes) => {
281
281
  getRes && getRes.networkType && (this.info.sysInfo['netWorkType'] = getRes.networkType);
282
282
  });
283
283
  }
284
284
  getAPPUseStraightCorner() {
285
285
  return Promise.resolve(false);
286
286
  }
287
287
 
288
288
  checkStatusAndLogin(options = {}) {
289
289
  this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
290
290
  console.log('微信小程序登录状态及获取cookie状态的promise,之前登录状态', this.info.loginState);
291
291
  this.toLogin(options)
292
292
  .then((res) => {
293
293
  console.log('微信小程序登录状态结果,成功', res);
294
294
  this.info.loginState = true;
295
295
  resolve(res);
296
296
  })
297
297
  .catch((err) => {
298
298
  console.log('微信小程序登录异常状态结果', err);
299
299
  this.doLogin(options)
300
300
  .then((res2) => {
301
301
  console.log('微信小程序wxDoLogin强制登陆成功:', res2);
302
302
  this.info.loginState = true;
303
303
  resolve(res2);
304
304
  })
305
305
  .catch((err2) => {
306
306
  console.log('微信小程序wxDoLogin强制登陆失败:', err2);
307
307
  this.checkStatusAndLoginPromise = null;
308
308
  reject(err2);
309
309
  });
310
310
  });
311
311
  });
312
312
  return this.checkStatusAndLoginPromise;
313
313
  }
314
314
 
315
315
  checkJdStatusAndLogin(
316
316
  options = {
317
317
  loginColor: {
318
318
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
319
319
  dpin: 0,
320
320
  },
321
321
  },
322
322
  ) {
323
323
  return this.checkStatusAndLogin(options);
324
324
  }
325
325
 
326
326
  toLogin(options = {}): Promise<any> {
327
327
  return this.wxAppLoginInstance
328
328
  .getLoginPromise({
329
329
  mode: 'common',
330
330
  loginColor: {
331
331
  biz: WXAPP_BIZ_KEY,
332
332
  dpin: 1,
333
333
  },
334
334
  ...options,
335
335
  })
336
336
  .then((res) => {
337
337
  console.log('微信app登录返回信息,微信侧返回code为0表示成功', res);
338
338
  setTimeout(() => {
339
339
  console.log(
340
340
  '微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
341
341
  );
342
342
  this.getLoginCookie(`${Date.now()}`);
343
343
  }, 500);
344
344
  })
345
345
  .catch((err) => {
346
346
  console.log('微信app登录异常返回信息,也获取cookie', err);
347
347
  this.getLoginCookie(`${Date.now()}`);
348
348
  });
349
349
  }
350
350
 
351
351
  doLogin(options = {}) {
352
352
  const getParams = {
353
353
  loginColor: {
354
354
  biz: WXAPP_BIZ_KEY,
355
355
  dpin: 1,
356
356
  },
357
357
  ...options,
358
358
  };
359
359
  if (isPublishToWxapp) {
360
360
  getParams['returnUrl'] = `/pages/shopx/pages/index/index?${objectToUrlEncode({
361
361
  ...this.info.originQueryInfo,
362
362
  loadShopxType: 'redirect',
363
363
  })}`;
364
364
  }
365
365
  return this.wxAppLoginInstance.doLogin(getParams).then((res) => {
366
366
  console.log('微信小程序强制登录返回信息,微信侧返回code为0表示成功', res);
367
367
  setTimeout(() => {
368
368
  console.log('微信强制登录后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie');
369
369
  this.getLoginCookie(`${Date.now()}`);
370
370
  }, 500);
371
371
  return res;
372
372
  });
373
373
  }
374
374
 
375
375
  doLoginForJdPin(options = {}) {
376
376
  return this.doLogin({
377
377
  loginColor: {
378
378
  biz: WXAPP_BIZ_SHOP_LIGHT_KEY,
379
379
  dpin: 0,
380
380
  },
381
381
  ...options,
382
382
  });
383
383
  }
384
384
 
385
385
  getLoginCookie(updateKey = 'wxapp') {
386
386
  return new Promise(async (resolve) => {
387
387
  console.log('开始获取更新wxapp中的cookie信息', updateKey);
388
388
  if (
389
389
  this.config.wqCookie &&
390
390
  this.config.wqCookieStr &&
391
391
  this.config.getWqCookieKey === updateKey
392
392
  ) {
393
393
  console.log('已有存储wxapp中的cookie信息,直接返回', this.config);
394
394
  resolve({
395
395
  wqCookie: this.config.wqCookie,
396
396
  wqCookieStr: this.config.wqCookieStr,
397
397
  });
398
398
  } else {
399
399
  if (isPublishToWxapp) {
400
400
  const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null;
401
401
  if (getWxappCookieObj) {
402
402
  const getCookieObj = getWxappCookieObj['_data'];
403
403
  const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
404
404
  const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie;
405
405
  this.info.loginState = true;
406
406
  this.info.userInfo.wqCookie = wqCookieStr;
407
407
  this.info.userInfo.wqVisitkey = visitkey;
408
408
  console.log('获取用户完整cookie信息', getCookieObj);
409
409
  if (this.miniAppLogInstance) {
410
410
  this.miniAppLogInstance.set({
411
411
  account: pin,
412
412
  unionid: wq_unionid,
413
413
  openid: wxapp_openid,
414
414
  });
415
415
  }
416
416
  this.config.wqCookie = wqCookie;
417
417
  this.config.wqCookieStr = wqCookieStr;
418
418
  this.config.getWqCookieKey = updateKey;
419
419
  console.log('解析wxapp中的cookie信息成功,返回后存储', this.config);
420
420
  resolve({
421
421
  wqCookie,
422
422
  wqCookieStr,
423
423
  });
424
424
  } else {
425
425
  console.log('解析wxapp中的cookie信息异常,返回异常结果', this.config);
426
426
  resolve({
427
427
  wqCookie: false,
428
428
  wqCookieStr: false,
429
429
  });
430
430
  }
431
431
  } else {
432
432
  resolve({
433
433
  wqCookie: false,
434
434
  wqCookieStr: false,
435
435
  });
436
436
  }
437
437
  }
438
438
  });
439
439
  }
440
440
 
441
441
 
442
442
  checkLoginStatus() {
443
443
  return this.getLoginCookie();
444
444
  }
445
445
 
446
446
  getAddressCachePromise = () => {
447
447
  return new Promise((resolve) => {
448
448
  if (this.info.sysInfo?.area) {
449
449
  resolve({
450
450
  lat: this.info.sysInfo?.lat,
451
451
  lng: this.info.sysInfo?.lng,
452
452
  area: this.info.sysInfo?.area,
453
453
  });
454
454
  } else {
455
455
  const getUserAddress = this.wxAppUserInfoInstance.getAddress();
456
456
  console.info('京购原生获取用户基地址信息', getUserAddress);
457
457
  if (getUserAddress) {
458
458
  const { areaId = '', latitude, longitude } = getUserAddress;
459
459
  this.info.sysInfo['lat'] = `${latitude || ''}`;
460
460
  this.info.sysInfo['lng'] = `${longitude || ''}`;
461
461
  if (areaId && areaId !== '') {
462
462
  this.info.pageInfo.address = areaId;
463
463
  this.info.pageInfo.addressCommaStr = areaId.replace(/_/g, ',');
464
464
  this.info.pageInfo.un_area = areaId;
465
465
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
466
466
  area: areaId,
467
467
  });
468
468
  this.info.sysInfo['area'] = areaId;
469
469
  }
470
470
  resolve({
471
471
  lat: this.info.sysInfo['lat'],
472
472
  lng: this.info.sysInfo['lng'],
473
473
  area: areaId,
474
474
  });
475
475
  } else {
476
476
  resolve({ lat: '', lng: '', area: '' });
477
477
  }
478
478
  }
479
479
  });
480
480
  };
481
481
 
482
482
  getLbsAddressCachePromise(): Promise<{
483
483
  ok: boolean;
484
484
  msg?: string;
485
485
  realTimeArea: string;
486
486
  data?: any;
487
487
  }> {
488
488
  if (!this.lbsAddressCachePromise) {
489
489
  this.lbsAddressCachePromise = new Promise((resolve) => {
490
490
  const getWxappLbsAddressInfo = this.wxAppUserInfoInstance.getLbsAddress();
491
491
  console.info('京购原生获取用户基于lbs的缓存地址信息', getWxappLbsAddressInfo);
492
492
  if (getWxappLbsAddressInfo && getWxappLbsAddressInfo?.areaId !== '') {
493
493
  this.info.pageInfo.userLbsAddress = getWxappLbsAddressInfo?.areaId;
494
494
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
495
495
  realTimeArea: this.info.pageInfo.userLbsAddress,
496
496
  });
497
497
  resolve({
498
498
  ok: true,
499
499
  realTimeArea: getWxappLbsAddressInfo?.areaId || '',
500
500
  });
501
501
  } else {
502
502
  this.wxAppAddressV2apiInstance
503
503
  .fetchLbsAddr({
504
504
  token: 'W23b9sUlcnhCPZxQ2daYMkDqrTL0TeDw9tbDm5lVMVA=',
505
505
  from: 'wxapp_shop_real_area',
506
506
  })
507
507
  .then((res) => {
508
508
  console.info('微信京购里面获取静默实时lbs地址信息结果', res);
509
509
  const { provinceId, cityId, countyId, townId } = res;
510
510
  let realTimeArea = '';
511
511
  if (provinceId) {
512
512
  realTimeArea = `${provinceId}_${cityId || 0}_${countyId || 0}_${townId || 0}`;
513
513
  this.info.pageInfo.userLbsAddress = realTimeArea;
514
514
  Taro.eventCenter.trigger(TaroEventType.USER_AREA_UPDATE, {
515
515
  realTimeArea: realTimeArea,
516
516
  });
517
517
  } else {
518
518
  this.lbsAddressCachePromise = null;
519
519
  }
520
520
  const getValidRealTimeArea = realTimeArea !== '';
521
521
  resolve({
522
522
  ok: getValidRealTimeArea,
523
523
  msg: getValidRealTimeArea
524
524
  ? '成功'
525
525
  : '根据微信底层接口获取静默实时lbs地址信息异常,详情见data',
526
526
  data: getValidRealTimeArea ? null : res,
527
527
  realTimeArea: realTimeArea,
528
528
  });
529
529
  })
530
530
  .catch((err) => {
531
531
  console.warn('微信京购里面获取静默实时lbs地址信息异常', err);
532
532
  this.lbsAddressCachePromise = null;
533
533
  resolve({
534
534
  ok: false,
535
535
  msg: '微信京购里面获取静默实时lbs地址信息异常',
536
536
  realTimeArea: '',
537
537
  });
538
538
  });
539
539
  }
540
540
  });
541
541
  }
542
542
  return this.lbsAddressCachePromise;
543
543
  }
544
544
 
545
545
  updatePageAndLogInfo(updateQuery = {}) {
546
546
  const createUpdateQueryInfo: {
547
547
  query: {
548
548
  shopId?: string | number;
549
549
  venderId?: string | number;
550
550
  };
551
551
  updateShopInfoState: boolean;
552
552
  } = Object.assign(
553
553
  {},
554
554
  {
555
555
  query: {},
556
556
  updateShopInfoState: false,
557
557
  },
558
558
  updateQuery,
559
559
  );
560
560
  console.log(
561
561
  '获取当前下发的店铺查询参数',
562
562
  updateQuery,
563
563
  '获取之前保存的shopInfo店铺查询参数',
564
564
  this.info?.shopInfo,
565
565
  );
566
566
  const { query, updateShopInfoState } = createUpdateQueryInfo;
567
567
  const { shopId, venderId } = query;
568
568
  if (updateShopInfoState) {
569
569
  this.info.queryInfo = {
570
570
  ...this.info.queryInfo,
571
571
  ...query,
572
572
  };
573
573
  if (shopId && venderId) {
574
574
  this.info.shopInfo = {
575
575
  shopId: `${shopId}`,
576
576
  venderId: `${venderId}`,
577
577
  };
578
578
  }
579
579
  } else {
580
580
  this.info.queryInfo = {
581
581
  ...query,
582
582
  };
583
583
  this.info.originQueryInfo = {
584
584
  ...query,
585
585
  };
586
586
  if (
587
587
  this.info.shopInfo?.shopId &&
588
588
  this.info.shopInfo?.venderId &&
589
589
  (this.info.shopInfo.shopId == shopId || this.info.shopInfo.venderId == venderId)
590
590
  ) {
591
591
  this.info.queryInfo.shopId = this.info.shopInfo.shopId;
592
592
  this.info.queryInfo.venderId = this.info.shopInfo.venderId;
593
593
  console.log(
594
594
  '当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
595
595
  this.info.queryInfo,
596
596
  );
597
597
  }
598
598
  }
599
599
  this.info.queryInfo['shopId'] &&
600
600
  (this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`);
601
601
  this.info.queryInfo['venderId'] &&
602
602
  (this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`);
603
603
  console.log(
604
604
  'weapp===获取店铺下发查询参数\n',
605
605
  query,
606
606
  '\n获取店铺最后查询参数\n',
607
607
  this.info.queryInfo,
608
608
  '\n是否为更新店铺状态\n',
609
609
  updateShopInfoState,
610
610
  );
611
611
  }
612
612
 
613
613
  getDynamicConfig(key: string) {
614
614
  console.warn('调用微信小程序的 getDynamicConfig(),注意,此方法还未实现!');
615
615
  return null;
616
616
  }
617
617
  renderNextTickLoadSdk() {
618
618
  console.warn('暂未实现 index.weapp.ts');
619
619
  }
620
620
  loadOtherSdk() {
621
621
  console.warn('暂未实现 index.weapp.ts');
622
622
  }
623
623
  loadItemSdkPromise() {
624
624
  console.warn('暂未实现 index.weapp.ts');
625
625
  }
626
626
  createLanguageProimse() {
627
627
  return Promise.reject({
628
628
  msg: '暂未实现',
629
629
  });
630
630
  }