gotmgs(){
let self = this
wx.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
maxDuration: 30,
camera: 'back',
success(res) {
console.log(res)
let gotResource = res.tempFiles[0].tempFilePath //获取到的拍照的身份信息
console.log(gotResource)
uni.compressImage({
src: gotResource, // 图片路径
quality: 80 ,// 压缩质量
success:res=>{
console.log("压缩正常")
console.log(res)
let gotResource = res.tempFilePath
wx.getFileSystemManager().readFile({
filePath: gotResource,
encoding: "base64",
success: res => {
let image= res.data
self.getInformationForHumen(image) //上传身份证的接口
},
fail: err => {
console.log("转换base64失败")
}
})
},
fail:err=>{
console.log("压缩失败")
}
})
}
})
},