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