|
|
|
@ -80,41 +80,43 @@ |
|
|
|
|
<el-form-item v-for="(item, i) in data.forms" :key="i" :prop="item.prop" :label="item.label"> |
|
|
|
|
<el-input v-if="item.type === 'input'" v-model="data.form[item.prop]" placeholder="请输入" maxlength="100"></el-input> |
|
|
|
|
<el-input v-if="item.type === 'textarea'" v-model="data.form[item.prop]" type="textarea" placeholder="请输入" maxlength="300"></el-input> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="item.type === 'upload'" |
|
|
|
|
class="uploader" |
|
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form)" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<img v-if="data.form[item.prop]" :src="data.form[item.prop]" class="avatar"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<p>上传图片</p> |
|
|
|
|
</div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<p>只支持.jpg,.png格式</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="item.type === 'video'" |
|
|
|
|
accept=".mp4,.mov,.avi" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form, item)" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<el-button>上传视频</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<!-- 图片视频都可上传 --> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="item.type === 'media'" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form, item)" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<el-button>上传资源</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<div v-if="item.type === 'upload' || item.type === 'video' || item.type === 'media'" class="uploader-wrap"> |
|
|
|
|
<el-upload |
|
|
|
|
class="uploader" |
|
|
|
|
accept=".jpg,.png,.jpeg" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form)" |
|
|
|
|
:show-file-list="false" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<img v-if="data.form[item.prop]" :src="data.form[item.prop]" class="avatar"> |
|
|
|
|
<div class="uploader-default" v-else> |
|
|
|
|
<i class="el-icon-plus"></i> |
|
|
|
|
<p>上传图片</p> |
|
|
|
|
</div> |
|
|
|
|
<div slot="tip" class="el-upload__tip"> |
|
|
|
|
<p>只支持.jpg,.png格式</p> |
|
|
|
|
</div> |
|
|
|
|
</el-upload> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="item.type === 'video'" |
|
|
|
|
accept=".mp4,.mov,.avi" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form, item)" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<el-button>上传视频</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<!-- 图片视频都可上传 --> |
|
|
|
|
<el-upload |
|
|
|
|
v-if="item.type === 'media'" |
|
|
|
|
:on-success="res => uploadSuccess(res, data.form, item)" |
|
|
|
|
:file-list="fileList" |
|
|
|
|
:headers="headers" |
|
|
|
|
:action="api.upload"> |
|
|
|
|
<el-button>上传资源</el-button> |
|
|
|
|
</el-upload> |
|
|
|
|
<i v-if="!item.required" class="el-icon-delete del" @click="data.form[item.prop] = ''"></i> |
|
|
|
|
</div> |
|
|
|
|
<div v-if="item.type === 'link'" class="flex"> |
|
|
|
|
<el-input class="m-r-10" v-model="data.form.link.linkName"></el-input> |
|
|
|
|
<el-button @click="toLink(data.form)">设置链接</el-button> |
|
|
|
|