第一个版本
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { get, post } from '../../../api/request'
|
||||
import { BASE_URL } from '../../../config'
|
||||
import type { CardInfo, CardDetail, MyCard, ActivateParams, QrCodeInfo } from '../../../api/types'
|
||||
|
||||
/** 获取年卡列表 */
|
||||
@@ -17,8 +18,21 @@ export function activateCard(cardId: string, data: ActivateParams): Promise<bool
|
||||
}
|
||||
|
||||
/** 绑定年卡 */
|
||||
export function bindCard(cardNo: string): Promise<boolean> {
|
||||
return post<boolean>('/card/bind', { cardNo })
|
||||
export function bindCard(data: {
|
||||
cardNum: string
|
||||
userName: string
|
||||
mobile: string
|
||||
idType: string
|
||||
idNo: string
|
||||
img: string
|
||||
smsCode: string
|
||||
thirdId: string
|
||||
bindType: string
|
||||
bindSource: string
|
||||
channel: string
|
||||
activeCode: string
|
||||
}): Promise<boolean> {
|
||||
return post<boolean>(`${BASE_URL}/zhy-api/cardBag/bind`, data, false)
|
||||
}
|
||||
|
||||
/** 获取我的年卡列表 */
|
||||
@@ -30,3 +44,52 @@ export function getMyCards(): Promise<MyCard[]> {
|
||||
export function getEntryQrCode(cardId: string): Promise<QrCodeInfo> {
|
||||
return get<QrCodeInfo>('/card/qrcode', { cardId })
|
||||
}
|
||||
|
||||
/** 人脸绑定(上传照片) */
|
||||
export function bindFaceImg(data: {
|
||||
cardNum: string
|
||||
userName: string
|
||||
mobile: string
|
||||
idType: string
|
||||
idNo: string
|
||||
img: string
|
||||
smsCode: string
|
||||
thirdId: string
|
||||
bindType: string
|
||||
bindSource: string
|
||||
channel: string
|
||||
activeCode: string
|
||||
}): Promise<boolean> {
|
||||
return post<boolean>(`${BASE_URL}/zhy-api/cardBag/bindForAddFaceImg`, data, false)
|
||||
}
|
||||
|
||||
/** 查询是否需要人脸绑定 */
|
||||
export function checkFaceFlag(cardNo: string): Promise<boolean> {
|
||||
return post<boolean>(`${BASE_URL}/zhy-api/cardBag/faceFlag?cardNo=${cardNo}`, {}, false)
|
||||
}
|
||||
|
||||
/** 上传图片到 OSS */
|
||||
export function uploadImage(filePath: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${BASE_URL}/open-api/oss/upload`,
|
||||
filePath,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
try {
|
||||
const data = JSON.parse(res.data as string)
|
||||
if (data.errcode === 0 && data.data?.fileUrl) {
|
||||
resolve(data.data.fileUrl)
|
||||
} else {
|
||||
reject(new Error(data.errmsg || '上传失败'))
|
||||
}
|
||||
} catch { reject(new Error('解析响应失败')) }
|
||||
} else {
|
||||
reject(new Error('上传失败,状态码:' + res.statusCode))
|
||||
}
|
||||
},
|
||||
fail: reject,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user