@@ -14,11 +14,11 @@
<div style="height:230px;width: 96%;margin: 0 auto;">
<el-upload
action="#"
accept=".jpg,.jpeg,.png,.gif,. JPG,.JPEG"
accept=".jpg,.jpeg,.png,.JPG,.JPEG,.PN G"
:show-file-list="false"
:on-change="handleLicensePreview"
:before-upload="beforeLicenseUpload"
:on-change="handleChangePicture"
list-type="picture-card"
:file-list="fileList"
:style="{display:(ImageUrl ? 'none':'block')}"
:auto-upload="false"
>
@@ -41,7 +41,7 @@
</div>
<div class="tuomin-button-model">
<el-button @click="cancelUpload">{{$t('cancel')}}</el-button>
<el-button @click="startTranform" type="primary">{{$t('startDesensitization')}}</el-button>
<el-button :disabled="fileList.length<1" @click="startTranform" type="primary">{{$t('startDesensitization')}}</el-button>
</div>
</div>
</div>
@@ -76,14 +76,35 @@
<el-table border :data="tableData1" style="width:100%">
<el-table-column :label="$t('originPicture')" align="center">
<template slot-scope="scope">
<img :src="scope.row.imgSrc1" alt="">
<span style="margin-left: 10px">{{ scope.row.imgSrc1}}</span>
<div style="width: 100%;height:200px;">
<el-image
style="height: 100%;width: 100%;"
:src="scope.row.imgSrc1"
:preview-src-list="[scope.row.imgSrc1]">
<div slot="error" class="image-slot">
<i style="font-size: 0;" class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column :label="$t('desensitizationPicture')" align="center">
<template slot-scope="scope">
<img :src="scope.row.imgSrc2" alt="">
<span style="margin-left: 10px">{{ scope.row.imgSrc1}}</span>
<div style="width: 100%;height:200px;">
<el-image
style="height: 100%;width: 100%;"
:src="scope.row.imgSrc2"
:preview-src-list="[scope.row.imgSrc2]">
<div slot="error" class="image-slot">
<i style="font-size: 0;" class="el-icon-picture-outline"></i>
</div>
</el-image>
</div>
</template>
</el-table-column>
<el-table-column prop="mode" :label="$t('desensitizationObject')" align="center" header-align="center">
@@ -105,27 +126,46 @@
ImageUrl:'',
radio:2,
file:'',
fileList:[],
resultImgSrc:'',
tranformImageLoading:false,
tableData1:[{
imgSrc1:'/img/jian.sv g',
imgSrc2:'/img/jian.sv g',
mode:this.$t('onlyLicensePlate ')
imgSrc1:'/img/origin.pn g',
imgSrc2:'/img/tuomin.pn g',
mode:this.$t('all ')
}]
};
},
components: {},
methods: {
handleLicensePreview(file) {
console.log(file)
// 选择文件、移除文件、上传文件成功/失败后,都会触发
handleChangePicture(file,fileList) {
console.log("----change:",file,fileList)
let acceptList = ["jpg", "jpeg",'png']
// 根据文件名获取文件的后缀名
let fileType = file.name.split('.').pop().toLowerCase()
// 判断文件格式是否符合要求
if (acceptList.indexOf(fileType) === -1) {
this.$message.error(this.$t('limitFilesUpload'));
return false
}
// 判断文件大小是否符合要求
if (file.size / 1024 / 1024 > 20) {
this.$message.error(this.$t('limitSizeUpload'));
return false
}
this.ImageUrl = URL.createObjectURL(file.raw);
this.file = file
this.fileList = fileList
},
cancelUpload(){
this.ImageUrl = ''
this.file=''
this.fileList = []
},
startTranform(){
if(!this.file)return
let fd = new FormData();
fd.append('file', this.file.raw);
console.log(fd.get("file"))
@@ -152,9 +192,7 @@
})
},
beforeLicenseUpload(){
console.log("----------")
},
},
mounted() {