From 6107ca932eb5d79e7fff50e9501ef9f997ffa9bf Mon Sep 17 00:00:00 2001
From: yujk <990961482@qq.com>
Date: Wed, 4 Aug 2021 13:12:14 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E6=9D=83=E8=B0=83=E6=9F=A5=E7=A7=BB?=
=?UTF-8?q?=E5=8A=A8=E7=AB=AF?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/api/authenticRight/index.js | 8 ++
src/components/uploader/uploader.vue | 186 ---------------------------
src/views/authenticRight/index.vue | 111 +++++++++++++---
3 files changed, 104 insertions(+), 201 deletions(-)
delete mode 100644 src/components/uploader/uploader.vue
diff --git a/src/api/authenticRight/index.js b/src/api/authenticRight/index.js
index 08d831bd..c354a048 100644
--- a/src/api/authenticRight/index.js
+++ b/src/api/authenticRight/index.js
@@ -70,3 +70,11 @@ export function uploadFile(data) {
data: data
})
}
+// 修改农户抽样
+export function uploadFileBase(data) {
+ return request({
+ url: '/common/upload',
+ method: 'post',
+ data: data
+ })
+}
diff --git a/src/components/uploader/uploader.vue b/src/components/uploader/uploader.vue
deleted file mode 100644
index 247bc3dd..00000000
--- a/src/components/uploader/uploader.vue
+++ /dev/null
@@ -1,186 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-————————————————
-版权声明:本文为CSDN博主「bydongxin」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
-原文链接:https://blog.csdn.net/bydongxin/article/details/108367086
diff --git a/src/views/authenticRight/index.vue b/src/views/authenticRight/index.vue
index 2ce15808..41a8914b 100644
--- a/src/views/authenticRight/index.vue
+++ b/src/views/authenticRight/index.vue
@@ -126,6 +126,10 @@
placeholder="被核查人身份证号"
:rules="[{ required: true, message: '请填写被核查人身份证号' }]"
/>
+
+
+
+
农村土地承包经营权证
@@ -480,7 +484,7 @@
getInvestigate,
listSampling, listSamplingDept,
updateInvestigate,
- updateSampling, uploadFile
+ updateSampling, uploadFile, uploadFileBase
} from "../../api/authenticRight";
import {getDeptList} from "../../api/biddingHall";
import {Dialog} from "vant";
@@ -584,6 +588,8 @@
params: null,
samplingId: null,
searchValue: null,
+ fileUrl1:[],
+ fileUrl2:[],
},
dhdcform:{
callPhone: null,
@@ -619,7 +625,9 @@
userId :null,
nickName:null,
currentValue:null,
- fileList:[]
+ fileList:[],
+ fileList1:[],
+ fileList2:[],
}
},
created(){
@@ -639,8 +647,6 @@
},
methods:{
onOversize(file) {
- console.log(file);
- Toast('文件大小不能超过 16mb');
this.$toast({
icon: 'error', // 找到自己需要的图标
message: '上传失败!文件大小不能超过 16m',
@@ -689,18 +695,79 @@
}
this.fileList = []
},
- /*afterRead(file) {
+ afterRead1(file){
+ // 创建Canvas对象(画布)
+ let canvas = document.createElement('canvas')
+ // 获取对应的CanvasRenderingContext2D对象(画笔)
+ let context = canvas.getContext('2d')
+ // 创建新的图片对象
+ let img = new Image()
+ // 指定图片的DataURL(图片的base64编码数据)
+ img.src = file.content
+ img.onload = () => {
+ const h = img.height
+ const w = img.width
+ let ch = img.height/4
+ let cw = img.width/4
+ let canvas = document.createElement('canvas')
+ let ctx = canvas.getContext('2d')
+ canvas.height = ch
+ canvas.width = cw
+ ctx.clearRect(0,0,cw,ch)
+ ctx.drawImage(img,0,0,cw,ch)
+ let base_img = canvas.toDataURL('image/jpeg')
+ const blobBin = atob(base_img.split(',')[1])
+ let d = []
+ for (let i=0;i {
- if(res.code == 200){
- this.xcdcform.idcardCheckedBy = res.idcardCheckedBy
- this.xcdcform.nameCheckedBy = res.nameCheckedBy
- this.xcdcform["fileUrl"] = res.url
- }
+ data2.append("file", new Blob([new Uint8Array(d)],{type:'image/jpeg'}));
+ uploadFileBase(data2).then(res => {
+ this.xcdcform.fileUrl1=res.url
+ })
+ }
+ },
+ afterRead2(file){
+ // 创建Canvas对象(画布)
+ let canvas = document.createElement('canvas')
+ // 获取对应的CanvasRenderingContext2D对象(画笔)
+ let context = canvas.getContext('2d')
+ // 创建新的图片对象
+ let img = new Image()
+ // 指定图片的DataURL(图片的base64编码数据)
+ img.src = file.content
+ img.onload = () => {
+ const h = img.height
+ const w = img.width
+ let ch = img.height/4
+ let cw = img.width/4
+ let canvas = document.createElement('canvas')
+ let ctx = canvas.getContext('2d')
+ canvas.height = ch
+ canvas.width = cw
+ ctx.clearRect(0,0,cw,ch)
+ ctx.drawImage(img,0,0,cw,ch)
+ let base_img = canvas.toDataURL('image/jpeg')
+ const blobBin = atob(base_img.split(',')[1])
+ let d = []
+ for (let i=0;i {
+ this.xcdcform.fileUrl2=res.url
})
- this.fileList = []
- },*/
+ }
+ },
+ remove(val){
+ if(val==1){
+ this.xcdcform.fileUrl1=""
+ }else {
+ this.xcdcform.fileUrl2=""
+ }
+ },
changeFn(val) {
},
confirmFn(){
@@ -830,6 +897,8 @@
samplingId: null,
searchValue: null,
updateBy: null,
+ fileUrl1: [],
+ fileUrl2: [],
};
this.dhdcform={
countName: null,
@@ -857,6 +926,9 @@
searchValue: null,
updateBy: null,
}
+ this.fileList = []
+ this.fileList1 = []
+ this.fileList2 = []
},
onClickRight() {
this.show = true
@@ -929,7 +1001,6 @@
}
},
selectType(val,data,index){
- console.log(this.nickName,this.userId)
if(val==1){
let _this = this
let a ={
@@ -957,6 +1028,16 @@
getInvestigate(data.id).then(res => {
if(res.data){
this.xcdcform = res.data
+ if(this.xcdcform.fileUrl1){
+ this.fileList1.push({
+ "url":this.xcdcform.fileUrl1
+ })
+ }
+ if(this.xcdcform.fileUrl2){
+ this.fileList2.push({
+ "url":this.xcdcform.fileUrl2
+ })
+ }
this.xcdcform["countName"] = data.countName
this.xcdcform["townName"] = data.townName
this.xcdcform["villageName"] = data.villageName