@conecli/cone-render 0.9.1-shop2.22 → 0.9.1-shop2.23
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/common/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
floorVideInfo: {},
|
|
3
2
|
productVideInfo: {},
|
|
4
3
|
isVipShop: false,
|
|
5
4
|
isJdShowNativeImmersivePlayer: false,
|
|
6
5
|
pageIdxHeightInfo: {
|
|
7
6
|
list: []
|
|
8
7
|
},
|
|
9
8
|
jdBottomBarHeight: 0,
|
|
10
9
|
jdNativeHeaderHeight: 0,
|
|
11
10
|
openAppData: {}
|
|
12
11
|
public config: {
|
|
13
12
|
[key: string]: any
|
|
14
13
|
}
|
|
15
14
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
16
15
|
public renderedIsvComponents: CommonInterFace.renderedIsvComponents
|
|
17
16
|
public loadJsSdkList: Array<any>
|
|
18
17
|
public loadJsSdkListCachePromise: any
|
|
19
18
|
this.config = {}
|
|
20
19
|
this.loadJsSdkList = []
|
|
21
20
|
this.loadJsSdkListCachePromise = {}
|
|
22
21
|
this.renderedIsvComponents = {}
|
|
23
22
|
|
|
24
23
|
taskTimeoutPromise(callBack, timeout = 2000){
|
|
25
24
|
return new Promise((resolve) => {
|
|
26
25
|
setTimeout(() => {
|
|
27
26
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
28
27
|
return resolve(getCallBackRes || false)
|
|
29
28
|
}, timeout)
|
|
30
29
|
})
|
|
31
30
|
}
|
|
32
31
|
removeJdAndroidRquestEventForTouchStart(){}
|
|
33
32
|
this.info.sysInfo['wifiVideoAutoPlay'] = false
|
|
34
33
|
checkStatusAndLogin(options = {}) {
|
|
35
34
|
|
|
36
35
|
checkJdStatusAndLogin(options){
|
|
37
36
|
return this.checkStatusAndLogin(options)
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
doLoginForJdPin(options = {}) {
|
|
41
40
|
return this.doLogin(options)
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
getLoginCookie(updateKey = 'wxapp') {
|
|
45
44
|
return new Promise((resolve) => {
|
|
46
45
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
47
46
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
48
47
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
49
48
|
resolve({
|
|
50
49
|
wqCookie: this.config.wqCookie,
|
|
51
50
|
wqCookieStr: this.config.wqCookieStr,
|
|
52
51
|
})
|
|
53
52
|
}else {
|
|
54
53
|
if (isPublishToWxapp) {
|
|
55
54
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
56
55
|
if (getWxappCookieObj) {
|
|
57
56
|
const getCookieObj = getWxappCookieObj['_data']
|
|
58
57
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
59
58
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
60
59
|
this.info.loginState = true
|
|
61
60
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
62
61
|
this.info.userInfo.wqVisitkey = visitkey
|
|
63
62
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
64
63
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
65
64
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
66
65
|
if (getUserAddress) {
|
|
67
66
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
68
67
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
69
68
|
.address
|
|
70
69
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
71
70
|
: ''
|
|
72
71
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
73
72
|
Taro.eventCenter.trigger(
|
|
74
73
|
TaroEventType.USER_AREA_UPDATE,
|
|
75
74
|
this.info.pageInfo.address,
|
|
76
75
|
)
|
|
77
76
|
}
|
|
78
77
|
if(this.miniAppLogInstance){
|
|
79
78
|
this.miniAppLogInstance.set({
|
|
80
79
|
account: pin,
|
|
81
80
|
unionid: wq_unionid,
|
|
82
81
|
openid: wxapp_openid,
|
|
83
82
|
})
|
|
84
83
|
}
|
|
85
84
|
this.config.wqCookie = wqCookie
|
|
86
85
|
this.config.wqCookieStr = wqCookieStr
|
|
87
86
|
this.config.getWqCookieKey = updateKey
|
|
88
87
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
89
88
|
resolve({
|
|
90
89
|
wqCookie,
|
|
91
90
|
wqCookieStr,
|
|
92
91
|
})
|
|
93
92
|
}else {
|
|
94
93
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
95
94
|
resolve({
|
|
96
95
|
wqCookie: false,
|
|
97
96
|
wqCookieStr: false,
|
|
98
97
|
})
|
|
99
98
|
}
|
|
100
99
|
}else {
|
|
101
100
|
resolve({
|
|
102
101
|
wqCookie: false,
|
|
103
102
|
wqCookieStr: false,
|
|
104
103
|
})
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
})
|
|
108
107
|
}
|
|
109
108
|
return this.getLoginCookie()
|
|
110
109
|
|
|
111
110
|
getAddressCachePromise = () => {
|
|
112
111
|
return Promise.reject("该方法只在APP内适用")
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
getDynamicConfig(key: string){
|
|
116
115
|
console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!')
|
|
117
116
|
return null
|
|
118
117
|
}
|
|
119
118
|
renderNextTickLoadSdk(){
|
|
120
119
|
console.warn("暂未实现 index.ts")
|
|
121
120
|
}
|
|
122
121
|
loadOtherSdk(){
|
|
123
122
|
console.warn("暂未实现 index.ts")
|
|
124
123
|
}
|
|
125
124
|
loadItemSdkPromise() {
|
|
126
125
|
console.warn('暂未实现 index.ts')
|
|
127
126
|
}
|
|
127
|
+
import Taro from '@tarojs/taro'
|
|
128
128
|
floorVideInfo: {},
|
|
129
129
|
productVideInfo: {},
|
|
130
130
|
isVipShop: false,
|
|
131
131
|
isJdShowNativeImmersivePlayer: false,
|
|
132
132
|
pageIdxHeightInfo: {
|
|
133
133
|
list: []
|
|
134
134
|
},
|
|
135
135
|
jdBottomBarHeight: 0,
|
|
136
136
|
jdNativeHeaderHeight: 0,
|
|
137
137
|
openAppData: {}
|
|
138
138
|
public config: {
|
|
139
139
|
[key: string]: any
|
|
140
140
|
}
|
|
141
141
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
142
142
|
public renderedIsvComponents: CommonInterFace.renderedIsvComponents
|
|
143
143
|
public loadJsSdkList: Array<any>
|
|
144
144
|
public loadJsSdkListCachePromise: any
|
|
145
145
|
this.config = {}
|
|
146
146
|
this.loadJsSdkList = []
|
|
147
147
|
this.loadJsSdkListCachePromise = {}
|
|
148
148
|
this.renderedIsvComponents = {}
|
|
149
149
|
|
|
150
150
|
taskTimeoutPromise(callBack, timeout = 2000){
|
|
151
151
|
return new Promise((resolve) => {
|
|
152
152
|
setTimeout(() => {
|
|
153
153
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
154
154
|
return resolve(getCallBackRes || false)
|
|
155
155
|
}, timeout)
|
|
156
156
|
})
|
|
157
157
|
}
|
|
158
158
|
removeJdAndroidRquestEventForTouchStart(){}
|
|
159
159
|
this.info.sysInfo['wifiVideoAutoPlay'] = false
|
|
160
160
|
getAPPUseStraightCorner () {
|
|
161
161
|
return Promise.resolve(false)
|
|
162
162
|
}
|
|
163
163
|
checkStatusAndLogin(options = {}) {
|
|
164
164
|
|
|
165
165
|
checkJdStatusAndLogin(options){
|
|
166
166
|
return this.checkStatusAndLogin(options)
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
doLoginForJdPin(options = {}) {
|
|
170
170
|
return this.doLogin(options)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
getLoginCookie(updateKey = 'wxapp') {
|
|
174
174
|
return new Promise((resolve) => {
|
|
175
175
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
176
176
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
177
177
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
178
178
|
resolve({
|
|
179
179
|
wqCookie: this.config.wqCookie,
|
|
180
180
|
wqCookieStr: this.config.wqCookieStr,
|
|
181
181
|
})
|
|
182
182
|
}else {
|
|
183
183
|
if (isPublishToWxapp) {
|
|
184
184
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
185
185
|
if (getWxappCookieObj) {
|
|
186
186
|
const getCookieObj = getWxappCookieObj['_data']
|
|
187
187
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
188
188
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
189
189
|
this.info.loginState = true
|
|
190
190
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
191
191
|
this.info.userInfo.wqVisitkey = visitkey
|
|
192
192
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
193
193
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
194
194
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
195
195
|
if (getUserAddress) {
|
|
196
196
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
197
197
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
198
198
|
.address
|
|
199
199
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
200
200
|
: ''
|
|
201
201
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
202
202
|
Taro.eventCenter.trigger(
|
|
203
203
|
TaroEventType.USER_AREA_UPDATE,
|
|
204
204
|
this.info.pageInfo.address,
|
|
205
205
|
)
|
|
206
206
|
}
|
|
207
207
|
if(this.miniAppLogInstance){
|
|
208
208
|
this.miniAppLogInstance.set({
|
|
209
209
|
account: pin,
|
|
210
210
|
unionid: wq_unionid,
|
|
211
211
|
openid: wxapp_openid,
|
|
212
212
|
})
|
|
213
213
|
}
|
|
214
214
|
this.config.wqCookie = wqCookie
|
|
215
215
|
this.config.wqCookieStr = wqCookieStr
|
|
216
216
|
this.config.getWqCookieKey = updateKey
|
|
217
217
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
218
218
|
resolve({
|
|
219
219
|
wqCookie,
|
|
220
220
|
wqCookieStr,
|
|
221
221
|
})
|
|
222
222
|
}else {
|
|
223
223
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
224
224
|
resolve({
|
|
225
225
|
wqCookie: false,
|
|
226
226
|
wqCookieStr: false,
|
|
227
227
|
})
|
|
228
228
|
}
|
|
229
229
|
}else {
|
|
230
230
|
resolve({
|
|
231
231
|
wqCookie: false,
|
|
232
232
|
wqCookieStr: false,
|
|
233
233
|
})
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
})
|
|
237
237
|
}
|
|
238
238
|
return this.getLoginCookie()
|
|
239
239
|
|
|
240
240
|
getAddressCachePromise = () => {
|
|
241
241
|
return Promise.reject("该方法只在APP内适用")
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
getDynamicConfig(key: string){
|
|
245
245
|
console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!')
|
|
246
246
|
return null
|
|
247
247
|
}
|
|
248
248
|
renderNextTickLoadSdk(){
|
|
249
249
|
console.warn("暂未实现 index.ts")
|
|
250
250
|
}
|
|
251
251
|
loadOtherSdk(){
|
|
252
252
|
console.warn("暂未实现 index.ts")
|
|
253
253
|
}
|
|
254
254
|
loadItemSdkPromise() {
|
|
255
255
|
console.warn('暂未实现 index.ts')
|
|
256
256
|
}
|