|
@@ -1,11 +1,12 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <div>
|
|
|
|
|
|
|
+ <div v-if="uploadModal">
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
title="上传图片"
|
|
title="上传图片"
|
|
|
append-to-body
|
|
append-to-body
|
|
|
:modal-append-to-body="false"
|
|
:modal-append-to-body="false"
|
|
|
:visible.sync="uploadModal"
|
|
:visible.sync="uploadModal"
|
|
|
width="1024px"
|
|
width="1024px"
|
|
|
|
|
+ :fullscreen="!isPage"
|
|
|
@closed="closed"
|
|
@closed="closed"
|
|
|
>
|
|
>
|
|
|
<div class="main" v-loading="loading">
|
|
<div class="main" v-loading="loading">
|
|
@@ -57,7 +58,7 @@
|
|
|
@dragend="handleDragEnd($event, file)"
|
|
@dragend="handleDragEnd($event, file)"
|
|
|
>
|
|
>
|
|
|
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
|
|
<img class="el-upload-list__item-thumbnail" :src="file.url" alt="" />
|
|
|
- <i class="el-icon-error btndel" @click="handleRemove(file)" />
|
|
|
|
|
|
|
+ <i class="el-icon-error btndel" @click="handleWebRemove(file)" />
|
|
|
</div>
|
|
</div>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
|
<div class="tips">建议上传图片最大宽度750px,不超过3MB;仅支持jpeg、png格式</div>
|
|
<div class="tips">建议上传图片最大宽度750px,不超过3MB;仅支持jpeg、png格式</div>
|
|
@@ -82,7 +83,7 @@
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
- <div class="code-image" v-show="ruleForm.type == 2">
|
|
|
|
|
|
|
+ <div class="code-image" v-if="ruleForm.type == 2">
|
|
|
<div class="left">
|
|
<div class="left">
|
|
|
<div class="code" ref="qrCodeUrl"></div>
|
|
<div class="code" ref="qrCodeUrl"></div>
|
|
|
<el-cascader
|
|
<el-cascader
|
|
@@ -109,7 +110,7 @@
|
|
|
@dragend="handleDragEnd($event, item)"
|
|
@dragend="handleDragEnd($event, item)"
|
|
|
>
|
|
>
|
|
|
<img :src="item.att_dir" />
|
|
<img :src="item.att_dir" />
|
|
|
- <i class="el-icon-error btndel" @click="handleRemove(index)" />
|
|
|
|
|
|
|
+ <i class="el-icon-error btndel" @click="handleWebRemove(item)" />
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
@@ -140,6 +141,21 @@ export default {
|
|
|
return [];
|
|
return [];
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
|
|
+ categoryId: {
|
|
|
|
|
+ default: '',
|
|
|
|
|
+ },
|
|
|
|
|
+ isPage: {
|
|
|
|
|
+ default: false,
|
|
|
|
|
+ },
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ categoryId: {
|
|
|
|
|
+ handler(newVal) {
|
|
|
|
|
+ this.ruleForm.region = newVal;
|
|
|
|
|
+ console.log('diaole ');
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true,
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -150,14 +166,14 @@ export default {
|
|
|
'Authori-zation': 'Bearer ' + getCookies('token'),
|
|
'Authori-zation': 'Bearer ' + getCookies('token'),
|
|
|
},
|
|
},
|
|
|
uploadData: {},
|
|
uploadData: {},
|
|
|
- props: { label: 'title', value: 'id', multiple: false, checkStrictly: true, lazy: true, lazyLoad: this.loadData },
|
|
|
|
|
|
|
+ props: { checkStrictly: true, emitPath: false, label: 'title', value: 'id' },
|
|
|
disabled: false,
|
|
disabled: false,
|
|
|
ruleForm: {
|
|
ruleForm: {
|
|
|
type: 0,
|
|
type: 0,
|
|
|
|
|
+ region: '',
|
|
|
imgList: [],
|
|
imgList: [],
|
|
|
},
|
|
},
|
|
|
rules: { type: [{ required: true, message: '请选择活动资源', trigger: 'change' }] },
|
|
rules: { type: [{ required: true, message: '请选择活动资源', trigger: 'change' }] },
|
|
|
- treeId: '',
|
|
|
|
|
qrcode: '',
|
|
qrcode: '',
|
|
|
scanToken: '',
|
|
scanToken: '',
|
|
|
limit: 20,
|
|
limit: 20,
|
|
@@ -169,6 +185,9 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
closed() {
|
|
closed() {
|
|
|
this.ruleForm.type = 0;
|
|
this.ruleForm.type = 0;
|
|
|
|
|
+ this.ruleForm.region = 0;
|
|
|
|
|
+ this.scanToken = '';
|
|
|
|
|
+ this.webImgUrl = '';
|
|
|
this.ruleForm.imgList = [];
|
|
this.ruleForm.imgList = [];
|
|
|
scanUploadCode().then((res) => {});
|
|
scanUploadCode().then((res) => {});
|
|
|
},
|
|
},
|
|
@@ -180,7 +199,7 @@ export default {
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
scanUploadQrcode() {
|
|
scanUploadQrcode() {
|
|
|
- scanUploadQrcode().then((res) => {
|
|
|
|
|
|
|
+ scanUploadQrcode(this.ruleForm.region).then((res) => {
|
|
|
this.creatQrCode(res.data.url);
|
|
this.creatQrCode(res.data.url);
|
|
|
this.scanToken = res.data.url;
|
|
this.scanToken = res.data.url;
|
|
|
});
|
|
});
|
|
@@ -205,7 +224,7 @@ export default {
|
|
|
async submitUpload() {
|
|
async submitUpload() {
|
|
|
if (this.ruleForm.type == 0) {
|
|
if (this.ruleForm.type == 0) {
|
|
|
this.uploadData = {
|
|
this.uploadData = {
|
|
|
- pid: this.treeId,
|
|
|
|
|
|
|
+ pid: this.ruleForm.region,
|
|
|
};
|
|
};
|
|
|
if (this.ruleForm.imgList.length) {
|
|
if (this.ruleForm.imgList.length) {
|
|
|
if (this.loading) return;
|
|
if (this.loading) return;
|
|
@@ -228,7 +247,7 @@ export default {
|
|
|
if (urls.length) {
|
|
if (urls.length) {
|
|
|
if (this.loading) return;
|
|
if (this.loading) return;
|
|
|
this.loading = true;
|
|
this.loading = true;
|
|
|
- onlineUpload({ pid: this.treeId, images: urls })
|
|
|
|
|
|
|
+ onlineUpload({ pid: this.ruleForm.region, images: urls })
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
this.$Message.success('上传成功');
|
|
this.$Message.success('上传成功');
|
|
|
this.$emit('uploadSuccess');
|
|
this.$emit('uploadSuccess');
|
|
@@ -244,7 +263,7 @@ export default {
|
|
|
let attId = this.ruleForm.imgList.map((e) => {
|
|
let attId = this.ruleForm.imgList.map((e) => {
|
|
|
return e.att_id;
|
|
return e.att_id;
|
|
|
});
|
|
});
|
|
|
- moveApi({ pid: this.treeId, images: attId }).then((res) => {
|
|
|
|
|
|
|
+ moveApi({ pid: this.ruleForm.region, images: attId }).then((res) => {
|
|
|
this.$Message.success('上传成功');
|
|
this.$Message.success('上传成功');
|
|
|
this.$emit('uploadSuccess');
|
|
this.$emit('uploadSuccess');
|
|
|
this.uploadModal = false;
|
|
this.uploadModal = false;
|
|
@@ -255,7 +274,7 @@ export default {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
const formData = new FormData();
|
|
const formData = new FormData();
|
|
|
formData.append('file', file);
|
|
formData.append('file', file);
|
|
|
- formData.append('pid', this.treeId);
|
|
|
|
|
|
|
+ formData.append('pid', this.ruleForm.region);
|
|
|
fileUpload(formData)
|
|
fileUpload(formData)
|
|
|
.then((res) => {
|
|
.then((res) => {
|
|
|
if (res.status == 200) {
|
|
if (res.status == 200) {
|
|
@@ -288,13 +307,16 @@ export default {
|
|
|
correctLevel: QRCode.CorrectLevel.H,
|
|
correctLevel: QRCode.CorrectLevel.H,
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- handleRemove(file) {
|
|
|
|
|
|
|
+ handleWebRemove(file) {
|
|
|
console.log(file);
|
|
console.log(file);
|
|
|
let index = this.ruleForm.imgList.findIndex((e) => {
|
|
let index = this.ruleForm.imgList.findIndex((e) => {
|
|
|
- e.url == file.url;
|
|
|
|
|
|
|
+ return e.url == file.url;
|
|
|
});
|
|
});
|
|
|
this.ruleForm.imgList.splice(index, 1);
|
|
this.ruleForm.imgList.splice(index, 1);
|
|
|
},
|
|
},
|
|
|
|
|
+ handleRemove(index) {
|
|
|
|
|
+ this.ruleForm.imgList.splice(index, 1);
|
|
|
|
|
+ },
|
|
|
handlePictureCardPreview(file) {
|
|
handlePictureCardPreview(file) {
|
|
|
this.dialogImageUrl = file.url;
|
|
this.dialogImageUrl = file.url;
|
|
|
this.dialogVisible = true;
|
|
this.dialogVisible = true;
|
|
@@ -334,8 +356,7 @@ export default {
|
|
|
.catch((res) => {});
|
|
.catch((res) => {});
|
|
|
},
|
|
},
|
|
|
handleChange(e) {
|
|
handleChange(e) {
|
|
|
- console.log(e, e.length == 1 ? e[0] : e[e.length - 1]);
|
|
|
|
|
- this.treeId = e[e.length - 1];
|
|
|
|
|
|
|
+ if (this.ruleForm.type == 2) this.scanUploadQrcode();
|
|
|
},
|
|
},
|
|
|
// 移动
|
|
// 移动
|
|
|
handleDragStart(e, item) {
|
|
handleDragStart(e, item) {
|