|
|
|
|
@ -75,12 +75,26 @@
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="跳转链接" prop="jump_url">
|
|
|
|
|
<el-input
|
|
|
|
|
v-model="form['jump_url']"
|
|
|
|
|
clearable
|
|
|
|
|
placeholder="请填写跳转链接"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
></el-input>
|
|
|
|
|
<el-upload
|
|
|
|
|
:action="action"
|
|
|
|
|
:file-list="jumpUrlFileList"
|
|
|
|
|
:headers="{ Authorization: `Bearer ${getToken()}` }"
|
|
|
|
|
accept="image/jpeg,image/png,image/gif,image/webp"
|
|
|
|
|
list-type="picture-card"
|
|
|
|
|
:limit="1"
|
|
|
|
|
:before-upload="uploadBefore"
|
|
|
|
|
:on-success="uploadJumpUrlSuccess"
|
|
|
|
|
:on-remove="uploadJumpUrlRemove"
|
|
|
|
|
:on-error="
|
|
|
|
|
(err, file, fileList) =>
|
|
|
|
|
uploadError(err, file, fileList, 'jump_url')
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<i class="el-icon-plus"></i>
|
|
|
|
|
<div slot="tip" class="el-upload__tip">
|
|
|
|
|
上传图片后自动保存链接,文件不超过{{ formatFileSize(uploadSize) }}
|
|
|
|
|
</div>
|
|
|
|
|
</el-upload>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<el-form-item label="排序" prop="sort">
|
|
|
|
|
@ -157,6 +171,7 @@ export default {
|
|
|
|
|
action: process.env.VUE_APP_UPLOAD_API,
|
|
|
|
|
loading: false,
|
|
|
|
|
visible: false,
|
|
|
|
|
jumpUrlFileList: [],
|
|
|
|
|
form: {
|
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
|
|
@ -203,6 +218,21 @@ export default {
|
|
|
|
|
});
|
|
|
|
|
this.form[fieldName] = fileList;
|
|
|
|
|
},
|
|
|
|
|
uploadJumpUrlSuccess(response, file, fileList) {
|
|
|
|
|
window.$_uploading = false;
|
|
|
|
|
fileList.forEach((item) => {
|
|
|
|
|
if (item.response?.data && !item.response?.code) {
|
|
|
|
|
item.response = item.response.data;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this.jumpUrlFileList = fileList;
|
|
|
|
|
const uploaded = fileList[0]?.response;
|
|
|
|
|
this.form.jump_url = uploaded?.url || "";
|
|
|
|
|
},
|
|
|
|
|
uploadJumpUrlRemove() {
|
|
|
|
|
this.jumpUrlFileList = [];
|
|
|
|
|
this.form.jump_url = "";
|
|
|
|
|
},
|
|
|
|
|
uploadRemove(file, fileList, fieldName) {
|
|
|
|
|
this.form[fieldName] = fileList;
|
|
|
|
|
},
|
|
|
|
|
@ -225,6 +255,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
reset() {
|
|
|
|
|
this.jumpUrlFileList = [];
|
|
|
|
|
this.form = {
|
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
|
|
|