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