@conecli/cone-render 0.9.1-shop2.26 → 0.9.1-shop2.28
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/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/pageType.ts +1 -1
- package/dist/common/sgmCustomCode.ts +1 -1
- package/dist/common/token/token.jd.ts +1 -1
- package/dist/components/base/CustomVideo/common.ts +1 -0
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/Price/Base/index.tsx +1 -1
- 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/floorItem.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/interface/service.ts +1 -1
- package/dist/jumpEventReport/index.weapp.ts +1 -1
- package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
- package/dist/modules/ContainerFloorList/index.tsx +1 -1
- package/dist/service/http/colorSign.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/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/utils.ts +1 -1
- package/package.json +1 -1
package/dist/common/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
floorVideInfo: {},
|
|
3
2
|
productVideInfo: {},
|
|
4
3
|
isVipShop: false,
|
|
5
4
|
isJdShowNativeImmersivePlayer: false,
|
|
6
5
|
pageIdxHeightInfo: {
|
|
7
6
|
list: []
|
|
8
7
|
},
|
|
9
8
|
jdBottomBarHeight: 0,
|
|
10
9
|
jdNativeHeaderHeight: 0,
|
|
11
10
|
openAppData: {}
|
|
12
11
|
public config: {
|
|
13
12
|
[key: string]: any
|
|
14
13
|
}
|
|
15
14
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
16
15
|
public renderedIsvComponents: CommonInterFace.renderedIsvComponents
|
|
17
16
|
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
|
getAPPUseStraightCorner () {
|
|
35
34
|
return Promise.resolve(false)
|
|
36
35
|
}
|
|
37
36
|
checkStatusAndLogin(options = {}) {
|
|
38
37
|
|
|
39
38
|
checkJdStatusAndLogin(options){
|
|
40
39
|
return this.checkStatusAndLogin(options)
|
|
41
40
|
}
|
|
42
41
|
|
|
43
42
|
doLoginForJdPin(options = {}) {
|
|
44
43
|
return this.doLogin(options)
|
|
45
44
|
}
|
|
46
45
|
|
|
47
46
|
getLoginCookie(updateKey = 'wxapp') {
|
|
48
47
|
return new Promise((resolve) => {
|
|
49
48
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
50
49
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
51
50
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
52
51
|
resolve({
|
|
53
52
|
wqCookie: this.config.wqCookie,
|
|
54
53
|
wqCookieStr: this.config.wqCookieStr,
|
|
55
54
|
})
|
|
56
55
|
}else {
|
|
57
56
|
if (isPublishToWxapp) {
|
|
58
57
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
59
58
|
if (getWxappCookieObj) {
|
|
60
59
|
const getCookieObj = getWxappCookieObj['_data']
|
|
61
60
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
62
61
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
63
62
|
this.info.loginState = true
|
|
64
63
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
65
64
|
this.info.userInfo.wqVisitkey = visitkey
|
|
66
65
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
67
66
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
68
67
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
69
68
|
if (getUserAddress) {
|
|
70
69
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
71
70
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
72
71
|
.address
|
|
73
72
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
74
73
|
: ''
|
|
75
74
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
76
75
|
Taro.eventCenter.trigger(
|
|
77
76
|
TaroEventType.USER_AREA_UPDATE,
|
|
78
77
|
this.info.pageInfo.address,
|
|
79
78
|
)
|
|
80
79
|
}
|
|
81
80
|
if(this.miniAppLogInstance){
|
|
82
81
|
this.miniAppLogInstance.set({
|
|
83
82
|
account: pin,
|
|
84
83
|
unionid: wq_unionid,
|
|
85
84
|
openid: wxapp_openid,
|
|
86
85
|
})
|
|
87
86
|
}
|
|
88
87
|
this.config.wqCookie = wqCookie
|
|
89
88
|
this.config.wqCookieStr = wqCookieStr
|
|
90
89
|
this.config.getWqCookieKey = updateKey
|
|
91
90
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
92
91
|
resolve({
|
|
93
92
|
wqCookie,
|
|
94
93
|
wqCookieStr,
|
|
95
94
|
})
|
|
96
95
|
}else {
|
|
97
96
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
98
97
|
resolve({
|
|
99
98
|
wqCookie: false,
|
|
100
99
|
wqCookieStr: false,
|
|
101
100
|
})
|
|
102
101
|
}
|
|
103
102
|
}else {
|
|
104
103
|
resolve({
|
|
105
104
|
wqCookie: false,
|
|
106
105
|
wqCookieStr: false,
|
|
107
106
|
})
|
|
108
107
|
}
|
|
109
108
|
}
|
|
110
109
|
})
|
|
111
110
|
}
|
|
112
111
|
return this.getLoginCookie()
|
|
113
112
|
|
|
114
113
|
getAddressCachePromise = () => {
|
|
115
114
|
return Promise.reject("该方法只在APP内适用")
|
|
116
115
|
}
|
|
117
116
|
|
|
118
117
|
getDynamicConfig(key: string){
|
|
119
118
|
console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!')
|
|
120
119
|
return null
|
|
121
120
|
}
|
|
122
121
|
renderNextTickLoadSdk(){
|
|
123
122
|
console.warn("暂未实现 index.ts")
|
|
124
123
|
}
|
|
125
124
|
loadOtherSdk(){
|
|
126
125
|
console.warn("暂未实现 index.ts")
|
|
127
126
|
}
|
|
128
127
|
loadItemSdkPromise() {
|
|
129
128
|
console.warn('暂未实现 index.ts')
|
|
130
129
|
}
|
|
130
|
+
import Taro from '@tarojs/taro'
|
|
131
131
|
floorVideInfo: {},
|
|
132
132
|
productVideInfo: {},
|
|
133
133
|
isVipShop: false,
|
|
134
134
|
isJdShowNativeImmersivePlayer: false,
|
|
135
135
|
pageIdxHeightInfo: {
|
|
136
136
|
list: []
|
|
137
137
|
},
|
|
138
138
|
jdBottomBarHeight: 0,
|
|
139
139
|
jdNativeHeaderHeight: 0,
|
|
140
140
|
openAppData: {}
|
|
141
141
|
public config: {
|
|
142
142
|
[key: string]: any
|
|
143
143
|
}
|
|
144
144
|
public lazyContainer: CommonInterFace.lazyContainer
|
|
145
145
|
public renderedIsvComponents: CommonInterFace.renderedIsvComponents
|
|
146
146
|
public loadJsSdkList: Array<any>
|
|
147
147
|
public loadJsSdkListCachePromise: any
|
|
148
148
|
this.config = {}
|
|
149
149
|
this.loadJsSdkList = []
|
|
150
150
|
this.loadJsSdkListCachePromise = {}
|
|
151
151
|
this.renderedIsvComponents = {}
|
|
152
152
|
|
|
153
153
|
taskTimeoutPromise(callBack, timeout = 2000){
|
|
154
154
|
return new Promise((resolve) => {
|
|
155
155
|
setTimeout(() => {
|
|
156
156
|
const getCallBackRes = typeof callBack === 'function' && callBack()
|
|
157
157
|
return resolve(getCallBackRes || false)
|
|
158
158
|
}, timeout)
|
|
159
159
|
})
|
|
160
160
|
}
|
|
161
161
|
removeJdAndroidRquestEventForTouchStart(){}
|
|
162
162
|
this.info.sysInfo['wifiVideoAutoPlay'] = false
|
|
163
163
|
getAPPUseStraightCorner () {
|
|
164
164
|
return Promise.resolve(false)
|
|
165
165
|
}
|
|
166
166
|
checkStatusAndLogin(options = {}) {
|
|
167
167
|
|
|
168
168
|
checkJdStatusAndLogin(options){
|
|
169
169
|
return this.checkStatusAndLogin(options)
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
doLoginForJdPin(options = {}) {
|
|
173
173
|
return this.doLogin(options)
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
getLoginCookie(updateKey = 'wxapp') {
|
|
177
177
|
return new Promise((resolve) => {
|
|
178
178
|
console.log("开始获取更新wxapp中的cookie信息", updateKey)
|
|
179
179
|
if(this.config.wqCookie && this.config.wqCookieStr && this.config.getWqCookieKey === updateKey){
|
|
180
180
|
console.log("已有存储wxapp中的cookie信息,直接返回",this.config)
|
|
181
181
|
resolve({
|
|
182
182
|
wqCookie: this.config.wqCookie,
|
|
183
183
|
wqCookieStr: this.config.wqCookieStr,
|
|
184
184
|
})
|
|
185
185
|
}else {
|
|
186
186
|
if (isPublishToWxapp) {
|
|
187
187
|
const getWxappCookieObj = getTaroStorageKeyValue('cookies') || null
|
|
188
188
|
if (getWxappCookieObj) {
|
|
189
189
|
const getCookieObj = getWxappCookieObj['_data']
|
|
190
190
|
const { wqCookie, wqCookieStr } = getWxAppCookieStr(getCookieObj)
|
|
191
191
|
const { pin = '', visitkey = '-1', wq_unionid = '', wxapp_openid = '' } = wqCookie
|
|
192
192
|
this.info.loginState = true
|
|
193
193
|
this.info.userInfo.wqCookie = wqCookieStr
|
|
194
194
|
this.info.userInfo.wqVisitkey = visitkey
|
|
195
195
|
console.log('获取用户完整cookie信息', getCookieObj)
|
|
196
196
|
const getUserAddress = this.wxAppUserInfoInstance.getAddress()
|
|
197
197
|
console.log('获取微信用户地址信息', getUserAddress)
|
|
198
198
|
if (getUserAddress) {
|
|
199
199
|
this.info.pageInfo.address = getUserAddress?.areaId
|
|
200
200
|
this.info.pageInfo.addressCommaStr = this.info.pageInfo
|
|
201
201
|
.address
|
|
202
202
|
? this.info.pageInfo.address.replace(/_/g, ',')
|
|
203
203
|
: ''
|
|
204
204
|
this.info.pageInfo.un_area = this.info.pageInfo.address
|
|
205
205
|
Taro.eventCenter.trigger(
|
|
206
206
|
TaroEventType.USER_AREA_UPDATE,
|
|
207
207
|
this.info.pageInfo.address,
|
|
208
208
|
)
|
|
209
209
|
}
|
|
210
210
|
if(this.miniAppLogInstance){
|
|
211
211
|
this.miniAppLogInstance.set({
|
|
212
212
|
account: pin,
|
|
213
213
|
unionid: wq_unionid,
|
|
214
214
|
openid: wxapp_openid,
|
|
215
215
|
})
|
|
216
216
|
}
|
|
217
217
|
this.config.wqCookie = wqCookie
|
|
218
218
|
this.config.wqCookieStr = wqCookieStr
|
|
219
219
|
this.config.getWqCookieKey = updateKey
|
|
220
220
|
console.log("解析wxapp中的cookie信息成功,返回后存储",this.config)
|
|
221
221
|
resolve({
|
|
222
222
|
wqCookie,
|
|
223
223
|
wqCookieStr,
|
|
224
224
|
})
|
|
225
225
|
}else {
|
|
226
226
|
console.log("解析wxapp中的cookie信息异常,返回异常结果",this.config)
|
|
227
227
|
resolve({
|
|
228
228
|
wqCookie: false,
|
|
229
229
|
wqCookieStr: false,
|
|
230
230
|
})
|
|
231
231
|
}
|
|
232
232
|
}else {
|
|
233
233
|
resolve({
|
|
234
234
|
wqCookie: false,
|
|
235
235
|
wqCookieStr: false,
|
|
236
236
|
})
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
239
|
})
|
|
240
240
|
}
|
|
241
241
|
return this.getLoginCookie()
|
|
242
242
|
|
|
243
243
|
getAddressCachePromise = () => {
|
|
244
244
|
return Promise.reject("该方法只在APP内适用")
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
getDynamicConfig(key: string){
|
|
248
248
|
console.warn('调用默认的 getDynamicConfig(),注意,此方法还未实现!')
|
|
249
249
|
return null
|
|
250
250
|
}
|
|
251
251
|
renderNextTickLoadSdk(){
|
|
252
252
|
console.warn("暂未实现 index.ts")
|
|
253
253
|
}
|
|
254
254
|
loadOtherSdk(){
|
|
255
255
|
console.warn("暂未实现 index.ts")
|
|
256
256
|
}
|
|
257
257
|
loadItemSdkPromise(jsInfo = {}) {
|
|
258
258
|
console.warn('暂未实现 index.ts')
|
|
259
259
|
}
|
package/dist/common/pageType.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const getPageType = () => {
|
|
2
1
|
return process.env.BUILD_TYPE || ''
|
|
3
2
|
|
|
4
3
|
M_DECORATE = 'm-decorate',
|
|
5
4
|
M_RENDER_MODULE = 'm-render-module',
|
|
6
5
|
M_PREVIEW = 'm-preview',
|
|
7
6
|
M_ISV_PREVIEW = 'm-isv-preview',
|
|
8
7
|
MARKETING_PREVIEW = 'marketing-preview',
|
|
9
8
|
|
|
10
9
|
APP_VIEW = 'app-view',
|
|
11
10
|
APP_MEMBER = 'app-member',
|
|
12
11
|
APP_INTRODUCE = 'app-introduce',
|
|
13
12
|
APP_PROMOTION = 'app-promotion',
|
|
14
13
|
APP_CLASSIFY = 'app-classify',
|
|
15
14
|
APP_PRODUCT = 'app-product',
|
|
16
15
|
|
|
17
16
|
|
|
18
17
|
PC_VIEW = 'pc-view',
|
|
19
18
|
PC_VIEW1 = 'pc-view1',
|
|
20
19
|
PC_VIEW2 = 'pc-view2',
|
|
21
20
|
M_VIEW = 'm-view',
|
|
22
21
|
M_BSC_VIEW = 'm-bsc-view',
|
|
23
22
|
SALE_VIEW = 'sale-view',
|
|
24
23
|
VIP_VIEW = 'vip-view',
|
|
25
24
|
M_SEARCH = 'm-search',
|
|
26
25
|
M_INTRODUCE = 'm-introduce',
|
|
27
26
|
|
|
28
27
|
MEMBER_SHOPCARD = 'member-shopcard',
|
|
29
28
|
M_MEMBER = 'm-member',
|
|
30
29
|
M_MEMBER_SAM_BIND_CARD = 'm-member-sam-bind-card',
|
|
31
30
|
M_MEMBER_WATSONS_BIND_CARD = 'm-member-watsons-bind-card',
|
|
32
31
|
M_SAM_CARD = 'm-sam-card',
|
|
33
32
|
M_SAM_CENTER = 'm-sam-center',
|
|
34
33
|
M_WATSONS_CARD = 'm-watsons-card',
|
|
35
34
|
|
|
36
35
|
M_LOTTERY = 'm-lottery',
|
|
37
36
|
M_COUPON = 'm-coupon',
|
|
38
37
|
M_WARES = 'm-wares',
|
|
39
38
|
M_FAST_SHOPPING = 'm-fast-shopping',
|
|
40
39
|
M_SPECIAL_SECKILL = 'm-special-seckill',
|
|
41
40
|
WEAPP_SHOP = 'weapp-shop',
|
|
42
41
|
WEAPP_PROMOTION = 'weapp-promotion',
|
|
43
42
|
M_VIDEOS = 'm-videos',
|
|
43
|
+
export const getPageType = () => {
|
|
44
44
|
return process.env.BUILD_TYPE || ''
|
|
45
45
|
|
|
46
46
|
M_DECORATE = 'm-decorate',
|
|
47
47
|
M_RENDER_MODULE = 'm-render-module',
|
|
48
48
|
M_PREVIEW = 'm-preview',
|
|
49
49
|
M_ISV_PREVIEW = 'm-isv-preview',
|
|
50
50
|
MARKETING_PREVIEW = 'marketing-preview',
|
|
51
51
|
|
|
52
52
|
APP_VIEW = 'app-view',
|
|
53
53
|
APP_MEMBER = 'app-member',
|
|
54
54
|
APP_INTRODUCE = 'app-introduce',
|
|
55
55
|
APP_PROMOTION = 'app-promotion',
|
|
56
56
|
APP_CLASSIFY = 'app-classify',
|
|
57
57
|
APP_PRODUCT = 'app-product',
|
|
58
58
|
MEMBER_HOME = 'member-home',
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
PC_VIEW = 'pc-view',
|
|
62
62
|
PC_VIEW1 = 'pc-view1',
|
|
63
63
|
PC_VIEW2 = 'pc-view2',
|
|
64
64
|
M_VIEW = 'm-view',
|
|
65
65
|
M_BSC_VIEW = 'm-bsc-view',
|
|
66
66
|
SALE_VIEW = 'sale-view',
|
|
67
67
|
VIP_VIEW = 'vip-view',
|
|
68
68
|
M_SEARCH = 'm-search',
|
|
69
69
|
M_INTRODUCE = 'm-introduce',
|
|
70
70
|
|
|
71
71
|
MEMBER_SHOPCARD = 'member-shopcard',
|
|
72
72
|
M_MEMBER = 'm-member',
|
|
73
73
|
M_MEMBER_SAM_BIND_CARD = 'm-member-sam-bind-card',
|
|
74
74
|
M_MEMBER_WATSONS_BIND_CARD = 'm-member-watsons-bind-card',
|
|
75
75
|
M_SAM_CARD = 'm-sam-card',
|
|
76
76
|
M_SAM_CENTER = 'm-sam-center',
|
|
77
77
|
M_WATSONS_CARD = 'm-watsons-card',
|
|
78
78
|
|
|
79
79
|
M_LOTTERY = 'm-lottery',
|
|
80
80
|
M_COUPON = 'm-coupon',
|
|
81
81
|
M_WARES = 'm-wares',
|
|
82
82
|
M_FAST_SHOPPING = 'm-fast-shopping',
|
|
83
83
|
M_SPECIAL_SECKILL = 'm-special-seckill',
|
|
84
84
|
WEAPP_SHOP = 'weapp-shop',
|
|
85
85
|
WEAPP_PROMOTION = 'weapp-promotion',
|
|
86
86
|
M_VIDEOS = 'm-videos',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG = 'noType_'
|
|
2
1
|
IMAGE_LOAD = 'imageLazyLoadError',
|
|
3
2
|
GRAYSCALE = 'grayscale',
|
|
4
3
|
REMOTEMODULE_DATA = 'remoteModule_interface_dataError',
|
|
5
4
|
REMOTEMODULE_JS = 'remoteModule_render_jsError',
|
|
6
5
|
SYSTEMMODULE_JS = 'systemModule_render_jsError',
|
|
7
6
|
SYSTEMPDCMODULE_DATA = 'systemPdcModule_interface_dataError',
|
|
8
7
|
SYSTEMPDCMODULE_JS = 'systemPdcModule_render_jsError',
|
|
9
8
|
FLOORLAZYLOAD_DATA = 'floorLazyLoad_render_dataError',
|
|
9
|
+
export const NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG = 'noType_'
|
|
10
10
|
IMAGE_LOAD = 'imageLazyLoadError',
|
|
11
11
|
PRICE_RENDER = 'priceRenderError',
|
|
12
12
|
GRAYSCALE = 'grayscale',
|
|
13
13
|
REMOTEMODULE_DATA = 'remoteModule_interface_dataError',
|
|
14
14
|
REMOTEMODULE_JS = 'remoteModule_render_jsError',
|
|
15
15
|
SYSTEMMODULE_JS = 'systemModule_render_jsError',
|
|
16
16
|
SYSTEMPDCMODULE_DATA = 'systemPdcModule_interface_dataError',
|
|
17
17
|
SYSTEMPDCMODULE_JS = 'systemPdcModule_render_jsError',
|
|
18
18
|
FLOORLAZYLOAD_DATA = 'floorLazyLoad_render_dataError',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
console.log('load token.jd')
|
|
2
1
|
return new Promise((resolve) => {
|
|
3
2
|
if (window['jmfe']) {
|
|
4
3
|
window['jmfe'].isJDAppLogin().then(({ data }) => {
|
|
5
4
|
if (data === '1') {
|
|
6
5
|
resolve(true)
|
|
7
6
|
} else if (data === '0') {
|
|
8
7
|
resolve(false)
|
|
9
8
|
}
|
|
10
9
|
})
|
|
11
10
|
} else {
|
|
12
11
|
console.warn('jmfe对象不存在,可能没有提前动态引入jd-jssdk.js')
|
|
13
12
|
resolve(false)
|
|
14
13
|
}
|
|
15
14
|
})
|
|
16
15
|
return requestIsvToken(window.location.href)
|
|
17
16
|
if (window['jmfe']) {
|
|
18
17
|
window['jmfe'].toLogin(options)
|
|
19
18
|
} else {
|
|
20
19
|
console.warn('jmfe对象不存在,可能没有提前动态引入jd-jssdk.js')
|
|
21
20
|
}
|
|
22
21
|
if (window['jmfe']) {
|
|
23
22
|
console.log('registerCode:', code)
|
|
24
23
|
window['jmfe'].registerCode(code)
|
|
25
24
|
} else {
|
|
26
25
|
console.warn('jmfe对象不存在,可能没有提前引入jd-jssdk.js')
|
|
27
26
|
}
|
|
28
27
|
return new Promise((resolve) => {
|
|
29
28
|
console.log('requestIsvToken:', url)
|
|
30
29
|
if (window['jmfe']) {
|
|
31
30
|
window['jmfe']
|
|
32
31
|
.requestIsvToken(url)
|
|
33
32
|
.then((result: any) => {
|
|
34
33
|
console.log('requestIsvToken result:' + JSON.stringify(result))
|
|
35
34
|
const { status, data, msg } = result
|
|
36
35
|
if (status === '0') {
|
|
37
36
|
resolve(data || '')
|
|
38
37
|
} else {
|
|
39
38
|
resolve('')
|
|
40
39
|
}
|
|
41
40
|
})
|
|
42
41
|
.catch((e: any) => {
|
|
43
42
|
console.log('requestIsvToken error:' + JSON.stringify(e))
|
|
44
43
|
resolve('')
|
|
45
44
|
})
|
|
46
45
|
} else {
|
|
47
46
|
console.warn('jmfe对象不存在,可能没有提前引入jd-jssdk.js')
|
|
48
47
|
resolve('')
|
|
49
48
|
}
|
|
50
49
|
})
|
|
50
|
+
console.log('load token.jd')
|
|
51
51
|
return new Promise(resolve => {
|
|
52
52
|
if (window['jmfe']) {
|
|
53
53
|
window['jmfe'].isJDAppLogin().then(({ data }) => {
|
|
54
54
|
if (data === '1') {
|
|
55
55
|
resolve(true)
|
|
56
56
|
} else if (data === '0') {
|
|
57
57
|
resolve(false)
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
} else {
|
|
61
61
|
console.warn('jmfe对象不存在,可能没有提前动态引入jd-jssdk.js')
|
|
62
62
|
resolve(false)
|
|
63
63
|
}
|
|
64
64
|
})
|
|
65
65
|
return requestIsvToken(window.location.href)
|
|
66
66
|
if (window['jmfe']) {
|
|
67
67
|
window['jmfe'].toLogin(options)
|
|
68
68
|
} else {
|
|
69
69
|
console.warn('jmfe对象不存在,可能没有提前动态引入jd-jssdk.js')
|
|
70
70
|
}
|
|
71
71
|
if (window['jmfe']) {
|
|
72
72
|
console.log('registerCode:', code)
|
|
73
73
|
window['jmfe'].registerCode(code)
|
|
74
74
|
} else {
|
|
75
75
|
console.warn('jmfe对象不存在,可能没有提前引入jd-jssdk.js')
|
|
76
76
|
}
|
|
77
77
|
return new Promise(resolve => {
|
|
78
78
|
console.log('requestIsvToken:', url)
|
|
79
79
|
if (window['jmfe']) {
|
|
80
80
|
window['jmfe']
|
|
81
81
|
.requestIsvToken(url)
|
|
82
82
|
.then((result: any) => {
|
|
83
83
|
console.log('requestIsvToken result:' + JSON.stringify(result))
|
|
84
84
|
const { status, data, msg } = result
|
|
85
85
|
if (status === '0') {
|
|
86
86
|
resolve(data || '')
|
|
87
87
|
} else {
|
|
88
88
|
resolve('')
|
|
89
89
|
}
|
|
90
90
|
})
|
|
91
91
|
.catch((e: any) => {
|
|
92
92
|
console.log('requestIsvToken error:' + JSON.stringify(e))
|
|
93
93
|
resolve('')
|
|
94
94
|
})
|
|
95
95
|
} else {
|
|
96
96
|
console.warn('jmfe对象不存在,可能没有提前引入jd-jssdk.js')
|
|
97
97
|
resolve('')
|
|
98
98
|
}
|
|
99
99
|
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const MediaError = {
|
|
2
|
MEDIA_ERR_ABORTED: 1,
|
|
1
3
|
MEDIA_ERR_NETWORK: 2,
|
|
2
4
|
MEDIA_ERR_DECODE: 3,
|
|
3
5
|
MEDIA_ERR_SRC_NOT_SUPPORTED: 4,
|
|
4
6
|
[MediaError.MEDIA_ERR_ABORTED]: 'MEDIA_ERR_ABORTED',
|
|
5
7
|
[MediaError.MEDIA_ERR_NETWORK]: 'MEDIA_ERR_NETWORK',
|
|
6
8
|
[MediaError.MEDIA_ERR_DECODE]: 'MEDIA_ERR_DECODE',
|
|
7
9
|
[MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED]: 'MEDIA_ERR_SRC_NOT_SUPPORTED',
|
|
8
10
|
if (!error) {
|
|
9
11
|
return ''
|
|
10
12
|
}
|
|
11
13
|
const message = error.message
|
|
12
14
|
let s = ''
|
|
13
15
|
if (error?.code) {
|
|
14
16
|
s += codeMap[error.code] || 'UNKNOWN'
|
|
15
17
|
}
|
|
16
18
|
if (message?.length > 0) {
|
|
17
19
|
s += ` ${message}`
|
|
18
20
|
}
|
|
19
21
|
return `${error.constructor.name} ${error.code}: ${s}`
|