Authored by bevishuang

优化imagelist楼层

... ... @@ -57,7 +57,7 @@ import util from '@/libs/util';
import draggable from 'vuedraggable';
export default {
props: ['value', 'hideAddButton', 'hideDeleteButton','type', 'templateName'],
props: ['value', 'hideAddButton', 'hideDeleteButton','type', 'templateName', 'size'],
filters: {
removeImageParams(url) {
if (!url) {
... ... @@ -69,8 +69,9 @@ export default {
},
data() {
return {
type_: '0',
value_: this.handleData(util.clone(this.value))
type_: this.size || '0',
value_: this.handleData(util.clone(this.value)),
itemStyle: ''
};
},
methods: {
... ... @@ -106,7 +107,10 @@ export default {
this.$emit('input', this.handleSaveData(this.value_));
},
handleData(m) {
console.log('===handleData===')
console.log(m);
console.log('===handl///eData===')
console.log(this.type_);
let keys = Object.keys(m);
keys.sort((a,b) => {
... ... @@ -201,7 +205,7 @@ export default {
return this.handleSaveData(this.value_);
},
getType(){
return this.type_;
return this.type_ || '0';
},
addId(m) {
m.id = this.$bus.genId();
... ... @@ -209,6 +213,9 @@ export default {
setValue(newVal) {
this.value_ = this.handleData(util.clone(newVal));
},
reSetType() {
this.type_ = '0';
},
reset() {
this.value_ = [];
}
... ... @@ -216,6 +223,7 @@ export default {
},
watch: {
value(newVal) {
this.type_ = this.size || '0';
this.value_ = this.handleData(util.clone(newVal));
}
},
... ...
... ... @@ -53,13 +53,15 @@
<div class="hot-image-list-body">
<div class="hot-image-list-item"
v-for="(item, index) in i.data"
:class="i.itemClass"
:key="index">
<img class="item-image"
:class="i.imageClass"
:src="item.src ? item.src.split('?')[0] : ''"
alt=""
srcset="" >
<p class="item-title" >{{item.title}}</p>
<p class="item-title"
:class="i.titleClass" >{{item.title}}</p>
</div>
</div>
</div>
... ... @@ -118,7 +120,7 @@
<Modal v-model="show" @on-ok="onOk" @on-cancel="onCancel" :title="modalInfo.modalTitle" width="650">
<banner-editor ref="addEditor" v-model="modalData" :hideAddButton="modalInfo.hideAddButton"
:hideDeleteButton="true" :type="platform" :templateName="modalInfo.template_name"></banner-editor>
:hideDeleteButton="true" :type="platform" :templateName="modalInfo.template_name" :size="modalInfo.size"></banner-editor>
</Modal>
</div>
</LayoutContent>
... ... @@ -310,7 +312,6 @@
template_name: 'tabFloor',
resContentId: 0
}, // 猜你喜欢Tab的基础数据
resId: null,
bg: '',
show: false, // 显示Modal
... ... @@ -355,7 +356,18 @@
let item = JSON.parse(data[i].data);
item.resContentId = data[i].resContentId;
item.type = data[i].type;
if(item.template_name === 'imageList' && item.size == 5){
item.itemClass = 'hot-image-list-item-5';
item.titleClass = 'item-title-5';
item.imageClass = 'item-image-5';
}else {
item.itemClass = '';
item.titleClass = '';
item.imageClass = '';
}
this.floorList.push(item);
}
},
showModal(type, data, index) {
... ... @@ -414,6 +426,7 @@
this.modalInfo.resContentId = data.resContentId;
this.modalInfo.template_intro = data.template_intro;
this.modalInfo.template_name = data.template_name;
this.modalInfo.size = data.size || '0';
this.modalInfo.floorIndex = index;
this.modalInfo.hideAddButton = hideAddButton;
this.show = true;
... ... @@ -428,9 +441,13 @@
onOk: () => {
this.uploadData.items.splice(index, 1);
this.resourceService.addOrUpdateResourceDetail(this.uploadData).then(res => {
if (res && res.code === 200) {
if (res && res.code === 2000) {
this.$Message.success(res.message || '修改成功!');
this.getResourceDetailList();
} else {
this.$Message.error(res.message || '修改失败!');
}
//修改成功失败都需要初始化数据
this.modalData = [];
this.modalInfo = {
modalType: 0,
... ... @@ -438,11 +455,9 @@
resContentId: 0,
floorIndex: -1,
template_intro: '',
template_name: ''
template_name: '',
size: '0'
};
} else {
this.$Message.error(res.message || '修改失败!');
}
});
}
});
... ... @@ -460,7 +475,8 @@
}
}
if(size != 0 && length != size) {
if(size && size != 0 && length != size) {
this.modalData = [];
this.$Message.error('请配置'+size+'个图片后再提交!');
return;
}
... ... @@ -505,13 +521,15 @@
resContentId: 0,
floorIndex: -1,
template_intro: '',
template_name: ''
template_name: '',
size: '0'
};
this.show = false;
} else {
this.$Message.error(res.message || '修改失败!');
}
});
this.$refs.addEditor.reSetType();
},
onCancel() {
this.modalData = [];
... ... @@ -521,7 +539,8 @@
resContentId: 0,
floorIndex: -1,
template_intro: '',
template_name: ''
template_name: '',
size: '0'
};
this.show = false;
}
... ... @@ -682,6 +701,10 @@
flex-shrink: 0;
height: 150px;
}
.hot-image-list-item-5 {
flex: 0 0 20%;
height: 120px;
}
.item-image {
margin-top: 10px;
... ... @@ -692,6 +715,10 @@
justify-content: center; */
}
.item-image-5 {
height: 80px;
}
.item-title {
width: 110px;
margin-top: 10px;
... ... @@ -710,6 +737,10 @@
text-overflow: ellipsis;
}
.item-title-5 {
width: 88px;
}
.sort-tab-body {
display: flex;
flex-direction: row;
... ...