jufubao-third 1.0.8 → 1.0.9
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/package.json +2 -2
- package/src/components/JfbThirdBlock/JfbThirdBlock.vue +6 -4
- package/src/components/JfbThirdBlock/JfbThirdBlockLess.less +6 -5
- package/src/components/JfbThirdPay/JfbThirdPay.vue +13 -11
- package/src/components/JfbThirdPay/JfbThirdPayLess.less +6 -5
- package/src/components/JfbThirdPay/WalletMix.js +30 -4
- package/src/mixins/componentsMixins.js +530 -46
- package/src/mixins/locationMixins.js +93 -9
- package/src/mixins/pageEditx.js +180 -84
- package/src/mixins/pageEvent.js +195 -16
- package/src/mixins/pageMain.js +2 -1
- package/src/mixins/pageUitls.js +336 -98
- package/src/mixins/posterMixins.js +122 -0
package/src/mixins/pageEvent.js
CHANGED
|
@@ -1,76 +1,245 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
import {JfbEvent} from "@/utils/xd.event";
|
|
3
|
-
|
|
3
|
+
import {mapActions, mapMutations, mapState} from 'vuex';
|
|
4
|
+
import storage from "@/common/storage";
|
|
5
|
+
import {getCacheTime} from "@/common/common";
|
|
6
|
+
import {isThirdLogin} from "@/utils/xd.base";
|
|
4
7
|
/**
|
|
5
8
|
* @description 绑定生命周期 + 操作事件类方法
|
|
6
9
|
*/
|
|
7
10
|
export default {
|
|
11
|
+
computed:{
|
|
12
|
+
...mapState(['shareInfo'])
|
|
13
|
+
},
|
|
8
14
|
data(){
|
|
9
15
|
return {
|
|
10
16
|
isFirst: true, //是否为首次访问
|
|
11
17
|
currentPagesIsShow: false, //当前页面是否为显示状态
|
|
12
18
|
layoutInfo: null, //框架信息
|
|
13
19
|
options: null, //参数信息
|
|
20
|
+
scrollDetail: 0,
|
|
14
21
|
|
|
22
|
+
//窗口高度
|
|
23
|
+
windowHeight:0,
|
|
24
|
+
//相同城市临是存储第三方定位信息
|
|
25
|
+
sameCityChangeLocationKey: 'xd_same_city_change_three_map',
|
|
26
|
+
//保存上一次定位信息
|
|
27
|
+
locationStorageKey: "xd_three_map",
|
|
28
|
+
|
|
29
|
+
scrolltimer: null
|
|
15
30
|
}
|
|
16
31
|
},
|
|
32
|
+
created() {
|
|
33
|
+
this.$xdRoot.$emit('setLayoutPageBg', null);
|
|
34
|
+
},
|
|
17
35
|
onLoad(options) {
|
|
18
36
|
this.options = options;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
this.isOnLoad = true;
|
|
38
|
+
|
|
39
|
+
// #ifdef MP-WEIXIN
|
|
40
|
+
this.init(options);
|
|
41
|
+
this.$xdLog.getARMS().pageShow(this.options);
|
|
42
|
+
wx.onAppRoute(this.handleRouter)
|
|
43
|
+
// #endif
|
|
44
|
+
|
|
45
|
+
// #ifdef H5
|
|
46
|
+
if(this.isCheckAuth) this.setBusinessCodeSave(options, this.pageAttr);
|
|
47
|
+
this.$xdLog.setProject(`App.onLoad`, 'App.pages.onLoad.done');
|
|
48
|
+
this.onInitLoad();
|
|
49
|
+
if(isThirdLogin().isICB){
|
|
50
|
+
this.$nextTick(()=>{
|
|
51
|
+
setTimeout(()=>{
|
|
52
|
+
this.handleIcbHeader();
|
|
53
|
+
}, 500)
|
|
54
|
+
})
|
|
28
55
|
}
|
|
56
|
+
// #endif
|
|
57
|
+
|
|
29
58
|
},
|
|
30
59
|
onPageScroll(e) {
|
|
31
|
-
|
|
60
|
+
//预览模式不处理
|
|
61
|
+
if(this.$configProject.isPreview || this.currentPagesIsShow === false) return;
|
|
62
|
+
|
|
63
|
+
if(this.scrolltimer) {
|
|
64
|
+
clearTimeout(this.scrolltimer);
|
|
65
|
+
this.scrolltimer = null;
|
|
66
|
+
}
|
|
67
|
+
this.scrolltimer = setTimeout(()=>{
|
|
68
|
+
console.warn(`event.onPageScroll.onJfbScroll:${e.scrollTop}`);
|
|
69
|
+
},500)
|
|
32
70
|
new JfbEvent('onJfbScroll', {
|
|
33
71
|
vm: this,
|
|
34
72
|
data: {e, options: this.options},
|
|
35
|
-
})
|
|
73
|
+
});
|
|
74
|
+
this.scrollDetail = e.scrollTop;
|
|
36
75
|
},
|
|
37
76
|
onReachBottom(e) {
|
|
77
|
+
//预览模式不处理
|
|
78
|
+
if(this.$configProject.isPreview || this.currentPagesIsShow === false) return;
|
|
38
79
|
console.warn('event.onReachBottom.onJfbReachBottom');
|
|
39
80
|
new JfbEvent('onJfbReachBottom', {
|
|
40
81
|
vm: this,
|
|
41
82
|
data: {e, options: this.options},
|
|
42
83
|
})
|
|
43
84
|
},
|
|
85
|
+
// #ifdef H5
|
|
86
|
+
onBackPress(e) {
|
|
87
|
+
this.onJfbSystemBack(e)
|
|
88
|
+
},
|
|
89
|
+
// #endif
|
|
90
|
+
// #ifdef MP-WEIXIN
|
|
91
|
+
onShareAppMessage(message){
|
|
92
|
+
console.warn(`shareInfo=>${JSON.stringify(this.shareInfo)}`);
|
|
93
|
+
return this.shareInfo;
|
|
94
|
+
},
|
|
95
|
+
// #endif
|
|
44
96
|
onShow() {
|
|
45
97
|
this.currentPagesIsShow = true;
|
|
46
98
|
if (!this.isFirst) {
|
|
47
99
|
console.log('exec.onShow', new Date().getTime() - this.time, 'ms');
|
|
48
100
|
console.warn('event.onShow.onJfbShow');
|
|
101
|
+
|
|
102
|
+
//设置页面headers参数
|
|
103
|
+
this.setPagesHeader(this.$xdUniHelper.cloneDeep(this.pageHeadersInfo));
|
|
104
|
+
|
|
105
|
+
//设置业务线与公共参数
|
|
106
|
+
const bussCode = this.setBusinessCodeSave(this.$xdUniHelper.parseURL().params, this.pageAttr);
|
|
107
|
+
this.setCommonPagesParams(this.pageAttr, bussCode)
|
|
49
108
|
new JfbEvent('onJfbShow', {
|
|
50
109
|
vm: this,
|
|
51
110
|
data: this.options,
|
|
52
|
-
})
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
// #ifdef MP-WEIXIN
|
|
115
|
+
this.$xdLog.getARMS().pageShow(this.options);
|
|
116
|
+
wx.onAppRoute(this.handleRouter)
|
|
117
|
+
// #endif
|
|
118
|
+
|
|
53
119
|
}
|
|
54
120
|
if (this.isFirst) {
|
|
55
121
|
this.isFirst = false;
|
|
56
122
|
}
|
|
123
|
+
this.setPageTitle();
|
|
124
|
+
|
|
57
125
|
},
|
|
58
126
|
onHide() {
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
this.setShareInfo({});
|
|
59
130
|
this.currentPagesIsShow = false;
|
|
60
131
|
new JfbEvent('onJfbHide', {
|
|
61
132
|
vm: this,
|
|
62
133
|
data: this.options,
|
|
63
|
-
})
|
|
134
|
+
});
|
|
135
|
+
this.updateLocation();
|
|
136
|
+
// #ifdef MP-WEIXIN
|
|
137
|
+
this.$xdLog.getARMS().pageHide(this.options);
|
|
138
|
+
wx.offAppRoute(this.handleRouter)
|
|
139
|
+
// #endif
|
|
64
140
|
},
|
|
65
141
|
onUnload() {
|
|
142
|
+
this.setShareInfo({});
|
|
66
143
|
console.warn('event.onUnload.onJfbUnload');
|
|
67
144
|
this.currentPagesIsShow = false;
|
|
68
145
|
new JfbEvent('onJfbUnload', {
|
|
69
146
|
vm: this,
|
|
70
147
|
data: this.options,
|
|
71
|
-
})
|
|
148
|
+
});
|
|
149
|
+
this.updateLocation()
|
|
150
|
+
},
|
|
151
|
+
destroyed() {
|
|
152
|
+
this.updateLocation();
|
|
153
|
+
this.setShareInfo({});
|
|
72
154
|
},
|
|
73
155
|
methods: {
|
|
156
|
+
...mapMutations(['setLocationInfo', 'setShareInfo']),
|
|
157
|
+
|
|
158
|
+
// #ifdef MP-WEIXIN
|
|
159
|
+
handleRouter(router){
|
|
160
|
+
if(router.openType === 'navigateBack') {
|
|
161
|
+
if(this.currentPagesIsShow === false) {
|
|
162
|
+
this.onJfbSystemBack(router);
|
|
163
|
+
wx.offAppRoute(this.handleRouter);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
//debugger
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
// #endif
|
|
171
|
+
|
|
172
|
+
handleIcbHeader(){
|
|
173
|
+
let btn = document.getElementsByClassName('uni-page-head-btn').item(0);
|
|
174
|
+
let fat = document.getElementsByClassName('uni-page-head-ft').item(0);
|
|
175
|
+
//非系统导航模式不处理
|
|
176
|
+
if(!btn) return;
|
|
177
|
+
const styles = window.getComputedStyle(btn, null);
|
|
178
|
+
const color = styles.getPropertyValue('color');
|
|
179
|
+
const display = styles.getPropertyValue('display');
|
|
180
|
+
if(display === 'block') {
|
|
181
|
+
fat.innerHTML = '关闭';
|
|
182
|
+
fat.style.fontSize = '14px';
|
|
183
|
+
fat.style.color = color;
|
|
184
|
+
fat.style.marginTop = '-4px';
|
|
185
|
+
fat.style.marginLeft = '10px'
|
|
186
|
+
}
|
|
187
|
+
const handle = ()=>{
|
|
188
|
+
if(display === 'block') {
|
|
189
|
+
window.ICBC_SDK.back();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
fat.removeEventListener('click',handle);
|
|
193
|
+
fat.addEventListener('click',handle, false)
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @description 页面卸载,隐藏时候触发更新经纬度状态
|
|
198
|
+
*/
|
|
199
|
+
updateLocation(){
|
|
200
|
+
let location = storage.get(this.sameCityChangeLocationKey)
|
|
201
|
+
storage.remove(this.sameCityChangeLocationKey);
|
|
202
|
+
if(location) {
|
|
203
|
+
let time = getCacheTime(this);
|
|
204
|
+
storage.set(this.locationStorageKey,location, time);
|
|
205
|
+
this.setLocationInfo(location)
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
onInitLoad(){
|
|
209
|
+
let {isCheckAuth, isOnLoad, layoutInfo} = this;
|
|
210
|
+
if(
|
|
211
|
+
isCheckAuth
|
|
212
|
+
&& layoutInfo !== null
|
|
213
|
+
&& isOnLoad
|
|
214
|
+
) {
|
|
215
|
+
let nowTime = new Date().getTime();
|
|
216
|
+
this.$xdLog.setProject('App.init.userTime', {
|
|
217
|
+
userTime: `${nowTime - this.time}ms`,
|
|
218
|
+
userStartTime: this.time,
|
|
219
|
+
endTime: nowTime,
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
new JfbEvent('onJfbLoad', {
|
|
223
|
+
vm: this,
|
|
224
|
+
data: this.options,
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
this.$xdRoot.$emit('setLayoutPageBg', null);
|
|
228
|
+
|
|
229
|
+
let currentPath = '';
|
|
230
|
+
// #ifdef MP-WEIXIN
|
|
231
|
+
currentPath = this.$xdUniHelper.getCurrentPages().path;
|
|
232
|
+
// #endif
|
|
233
|
+
// #ifdef H5
|
|
234
|
+
currentPath = location.href;
|
|
235
|
+
// #endif
|
|
236
|
+
//5s上报
|
|
237
|
+
if ((nowTime - this.time) > 10000) {
|
|
238
|
+
this.$xdLog.setARMSCustomError('slow.link', `Slow.Link--${nowTime - this.time}ms--${currentPath}`)
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
},
|
|
74
243
|
|
|
75
244
|
getCurrentPagesIsShow(){
|
|
76
245
|
return this.currentPagesIsShow
|
|
@@ -81,7 +250,9 @@ export default {
|
|
|
81
250
|
* @return {Object}
|
|
82
251
|
*/
|
|
83
252
|
handleDone(layout) {
|
|
253
|
+
this.$xdLog.setProject(`App.layout`, 'App.pages.layout.done',layout);
|
|
84
254
|
this.layoutInfo = layout;
|
|
255
|
+
this.onInitLoad();
|
|
85
256
|
|
|
86
257
|
// #ifdef H5
|
|
87
258
|
if (this.$configProject.viewType === 'preview') {
|
|
@@ -116,6 +287,14 @@ export default {
|
|
|
116
287
|
}
|
|
117
288
|
},
|
|
118
289
|
|
|
290
|
+
onJfbSystemBack(system){
|
|
291
|
+
console.warn('event.onSystemBack.onJfbBack');
|
|
292
|
+
new JfbEvent('onJfbSystemBack', {
|
|
293
|
+
vm: this,
|
|
294
|
+
data: system
|
|
295
|
+
})
|
|
296
|
+
},
|
|
297
|
+
|
|
119
298
|
/**
|
|
120
299
|
* @description 绑定自定义导航时候返回事件方法
|
|
121
300
|
*/
|
|
@@ -123,7 +302,7 @@ export default {
|
|
|
123
302
|
console.warn('event.back.onJfbBack');
|
|
124
303
|
new JfbEvent('onJfbBack', {
|
|
125
304
|
vm: this,
|
|
126
|
-
data: this.options
|
|
305
|
+
data: this.options
|
|
127
306
|
})
|
|
128
307
|
},
|
|
129
308
|
}
|
package/src/mixins/pageMain.js
CHANGED
|
@@ -12,6 +12,7 @@ export default {
|
|
|
12
12
|
time: new Date().getTime(),//与页面加载速度有关
|
|
13
13
|
isOnLoad: false, //是否执行了onload事件
|
|
14
14
|
options: null, //页面参数
|
|
15
|
+
pagesParams:'',//页面Json设置参数
|
|
15
16
|
site_id: null, //当前网站ID
|
|
16
17
|
layoutInfo: null, //框架数据
|
|
17
18
|
indexHeight: 0, //预览模式更新Iframe高度有关
|
|
@@ -89,7 +90,7 @@ export default {
|
|
|
89
90
|
},
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
|
-
* @description Container数据转化
|
|
93
|
+
* @description Container数据转化(废弃)
|
|
93
94
|
* @param containers {Array} 使用业务插件数据
|
|
94
95
|
* @return {Object}
|
|
95
96
|
*/
|