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

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 getClassList = (params) => post("/app/stagestudentrelation/pageTaskByUser", params);
/**
* 获取是否上传人脸信息
*/
export const getIsUploadFace = (params) => post("/app/user/getUserFace", params);
// ********************* end *********************** // ********************* end ***********************

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<view class="content"> <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"> <u-list-item v-for="(item, index) in trainList" :key="index">
<view class="container_item"> <view class="container_item">
<view class="container_item_name"> <view class="container_item_name">
@ -28,14 +28,10 @@
</view> </view>
<view class="content_text"> <view class="content_text">
<view class="content_bottom"> <view class="content_bottom">
<view> <view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }} </view>
<text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.taskStatus) }}
</view>
<view class="action-row"> <view class="action-row">
<u-button size="mini" type="primary" text="签到信息" <u-button size="mini" type="primary" text="签到信息" @click="signInInformation(item.classId)" />
@click="signInInformation(item.classId)" /> <u-button size="mini" type="primary" text="考试记录" @click="ExamRecord(item.classId)" />
<u-button size="mini" type="primary" text="考试记录"
@click="ExamRecord(item.classId)" />
</view> </view>
</view> </view>
</view> </view>
@ -43,11 +39,13 @@
</view> </view>
</u-list-item> </u-list-item>
</u-list> </u-list>
<empty v-else></empty>
</view> </view>
</template> </template>
<script> <script>
import { getClassList } from '../../api'; import { getClassList, getIsUploadFace } from '../../api'
export default { export default {
data() { data() {
@ -63,6 +61,11 @@
} }
}, },
async onLoad(query) {
console.log('页面加载完成 :>> ', query)
// await this.getUserFaceCompleted()
},
/* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */ /* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */
onShow() { onShow() {
this.resetList() this.resetList()
@ -72,11 +75,10 @@
async getData() { async getData() {
let resData = await getClassList({ let resData = await getClassList({
showCount: this.pageSize, showCount: this.pageSize,
currentPage: this.currentPage, currentPage: this.currentPage
}); })
console.log(resData) this.trainList = [...this.trainList, ...resData.page.list]
this.trainList = [...this.trainList, ...resData.page.list]; this.totalPage = resData.page.totalPage
this.totalPage = resData.page.totalPage;
}, },
resetList() { resetList() {
this.pageSize = 10 this.pageSize = 10
@ -88,6 +90,31 @@
this.currentPage++ this.currentPage++
if (this.totalPage >= this.currentPage) this.getData() 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 });
// }
// }
// })
// }
// },
/** /**
* 右上角自定义扫码图标触发事件 * 右上角自定义扫码图标触发事件
*/ */
@ -103,7 +130,7 @@
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/realname_info_auth', url: '/pages/train_management/realname_info_auth',
params: { params: {
type: 'scan_face', type: 'scan_face'
} }
}) })
} else if (res.result === '1') { } else if (res.result === '1') {
@ -117,12 +144,12 @@
} }
}, },
fail: function (error) { fail: function (error) {
console.log("error :>> ", error) console.log('error :>> ', error)
}, },
complete: function (result) { complete: function (result) {
console.log("扫码完成,正在跳转功能页!") console.log('扫码完成,正在跳转功能页!')
} }
}); })
}, },
handleCalcTaskStatus(type) { handleCalcTaskStatus(type) {
return this.taskStatusMap[type] return this.taskStatusMap[type]