第一步 idCard.js
import {
baseURL
} from "@/request.js"//后台上传图片地址
function OcrIdCard(access_token, idCardSide) {
return new Promise(function(resolve, reject) {
var that = this;
//识别身份证
uni.chooseImage({
count: 1,
sizeType: ['compressed'],
sourceType: ['album', 'camera'],
success: function(res) {
uni.showLoading({
title: '识别中'
})
console.log(res.tempFiles[0].path)
//核心代码
const tempFilePaths = res.tempFiles[0].path
uni.uploadFile({
filePath: tempFilePaths,
name: 'file',
url: baseURL + '/app/upload',
success: suc => {
console.log(JSON.parse(suc.data))
let cardImg = JSON.parse(suc.data).message
uni.request({
u