提交 3e0ba983 编写于 作者: tao.wu's avatar tao.wu

修改上传图片按钮隐藏

上级 68f62edb
......@@ -23,9 +23,10 @@
:on-success="handleSuccess"
:on-error="handleError"
:on-exceed="handleExceed"
:disabled="addImageDisabled"
:file-list="fileList">
<el-button size="small" type="primary" @click="addImage" :disabled="addImageDisabled">添加图片</el-button>
<!--:disabled="addImageDisabled"-->
<!--<el-button size="small" type="primary" @click="addImage" :disabled="addImageDisabled">添加图片</el-button>-->
<el-button size="small" type="primary" v-if="!addImageDisabled" @click="addImage">添加图片</el-button>
<div slot="tip" class="el-upload__tip">最多5张,每张小于5M,支持jpg,png,bmp</div>
</el-upload>
</el-form-item>
......@@ -103,6 +104,7 @@
{ required: true, message: '请输入意见反馈', trigger: 'blur' }
]
},
imgDomin: '',
addImageDisabled: false,
imgLimit: 5,// 最多允许上传的图片个数
action: 'https://upload.qiniup.com/',
......@@ -117,7 +119,7 @@
}
},
created(){
// this.token = 'D34A213A354849A0B08A241771F7A675';
// this.token = 'C712F412E096492B84E2B1D636565626';
this.token = localStorage.getItem('storageToken');
this.headers.token = this.token
},
......@@ -150,6 +152,10 @@
submitFrom(formName){
this.$refs[formName].validate((valid) => {
if (valid) {
this.urlString = '';
this.fileList.forEach((item)=>{
this.urlString += `${this.imgDomin}/${item.response.key};`
})
const data = {
input_text: this.form.opinion,
system_type: 'workStation',
......@@ -185,10 +191,18 @@
this.imgFile.key = `qiniu/image/feedback/${year}/${month}/${file.name}`;
this.imgFile.token = this.imgToken;
},
handleRemove(){},
handleRemove(file, fileList){
this.fileList = fileList
this.addImageDisabled = false;
},
handleSuccess(response, file, fileList){
const imgDomin = uploadImg();
this.urlString += `${imgDomin}/${response.key};`
this.imgDomin = imgDomin;
// this.urlString += `${imgDomin}/${response.key};`
// this.fileList.forEach((item)=>{
// this.urlString += `${imgDomin}/${response.key};`
// })
this.fileList = fileList;
this.$message.success(`上传成功!`);
if(fileList.length>=this.imgLimit){
this.addImageDisabled = true;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册