jufubao-base 1.0.195 → 1.0.197-beta1
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/JfbBaseHeaderElephant/Api.js +22 -0
- package/src/components/JfbBaseHeaderElephant/Attr.js +14 -0
- package/src/components/JfbBaseHeaderElephant/JfbBaseHeaderElephant.vue +207 -0
- package/src/components/JfbBaseHeaderElephant/JfbBaseHeaderElephantLess.less +79 -0
- package/src/components/JfbBaseHeaderElephant/JfbBaseHeaderElephantMixin.js +30 -0
- package/src/components/JfbBaseHeaderElephant/Mock.js +5 -0
- package/src/components/JfbBasePoster/Attr.js +8 -0
- package/src/components/JfbBasePoster/JfbBasePoster.vue +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @description 接口配置,
|
|
4
|
+
* 在设置方法名字当时候,别忘记加上【模块名字】:Header
|
|
5
|
+
* @type {*[]}
|
|
6
|
+
*/
|
|
7
|
+
module.exports = [
|
|
8
|
+
{
|
|
9
|
+
mapFnName: 'getListPosterContent', //自定义方法名字(必选)
|
|
10
|
+
title: '获取内容',
|
|
11
|
+
path: '/cms/v1/ad-content',
|
|
12
|
+
isRule: false,
|
|
13
|
+
params: {
|
|
14
|
+
scene: ['使用场景', 'String', '选填'],
|
|
15
|
+
container_id: ['插件ID', 'String', '必填'],
|
|
16
|
+
page_id: ['页面ID', 'String', '必填'],
|
|
17
|
+
page_size: ['记录条数', 'Number', '必填'],
|
|
18
|
+
},
|
|
19
|
+
isConsole: true,
|
|
20
|
+
disabled: true,
|
|
21
|
+
},
|
|
22
|
+
];
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<view
|
|
3
|
+
class="jfb-base-header-elephant"
|
|
4
|
+
@click="handleEditxSelect"
|
|
5
|
+
:class="{ editx : isEditx && active }"
|
|
6
|
+
>
|
|
7
|
+
<!--#ifdef H5-->
|
|
8
|
+
<view
|
|
9
|
+
class="jfb-base-header-elephant__edit"
|
|
10
|
+
:class="{ editx : isEditx && active }"
|
|
11
|
+
v-if="isEditx && active"
|
|
12
|
+
>
|
|
13
|
+
<view class="jfb-base-header-elephant__edit-icon" @click="delEdit">删除</view>
|
|
14
|
+
</view>
|
|
15
|
+
<!-- #endif -->
|
|
16
|
+
<view class="jfb-base-header-elephant__body">
|
|
17
|
+
<view class="box_wrap">
|
|
18
|
+
<view class="box_cont">
|
|
19
|
+
<view class="box_l">
|
|
20
|
+
<view class="box_logo"></view>
|
|
21
|
+
<view class="box_site_name"></view>
|
|
22
|
+
</view>
|
|
23
|
+
<view class="box_r">
|
|
24
|
+
<xd-font-icon icon="iconfenlei1"></xd-font-icon>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
<view class="cate_pop">
|
|
28
|
+
<view></view>
|
|
29
|
+
</view>
|
|
30
|
+
|
|
31
|
+
</view>
|
|
32
|
+
</view>
|
|
33
|
+
</view>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
import XdFontIcon from "@/components/XdFontIcon/XdFontIcon";
|
|
38
|
+
import { jfbRootExec } from "@/utils/xd.event";
|
|
39
|
+
import JfbBaseHeaderElephantMixin from "./JfbBaseHeaderElephantMixin";
|
|
40
|
+
import { getContainerPropsValue } from "@/utils/xd.base";
|
|
41
|
+
import componentsMixins from "@/mixins/componentsMixins";
|
|
42
|
+
import extsMixins from "@/mixins/extsMixins";
|
|
43
|
+
import getServiceUrl from '@/common/getServiceUrl'
|
|
44
|
+
export default {
|
|
45
|
+
name: "JfbBaseHeaderElephant",
|
|
46
|
+
components: {
|
|
47
|
+
XdFontIcon
|
|
48
|
+
},
|
|
49
|
+
mixins: [
|
|
50
|
+
componentsMixins, extsMixins, JfbBaseHeaderElephantMixin
|
|
51
|
+
],
|
|
52
|
+
data() {
|
|
53
|
+
return {
|
|
54
|
+
useNumber: 4,
|
|
55
|
+
info: [],
|
|
56
|
+
//todo
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
watch: {
|
|
60
|
+
container(value, oldValue) {
|
|
61
|
+
if (JSON.stringify(value) === JSON.stringify(oldValue)) return;
|
|
62
|
+
if (this.$configProject['isPreview']) this.init(value)
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
created() {
|
|
66
|
+
this.init(this.container);
|
|
67
|
+
|
|
68
|
+
//todo
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
onJfbLoad(options) {
|
|
72
|
+
|
|
73
|
+
jfbRootExec('getListPosterContent', {
|
|
74
|
+
vm: this,
|
|
75
|
+
data: {
|
|
76
|
+
page_id: this.pageAttr['page_id'], //页面ID
|
|
77
|
+
container_id: this.containerId, //组件ID
|
|
78
|
+
page_size: this.useNumber //可以不传
|
|
79
|
+
},
|
|
80
|
+
}).then(res => {
|
|
81
|
+
if(res.list.length === 0 && this.isPreview) {
|
|
82
|
+
res.list = this.getTestData();
|
|
83
|
+
}
|
|
84
|
+
this.handleOne(res.list);
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* @description 监听事件变化
|
|
89
|
+
* @param container {object} 业务组件对象自己
|
|
90
|
+
*/
|
|
91
|
+
init(container) {
|
|
92
|
+
|
|
93
|
+
},
|
|
94
|
+
handleImage(list){
|
|
95
|
+
list = this.filterItem(list);
|
|
96
|
+
|
|
97
|
+
return list.map((item,index) => {
|
|
98
|
+
return {
|
|
99
|
+
...item,
|
|
100
|
+
image_background_url: item.image_background_url?getServiceUrl(item.image_background_url):'',
|
|
101
|
+
image_url: item.image_url?getServiceUrl(item.image_url):''
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
handleOne(list){
|
|
106
|
+
this.info = this.handleImage(list);
|
|
107
|
+
|
|
108
|
+
//轮播图记录为0条处理
|
|
109
|
+
if( this.info.length === 0) return
|
|
110
|
+
let current = this.current || 0;
|
|
111
|
+
this.currentImage = this.info[current]['image_background_url']
|
|
112
|
+
},
|
|
113
|
+
getTestData(){
|
|
114
|
+
let temp = [];
|
|
115
|
+
for (let i = 0; i< this.useNumber; i++) {
|
|
116
|
+
let item = this.$xdUniHelper.cloneDeep(this['posterTest']);
|
|
117
|
+
item.content_id = i;
|
|
118
|
+
item.content_name = item.content_name + i;
|
|
119
|
+
item.image_url = `//dummyimage.com/${this.width}x${this.height}`;
|
|
120
|
+
temp.push(item)
|
|
121
|
+
}
|
|
122
|
+
return temp
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* @description 过滤不可以用
|
|
126
|
+
* 当前项目未H5时,过滤所有小程序应用
|
|
127
|
+
* 当前项目未小程序时,过滤所有非当前小程序应用
|
|
128
|
+
* 站外地址直接返回
|
|
129
|
+
* 站内地址未选值直接返回
|
|
130
|
+
* 预览模式全过
|
|
131
|
+
*/
|
|
132
|
+
filterItem(list){
|
|
133
|
+
let content = list.filter(item=>{
|
|
134
|
+
//预览模式
|
|
135
|
+
if( this.$configProject.isPreview) return true;
|
|
136
|
+
|
|
137
|
+
//非内部应用
|
|
138
|
+
if(item.redirect_type !== 'INN') return true
|
|
139
|
+
|
|
140
|
+
//没有配置链接
|
|
141
|
+
if(!item.redirect_data) return true;
|
|
142
|
+
|
|
143
|
+
//内部应用
|
|
144
|
+
else {
|
|
145
|
+
let redirect_data;
|
|
146
|
+
try {
|
|
147
|
+
redirect_data = JSON.parse(item.redirect_data);
|
|
148
|
+
if(!item['app_type']) item['app_type']= 'h5';
|
|
149
|
+
|
|
150
|
+
//#ifdef H5
|
|
151
|
+
return item['app_type'] !== 'wxmp';
|
|
152
|
+
//#endif
|
|
153
|
+
|
|
154
|
+
//#ifdef MP-WEIXIN
|
|
155
|
+
let actDir = this.$parent.projectAttr.deploy_dir;
|
|
156
|
+
let dir = this.getPathDir(redirect_data.page);
|
|
157
|
+
if(item['app_type'] === 'wxmp'){
|
|
158
|
+
return actDir === dir;
|
|
159
|
+
}
|
|
160
|
+
else if(item['app_type'] === 'h5') return true;
|
|
161
|
+
else return true
|
|
162
|
+
//#endif
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
return true
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
console.warn(`PostersList:${JSON.stringify(content.map(item=>`${item.app_type}:${item.content_name}:${item.redirect_data}`), null,2)}`)
|
|
170
|
+
return content;
|
|
171
|
+
|
|
172
|
+
},
|
|
173
|
+
onJfbScroll(options) {
|
|
174
|
+
// console.log('event.onJfbScroll', options)
|
|
175
|
+
},
|
|
176
|
+
onJfbReachBottom(options) {
|
|
177
|
+
console.log('event.onJfbReachBottom', options)
|
|
178
|
+
},
|
|
179
|
+
onJfbShow(options) {
|
|
180
|
+
console.log('event.onJfbShow', options)
|
|
181
|
+
},
|
|
182
|
+
onJfbHide(options) {
|
|
183
|
+
console.log('event.onJfbHide', options)
|
|
184
|
+
},
|
|
185
|
+
onJfbBack(options) {
|
|
186
|
+
console.log('event.onJfbBack', options)
|
|
187
|
+
},
|
|
188
|
+
onJfbUpdate(...data) {
|
|
189
|
+
console.log('event.onJfbUpdate', data)
|
|
190
|
+
},
|
|
191
|
+
onJfbCustomEvent(options) {
|
|
192
|
+
console.log('event.onJfbReachBottom', options)
|
|
193
|
+
},
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
</script>
|
|
198
|
+
|
|
199
|
+
<style scoped lang="less">
|
|
200
|
+
@import "./JfbBaseHeaderElephantLess.less";
|
|
201
|
+
|
|
202
|
+
.jfb-base-header-elephant {
|
|
203
|
+
&__body{
|
|
204
|
+
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
</style>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc 获取绝对路径完整地址
|
|
3
|
+
* @param @path
|
|
4
|
+
**/
|
|
5
|
+
//例如:https://image.jufubao.cn/20220501010108/image/bg/default_gonghui_bg.png
|
|
6
|
+
@basePath: 'business/';
|
|
7
|
+
@doMain: '//sandbox-img.jufubao.cn/';
|
|
8
|
+
|
|
9
|
+
.getBusinessImageUrl(@path, @size: 'size8') {
|
|
10
|
+
@url: "@{doMain}@{basePath}@{path}?x-oss-process=style/@{size}";
|
|
11
|
+
background-image: url(@url);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//start
|
|
15
|
+
.jfb-base-header-elephant {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
|
|
18
|
+
&__body{
|
|
19
|
+
position: relative;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
z-index: 2
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.editx,&.editx:hover {
|
|
25
|
+
position: relative;
|
|
26
|
+
min-height: unit(100, rpx);
|
|
27
|
+
z-index: 3;
|
|
28
|
+
&::after {
|
|
29
|
+
border: 2rpx dashed blue;
|
|
30
|
+
content: " ";
|
|
31
|
+
position: absolute;
|
|
32
|
+
top:0;
|
|
33
|
+
left:0;
|
|
34
|
+
bottom:0;
|
|
35
|
+
right:0;
|
|
36
|
+
z-index: 4;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
&__edit {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
position: absolute;
|
|
46
|
+
right: unit(0, rpx);
|
|
47
|
+
top: unit(-52, rpx);
|
|
48
|
+
height: unit(50, rpx);
|
|
49
|
+
line-height: unit(50, rpx);
|
|
50
|
+
display: flex;
|
|
51
|
+
justify-content: center;
|
|
52
|
+
align-items: center;
|
|
53
|
+
background: rgba(0, 0, 0, .6);
|
|
54
|
+
border-radius: unit(10, rpx);
|
|
55
|
+
box-shadow: 0 0 10px rbga(0, 0, 0, 0.3);
|
|
56
|
+
color: #fff;
|
|
57
|
+
font-size: unit(22, rpx);
|
|
58
|
+
|
|
59
|
+
&-icon{
|
|
60
|
+
padding: 0 unit(20, rpx);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&.editx {
|
|
64
|
+
box-sizing: border-box;
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
/**notPreview**/
|
|
73
|
+
.jfb-base-header-elephant {
|
|
74
|
+
//&:before {
|
|
75
|
+
//content: " ";
|
|
76
|
+
//display: table;
|
|
77
|
+
//}
|
|
78
|
+
}
|
|
79
|
+
/**endNotPreview**/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
//@AttrImport
|
|
5
|
+
import Attr from "./Attr";
|
|
6
|
+
//@EndAttrImport
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
data() {
|
|
11
|
+
return {
|
|
12
|
+
//#ifdef H5
|
|
13
|
+
|
|
14
|
+
//@AttrData
|
|
15
|
+
Attr:{}, //对外开发编辑属性
|
|
16
|
+
//@EndAttrData
|
|
17
|
+
|
|
18
|
+
// #endif
|
|
19
|
+
cssRoot: 'jfb-base-header-elephant'
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
created() {
|
|
23
|
+
|
|
24
|
+
//@AttrDataCreated
|
|
25
|
+
this.Attr = this.$xdUniHelper.customClone(Attr);
|
|
26
|
+
//@EndAttrDataCreated
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
},
|
|
30
|
+
}
|
|
@@ -295,6 +295,14 @@ export default {
|
|
|
295
295
|
sort: true,
|
|
296
296
|
maxlen: 100,
|
|
297
297
|
},
|
|
298
|
+
{
|
|
299
|
+
label: '背景颜色:',
|
|
300
|
+
ele: 'xd-color',
|
|
301
|
+
valueKey: 'bgColor',
|
|
302
|
+
value: params.bgColor || '',
|
|
303
|
+
groupKey:'content',
|
|
304
|
+
classNmae: 'input80',
|
|
305
|
+
},
|
|
298
306
|
{
|
|
299
307
|
label: '广告位置使用张数:',
|
|
300
308
|
ele: 'el-input',
|
|
@@ -168,6 +168,7 @@
|
|
|
168
168
|
isPreview: false,
|
|
169
169
|
noData:false,
|
|
170
170
|
background: '',
|
|
171
|
+
bgColor:'rgba(0,0,0,0)'
|
|
171
172
|
}
|
|
172
173
|
},
|
|
173
174
|
computed: {
|
|
@@ -181,6 +182,7 @@
|
|
|
181
182
|
image = Object.assign({},image,{
|
|
182
183
|
margin: this.margin,
|
|
183
184
|
padding: this.outPadding,
|
|
185
|
+
backgroundColor: this.bgColor,
|
|
184
186
|
})
|
|
185
187
|
return image
|
|
186
188
|
},
|
|
@@ -585,6 +587,7 @@
|
|
|
585
587
|
|
|
586
588
|
this.carouselTime = Number(getContainerPropsValue(container, 'content.carouselTime', 5)) * 1000;
|
|
587
589
|
this.useNumber = getContainerPropsValue(container, 'content.number', 1);
|
|
590
|
+
this.bgColor = getContainerPropsValue(container, 'content.bgColor', 'rgba(0,0,0,0)')
|
|
588
591
|
|
|
589
592
|
if(this.poster.size) {
|
|
590
593
|
this.width = this.poster.size.width;
|