market_api_929_2

This commit is contained in:
dengbw
2022-09-29 11:49:41 +08:00
parent e70f09de2a
commit 8371475a8c
@@ -62,6 +62,16 @@
class="ele-fluid"
/>
</el-form-item>
<el-form-item label="直播图片:" prop="channelImg">
<ele-image-upload
v-model="form.channelImg"
:limit="1"
:drag="true"
:multiple="false"
:upload-handler="channelImgHandler"
@upload="onUpload"
/>
</el-form-item>
<el-form-item label="活动简介:" prop="introduction">
<el-input
v-model="form.introduction"
@@ -137,7 +147,8 @@
introduction: '',
shareTitle: [''],
shareImg: [],
bgImg: []
bgImg: [],
channelImg: []
};
return {
defaultForm,
@@ -260,6 +271,27 @@
this.form.bgImg.push(item);
this.onUpload(item);
},
channelImgHandler(file) {
const item = {
file,
uid: file.uid,
name: file.name,
progress: 0,
status: null
};
if (!file.type.startsWith('image')) {
this.$message.error('只能选择图片');
return;
}
if (file.size / 1024 / 1024 > 2) {
this.$message.error('大小不能超过 2MB');
return;
}
item.url = window.URL.createObjectURL(file);
// 关键就是这里要自己 push 添加数据而不是靠 v-modal 自动更新
this.form.channelImg.push(item);
this.onUpload(item);
},
/* 上传事件 */
shareImgHandler(file) {
const item = {