jufubao-base 1.0.238-beta1 → 1.0.238-beta68
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 +1 -1
- package/src/components/JfbBaseCard/JfbBaseCard.vue +26 -20
- package/src/components/JfbBaseCardEntry/JfbBaseCardEntry.vue +63 -62
- package/src/components/JfbBaseCardV2/Attr.js +22 -0
- package/src/components/JfbBaseCardV2/JfbBaseCardV2.vue +33 -13
- package/src/components/JfbBaseCardV3/Attr.js +22 -0
- package/src/components/JfbBaseCardV3/JfbBaseCardV3.vue +34 -23
- package/src/components/JfbBaseTfkCardLogin/JfbBaseTfkCardLogin.vue +11 -47
- package/src/mixins/cardListMixins.js +187 -0
- package/src/mixins/colorCardMixins.js +70 -2
- package/src/mixins/componentsMixins.js +50 -22
- package/src/mixins/locationMixins.js +119 -0
- package/src/mixins/newLocaltionMixins.js +753 -0
- package/src/mixins/openDebuggerMixins.js +74 -0
- package/src/mixins/pageEditx.js +347 -0
- package/src/mixins/pageEvent.js +330 -0
- package/src/mixins/pageMain.js +120 -0
- package/src/mixins/pageUitls.js +738 -0
- package/src/mixins/posterMixins.js +6 -2
- package/src/mixins/scrollListFixedHeigthMixins.js +174 -0
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import {JfbEvent} from "@/utils/xd.event";
|
|
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";
|
|
7
|
+
import {Base64} from "js-base64";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description 绑定生命周期 + 操作事件类方法
|
|
11
|
+
*/
|
|
12
|
+
export default {
|
|
13
|
+
computed:{
|
|
14
|
+
...mapState(['shareInfo'])
|
|
15
|
+
},
|
|
16
|
+
data(){
|
|
17
|
+
return {
|
|
18
|
+
isFirst: true, //是否为首次访问
|
|
19
|
+
currentPagesIsShow: false, //当前页面是否为显示状态
|
|
20
|
+
layoutInfo: null, //框架信息
|
|
21
|
+
options: null, //参数信息
|
|
22
|
+
scrollDetail: 0,
|
|
23
|
+
|
|
24
|
+
//窗口高度
|
|
25
|
+
windowHeight:0,
|
|
26
|
+
//相同城市临是存储第三方定位信息
|
|
27
|
+
sameCityChangeLocationKey: 'xd_same_city_change_three_map',
|
|
28
|
+
//保存上一次定位信息
|
|
29
|
+
locationStorageKey: "xd_three_map",
|
|
30
|
+
|
|
31
|
+
scrolltimer: null
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
created() {
|
|
35
|
+
this.$xdRoot.$emit('setLayoutPageBg', null);
|
|
36
|
+
},
|
|
37
|
+
onLoad(options) {
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.isOnLoad = true;
|
|
40
|
+
|
|
41
|
+
// #ifdef MP-WEIXIN
|
|
42
|
+
this.init(options);
|
|
43
|
+
this.$xdLog.getARMS().pageShow(this.options);
|
|
44
|
+
wx.onAppRoute(this.handleRouter)
|
|
45
|
+
// #endif
|
|
46
|
+
|
|
47
|
+
// #ifdef H5
|
|
48
|
+
if(this.isCheckAuth) this.setBusinessCodeSave(options, this.pageAttr);
|
|
49
|
+
this.$xdLog.setProject(`App.onLoad`, 'App.pages.onLoad.done');
|
|
50
|
+
this.onInitLoad();
|
|
51
|
+
if(isThirdLogin().isICB){
|
|
52
|
+
this.$nextTick(()=>{
|
|
53
|
+
setTimeout(()=>{
|
|
54
|
+
this.handleIcbHeader();
|
|
55
|
+
}, 500)
|
|
56
|
+
})
|
|
57
|
+
}
|
|
58
|
+
// #endif
|
|
59
|
+
|
|
60
|
+
},
|
|
61
|
+
onPageScroll(e) {
|
|
62
|
+
//预览模式不处理
|
|
63
|
+
if(this.$configProject.isPreview || this.currentPagesIsShow === false) return;
|
|
64
|
+
|
|
65
|
+
if(this.scrolltimer) {
|
|
66
|
+
clearTimeout(this.scrolltimer);
|
|
67
|
+
this.scrolltimer = null;
|
|
68
|
+
}
|
|
69
|
+
this.scrolltimer = setTimeout(()=>{
|
|
70
|
+
console.warn(`event.onPageScroll.onJfbScroll:${e.scrollTop}`);
|
|
71
|
+
},500)
|
|
72
|
+
new JfbEvent('onJfbScroll', {
|
|
73
|
+
vm: this,
|
|
74
|
+
data: {e, options: this.options},
|
|
75
|
+
});
|
|
76
|
+
this.scrollDetail = e.scrollTop;
|
|
77
|
+
},
|
|
78
|
+
onReachBottom(e) {
|
|
79
|
+
//预览模式不处理
|
|
80
|
+
if(this.$configProject.isPreview || this.currentPagesIsShow === false) return;
|
|
81
|
+
console.warn('event.onReachBottom.onJfbReachBottom');
|
|
82
|
+
new JfbEvent('onJfbReachBottom', {
|
|
83
|
+
vm: this,
|
|
84
|
+
data: {e, options: this.options},
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
// #ifdef H5
|
|
88
|
+
onBackPress(e) {
|
|
89
|
+
this.onJfbSystemBack(e)
|
|
90
|
+
},
|
|
91
|
+
// #endif
|
|
92
|
+
// #ifdef MP-WEIXIN
|
|
93
|
+
onShareAppMessage(message){
|
|
94
|
+
const promise = new Promise(resolve => {
|
|
95
|
+
console.warn(`shareInfo=>${JSON.stringify(this.shareInfo)}`);
|
|
96
|
+
let shareInfo = this.$xdUniHelper.cloneDeep(this.shareInfo);
|
|
97
|
+
if(this.$xdUniHelper.isEmpty(shareInfo)) {
|
|
98
|
+
const curPath = Base64.encodeURI(this.$xdUniHelper.parseURL().source);
|
|
99
|
+
shareInfo = {
|
|
100
|
+
path: `/pages/loading/loading?callback_local=${curPath}`
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
setTimeout(()=>{
|
|
104
|
+
resolve(shareInfo)
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
return{
|
|
109
|
+
promise
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
// #endif
|
|
113
|
+
onShow() {
|
|
114
|
+
this.currentPagesIsShow = true;
|
|
115
|
+
if (!this.isFirst) {
|
|
116
|
+
console.log('exec.onShow', new Date().getTime() - this.time, 'ms');
|
|
117
|
+
console.warn('event.onShow.onJfbShow');
|
|
118
|
+
|
|
119
|
+
//设置页面headers参数
|
|
120
|
+
this.setPagesHeader(this.$xdUniHelper.cloneDeep(this.pageHeadersInfo));
|
|
121
|
+
|
|
122
|
+
//设置业务线与公共参数
|
|
123
|
+
const bussCode = this.setBusinessCodeSave(this.$xdUniHelper.parseURL().params, this.pageAttr);
|
|
124
|
+
this.setCommonPagesParams(this.pageAttr, bussCode)
|
|
125
|
+
new JfbEvent('onJfbShow', {
|
|
126
|
+
vm: this,
|
|
127
|
+
data: this.options,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
// #ifdef MP-WEIXIN
|
|
132
|
+
this.$xdLog.getARMS().pageShow(this.options);
|
|
133
|
+
wx.onAppRoute(this.handleRouter)
|
|
134
|
+
// #endif
|
|
135
|
+
|
|
136
|
+
}
|
|
137
|
+
if (this.isFirst) {
|
|
138
|
+
this.isFirst = false;
|
|
139
|
+
}
|
|
140
|
+
this.setPageTitle();
|
|
141
|
+
|
|
142
|
+
},
|
|
143
|
+
onHide() {
|
|
144
|
+
this.setShareInfo({});
|
|
145
|
+
this.currentPagesIsShow = false;
|
|
146
|
+
new JfbEvent('onJfbHide', {
|
|
147
|
+
vm: this,
|
|
148
|
+
data: this.options,
|
|
149
|
+
});
|
|
150
|
+
this.updateLocation();
|
|
151
|
+
// #ifdef MP-WEIXIN
|
|
152
|
+
this.$xdLog.getARMS().pageHide(this.options);
|
|
153
|
+
wx.offAppRoute(this.handleRouter)
|
|
154
|
+
// #endif
|
|
155
|
+
this.setHasPopStatus({popId: null, action: 'close'});
|
|
156
|
+
},
|
|
157
|
+
onUnload() {
|
|
158
|
+
this.setShareInfo({});
|
|
159
|
+
console.warn('event.onUnload.onJfbUnload');
|
|
160
|
+
this.currentPagesIsShow = false;
|
|
161
|
+
new JfbEvent('onJfbUnload', {
|
|
162
|
+
vm: this,
|
|
163
|
+
data: this.options,
|
|
164
|
+
});
|
|
165
|
+
this.updateLocation();
|
|
166
|
+
this.setHasPopStatus({popId: null, action: 'close'});
|
|
167
|
+
},
|
|
168
|
+
destroyed() {
|
|
169
|
+
this.updateLocation();
|
|
170
|
+
this.setShareInfo({});
|
|
171
|
+
this.setHasPopStatus({popId: null, action: 'close'});
|
|
172
|
+
},
|
|
173
|
+
methods: {
|
|
174
|
+
...mapMutations(['setLocationInfo', 'setShareInfo']),
|
|
175
|
+
...mapActions(['setHasPopStatus']),
|
|
176
|
+
|
|
177
|
+
// #ifdef MP-WEIXIN
|
|
178
|
+
handleRouter(router){
|
|
179
|
+
if(router.openType === 'navigateBack') {
|
|
180
|
+
if(this.currentPagesIsShow === false) {
|
|
181
|
+
this.onJfbSystemBack(router);
|
|
182
|
+
wx.offAppRoute(this.handleRouter);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
//debugger
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
// #endif
|
|
190
|
+
|
|
191
|
+
handleIcbHeader(){
|
|
192
|
+
let btn = document.getElementsByClassName('uni-page-head-btn').item(0);
|
|
193
|
+
let fat = document.getElementsByClassName('uni-page-head-ft').item(0);
|
|
194
|
+
//非系统导航模式不处理
|
|
195
|
+
if(!btn) return;
|
|
196
|
+
const styles = window.getComputedStyle(btn, null);
|
|
197
|
+
const color = styles.getPropertyValue('color');
|
|
198
|
+
const display = styles.getPropertyValue('display');
|
|
199
|
+
if(display === 'block') {
|
|
200
|
+
fat.innerHTML = '关闭';
|
|
201
|
+
fat.style.fontSize = '14px';
|
|
202
|
+
fat.style.color = color;
|
|
203
|
+
fat.style.marginTop = '-4px';
|
|
204
|
+
fat.style.marginLeft = '10px'
|
|
205
|
+
}
|
|
206
|
+
const handle = ()=>{
|
|
207
|
+
if(display === 'block') {
|
|
208
|
+
window.ICBC_SDK.back();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
fat.removeEventListener('click',handle);
|
|
212
|
+
fat.addEventListener('click',handle, false)
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @description 页面卸载,隐藏时候触发更新经纬度状态
|
|
217
|
+
*/
|
|
218
|
+
updateLocation(){
|
|
219
|
+
let location = storage.get(this.sameCityChangeLocationKey)
|
|
220
|
+
storage.remove(this.sameCityChangeLocationKey);
|
|
221
|
+
if(location) {
|
|
222
|
+
let time = getCacheTime(this);
|
|
223
|
+
storage.set(this.locationStorageKey,location, time);
|
|
224
|
+
this.setLocationInfo(location)
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
onInitLoad(){
|
|
228
|
+
let {isCheckAuth, isOnLoad, layoutInfo} = this;
|
|
229
|
+
if(
|
|
230
|
+
isCheckAuth
|
|
231
|
+
&& layoutInfo !== null
|
|
232
|
+
&& isOnLoad
|
|
233
|
+
) {
|
|
234
|
+
let nowTime = new Date().getTime();
|
|
235
|
+
this.$xdLog.setProject('App.init.userTime', {
|
|
236
|
+
userTime: `${nowTime - this.time}ms`,
|
|
237
|
+
userStartTime: this.time,
|
|
238
|
+
endTime: nowTime,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
new JfbEvent('onJfbLoad', {
|
|
242
|
+
vm: this,
|
|
243
|
+
data: this.options,
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
this.$xdRoot.$emit('setLayoutPageBg', null);
|
|
247
|
+
|
|
248
|
+
let currentPath = '';
|
|
249
|
+
// #ifdef MP-WEIXIN
|
|
250
|
+
currentPath = this.$xdUniHelper.getCurrentPages().path;
|
|
251
|
+
// #endif
|
|
252
|
+
// #ifdef H5
|
|
253
|
+
currentPath = location.href;
|
|
254
|
+
// #endif
|
|
255
|
+
//5s上报
|
|
256
|
+
if ((nowTime - this.time) > 10000) {
|
|
257
|
+
this.$xdLog.setARMSCustomError('slow.link', `Slow.Link--${nowTime - this.time}ms--${currentPath}`)
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
},
|
|
262
|
+
|
|
263
|
+
getCurrentPagesIsShow(){
|
|
264
|
+
return this.currentPagesIsShow
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* @description 框架完成事件
|
|
268
|
+
* @param layout {object} 框架对象
|
|
269
|
+
* @return {Object}
|
|
270
|
+
*/
|
|
271
|
+
handleDone(layout) {
|
|
272
|
+
this.$xdLog.setProject(`App.layout`, 'App.pages.layout.done',layout);
|
|
273
|
+
this.layoutInfo = layout;
|
|
274
|
+
this.onInitLoad();
|
|
275
|
+
|
|
276
|
+
// #ifdef H5
|
|
277
|
+
if (this.$configProject.viewType === 'preview') {
|
|
278
|
+
this.$nextTick(() => {
|
|
279
|
+
setTimeout(() => {
|
|
280
|
+
this.setIframeHeigth();
|
|
281
|
+
}, 50)
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
// #endif
|
|
285
|
+
},
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* @description 框架节点发生变化事件
|
|
289
|
+
* @param layout {object} 框架对象
|
|
290
|
+
* @return {Object}
|
|
291
|
+
*/
|
|
292
|
+
handleChange(layout) {
|
|
293
|
+
this.layoutInfo = layout;
|
|
294
|
+
},
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* 业务组件之间通信事件
|
|
298
|
+
*/
|
|
299
|
+
onCustomEvent(action, data) {
|
|
300
|
+
if (this.currentPagesIsShow) {
|
|
301
|
+
console.warn('event.onCustomEvent.onJfbCustomEvent');
|
|
302
|
+
new JfbEvent('onJfbCustomEvent', {
|
|
303
|
+
vm: this,
|
|
304
|
+
data: {action, data, options: this.options},
|
|
305
|
+
})
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
|
|
309
|
+
onJfbSystemBack(system){
|
|
310
|
+
console.warn('event.onSystemBack.onJfbBack');
|
|
311
|
+
new JfbEvent('onJfbSystemBack', {
|
|
312
|
+
vm: this,
|
|
313
|
+
data: system
|
|
314
|
+
})
|
|
315
|
+
},
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* @description 绑定自定义导航时候返回事件方法
|
|
319
|
+
*/
|
|
320
|
+
back() {
|
|
321
|
+
console.warn('event.back.onJfbBack');
|
|
322
|
+
new JfbEvent('onJfbBack', {
|
|
323
|
+
vm: this,
|
|
324
|
+
data: this.options
|
|
325
|
+
})
|
|
326
|
+
},
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
import {mapActions, mapState, mapMutations} from 'vuex';
|
|
3
|
+
import {
|
|
4
|
+
AttrToTargetValues,
|
|
5
|
+
getContainerPropsValue,
|
|
6
|
+
baseCloneDeep,
|
|
7
|
+
} from "@/utils/xd.base";
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
data(){
|
|
11
|
+
return {
|
|
12
|
+
time: new Date().getTime(),//与页面加载速度有关
|
|
13
|
+
isOnLoad: false, //是否执行了onload事件
|
|
14
|
+
options: null, //页面参数
|
|
15
|
+
pagesParams:'',//页面Json设置参数
|
|
16
|
+
site_id: null, //当前网站ID
|
|
17
|
+
layoutInfo: null, //框架数据
|
|
18
|
+
indexHeight: 0, //预览模式更新Iframe高度有关
|
|
19
|
+
projectAttr: {}, //项目属性
|
|
20
|
+
settings: {}, //编译时刻项目配置对象
|
|
21
|
+
|
|
22
|
+
//保存计算当前页面使用业务组件列表
|
|
23
|
+
containers: {
|
|
24
|
+
topHeight: 0,
|
|
25
|
+
bottomHeight: 0,
|
|
26
|
+
footerHeight: 0,
|
|
27
|
+
tops: [],
|
|
28
|
+
bottoms: [],
|
|
29
|
+
bodys: [],
|
|
30
|
+
footers: [],
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
created(){
|
|
35
|
+
this.settings = this.$settings;
|
|
36
|
+
this.site_id = getApp().globalData.$xd.brandInfo.site_id;
|
|
37
|
+
this.projectAttr = getApp().globalData.$xd.brandInfo;
|
|
38
|
+
},
|
|
39
|
+
methods: {
|
|
40
|
+
...mapActions(['getPageAttr']),
|
|
41
|
+
...mapMutations(['setPagesHeader', 'setPagesPermission']),
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @description 获取Containers生产的位置和高度
|
|
46
|
+
* @param item
|
|
47
|
+
* @param isTranform 是否需要转化事件 默认:true
|
|
48
|
+
* @returns {{fixed: *, height: *}}
|
|
49
|
+
*/
|
|
50
|
+
getFixedKey(item, isTranform = true) {
|
|
51
|
+
let fixed = 'body';
|
|
52
|
+
let height = 0;
|
|
53
|
+
if (isTranform) item['component']['attrs'] = AttrToTargetValues(item['component']['attrs']);
|
|
54
|
+
item['component']['attrs'].map(it => {
|
|
55
|
+
if (it['key'] === 'fixed') {
|
|
56
|
+
fixed = it['value'];
|
|
57
|
+
}
|
|
58
|
+
if (it['key'] === 'height') {
|
|
59
|
+
height = it['value'];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return {fixed, height};
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @description 计算top/bottom/footer各自所站高度
|
|
67
|
+
* @param fixed
|
|
68
|
+
* @param height
|
|
69
|
+
* @param oldItem
|
|
70
|
+
* @param containers
|
|
71
|
+
* @returns {*}
|
|
72
|
+
*/
|
|
73
|
+
switchFixed(fixed, height, oldItem, containers ){
|
|
74
|
+
switch (fixed) {
|
|
75
|
+
case 'top':
|
|
76
|
+
containers.tops.push(oldItem);
|
|
77
|
+
if (!oldItem.hidden) containers.topHeight += height;
|
|
78
|
+
break;
|
|
79
|
+
case 'bottom':
|
|
80
|
+
containers.bottoms.push(oldItem);
|
|
81
|
+
if (!oldItem.hidden) containers.bottomHeight += height;
|
|
82
|
+
break;
|
|
83
|
+
case 'footer':
|
|
84
|
+
containers.footers.push(oldItem);
|
|
85
|
+
if (!oldItem.hidden) containers.footerHeight += height;
|
|
86
|
+
break;
|
|
87
|
+
default:
|
|
88
|
+
containers.bodys.push(oldItem);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @description Container数据转化(废弃)
|
|
94
|
+
* @param containers {Array} 使用业务插件数据
|
|
95
|
+
* @return {Object}
|
|
96
|
+
*/
|
|
97
|
+
getContainerGroup(containers) {
|
|
98
|
+
let temp = {
|
|
99
|
+
topHeight: 0,
|
|
100
|
+
bottomHeight: 0,
|
|
101
|
+
footerHeight: 0,
|
|
102
|
+
tops: [],
|
|
103
|
+
bottoms: [],
|
|
104
|
+
bodys: [],
|
|
105
|
+
footers: [],
|
|
106
|
+
};
|
|
107
|
+
let refs = [];
|
|
108
|
+
containers.map(item => {
|
|
109
|
+
item['refreshKey'] = this.$xdUniHelper.randomChar(20);
|
|
110
|
+
if (!item.hidden) refs.push(item['container_id']);
|
|
111
|
+
let {fixed, height} = this.getFixedKey(item);
|
|
112
|
+
this.switchFixed(fixed, height, item, temp);
|
|
113
|
+
});
|
|
114
|
+
this.refs = refs;
|
|
115
|
+
return temp;
|
|
116
|
+
},
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
|