You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
|
import request from '../utils/request.js'
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 提交表单数据
|
|
|
|
|
|
* @param {Object} data - 表单数据
|
|
|
|
|
|
* @param {Object} options - 额外配置(如是否显示 loading)
|
|
|
|
|
|
* @returns {Promise}
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const postForm = (data, options = {}) => {
|
|
|
|
|
|
const { showLoading = true } = options
|
|
|
|
|
|
|
|
|
|
|
|
// 显示加载提示
|
|
|
|
|
|
if (showLoading) {
|
|
|
|
|
|
uni.showLoading({ title: '提交中...', mask: true })
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 调用基础 request
|
|
|
|
|
|
return request.post('/data/visitor/add', data)
|
|
|
|
|
|
.then(res => {
|
|
|
|
|
|
// 请求成功,隐藏 loading,显示成功提示
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
return res // 将数据返回给页面,可能页面还需要做一些处理
|
|
|
|
|
|
})
|
|
|
|
|
|
.catch(err => {
|
|
|
|
|
|
// 请求失败,隐藏 loading,错误已经在 request 中统一提示,这里可额外处理
|
|
|
|
|
|
uni.hideLoading()
|
|
|
|
|
|
// 如果 request 中没有统一提示,可以在这里提示
|
|
|
|
|
|
// uni.showToast({ title: err.message || '提交失败', icon: 'none' })
|
|
|
|
|
|
return Promise.reject(err)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证名字和身份证
|
|
|
|
|
|
export const matchIdAnName = (data) => {
|
|
|
|
|
|
return request.post('/data/face/match',data)
|
|
|
|
|
|
.then( res => {
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 验证人脸
|
|
|
|
|
|
export const matchFace = (data) => {
|
|
|
|
|
|
return request.post('/data/face/verify',data)
|
|
|
|
|
|
.then( res => {
|
|
|
|
|
|
return res
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|