@conecli/cone-render 0.10.1-shop-beta.4 → 0.10.1-shop-beta.6
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.
- package/dist/api/index.ts +1 -1
- package/dist/common/const.ts +1 -1
- package/dist/common/environmentType.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/pageType.ts +1 -1
- package/dist/common/sgmCustomCode.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/components/ErrorBoundary.tsx +1 -1
- package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
- package/dist/components/base/CommonFloorHead/index.tsx +1 -1
- package/dist/components/base/CountDown/index.module.scss +49 -44
- package/dist/components/base/CountDown/index.tsx +1 -1
- package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
- package/dist/components/base/CustomScrollView/index.tsx +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Dialog/index.module.scss +11 -0
- package/dist/components/base/ExposureSmart/index.h5.module.scss +12 -2
- package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
- package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.tsx +1 -1
- package/dist/components/base/InViewRender/index.weapp.tsx +1 -1
- package/dist/components/base/ItemViewExposureSmart/index.module.scss +2 -2
- package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.weapp.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.module.scss +11 -3
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
- package/dist/components/base/NetworkDataError/index.module.scss +3 -0
- package/dist/components/base/NetworkDataError/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.tsx +1 -1
- package/dist/components/base/Price/Double/index.module.scss +8 -0
- package/dist/components/base/Price/Double/index.tsx +1 -1
- package/dist/components/decorate/DecorateFloorModule/index.module.scss +11 -0
- package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
- package/dist/components/floorItem.jd.tsx +1 -1
- package/dist/components/floorItem.tsx +1 -1
- package/dist/components/floorItem.weapp.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/components/remoteFloorItem.tsx +1 -1
- package/dist/interface/common.ts +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/jumpEventReport.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/base.ts +1 -1
- package/dist/jumpEventReport/const.ts +1 -1
- package/dist/jumpEventReport/index.jd.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
- package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web/report.ts +1 -1
- package/dist/jumpEventReport/web.base.ts +1 -1
- package/dist/jumpEventReport/web.jd.ts +1 -1
- package/dist/jumpEventReport/web.jdb.ts +1 -1
- package/dist/jumpEventReport/web.jdjch.ts +1 -1
- package/dist/jumpEventReport/web.jxwxapp.ts +1 -1
- package/dist/jumpEventReport/web.pc.ts +1 -1
- package/dist/jumpEventReport/web.tjapp.ts +1 -1
- package/dist/jumpEventReport/web.tjm.ts +1 -1
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/libs/taroAppReport.js +2 -2
- package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -52
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/open/api/device.ts +1 -1
- package/dist/open/api/request.ts +1 -1
- package/dist/open/api/shopMember.ts +1 -1
- package/dist/open/api/util.ts +1 -1
- package/dist/open/components/index.ts +1 -1
- package/dist/sass/app.h5.scss +275 -221
- package/dist/sass/base.scss +183 -137
- package/dist/service/fetchGateway.ts +1 -1
- package/dist/service/fetchGateway.weapp.ts +1 -0
- package/dist/service/http/colorSign.ts +1 -1
- package/dist/service/http/const.ts +1 -1
- package/dist/service/http/h5Http.ts +1 -0
- package/dist/service/http/index.h5.ts +1 -0
- package/dist/service/requestServer.h5.ts +1 -0
- package/dist/service/requestServer.ts +1 -1
- package/dist/service/requestServer.weapp.ts +1 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/jumpExtMapUtil.js +1 -0
- package/dist/utils/sColor.js +1 -0
- package/dist/utils/sgmCodeUtils.ts +1 -1
- package/dist/utils/taroRenderUtil.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +53 -28
- package/dist/utils/memberFormatUtils.js +0 -1
package/dist/common/index.jd.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
appEid,
|
|
3
2
|
userPinKey,
|
|
4
3
|
jdUserLoginState,
|
|
5
4
|
WXAPP_LOGIN,
|
|
6
5
|
WXAPP_BIZ,
|
|
7
6
|
WXAPP_USER_INFO,
|
|
8
7
|
WXAPP_NAVIGATOR,
|
|
9
8
|
WXAPP_REPORT_GDT,
|
|
10
9
|
WXAPP_PARAMS_SIGN,
|
|
11
10
|
WXAPP_FINGER_REPORT,
|
|
12
11
|
WXAPP_REPORT_MANAGE,
|
|
13
12
|
BUSINESS_TYPE,
|
|
14
13
|
SHOP_MENU_ID_TYPE,
|
|
15
14
|
SHOP_MENU_ID_NAME,
|
|
16
15
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
17
16
|
SECTION_HOME_TAB_TYPE,
|
|
18
17
|
TaroEventType,
|
|
19
18
|
WX_BUSINESS_TYPE,
|
|
20
19
|
WXAPP_BIZ_KEY,
|
|
21
20
|
getSystemInfos,
|
|
22
21
|
getTaroStorageKeyValue,
|
|
23
22
|
removeTaroStorageKey,
|
|
24
23
|
setTaroStorage,
|
|
25
24
|
getWxAppCookieStr,
|
|
26
25
|
objectToUrlEncode,
|
|
27
26
|
loginState: jdUserLoginState,
|
|
28
27
|
cookiesStr: '',
|
|
29
28
|
userInfo: userPinKey,
|
|
30
29
|
pageInfo: {
|
|
31
30
|
wxBusinessType: WX_BUSINESS_TYPE.SHOP,
|
|
32
31
|
address: '',
|
|
33
32
|
addressCommaStr: '',
|
|
34
33
|
un_area: '',
|
|
35
34
|
vapptype: '1',
|
|
36
35
|
pageType: 'home',
|
|
37
36
|
dataType: BUSINESS_TYPE.ONLINE,
|
|
38
37
|
floorExposureInfo: {},
|
|
39
38
|
floorVideInfo: {},
|
|
40
39
|
productVideInfo: {},
|
|
41
40
|
tabsLoadAllDataInfo: {
|
|
42
41
|
[SECTION_HOME_TAB_NAME_TYPE[
|
|
43
42
|
SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN
|
|
44
43
|
]]: false,
|
|
45
44
|
[SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
|
|
46
45
|
},
|
|
47
46
|
updateShopInfosAllState: false,
|
|
48
47
|
isVipShop: false,
|
|
49
48
|
isJdShowNativeImmersivePlayer: false,
|
|
50
49
|
...shopConfig,
|
|
51
50
|
pageScrollTop: 0,
|
|
52
51
|
pageIdxHeightInfo: {
|
|
53
52
|
list: [],
|
|
54
53
|
},
|
|
55
54
|
shopNavBarHeight: 0,
|
|
56
55
|
},
|
|
57
56
|
defaultQueryLogInfo: {
|
|
58
57
|
sourceType: 'JDshop',
|
|
59
58
|
sourceValue: '',
|
|
60
59
|
moduleId: 'none',
|
|
61
60
|
entrance: 'none',
|
|
62
61
|
},
|
|
63
62
|
originQueryInfo: {},
|
|
64
63
|
sysInfo: {
|
|
65
64
|
windowWidth: 0,
|
|
66
65
|
windowHeight: 0,
|
|
67
66
|
eid: appEid,
|
|
68
67
|
netWorkType: '4g',
|
|
69
68
|
jdBottomBarHeight: 0,
|
|
70
69
|
jdNativeHeaderHeight: 0,
|
|
71
70
|
},
|
|
72
71
|
queryInfo: {},
|
|
73
72
|
shopInfo: {},
|
|
74
73
|
openAppData: {},
|
|
75
74
|
public info: CommonInterFace.BaseConfigInfo
|
|
76
75
|
public config: {
|
|
77
76
|
[key: string]: any
|
|
78
77
|
}
|
|
79
78
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
80
79
|
public rootEleNode: HTMLElement | null
|
|
81
80
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil
|
|
82
81
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null
|
|
83
82
|
public checkStatusAndLoginPromise: object | null
|
|
84
83
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin
|
|
85
84
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo
|
|
86
85
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo
|
|
87
86
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage
|
|
88
87
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT
|
|
89
88
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator
|
|
90
89
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign
|
|
91
90
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign
|
|
92
91
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign
|
|
93
92
|
constructor(opt) {
|
|
94
93
|
this.info = this._getConfig(opt)
|
|
95
94
|
this.config = {}
|
|
96
95
|
this.lazyContainer = {
|
|
97
96
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
|
|
98
97
|
appLazyContainerList: [],
|
|
99
98
|
appLazyFinishContainerList: [],
|
|
100
99
|
},
|
|
101
100
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
|
|
102
101
|
appLazyContainerList: [],
|
|
103
102
|
appLazyFinishContainerList: [],
|
|
104
103
|
},
|
|
105
104
|
}
|
|
106
105
|
this.rootEleNode = null
|
|
107
106
|
this.miniApplogUtil = MiniAppLogUtil
|
|
108
107
|
this.miniAppLogInstance = null
|
|
109
108
|
this.checkStatusAndLoginPromise = null
|
|
110
109
|
this.wxAppLoginInstance = WXAPP_LOGIN
|
|
111
110
|
this.wxAppBizInstance = WXAPP_BIZ
|
|
112
111
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO
|
|
113
112
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE
|
|
114
113
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT
|
|
115
114
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR
|
|
116
115
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN
|
|
117
116
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT
|
|
118
117
|
? new WXAPP_FINGER_REPORT()
|
|
119
118
|
: {}
|
|
120
119
|
this.wxAppSubsGuider = null
|
|
121
120
|
}
|
|
122
121
|
_getConfig(opt) {
|
|
123
122
|
return Object.assign({}, DefaultConfig, opt)
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
taskTimeoutPromise(callBack, timeout = 2000) {
|
|
127
126
|
return new Promise(resolve => {
|
|
128
127
|
setTimeout(() => {
|
|
129
128
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
130
129
|
return resolve(getCallBackRes || false)
|
|
131
130
|
}, timeout)
|
|
132
131
|
})
|
|
133
132
|
}
|
|
134
133
|
|
|
135
134
|
updateBusinessDomainAndApi(domain, api) {
|
|
136
135
|
}
|
|
137
136
|
|
|
138
137
|
getFullScreenHeight(systemInfo) {
|
|
139
138
|
const { screenHeight, statusBarHeight, isAndroid } = systemInfo
|
|
140
139
|
let result = screenHeight
|
|
141
140
|
if (statusBarHeight > 20 && isAndroid) {
|
|
142
141
|
result = screenHeight + statusBarHeight
|
|
143
142
|
}
|
|
144
143
|
return result
|
|
145
144
|
}
|
|
146
145
|
|
|
147
146
|
getTabBarHeight(systemInfo) {
|
|
148
147
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo
|
|
149
148
|
let result = 50
|
|
150
149
|
if (statusBarHeight > 20) {
|
|
151
150
|
if (isIOS) {
|
|
152
151
|
result = 84
|
|
153
152
|
} else if (isAndroid) {
|
|
154
153
|
result = 53
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
156
|
return result
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
getSystemInfo() {
|
|
161
160
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfos() || {}
|
|
162
161
|
const actualNavBarHeight =
|
|
163
162
|
(info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0)
|
|
164
163
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0)
|
|
165
164
|
const fullScreenHeight = this.getFullScreenHeight(info)
|
|
166
165
|
const tabBarHeight = this.getTabBarHeight(info)
|
|
167
166
|
const safeContentHeight = fullScreenHeight - headerHeight
|
|
168
167
|
this.info.sysInfo = {
|
|
169
168
|
...this.info.sysInfo,
|
|
170
169
|
...info,
|
|
171
170
|
actualNavBarHeight,
|
|
172
171
|
headerHeight,
|
|
173
172
|
fullScreenHeight,
|
|
174
173
|
tabBarHeight,
|
|
175
174
|
safeContentHeight,
|
|
176
175
|
}
|
|
177
176
|
this.getEid().then((res: { eid: string }) => {
|
|
178
177
|
res && res.eid && (this.info.sysInfo['eid'] = res.eid)
|
|
179
178
|
})
|
|
180
179
|
if (this.info.sysInfo['hostVersionName']) {
|
|
181
180
|
this.info.sysInfo['hostAppVersion'] = Number(
|
|
182
181
|
this.info.sysInfo['hostVersionName'].replace(/\./g, ''),
|
|
183
182
|
)
|
|
184
183
|
}
|
|
185
184
|
this.info.sysInfo['wifiVideoAutoPlay'] = false
|
|
186
185
|
this.getNetWorkType()
|
|
187
186
|
}
|
|
188
187
|
async updateMPaasConfig() {}
|
|
189
188
|
|
|
190
189
|
getNetWorkType() {
|
|
191
190
|
Taro.getNetworkType().then(getRes => {
|
|
192
191
|
getRes &&
|
|
193
192
|
getRes.networkType &&
|
|
194
193
|
(this.info.sysInfo['netWorkType'] = getRes.networkType)
|
|
195
194
|
})
|
|
196
195
|
}
|
|
197
196
|
|
|
198
197
|
checkStatusAndLogin(options = {}) {
|
|
199
198
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
200
199
|
console.log(
|
|
201
200
|
'微信小程序登录状态及获取cookie状态的promise,之前登录状态',
|
|
202
201
|
this.info.loginState,
|
|
203
202
|
)
|
|
204
203
|
this.toLogin(options)
|
|
205
204
|
.then(res => {
|
|
206
205
|
console.log('微信小程序登录状态结果,成功', res)
|
|
207
206
|
this.info.loginState = true
|
|
208
207
|
resolve(res)
|
|
209
208
|
})
|
|
210
209
|
.catch(err => {
|
|
211
210
|
console.log('微信小程序登录异常状态结果', err)
|
|
212
211
|
this.doLogin(options)
|
|
213
212
|
.then(res2 => {
|
|
214
213
|
console.log('微信小程序wxDoLogin强制登陆成功:', res2)
|
|
215
214
|
this.info.loginState = true
|
|
216
215
|
resolve(res2)
|
|
217
216
|
})
|
|
218
217
|
.catch(err2 => {
|
|
219
218
|
console.log('微信小程序wxDoLogin强制登陆失败:', err2)
|
|
220
219
|
this.checkStatusAndLoginPromise = null
|
|
221
220
|
reject(err2)
|
|
222
221
|
})
|
|
223
222
|
})
|
|
224
223
|
})
|
|
225
224
|
return this.checkStatusAndLoginPromise
|
|
226
225
|
}
|
|
227
226
|
|
|
228
227
|
checkJdStatusAndLogin(options) {
|
|
229
228
|
return this.checkStatusAndLogin(options)
|
|
230
229
|
}
|
|
231
230
|
|
|
232
231
|
|
|
233
232
|
doLoginForJdPin(options = {}) {
|
|
234
233
|
return this.doLogin(options)
|
|
235
234
|
}
|
|
236
235
|
|
|
237
236
|
getEid() {
|
|
238
237
|
if (typeof jd !== 'undefined' && jd.getEid) {
|
|
239
238
|
return new Promise((resolve, reject) => {
|
|
240
239
|
jd.getEid({
|
|
241
240
|
success: (res: { eid: string }) => {
|
|
242
241
|
resolve(res)
|
|
243
242
|
},
|
|
244
243
|
fail: (err: any) => {
|
|
245
244
|
reject(err)
|
|
246
245
|
},
|
|
247
246
|
})
|
|
248
247
|
})
|
|
249
248
|
} else {
|
|
250
249
|
return Promise.resolve(false)
|
|
251
250
|
}
|
|
252
251
|
}
|
|
253
252
|
|
|
254
253
|
toLogin(options = {}): Promise<any> {
|
|
255
254
|
return this.wxAppLoginInstance
|
|
256
255
|
.getLoginPromise({
|
|
257
256
|
mode: 'silent',
|
|
258
257
|
loginColor: {
|
|
259
258
|
biz: WXAPP_BIZ_KEY,
|
|
260
259
|
dpin: 0,
|
|
261
260
|
},
|
|
262
261
|
...options,
|
|
263
262
|
})
|
|
264
263
|
.then(res => {
|
|
265
264
|
console.log('微信app登录返回信息,微信侧返回code为0表示成功', res)
|
|
266
265
|
setTimeout(() => {
|
|
267
266
|
console.log(
|
|
268
267
|
'微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie',
|
|
269
268
|
)
|
|
270
269
|
this.getLoginCookie(`${Date.now()}`)
|
|
271
270
|
}, 500)
|
|
272
271
|
})
|
|
273
272
|
.catch(err => {
|
|
274
273
|
console.log('微信app登录异常返回信息,也获取cookie', err)
|
|
275
274
|
this.getLoginCookie(`${Date.now()}`)
|
|
276
275
|
})
|
|
277
276
|
}
|
|
278
277
|
|
|
279
278
|
doLogin(options) {
|
|
280
279
|
console.log('触发松果小程序 doLogin() new new')
|
|
281
280
|
return new Promise((resolve, reject) => {
|
|
282
281
|
jd.login({
|
|
283
282
|
success: res => {
|
|
284
283
|
if (res.code) {
|
|
285
284
|
console.log('[common]松果小程序登录成功', res.code)
|
|
286
285
|
jd.redirectTo({
|
|
287
286
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
288
287
|
...this.info.originQueryInfo,
|
|
289
288
|
})}`,
|
|
290
289
|
})
|
|
291
290
|
resolve(res)
|
|
292
291
|
} else {
|
|
293
292
|
console.error('[common]松果小程序登录失败', res.errMsg)
|
|
294
293
|
reject()
|
|
295
294
|
}
|
|
296
295
|
},
|
|
297
296
|
fail: res => {
|
|
298
297
|
console.error('[common]松果小程序登录失败', res.errMsg)
|
|
299
298
|
reject()
|
|
300
299
|
},
|
|
301
300
|
})
|
|
302
301
|
})
|
|
303
302
|
}
|
|
304
303
|
|
|
305
304
|
getLoginCookie(updateKey = 'wxapp') {
|
|
306
305
|
return new Promise(resolve => {
|
|
307
306
|
console.log('开始获取更新wxapp中的cookie信息', updateKey)
|
|
308
307
|
if (
|
|
309
308
|
this.config.wqCookie &&
|
|
310
309
|
this.config.wqCookieStr &&
|
|
311
310
|
this.config.getWqCookieKey === updateKey
|
|
312
311
|
) {
|
|
313
312
|
console.log('已有存储wxapp中的cookie信息,直接返回', this.config)
|
|
314
313
|
resolve({
|
|
315
314
|
wqCookie: this.config.wqCookie,
|
|
316
315
|
wqCookieStr: this.config.wqCookieStr,
|
|
317
316
|
})
|
|
318
317
|
} else {
|
|
319
318
|
if (isPublishToWxapp) {
|
|
320
319
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
321
320
|
if (getWxappCookieObj) {
|
|
322
321
|
const getCookieObj = getWxappCookieObj['_data']
|
|
323
322
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
324
323
|
const {
|
|
325
324
|
pin = '',
|
|
326
325
|
visitkey = '-1',
|
|
327
326
|
wq_unionid = '',
|
|
328
327
|
wxapp_openid = '',
|
|
329
328
|
} = wqCookie
|
|
330
329
|
this.info.loginState = true
|
|
331
330
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
332
331
|
this.info.userInfo.wqVisitkey = visitkey
|
|
333
332
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
334
333
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
335
334
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
336
335
|
if (getUserAddress) {
|
|
337
336
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
338
337
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
|
|
339
338
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
340
339
|
: ''
|
|
341
340
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
342
341
|
Taro.eventCenter.trigger(
|
|
343
342
|
TaroEventType.USER_AREA_UPDATE,
|
|
344
343
|
this.info.pageInfo.address,
|
|
345
344
|
)
|
|
346
345
|
}
|
|
347
346
|
if (this.miniAppLogInstance) {
|
|
348
347
|
this.miniAppLogInstance.set({
|
|
349
348
|
account: pin,
|
|
350
349
|
unionid: wq_unionid,
|
|
351
350
|
openid: wxapp_openid,
|
|
352
351
|
})
|
|
353
352
|
}
|
|
354
353
|
this.config.wqCookie = wqCookie
|
|
355
354
|
this.config.wqCookieStr = wqCookieStr
|
|
356
355
|
this.config.getWqCookieKey = updateKey
|
|
357
356
|
console.log('解析wxapp中的cookie信息成功,返回后存储', this.config)
|
|
358
357
|
resolve({
|
|
359
358
|
wqCookie,
|
|
360
359
|
wqCookieStr,
|
|
361
360
|
})
|
|
362
361
|
} else {
|
|
363
362
|
console.log(
|
|
364
363
|
'解析wxapp中的cookie信息异常,返回异常结果',
|
|
365
364
|
this.config,
|
|
366
365
|
)
|
|
367
366
|
resolve({
|
|
368
367
|
wqCookie: false,
|
|
369
368
|
wqCookieStr: false,
|
|
370
369
|
})
|
|
371
370
|
}
|
|
372
371
|
} else {
|
|
373
372
|
resolve({
|
|
374
373
|
wqCookie: false,
|
|
375
374
|
wqCookieStr: false,
|
|
376
375
|
})
|
|
377
376
|
}
|
|
378
377
|
}
|
|
379
378
|
})
|
|
380
379
|
}
|
|
381
380
|
|
|
382
381
|
|
|
383
382
|
checkLoginStatus() {
|
|
384
383
|
return this.getLoginCookie()
|
|
385
384
|
}
|
|
386
385
|
|
|
387
386
|
getAddressCachePromise = () => {
|
|
388
387
|
return Promise.reject('该方法只在APP内适用')
|
|
389
388
|
}
|
|
390
389
|
|
|
391
390
|
getDynamicConfig(key: string) {
|
|
392
391
|
console.warn(
|
|
393
392
|
'调用松果小程序的 getDynamicConfig(),注意,此方法还未实现!',
|
|
394
393
|
)
|
|
395
394
|
return null
|
|
396
395
|
}
|
|
397
396
|
|
|
398
397
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
399
398
|
const createUpdateQueryInfo: {
|
|
400
399
|
query: {
|
|
401
400
|
shopId?: string | number
|
|
402
401
|
venderId?: string | number
|
|
403
402
|
}
|
|
404
403
|
updateShopInfoState: boolean
|
|
405
404
|
} = Object.assign(
|
|
406
405
|
{},
|
|
407
406
|
{
|
|
408
407
|
query: {},
|
|
409
408
|
updateShopInfoState: false,
|
|
410
409
|
},
|
|
411
410
|
updateQuery,
|
|
412
411
|
)
|
|
413
412
|
console.log(
|
|
414
413
|
'获取当前下发的店铺查询参数',
|
|
415
414
|
updateQuery,
|
|
416
415
|
'获取之前保存的shopInfo店铺查询参数',
|
|
417
416
|
this.info?.shopInfo,
|
|
418
417
|
)
|
|
419
418
|
const { query, updateShopInfoState } = createUpdateQueryInfo
|
|
420
419
|
const { shopId, venderId } = query
|
|
421
420
|
if (updateShopInfoState) {
|
|
422
421
|
this.info.queryInfo = {
|
|
423
422
|
...this.info.queryInfo,
|
|
424
423
|
...query,
|
|
425
424
|
}
|
|
426
425
|
if (shopId && venderId) {
|
|
427
426
|
this.info.shopInfo = {
|
|
428
427
|
shopId: `${shopId}`,
|
|
429
428
|
venderId: `${venderId}`,
|
|
430
429
|
}
|
|
431
430
|
}
|
|
432
431
|
} else {
|
|
433
432
|
this.info.queryInfo = {
|
|
434
433
|
...query,
|
|
435
434
|
}
|
|
436
435
|
this.info.originQueryInfo = {
|
|
437
436
|
...query,
|
|
438
437
|
}
|
|
439
438
|
if (
|
|
440
439
|
this.info.shopInfo?.shopId &&
|
|
441
440
|
this.info.shopInfo?.venderId &&
|
|
442
441
|
(this.info.shopInfo.shopId == shopId ||
|
|
443
442
|
this.info.shopInfo.venderId == venderId)
|
|
444
443
|
) {
|
|
445
444
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId
|
|
446
445
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId
|
|
447
446
|
console.log(
|
|
448
447
|
'当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数',
|
|
449
448
|
this.info.queryInfo,
|
|
450
449
|
)
|
|
451
450
|
}
|
|
452
451
|
}
|
|
453
452
|
this.info.queryInfo['shopId'] &&
|
|
454
453
|
(this.info.queryInfo['shopId'] = `${this.info.queryInfo['shopId']}`)
|
|
455
454
|
this.info.queryInfo['venderId'] &&
|
|
456
455
|
(this.info.queryInfo['venderId'] = `${this.info.queryInfo['venderId']}`)
|
|
457
456
|
console.log(
|
|
458
457
|
'weapp===获取店铺下发查询参数\n',
|
|
459
458
|
query,
|
|
460
459
|
'\n获取店铺最后查询参数\n',
|
|
461
460
|
this.info.queryInfo,
|
|
462
461
|
'\n是否为更新店铺状态\n',
|
|
463
462
|
updateShopInfoState,
|
|
464
463
|
)
|
|
465
464
|
}
|
|
465
|
+
import Taro from "@tarojs/taro";
|
|
466
466
|
appEid,
|
|
467
467
|
userPinKey,
|
|
468
468
|
jdUserLoginState,
|
|
469
469
|
WXAPP_LOGIN,
|
|
470
470
|
WXAPP_BIZ,
|
|
471
471
|
WXAPP_USER_INFO,
|
|
472
472
|
WXAPP_NAVIGATOR,
|
|
473
473
|
WXAPP_REPORT_GDT,
|
|
474
474
|
WXAPP_PARAMS_SIGN,
|
|
475
475
|
WXAPP_FINGER_REPORT,
|
|
476
476
|
WXAPP_REPORT_MANAGE,
|
|
477
477
|
BUSINESS_TYPE,
|
|
478
478
|
SHOP_MENU_ID_TYPE,
|
|
479
479
|
SHOP_MENU_ID_NAME,
|
|
480
480
|
SECTION_HOME_TAB_NAME_TYPE,
|
|
481
481
|
SECTION_HOME_TAB_TYPE,
|
|
482
482
|
TaroEventType,
|
|
483
483
|
WX_BUSINESS_TYPE,
|
|
484
484
|
WXAPP_BIZ_KEY,
|
|
485
485
|
getSystemInfos,
|
|
486
486
|
getTaroStorageKeyValue,
|
|
487
487
|
removeTaroStorageKey,
|
|
488
488
|
setTaroStorage,
|
|
489
489
|
getWxAppCookieStr,
|
|
490
490
|
objectToUrlEncode,
|
|
491
491
|
abTestLabels: {},
|
|
492
492
|
loginState: jdUserLoginState,
|
|
493
493
|
cookiesStr: "",
|
|
494
494
|
userInfo: userPinKey,
|
|
495
495
|
pageInfo: {
|
|
496
496
|
wxBusinessType: WX_BUSINESS_TYPE.SHOP,
|
|
497
497
|
address: "",
|
|
498
498
|
addressCommaStr: "",
|
|
499
499
|
un_area: "",
|
|
500
500
|
vapptype: "1",
|
|
501
501
|
pageType: "home",
|
|
502
502
|
dataType: BUSINESS_TYPE.ONLINE,
|
|
503
503
|
floorExposureInfo: {},
|
|
504
504
|
floorVideInfo: {},
|
|
505
505
|
productVideInfo: {},
|
|
506
506
|
tabsLoadAllDataInfo: {
|
|
507
507
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]:
|
|
508
508
|
false,
|
|
509
509
|
[SHOP_MENU_ID_NAME[SHOP_MENU_ID_TYPE.CLASSIFY]]: true,
|
|
510
510
|
},
|
|
511
511
|
updateShopInfosAllState: false,
|
|
512
512
|
isVipShop: false,
|
|
513
513
|
isJdShowNativeImmersivePlayer: false,
|
|
514
514
|
...shopConfig,
|
|
515
515
|
pageScrollTop: 0,
|
|
516
516
|
pageIdxHeightInfo: {
|
|
517
517
|
list: [],
|
|
518
518
|
},
|
|
519
519
|
shopNavBarHeight: 0,
|
|
520
520
|
},
|
|
521
521
|
defaultQueryLogInfo: {
|
|
522
522
|
sourceType: "JDshop",
|
|
523
523
|
sourceValue: "",
|
|
524
524
|
moduleId: "none",
|
|
525
525
|
entrance: "none",
|
|
526
526
|
},
|
|
527
527
|
originQueryInfo: {},
|
|
528
528
|
sysInfo: {
|
|
529
529
|
windowWidth: 0,
|
|
530
530
|
windowHeight: 0,
|
|
531
531
|
eid: appEid,
|
|
532
532
|
netWorkType: "4g",
|
|
533
533
|
jdBottomBarHeight: 0,
|
|
534
534
|
jdNativeHeaderHeight: 0,
|
|
535
535
|
},
|
|
536
536
|
queryInfo: {},
|
|
537
537
|
shopInfo: {},
|
|
538
538
|
openAppData: {},
|
|
539
539
|
public info: CommonInterFace.BaseConfigInfo;
|
|
540
540
|
public config: {
|
|
541
541
|
[key: string]: any;
|
|
542
542
|
};
|
|
543
543
|
public lazyContainer: CommonInterFace.lazyContainer;
|
|
544
544
|
public rootEleNode: HTMLElement | null;
|
|
545
545
|
public miniApplogUtil: CommonInterFace.MiniApplogUtil;
|
|
546
546
|
public miniAppLogInstance: CommonInterFace.MiniAppLog | null;
|
|
547
547
|
public checkStatusAndLoginPromise: object | null;
|
|
548
548
|
public wxAppLoginInstance: CommonInterFace.WxAppLogin;
|
|
549
549
|
public wxAppBizInstance: CommonInterFace.WxAppUserInfo;
|
|
550
550
|
public wxAppUserInfoInstance: CommonInterFace.WxAppUserInfo;
|
|
551
551
|
public wxAppReportManageInstance: CommonInterFace.wxAppReportManage;
|
|
552
552
|
public wxAppReportGDTInstance: CommonInterFace.WxAppReportGDT;
|
|
553
553
|
public wxAppNavigatorInstance: CommonInterFace.WxAppNavigator;
|
|
554
554
|
public wxAppParamsSignInstance: CommonInterFace.wxAppParamsSign;
|
|
555
555
|
public wxAppFingerReportInstance: CommonInterFace.wxAppParamsSign;
|
|
556
556
|
public wxAppSubsGuider: CommonInterFace.wxAppParamsSign;
|
|
557
557
|
public loadJsSdkList: Array<any>
|
|
558
558
|
public loadJsSdkListCachePromise: any
|
|
559
559
|
constructor(opt) {
|
|
560
560
|
this.info = this._getConfig(opt);
|
|
561
561
|
this.config = {};
|
|
562
562
|
this.lazyContainer = {
|
|
563
563
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN]]: {
|
|
564
564
|
appLazyContainerList: [],
|
|
565
565
|
appLazyFinishContainerList: [],
|
|
566
566
|
},
|
|
567
567
|
[SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION]]: {
|
|
568
568
|
appLazyContainerList: [],
|
|
569
569
|
appLazyFinishContainerList: [],
|
|
570
570
|
},
|
|
571
571
|
};
|
|
572
572
|
this.loadJsSdkList = []
|
|
573
573
|
this.loadJsSdkListCachePromise = {}
|
|
574
574
|
this.rootEleNode = null;
|
|
575
575
|
this.miniApplogUtil = MiniAppLogUtil;
|
|
576
576
|
this.miniAppLogInstance = null;
|
|
577
577
|
this.checkStatusAndLoginPromise = null;
|
|
578
578
|
this.wxAppLoginInstance = WXAPP_LOGIN;
|
|
579
579
|
this.wxAppBizInstance = WXAPP_BIZ;
|
|
580
580
|
this.wxAppUserInfoInstance = WXAPP_USER_INFO;
|
|
581
581
|
this.wxAppReportManageInstance = WXAPP_REPORT_MANAGE;
|
|
582
582
|
this.wxAppReportGDTInstance = WXAPP_REPORT_GDT;
|
|
583
583
|
this.wxAppNavigatorInstance = WXAPP_NAVIGATOR;
|
|
584
584
|
this.wxAppParamsSignInstance = WXAPP_PARAMS_SIGN;
|
|
585
585
|
this.wxAppFingerReportInstance = WXAPP_FINGER_REPORT
|
|
586
586
|
? new WXAPP_FINGER_REPORT()
|
|
587
587
|
: {};
|
|
588
588
|
this.wxAppSubsGuider = null;
|
|
589
589
|
}
|
|
590
590
|
_getConfig(opt) {
|
|
591
591
|
return Object.assign({}, DefaultConfig, opt);
|
|
592
592
|
}
|
|
593
593
|
|
|
594
594
|
taskTimeoutPromise(callBack, timeout = 2000) {
|
|
595
595
|
return new Promise((resolve) => {
|
|
596
596
|
setTimeout(() => {
|
|
597
597
|
const getCallBackRes = typeof callBack === "function" && callBack();
|
|
598
598
|
return resolve(getCallBackRes || false);
|
|
599
599
|
}, timeout);
|
|
600
600
|
});
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
updateBusinessDomainAndApi(domain, api) {
|
|
604
604
|
}
|
|
605
605
|
|
|
606
606
|
getFullScreenHeight(systemInfo) {
|
|
607
607
|
const { screenHeight, statusBarHeight, isAndroid } = systemInfo;
|
|
608
608
|
let result = screenHeight;
|
|
609
609
|
if (statusBarHeight > 20 && isAndroid) {
|
|
610
610
|
result = screenHeight + statusBarHeight;
|
|
611
611
|
}
|
|
612
612
|
return result;
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
getTabBarHeight(systemInfo) {
|
|
616
616
|
const { statusBarHeight, isAndroid, isIOS } = systemInfo;
|
|
617
617
|
let result = 50;
|
|
618
618
|
if (statusBarHeight > 20) {
|
|
619
619
|
if (isIOS) {
|
|
620
620
|
result = 84;
|
|
621
621
|
} else if (isAndroid) {
|
|
622
622
|
result = 53;
|
|
623
623
|
}
|
|
624
624
|
}
|
|
625
625
|
return result;
|
|
626
626
|
}
|
|
627
627
|
|
|
628
628
|
getSystemInfo() {
|
|
629
629
|
const info: UtilsInterFace.taroGetSystemInfoSyncRes =
|
|
630
630
|
getSystemInfos() || {};
|
|
631
631
|
const actualNavBarHeight =
|
|
632
632
|
(info?.navBarHeight || 0) + (info?.navBarExtendHeight || 0);
|
|
633
633
|
const headerHeight = actualNavBarHeight + (info?.statusBarHeight || 0);
|
|
634
634
|
const fullScreenHeight = this.getFullScreenHeight(info);
|
|
635
635
|
const tabBarHeight = this.getTabBarHeight(info);
|
|
636
636
|
const safeContentHeight = fullScreenHeight - headerHeight;
|
|
637
637
|
this.info.sysInfo = {
|
|
638
638
|
...this.info.sysInfo,
|
|
639
639
|
...info,
|
|
640
640
|
actualNavBarHeight,
|
|
641
641
|
headerHeight,
|
|
642
642
|
fullScreenHeight,
|
|
643
643
|
tabBarHeight,
|
|
644
644
|
safeContentHeight,
|
|
645
645
|
};
|
|
646
646
|
this.getEid().then((res: { eid: string }) => {
|
|
647
647
|
res && res.eid && (this.info.sysInfo["eid"] = res.eid);
|
|
648
648
|
});
|
|
649
649
|
if (this.info.sysInfo["hostVersionName"]) {
|
|
650
650
|
this.info.sysInfo["hostAppVersion"] = Number(
|
|
651
651
|
this.info.sysInfo["hostVersionName"].replace(/\./g, "")
|
|
652
652
|
);
|
|
653
653
|
}
|
|
654
654
|
this.info.sysInfo["wifiVideoAutoPlay"] = false;
|
|
655
655
|
this.getNetWorkType();
|
|
656
656
|
}
|
|
657
657
|
async updateMPaasConfig() {}
|
|
658
658
|
|
|
659
659
|
getNetWorkType() {
|
|
660
660
|
Taro.getNetworkType().then((getRes) => {
|
|
661
661
|
getRes &&
|
|
662
662
|
getRes.networkType &&
|
|
663
663
|
(this.info.sysInfo["netWorkType"] = getRes.networkType);
|
|
664
664
|
});
|
|
665
665
|
}
|
|
666
666
|
getAPPUseStraightCorner () {
|
|
667
667
|
return Promise.resolve(false)
|
|
668
668
|
}
|
|
669
669
|
|
|
670
670
|
checkStatusAndLogin(options = {}) {
|
|
671
671
|
this.checkStatusAndLoginPromise = new Promise((resolve, reject) => {
|
|
672
672
|
console.log(
|
|
673
673
|
"微信小程序登录状态及获取cookie状态的promise,之前登录状态",
|
|
674
674
|
this.info.loginState
|
|
675
675
|
);
|
|
676
676
|
this.toLogin(options)
|
|
677
677
|
.then((res) => {
|
|
678
678
|
console.log("微信小程序登录状态结果,成功", res);
|
|
679
679
|
this.info.loginState = true;
|
|
680
680
|
resolve(res);
|
|
681
681
|
})
|
|
682
682
|
.catch((err) => {
|
|
683
683
|
console.log("微信小程序登录异常状态结果", err);
|
|
684
684
|
this.doLogin(options)
|
|
685
685
|
.then((res2) => {
|
|
686
686
|
console.log("微信小程序wxDoLogin强制登陆成功:", res2);
|
|
687
687
|
this.info.loginState = true;
|
|
688
688
|
resolve(res2);
|
|
689
689
|
})
|
|
690
690
|
.catch((err2) => {
|
|
691
691
|
console.log("微信小程序wxDoLogin强制登陆失败:", err2);
|
|
692
692
|
this.checkStatusAndLoginPromise = null;
|
|
693
693
|
reject(err2);
|
|
694
694
|
});
|
|
695
695
|
});
|
|
696
696
|
});
|
|
697
697
|
return this.checkStatusAndLoginPromise;
|
|
698
698
|
}
|
|
699
699
|
|
|
700
700
|
checkJdStatusAndLogin(options) {
|
|
701
701
|
return this.checkStatusAndLogin(options);
|
|
702
702
|
}
|
|
703
703
|
|
|
704
704
|
|
|
705
705
|
doLoginForJdPin(options = {}) {
|
|
706
706
|
return this.doLogin(options);
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
getEid() {
|
|
710
710
|
if (typeof jd !== "undefined" && jd.getEid) {
|
|
711
711
|
return new Promise((resolve, reject) => {
|
|
712
712
|
jd.getEid({
|
|
713
713
|
success: (res: { eid: string }) => {
|
|
714
714
|
resolve(res);
|
|
715
715
|
},
|
|
716
716
|
fail: (err: any) => {
|
|
717
717
|
reject(err);
|
|
718
718
|
},
|
|
719
719
|
});
|
|
720
720
|
});
|
|
721
721
|
} else {
|
|
722
722
|
return Promise.resolve(false);
|
|
723
723
|
}
|
|
724
724
|
}
|
|
725
725
|
|
|
726
726
|
toLogin(options = {}): Promise<any> {
|
|
727
727
|
return this.wxAppLoginInstance
|
|
728
728
|
.getLoginPromise({
|
|
729
729
|
mode: "silent",
|
|
730
730
|
loginColor: {
|
|
731
731
|
biz: WXAPP_BIZ_KEY,
|
|
732
732
|
dpin: 0,
|
|
733
733
|
},
|
|
734
734
|
...options,
|
|
735
735
|
})
|
|
736
736
|
.then((res) => {
|
|
737
737
|
console.log("微信app登录返回信息,微信侧返回code为0表示成功", res);
|
|
738
738
|
setTimeout(() => {
|
|
739
739
|
console.log(
|
|
740
740
|
"微信app登录返回成功后,后台会写入cookie,有延迟,这里延迟500ms去获取最新cookie"
|
|
741
741
|
);
|
|
742
742
|
this.getLoginCookie(`${Date.now()}`);
|
|
743
743
|
}, 500);
|
|
744
744
|
})
|
|
745
745
|
.catch((err) => {
|
|
746
746
|
console.log("微信app登录异常返回信息,也获取cookie", err);
|
|
747
747
|
this.getLoginCookie(`${Date.now()}`);
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
|
|
751
751
|
doLogin(options) {
|
|
752
752
|
console.log("触发松果小程序 doLogin() new new");
|
|
753
753
|
return new Promise((resolve, reject) => {
|
|
754
754
|
jd.login({
|
|
755
755
|
success: (res) => {
|
|
756
756
|
if (res.code) {
|
|
757
757
|
console.log("[common]松果小程序登录成功", res.code);
|
|
758
758
|
jd.redirectTo({
|
|
759
759
|
url: `/pages/shopx/pages/index/index?${objectToUrlEncode({
|
|
760
760
|
...this.info.originQueryInfo,
|
|
761
761
|
})}`,
|
|
762
762
|
});
|
|
763
763
|
resolve(res);
|
|
764
764
|
} else {
|
|
765
765
|
console.error("[common]松果小程序登录失败", res.errMsg);
|
|
766
766
|
reject();
|
|
767
767
|
}
|
|
768
768
|
},
|
|
769
769
|
fail: (res) => {
|
|
770
770
|
console.error("[common]松果小程序登录失败", res.errMsg);
|
|
771
771
|
reject();
|
|
772
772
|
},
|
|
773
773
|
});
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
776
|
|
|
777
777
|
getLoginCookie(updateKey = "wxapp") {
|
|
778
778
|
return new Promise((resolve) => {
|
|
779
779
|
console.log("开始获取更新wxapp中的cookie信息", updateKey);
|
|
780
780
|
if (
|
|
781
781
|
this.config.wqCookie &&
|
|
782
782
|
this.config.wqCookieStr &&
|
|
783
783
|
this.config.getWqCookieKey === updateKey
|
|
784
784
|
) {
|
|
785
785
|
console.log("已有存储wxapp中的cookie信息,直接返回", this.config);
|
|
786
786
|
resolve({
|
|
787
787
|
wqCookie: this.config.wqCookie,
|
|
788
788
|
wqCookieStr: this.config.wqCookieStr,
|
|
789
789
|
});
|
|
790
790
|
} else {
|
|
791
791
|
if (isPublishToWxapp) {
|
|
792
792
|
const getWxappCookieObj = getTaroStorageKeyValue("cookies") || null;
|
|
793
793
|
if (getWxappCookieObj) {
|
|
794
794
|
const getCookieObj = getWxappCookieObj["_data"];
|
|
795
795
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj);
|
|
796
796
|
const {
|
|
797
797
|
pin = "",
|
|
798
798
|
visitkey = "-1",
|
|
799
799
|
wq_unionid = "",
|
|
800
800
|
wxapp_openid = "",
|
|
801
801
|
} = wqCookie;
|
|
802
802
|
this.info.loginState = true;
|
|
803
803
|
this.info.userInfo.wqCookie = wqCookieStr;
|
|
804
804
|
this.info.userInfo.wqVisitkey = visitkey;
|
|
805
805
|
console.log("获取用户完整cookie信息", getCookieObj);
|
|
806
806
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress();
|
|
807
807
|
console.log("获取微信用户地址信息", getUserAddress);
|
|
808
808
|
if (getUserAddress) {
|
|
809
809
|
this.info.pageInfo.address = getUserAddress?.areaId;
|
|
810
810
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo.address
|
|
811
811
|
? this.info.pageInfo.address.replace(/_/g, ",")
|
|
812
812
|
: "";
|
|
813
813
|
this.info.pageInfo.un_area = this.info.pageInfo.address;
|
|
814
814
|
Taro.eventCenter.trigger(
|
|
815
815
|
TaroEventType.USER_AREA_UPDATE,
|
|
816
816
|
this.info.pageInfo.address
|
|
817
817
|
);
|
|
818
818
|
}
|
|
819
819
|
if (this.miniAppLogInstance) {
|
|
820
820
|
this.miniAppLogInstance.set({
|
|
821
821
|
account: pin,
|
|
822
822
|
unionid: wq_unionid,
|
|
823
823
|
openid: wxapp_openid,
|
|
824
824
|
});
|
|
825
825
|
}
|
|
826
826
|
this.config.wqCookie = wqCookie;
|
|
827
827
|
this.config.wqCookieStr = wqCookieStr;
|
|
828
828
|
this.config.getWqCookieKey = updateKey;
|
|
829
829
|
console.log("解析wxapp中的cookie信息成功,返回后存储", this.config);
|
|
830
830
|
resolve({
|
|
831
831
|
wqCookie,
|
|
832
832
|
wqCookieStr,
|
|
833
833
|
});
|
|
834
834
|
} else {
|
|
835
835
|
console.log(
|
|
836
836
|
"解析wxapp中的cookie信息异常,返回异常结果",
|
|
837
837
|
this.config
|
|
838
838
|
);
|
|
839
839
|
resolve({
|
|
840
840
|
wqCookie: false,
|
|
841
841
|
wqCookieStr: false,
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
844
|
} else {
|
|
845
845
|
resolve({
|
|
846
846
|
wqCookie: false,
|
|
847
847
|
wqCookieStr: false,
|
|
848
848
|
});
|
|
849
849
|
}
|
|
850
850
|
}
|
|
851
851
|
});
|
|
852
852
|
}
|
|
853
853
|
|
|
854
854
|
|
|
855
855
|
checkLoginStatus() {
|
|
856
856
|
return this.getLoginCookie();
|
|
857
857
|
}
|
|
858
858
|
|
|
859
859
|
getAddressCachePromise = () => {
|
|
860
860
|
return Promise.reject("该方法只在APP内适用");
|
|
861
861
|
};
|
|
862
862
|
|
|
863
863
|
getDynamicConfig(key: string) {
|
|
864
864
|
console.warn(
|
|
865
865
|
"调用松果小程序的 getDynamicConfig(),注意,此方法还未实现!"
|
|
866
866
|
);
|
|
867
867
|
return null;
|
|
868
868
|
}
|
|
869
869
|
|
|
870
870
|
updatePageAndLogInfo(updateQuery = {}) {
|
|
871
871
|
const createUpdateQueryInfo: {
|
|
872
872
|
query: {
|
|
873
873
|
shopId?: string | number;
|
|
874
874
|
venderId?: string | number;
|
|
875
875
|
};
|
|
876
876
|
updateShopInfoState: boolean;
|
|
877
877
|
} = Object.assign(
|
|
878
878
|
{},
|
|
879
879
|
{
|
|
880
880
|
query: {},
|
|
881
881
|
updateShopInfoState: false,
|
|
882
882
|
},
|
|
883
883
|
updateQuery
|
|
884
884
|
);
|
|
885
885
|
console.log(
|
|
886
886
|
"获取当前下发的店铺查询参数",
|
|
887
887
|
updateQuery,
|
|
888
888
|
"获取之前保存的shopInfo店铺查询参数",
|
|
889
889
|
this.info?.shopInfo
|
|
890
890
|
);
|
|
891
891
|
const { query, updateShopInfoState } = createUpdateQueryInfo;
|
|
892
892
|
const { shopId, venderId } = query;
|
|
893
893
|
if (updateShopInfoState) {
|
|
894
894
|
this.info.queryInfo = {
|
|
895
895
|
...this.info.queryInfo,
|
|
896
896
|
...query,
|
|
897
897
|
};
|
|
898
898
|
if (shopId && venderId) {
|
|
899
899
|
this.info.shopInfo = {
|
|
900
900
|
shopId: `${shopId}`,
|
|
901
901
|
venderId: `${venderId}`,
|
|
902
902
|
};
|
|
903
903
|
}
|
|
904
904
|
} else {
|
|
905
905
|
this.info.queryInfo = {
|
|
906
906
|
...query,
|
|
907
907
|
};
|
|
908
908
|
this.info.originQueryInfo = {
|
|
909
909
|
...query,
|
|
910
910
|
};
|
|
911
911
|
if (
|
|
912
912
|
this.info.shopInfo?.shopId &&
|
|
913
913
|
this.info.shopInfo?.venderId &&
|
|
914
914
|
(this.info.shopInfo.shopId == shopId ||
|
|
915
915
|
this.info.shopInfo.venderId == venderId)
|
|
916
916
|
) {
|
|
917
917
|
this.info.queryInfo.shopId = this.info.shopInfo.shopId;
|
|
918
918
|
this.info.queryInfo.venderId = this.info.shopInfo.venderId;
|
|
919
919
|
console.log(
|
|
920
920
|
"当前存储的店铺shopId和venderId与下发的店铺信息shopId或者venderId为同一个,补充shopId或者venderId查询参数",
|
|
921
921
|
this.info.queryInfo
|
|
922
922
|
);
|
|
923
923
|
}
|
|
924
924
|
}
|
|
925
925
|
this.info.queryInfo["shopId"] &&
|
|
926
926
|
(this.info.queryInfo["shopId"] = `${this.info.queryInfo["shopId"]}`);
|
|
927
927
|
this.info.queryInfo["venderId"] &&
|
|
928
928
|
(this.info.queryInfo["venderId"] = `${this.info.queryInfo["venderId"]}`);
|
|
929
929
|
console.log(
|
|
930
930
|
"weapp===获取店铺下发查询参数\n",
|
|
931
931
|
query,
|
|
932
932
|
"\n获取店铺最后查询参数\n",
|
|
933
933
|
this.info.queryInfo,
|
|
934
934
|
"\n是否为更新店铺状态\n",
|
|
935
935
|
updateShopInfoState
|
|
936
936
|
);
|
|
937
937
|
}
|
|
938
938
|
renderNextTickLoadSdk(){
|
|
939
939
|
console.warn("暂未实现 index.jd.ts")
|
|
940
940
|
}
|
|
941
941
|
loadOtherSdk(){
|
|
942
942
|
console.warn("暂未实现 index.jd.ts")
|
|
943
943
|
}
|
|
944
944
|
loadItemSdkPromise(jsInfo = {}) {
|
|
945
945
|
console.warn('暂未实现 index.jd.ts')
|
|
946
946
|
}
|