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