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