uni.chooseImage({
count: 1,
success: (chooseImageRes) => {
uni.showLoading({
title: '正在上传...'
})
const tempFilePaths = chooseImageRes.tempFilePaths;
console.log(tempFilePaths)
uni.uploadFile({
url: this.baseUrl + "/api/deform/upload/img", //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'file',
type: "image",
/* sizeType:"compressed", */
header: {
token: uni.getStorageSync('uerInfo').token
},
success: (uploadFileRes) => {
var res = JSON.parse(uploadFileRes.data)
if (res.success) {
console.log(res.res);
//识别身份证图片信息
//2寸证件照
this.params.idPhotoImg = this.baseUrl + res.res
this.params.idPhoto = res.res
uni.hideLoading();
} else {
uni.showToast({
title: res.err.msg,
icon: "none"
});
}
}
});
}
})
1 个回复
duanxirui
解决了吗?