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