Commit 271c13b0 by zhangquan

修复bug

1 parent e594304e
......@@ -81,25 +81,31 @@ export default {
this.$message.error('最多上传9张图片')
return
}
this.$emit('beforeUpload')
reader.readAsDataURL(file)
reader.onload = e => {
const imgFile = e.target.result
const arrBase64 = imgFile.split(',')
const splitStr = file.name.split('.')
const fileUrl = splitStr[splitStr.length - 1] + '@' + arrBase64[1]
this.$apis.common.pictureUpload({ file: fileUrl, compress: this.picOptions.compress || 0 }).then(res => {
if (res) {
this.$notify({
title: '提示',
message: '图片上传成功',
type: 'success'
})
this.imageUrlArr.push(res)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, index: this.index })
}
e.target.value = ''
this.$refs.uploadImg.value = ''
})
this.$apis.common
.pictureUpload({ file: fileUrl, compress: this.picOptions.compress || 0 })
.then(res => {
if (res) {
this.$notify({
title: '提示',
message: '图片上传成功',
type: 'success'
})
this.imageUrlArr.push(res)
this.$emit('change', { arr: this.imageUrlArr, key: this.picOptions.key, index: this.index })
}
e.target.value = ''
this.$refs.uploadImg.value = ''
})
.finally(end => {
this.$emit('afterUpload', end)
})
}
},
// 预览图文
......
......@@ -45,7 +45,7 @@
<div class="upload-wrap">
<div class="upload-item" v-for="(item, index) in uploadList" :key="index">
<span class="label">{{ item.label }}</span>
<glsx-preview :imageUrlArr="item.url" @change="changeChannelImg"></glsx-preview>
<glsx-preview :imageUrlArr="item.url" @beforeUpload="beforeUpload" @afterUpload="afterUpload"></glsx-preview>
</div>
</div>
</GLDialog>
......@@ -139,6 +139,7 @@ export default {
isBatch: false,
batchForm: {
isUpload: false,
isUploding: false,
successCount: 0,
failCount: 0,
exportUrl: '',
......@@ -177,7 +178,7 @@ export default {
{
type: 'el-button',
name: row => {
return '图片上传'
return '照片上传'
},
attrs: {
type: 'text'
......@@ -528,6 +529,7 @@ export default {
}
this.batchForm = {
isUpload: false,
isUploding: false,
successCount: 0,
failCount: 0,
exportUrl: '',
......@@ -558,6 +560,13 @@ export default {
this.uploadVisible = true
},
uploadOk() {
if (this.basicForm.isUploding) {
return this.$message({
message: '文件正在上传中,请稍后再提交',
type: 'error',
customClass: 'message-class'
})
}
let picList = []
this.uploadList.forEach(item => {
if (item.url[0]) {
......@@ -607,8 +616,11 @@ export default {
}
})
},
changeChannelImg(e) {
console.log(e, 'conpl')
beforeUpload(e) {
this.basicForm.isUploding = true
},
afterUpload() {
this.basicForm.isUploding = false
},
delParkingSpace(row) {
this.$confirm('请再次确认是否要执行删除操作', '提示', {
......@@ -628,7 +640,6 @@ export default {
})
},
getRadarList(radarId) {
console.log(1111)
let params = { pageNum: '1', pageSize: '1000', bindingStatus: 0 }
if (radarId) params.radarId = radarId
this.$apis.parkingSpace.getRadarListApi(params).then(res => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!