请求接口有2个
https://api.baidu.com/detect
https://api.baidu.com/rest/match
打开uniapp中manifest.json配置h5
"h5" : {
"template" : "template.h5.html",
"devServer" : {
"https" : false,
"disableHostCheck": true,
/* 这个是配置人脸识别的跨域 */
"proxy": {
"/apis": {
"target": "https://api.baidu.com/",
"changeOrigin": true,
"secure": false,
"pathRewrite": {
"/apis": ""
}
}
}
},
"router" : {
"mode" : "history"
}
}
这样配置之后uniapp请求如下
const getOCRUrl = 'https://api.baidu.com/detect'
uni.request({
url: '/apis' + getOCRUrl
})