人脸认证组件添加扫描类型

xgf-training-dev
mengfanliang 2025-02-18 16:54:09 +08:00
parent 909d4ab415
commit 4a9faf7cac
3 changed files with 186 additions and 150 deletions

View File

@ -77,4 +77,9 @@ export const getHistoricalApprovalRecords = (params) => post("/app/Task/getHis",
* 获取班级管理分页列表
*/
export const getClassList = (params) => post("/app/stagestudentrelation/pageTaskByUser", params);
/**
* 获取是否上传人脸信息
*/
export const getIsUploadFace = (params) => post("/app/user/getUserFace", params);
// ********************* end ***********************

View File

@ -60,12 +60,13 @@ export default {
// scan_face 扫码
// learning_certification 学习认证
// meeting_attendance 会议签到
const typeKey = ["scan_face", "learning_certification"];
const typeKey = ["facial_input", "scan_face", "learning_certification"];
if (!typeKey.includes(query.type)) {
uni.$u.toast("type参数错误");
return;
}
this.isFirst = query.isFirst || "";
if (query.type === "facial_input") this.btnTextStr = "人脸认证";
if (query.type === "scan_face") this.btnTextStr = "签到";
if (query.type === "learning_certification") this.btnTextStr = "开始考试";
this.type = query.type;
@ -74,7 +75,7 @@ export default {
},
onBackPress(event) {
if (event.from === "backbutton") {
if (
if (this.type === "facial_input" ||
(this.type === "scan_face" && this.isFirst === "1") ||
this.type === "learning_certification"
) {
@ -125,7 +126,10 @@ export default {
speech.indexOf("base64,") + 7,
);
try {
if (this.type === "scan_face") {
if (this.type === "facial_input") {
uni.$u.toast("人脸认证成功");
uni.navigateBack({ delta: 1 });
} else if (this.type === "scan_face") {
// await setScanCodeToVerifyFace({
// USERAVATARPREFIX,
// USERAVATARURL,

View File

@ -1,6 +1,6 @@
<template>
<view class="content">
<u-list @scrolltolower="scrolltolower">
<u-list @scrolltolower="scrolltolower" v-if="trainList.length > 0">
<u-list-item v-for="(item, index) in trainList" :key="index">
<view class="container_item">
<view class="container_item_name">
@ -28,14 +28,10 @@
</view>
<view class="content_text">
<view class="content_bottom">
<view>
<text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }}
</view>
<view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }} </view>
<view class="action-row">
<u-button size="mini" type="primary" text="签到信息"
@click="signInInformation(item.classId)" />
<u-button size="mini" type="primary" text="考试记录"
@click="ExamRecord(item.classId)" />
<u-button size="mini" type="primary" text="签到信息" @click="signInInformation(item.classId)" />
<u-button size="mini" type="primary" text="考试记录" @click="ExamRecord(item.classId)" />
</view>
</view>
</view>
@ -43,13 +39,15 @@
</view>
</u-list-item>
</u-list>
<empty v-else></empty>
</view>
</template>
<script>
import { getClassList } from '../../api';
import { getClassList, getIsUploadFace } from '../../api'
export default {
export default {
data() {
return {
pageSize: 10,
@ -63,6 +61,11 @@
}
},
async onLoad(query) {
console.log('页面加载完成 :>> ', query)
// await this.getUserFaceCompleted()
},
/* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */
onShow() {
this.resetList()
@ -72,11 +75,10 @@
async getData() {
let resData = await getClassList({
showCount: this.pageSize,
currentPage: this.currentPage,
});
console.log(resData)
this.trainList = [...this.trainList, ...resData.page.list];
this.totalPage = resData.page.totalPage;
currentPage: this.currentPage
})
this.trainList = [...this.trainList, ...resData.page.list]
this.totalPage = resData.page.totalPage
},
resetList() {
this.pageSize = 10
@ -88,6 +90,31 @@
this.currentPage++
if (this.totalPage >= this.currentPage) this.getData()
},
/**
* 获取是否已经完成上传人脸信息
*/
// async getUserFaceCompleted() {
// const userFaceData = await getIsUploadFace()
// console.log('userFaceData :>> ', userFaceData)
// if (!userFaceData?.data) {
// uni.showModal({
// title: '',
// content: '!',
// success: function (res) {
// if (res.confirm) {
// uni.$u.route({
// url: '/pages/train_management/face_authentication',
// params: {
// type: 'facial_input'
// }
// })
// } else if (res.cancel) {
// uni.navigateBack({ delta: 1 });
// }
// }
// })
// }
// },
/**
* 右上角自定义扫码图标触发事件
*/
@ -97,13 +124,13 @@
// scanType: ['qrCode'], //
onlyFromCamera: false, //
hideAlbum: false, // ,,
success: function(res) {
success: function (res) {
if (res.result === '0') {
//
uni.$u.route({
url: '/pages/train_management/realname_info_auth',
params: {
type: 'scan_face',
type: 'scan_face'
}
})
} else if (res.result === '1') {
@ -116,13 +143,13 @@
})
}
},
fail: function(error) {
console.log("error :>> ", error)
fail: function (error) {
console.log('error :>> ', error)
},
complete: function(result) {
console.log("扫码完成,正在跳转功能页!")
complete: function (result) {
console.log('扫码完成,正在跳转功能页!')
}
});
})
},
handleCalcTaskStatus(type) {
return this.taskStatusMap[type]
@ -150,11 +177,11 @@
})
}
}
}
}
</script>
<style scoped lang="scss">
.container_item {
.container_item {
padding-left: 16rpx;
.container_item_name {
@ -201,5 +228,5 @@
}
}
}
}
}
</style>