feat: 1. [我的]菜单,添加人脸认证的人脸录制的操作入口

2. 调试入班二维码进入,根据 classId 的条件进行逻辑提示进入
3. 调试考试二维码进入,根据 classId 的条件进行逻辑提示进入
4. 签到信息页面内, 字段校对
5. 入班人脸识别接口逻辑和考试人脸识别接口逻辑的调试
xgf-training-dev
mengfanliang 2025-02-21 18:08:09 +08:00
parent 661458ac6c
commit 7c245ffe68
12 changed files with 599 additions and 501 deletions

View File

@ -74,7 +74,14 @@ export const getHistoricalApprovalRecords = (params) => post('/app/Task/getHis',
export const getIsUploadFace = (params) => post('/app/user/getUserFace', params) // 获取是否上传人脸信息 export const getIsUploadFace = (params) => post('/app/user/getUserFace', params) // 获取是否上传人脸信息
export const getClassList = (params) => post('/app/stagestudentrelation/pageTaskByUser', params) //获取班级列表 export const getClassList = (params) => post('/app/stagestudentrelation/pageTaskByUser', params) //获取班级列表
export const joinClass = (params) => uploads('/app/student/joinClass', params) // 实名认证信息提交 export const joinClass = (params) => uploads('/app/student/joinClass', params) // 实名认证信息提交
export const getTaskScoreInfo = (params) => post('/app/stageexam/findResult', params) // 考试成绩详情 export const getSignInfo = (params) => post('/app/student/signinfo', params) // 获取签到信息
export const getTaskScoreInfo = (params) => post('/app/stageexam/findResult', params) // 考试成绩记录详情
export const getExamExercises = (params) => post('/app/stageexam/getExam', params) // 考试习题 export const getExamExercises = (params) => post('/app/stageexam/getExam', params) // 考试习题
export const setTestPaperSubmission = (params) => post('/app/stageexam/submit', params) // 考试交卷 export const setTestPaperSubmission = (params) => post('/app/stageexam/submit', params) // 考试交卷
export const submitEditUserFace = (params) => post('/app/user/editUserFace', params) // 提交照片人脸
export const submitEditUserVideoFace = (params) => post('/app/user/editUserVideoFace', params) // 提交视频人脸
export const compareUserFaceCertify = (params) => post('/app/user/compareFace', params) // 照片人脸认证
export const compareUserVideoFaceCertify = (params) => post('/app/user/compareVideoFace', params) // 视频人脸验证
export const compareUserExamFaceCertify = (params) => post('/app/user/compareExamFace', params) // 考试照片人脸认证
export const compareUserExamVideoFaceCertify = (params) => post('/app/user/compareExamVideoFace', params) // 考试视频人脸认证
// ********************* end *********************** // ********************* end ***********************

View File

@ -1,144 +1,180 @@
<template> <template>
<view class="page"> <view class="page">
<view class="status_bar"> <view class="status_bar">
<view class="top_view"></view> <view class="top_view"></view>
</view> </view>
<view class="wui_banner"> <view class="wui_banner">
<view class="banner_img"> <view class="banner_img">
<image src="../../static/home-bg.png" mode=""></image> <image src="../../static/home-bg.png" mode=""></image>
</view> </view>
</view> </view>
<view class="home-apps"> <view class="home-apps">
<view class="home-apps-item" @click="fnScan"> <view class="home-apps-item" @click="fnScan">
<view class="home-apps-item-img"> <view class="home-apps-item-img">
<image src="../../static/icon-apps/app_icons6.png" mode=""></image> <image src="../../static/icon-apps/app_icons6.png" mode=""></image>
</view> </view>
<view class="text"> <view class="text">
<text>扫码</text> <text>扫码</text>
</view> </view>
</view> </view>
<view class="home-apps-item" v-for="(item,index) in baseList" :key="index" @click="fnNavigator(index)"> <view class="home-apps-item" v-for="(item, index) in baseList" :key="index" @click="fnNavigator(index)">
<view class="home-apps-item-img"> <view class="home-apps-item-img">
<image :src="item.img" mode=""></image> <image :src="item.img" mode=""></image>
</view> </view>
<view class="text"> <view class="text">
<text>{{ item.title }}</text> <text>{{ item.title }}</text>
</view> </view>
</view> </view>
</view> </view>
<u-modal :show="updateVersion.modalShow" title="温馨提示" :showConfirmButton="updateVersion.showConfirmButton" <u-modal
:showCancelButton="updateVersion.showCancelButton" :confirmText="updateVersion.confirmText" :show="updateVersion.modalShow"
:cancelText="updateVersion.cancelText" title="温馨提示"
@cancel="modalCancel" @confirm="modalConfirm"> :showConfirmButton="updateVersion.showConfirmButton"
<view style="text-align: center;color:#606266"> :showCancelButton="updateVersion.showCancelButton"
<rich-text :nodes="updateVersion.modalContent"></rich-text> :confirmText="updateVersion.confirmText"
</view> :cancelText="updateVersion.cancelText"
</u-modal> @cancel="modalCancel"
</view> @confirm="modalConfirm"
>
<view style="text-align: center; color: #606266">
<rich-text :nodes="updateVersion.modalContent"></rich-text>
</view>
</u-modal>
</view>
</template> </template>
<script> <script>
import updateVersion from "../../utils/updateVersion"; import updateVersion from '../../utils/updateVersion'
import {setEntry} from "../../api"; import { setEntry, getIsUploadFace } from '../../api'
export default { export default {
mixins: [updateVersion], mixins: [updateVersion],
data() { data() {
return { return {
baseList: [ baseList: [
{ {
img: require('../../static/icon-apps/app_icons.png'), img: require('../../static/icon-apps/app_icons.png'),
title: '电子工牌', title: '电子工牌',
url: '/pages/electronic_work_card/index' url: '/pages/electronic_work_card/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons2.png'), img: require('../../static/icon-apps/app_icons2.png'),
title: '服务单位 管理', title: '服务单位 管理',
url: '/pages/service_unit_management/index' url: '/pages/service_unit_management/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons3.png'), img: require('../../static/icon-apps/app_icons3.png'),
title: '我的信息', title: '我的信息',
url: '/pages/mine/information/index' url: '/pages/mine/information/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons4.png'), img: require('../../static/icon-apps/app_icons4.png'),
title: '证书信息', title: '证书信息',
url: '/pages/certificate_information/index' url: '/pages/certificate_information/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons5.png'), img: require('../../static/icon-apps/app_icons5.png'),
title: '就职单位', title: '就职单位',
url: '/pages/employed_by/index' url: '/pages/employed_by/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons7.png'), img: require('../../static/icon-apps/app_icons7.png'),
title: '高危作业', title: '高危作业',
url: '/pages/eight_assignments/index' url: '/pages/eight_assignments/index'
}, },
{ {
img: require('../../static/icon-apps/app_icons8.png'), img: require('../../static/icon-apps/app_icons8.png'),
title: '培训管理', title: '培训管理',
url: '/pages/train_management/index' url: '/pages/train_management/index'
}, }
], ]
} }
}, },
computed: { computed: {
userInfo() { userInfo() {
return this.$store.getters.getUserInfo return this.$store.getters.getUserInfo
} }
}, },
onLoad() { onLoad() {
this.fnUpdateVersion(false) this.fnUpdateVersion(false)
}, this.getUserFaceCompleted()
methods: { },
async fnScan() { methods: {
uni.scanCode({ async fnScan() {
success: async (res) => { uni.scanCode({
let obj = JSON.parse(res.result) success: async (res) => {
let type = obj[0].CODE_TYPE let obj = JSON.parse(res.result)
if (type === '0') { let type = obj[0].CODE_TYPE
let info = await setEntry({ if (type === '0') {
USER_ID: this.userInfo.USER_ID, let info = await setEntry({
CORPINFO_ID: obj[0].CORPINFO_ID, USER_ID: this.userInfo.USER_ID,
RELEVANT_UNIT_NAME: obj[0].RELEVANT_UNIT_NAME CORPINFO_ID: obj[0].CORPINFO_ID,
}); RELEVANT_UNIT_NAME: obj[0].RELEVANT_UNIT_NAME
if (info.code === 200){ })
uni.$u.toast('入职成功') if (info.code === 200) {
}else { uni.$u.toast('入职成功')
uni.$u.toast('入职失败,请联系管理员') } else {
} uni.$u.toast('入职失败,请联系管理员')
}
} else if (type === '1') { } else if (type === '1') {
// type=1 // type=1
uni.$u.route({ uni.$u.route({
url: '/pages/electronic_work_card/index', url: '/pages/electronic_work_card/index',
params: { params: {
USER_ID: obj[0].USER_ID, USER_ID: obj[0].USER_ID,
CODE_TYPE: obj[0].CODE_TYPE CODE_TYPE: obj[0].CODE_TYPE
} }
}) })
} }
} }
}); })
}, },
fnIsShow(index){ fnIsShow(index) {
if(index === 5) return !!this.userInfo.CORPINFO_ID if (index === 5) return !!this.userInfo.CORPINFO_ID
return true return true
}, },
fnNavigator(e) { fnNavigator(e) {
uni.$u.route({ uni.$u.route({
url: this.baseList[e].url url: this.baseList[e].url
}) })
}, },
}, /**
* 获取是否已经完成上传人脸信息
*/
async getUserFaceCompleted() {
const userFaceData = await getIsUploadFace()
// userFaceData.authentication --> 0:
// userFaceData.authentication --> 1:
this.$store.dispatch('setVerification', userFaceData.authentication ? userFaceData.authentication : "0"); //
const isPassedVerification = userFaceData.authentication === '0'
if (isPassedVerification) {
uni.showModal({
title: '温馨提示',
content: '为了能够得到更好的体验,我们会获取您个人信息,请完成人脸信息认证!',
success: function (res) {
if (res.confirm) {
uni.$u.route({
url: '/pages/train_management/face_authentication',
params: {
type: 'facial_input'
}
})
}
if (res.cancel) {
uni.$u.toast("您可进入[我的]-[人脸认证]完成信息认证")
}
}
})
}
}
}
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.page { .page {
background-color: #f7f9ff; background-color: #f7f9ff;
min-height: 100vh; min-height: 100vh;
} }
</style> </style>

View File

@ -64,6 +64,11 @@ export default {
name: '个人信息', name: '个人信息',
url: '/pages/mine/information/index' url: '/pages/mine/information/index'
}, },
{
img: require('../../../static/images/my_ico2.png'),
name: '人脸认证',
url: '/pages/train_management/face_authentication?type=update_facial_input'
},
{ {
img: require('../../../static/images/my_ico3.png'), img: require('../../../static/images/my_ico3.png'),
name: '问题反馈', name: '问题反馈',

View File

@ -18,19 +18,19 @@
</text> </text>
</view> </view>
<view v-show="options[current].QUESTIONTYPE === '1'" class="options"> <view v-show="options[current].QUESTIONTYPE === '1'" class="options">
<view class="item" :class="{ active: options[current].checked === 'A' }" @click="fnChooseTopic('radio', 'A')"> <view class="item" :class="{ 'active': options[current].checked === 'A' }" @click="fnChooseTopic('radio', 'A')">
<text class="option">A</text> <text class="option">A</text>
<text class="text">{{ options[current].OPTIONA }}</text> <text class="text">{{ options[current].OPTIONA }}</text>
</view> </view>
<view class="item" :class="{ active: options[current].checked === 'B' }" @click="fnChooseTopic('radio', 'B')"> <view class="item" :class="{ 'active': options[current].checked === 'B' }" @click="fnChooseTopic('radio', 'B')">
<text class="option">B</text> <text class="option">B</text>
<text class="text">{{ options[current].OPTIONB }}</text> <text class="text">{{ options[current].OPTIONB }}</text>
</view> </view>
<view class="item" :class="{ active: options[current].checked === 'C' }" @click="fnChooseTopic('radio', 'C')"> <view class="item" :class="{ 'active': options[current].checked === 'C' }" @click="fnChooseTopic('radio', 'C')">
<text class="option">C</text> <text class="option">C</text>
<text class="text">{{ options[current].OPTIONC }}</text> <text class="text">{{ options[current].OPTIONC }}</text>
</view> </view>
<view class="item" :class="{ active: options[current].checked === 'D' }" @click="fnChooseTopic('radio', 'D')"> <view class="item" :class="{ 'active': options[current].checked === 'D' }" @click="fnChooseTopic('radio', 'D')">
<text class="option">D</text> <text class="option">D</text>
<text class="text">{{ options[current].OPTIOND }}</text> <text class="text">{{ options[current].OPTIOND }}</text>
</view> </view>
@ -39,7 +39,7 @@
<view <view
class="item" class="item"
:class="{ :class="{
active: options[current].checked && options[current].checked.indexOf('A') !== -1 'active': options[current].checked && options[current].checked.indexOf('A') !== -1
}" }"
@click="fnChooseTopic('multiple', 'A')" @click="fnChooseTopic('multiple', 'A')"
> >
@ -49,7 +49,7 @@
<view <view
class="item" class="item"
:class="{ :class="{
active: options[current].checked && options[current].checked.indexOf('B') !== -1 'active': options[current].checked && options[current].checked.indexOf('B') !== -1
}" }"
@click="fnChooseTopic('multiple', 'B')" @click="fnChooseTopic('multiple', 'B')"
> >
@ -59,7 +59,7 @@
<view <view
class="item" class="item"
:class="{ :class="{
active: options[current].checked && options[current].checked.indexOf('C') !== -1 'active': options[current].checked && options[current].checked.indexOf('C') !== -1
}" }"
@click="fnChooseTopic('multiple', 'C')" @click="fnChooseTopic('multiple', 'C')"
> >
@ -69,7 +69,7 @@
<view <view
class="item" class="item"
:class="{ :class="{
active: options[current].checked && options[current].checked.indexOf('D') !== -1 'active': options[current].checked && options[current].checked.indexOf('D') !== -1
}" }"
@click="fnChooseTopic('multiple', 'D')" @click="fnChooseTopic('multiple', 'D')"
> >
@ -78,11 +78,11 @@
</view> </view>
</view> </view>
<view v-show="options[current].QUESTIONTYPE === '3'" class="options"> <view v-show="options[current].QUESTIONTYPE === '3'" class="options">
<view class="item" :class="{ active: options[current].checked === 'A' }" @click="fnChooseTopic('judge', 'A')"> <view class="item" :class="{ 'active': options[current].checked === 'A' }" @click="fnChooseTopic('judge', 'A')">
<text class="option">{{ options[current].OPTIONA }}</text> <text class="option">{{ options[current].OPTIONA }}</text>
<text class="text"></text> <text class="text"></text>
</view> </view>
<view class="item" :class="{ active: options[current].checked === 'B' }" @click="fnChooseTopic('judge', 'B')"> <view class="item" :class="{ 'active': options[current].checked === 'B' }" @click="fnChooseTopic('judge', 'B')">
<text class="option">{{ options[current].OPTIONB }}</text> <text class="option">{{ options[current].OPTIONB }}</text>
<text class="text"></text> <text class="text"></text>
</view> </view>
@ -108,7 +108,7 @@ import {
getExamExercises, getExamExercises,
// getStrengthenExam, // getStrengthenExam,
setTestPaperSubmission, setTestPaperSubmission,
} from '../../api' } from '@/api';
export default { export default {
data() { data() {
@ -133,7 +133,6 @@ export default {
} }
}, },
onLoad(query) { onLoad(query) {
console.log('query :>> ', query);
this.routeQuery = query this.routeQuery = query
// this.STAGEEXAMPAPER_ID = query.STAGEEXAMPAPER_ID; // this.STAGEEXAMPAPER_ID = query.STAGEEXAMPAPER_ID;
// this.entrySite = query.entrySite; // this.entrySite = query.entrySite;

View File

@ -17,8 +17,7 @@
</view> </view>
<view class="counter"> <view class="counter">
当前试题: <text style="color: orange">{{ current + 1 }}</text 当前试题: <text style="color: orange">{{ current + 1 }}</text>/{{ questionList.length }}
>/{{ questionList.length }}
</view> </view>
<view class="topic"> <view class="topic">
@ -92,7 +91,7 @@
</template> </template>
<script> <script>
import { getTaskScoreInfo } from "../../api"; import { getTaskScoreInfo } from "@/api";
export default { export default {
data() { data() {
@ -125,7 +124,7 @@ export default {
// stagestudentrelationId, // stagestudentrelationId,
// classId // classId
// }) // })
// console.log('resData :>> ', resData); // this.questionList = resData.list
this.questionList = [ this.questionList = [
{ {
stageexamrecordId: '7cea826c3c974cb69028dd0624b632ba', stageexamrecordId: '7cea826c3c974cb69028dd0624b632ba',

View File

@ -1,207 +1,205 @@
<template> <template>
<view class="container"> <view class="container">
<view class="fat"> <view class="fat">
<text class="fatt">请将人脸置于圆圈内</text> <text class="fatt">请将人脸置于圆圈内</text>
</view> </view>
<view class="livefater"> <view class="livefater">
<view <view style="width: 700upx; height: 700upx; border-radius: 700upx; overflow: hidden">
style=" <live-pusher id="livePusher" ref="livePusher" class="livePusher" url="" mode="SD" :muted="true" :enable-camera="true" :auto-focus="true" :beauty="1" whiteness="2" aspect="1:1" />
width: 700upx; </view>
height: 700upx; <cover-image src="/static/images/gaiz.png" class="gaiimg"></cover-image>
border-radius: 700upx; </view>
overflow: hidden;
"
>
<live-pusher
id="livePusher"
ref="livePusher"
class="livePusher"
url=""
mode="SD"
:muted="true"
:enable-camera="true"
:auto-focus="true"
:beauty="1"
whiteness="2"
aspect="1:1"
/>
</view>
<cover-image src="/static/images/gaiz.png" class="gaiimg"></cover-image>
</view>
<view style="margin: 0 100upx"> <view style="margin: 0 100upx">
<u-button :text="btnTextStr" type="primary" @click="snapshot" /> <u-button :text="btnTextStr" type="primary" @click="snapshot" />
</view> </view>
</view> </view>
</template> </template>
<script> <script>
// import {setMeetingFace, setScanCodeToVerifyFace, setUserFace, setVerifyFace} from "@/api"; // import {setMeetingFace, setScanCodeToVerifyFace, setUserFace, setVerifyFace} from "@/api";
import { submitEditUserFace, compareUserFaceCertify, compareUserExamFaceCertify } from '@/api';
export default { export default {
data() { data() {
return { return {
startPreviewTimer: null, // 开始预览计时器实例 startPreviewTimer: null, // 开始预览计时器实例
isFirst: "", // 是否为第一次开启摄像头 isFirst: '', // 是否为第一次开启摄像头
type: "", // 摄像头使用类别 type: '', // 摄像头使用类别
// showButton: "yes", // showButton: "yes",
routeQueryparams: {}, // 额外携带的参数 routeQueryparams: {}, // 额外携带的参数
btnTextStr: "拍照" btnTextStr: '拍照'
}; }
}, },
onReady() { onReady() {
this.context = uni.createLivePusherContext("livePusher", this); this.context = uni.createLivePusherContext('livePusher', this)
this.startPreviewTimer = setInterval(() => { this.startPreviewTimer = setInterval(() => {
this.startPreview(); this.startPreview()
}, 1000); }, 1000)
}, },
onLoad(query) { onLoad(query) {
// facial_input 更新人脸 isFirst 1 第一次登录添加人脸 // facial_input 人脸认证 isFirst 1 第一次登录添加人脸
// scan_face 扫码 // scan_face 扫码
// learning_certification 学习认证 // update_facial_input 更新人脸
// meeting_attendance 会议签到 // learning_certification 学习认证
const typeKey = ["facial_input", "scan_face", "learning_certification"]; // meeting_attendance 会议签到
if (!typeKey.includes(query.type)) { const typeKey = ['facial_input', 'scan_face', 'learning_certification', 'update_facial_input']
uni.$u.toast("type参数错误"); if (!typeKey.includes(query.type)) {
return; uni.$u.toast('type参数错误')
} return
this.isFirst = query.isFirst || ""; }
if (query.type === "facial_input") this.btnTextStr = "人脸认证"; this.isFirst = query.isFirst || ''
if (query.type === "scan_face") this.btnTextStr = "签到"; if (query.type === 'facial_input' || 'update_facial_input') this.btnTextStr = '人脸认证'
if (query.type === "learning_certification") this.btnTextStr = "开始考试"; if (query.type === 'scan_face') this.btnTextStr = '签到'
this.type = query.type; if (query.type === 'learning_certification') this.btnTextStr = '开始考试'
// this.showButton = query.showButton || "yes"; this.type = query.type
this.routeQueryparams = query ?? {}; // this.showButton = query.showButton || "yes";
}, this.routeQueryparams = query ?? {}
onBackPress(event) { },
if (event.from === "backbutton") { onBackPress(event) {
if (this.type === "facial_input" || if (event.from === 'backbutton') {
(this.type === "scan_face" && this.isFirst === "1") || if ((this.type === 'scan_face' && this.isFirst === '1') || this.type === 'learning_certification' || this.type === 'facial_input') {
this.type === "learning_certification" uni.$u.toast('请完成人脸验证')
) { return true
uni.$u.toast("请完成人脸验证"); }
return true; }
} return false
} },
return false; onUnload() {
}, this.startPreviewTimer && clearInterval(this.startPreviewTimer)
methods: { },
snapshot() { methods: {
uni.showLoading({ snapshot() {
title: "加载中", uni.showLoading({
}); title: '加载中'
this.context.snapshot({ })
success: (e) => { this.context.snapshot({
this.getMinImage(e.message.tempImagePath); success: (e) => {
}, this.getMinImage(e.message.tempImagePath)
});
},
startPreview() {
this.context.stopPreview();
this.context.startPreview({
success: () => {
this.startPreviewTimer && clearInterval(this.startPreviewTimer);
// this.showButton === "no" && this.snapshot();
},
});
},
getMinImage(imgPath) {
plus.zip.compressImage(
{
src: imgPath,
dst: imgPath,
overwrite: true,
quality: 40
},
(zipRes) => {
setTimeout(() => {
const reader = new plus.io.FileReader();
reader.onloadend = async (res) => {
const speech = res.target.result;
// 获取 base 64 图片编码的前缀
const USERAVATARPREFIX = speech.substring(
0,
speech.indexOf("base64,") + 7,
);
// 获取 base 64 图片的二进制到文本
const USERAVATARURL = speech.substring(
speech.indexOf("base64,") + 7,
);
try {
if (this.type === "facial_input") {
uni.$u.toast("人脸认证成功");
uni.navigateBack({ delta: 1 });
} else if (this.type === "scan_face") {
// await setScanCodeToVerifyFace({
// USERAVATARPREFIX,
// USERAVATARURL,
// ...this.params,
// });
uni.$u.toast("认证成功");
uni.navigateBack({ delta: 2 });
} else if (this.type === "learning_certification") {
// await setVerifyFace({
// USERAVATARPREFIX,
// USERAVATARURL,
// ...this.params,
// });
// await this.$store.dispatch("setVerification", true);
uni.$u.toast("认证成功");
// uni.navigateBack();
uni.$u.route({
url: '/pages/train_management/course_exam',
params: { ...this.routeQueryparams }
})
}
} catch (e) {
if(e && e.msg){
uni.$u.toast(e.msg,);
} }
// this.showButton === "no" && this.snapshot(); })
} },
}; startPreview() {
reader.readAsDataURL( this.context.stopPreview()
plus.io.convertLocalFileSystemURL(zipRes.target), this.context.startPreview({
); success: () => {
}, 4000); this.startPreviewTimer && clearInterval(this.startPreviewTimer)
}, // this.showButton === "no" && this.snapshot();
); }
}, })
}, },
}; getMinImage(imgPath) {
plus.zip.compressImage(
{
src: imgPath,
dst: imgPath,
overwrite: true,
quality: 40
},
(zipRes) => {
setTimeout(() => {
const reader = new plus.io.FileReader()
reader.onloadend = async (res) => {
const speech = res.target.result
// 获取 base 64 图片编码的前缀
const USERAVATARPREFIX = speech.substring(0, speech.indexOf('base64,') + 7)
// 获取 base 64 图片的二进制到文本
const USERAVATARURL = speech.substring(speech.indexOf('base64,') + 7)
try {
const otherParams = {
...this.routeQueryparams
}
delete otherParams.type
if (this.type === 'facial_input' || this.type === 'update_facial_input') {
await submitEditUserFace({
...otherParams,
USERAVATARPREFIX,
USERAVATARURL
})
await this.$store.dispatch('setVerification', '1')
uni.$u.toast('人脸信息认证成功')
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 1000)
} else if (this.type === 'scan_face') {
await compareUserFaceCertify({
...otherParams,
USERAVATARPREFIX,
USERAVATARURL
})
uni.$u.toast('人脸认证成功')
setTimeout(() => {
uni.navigateBack({
delta: 2
})
}, 1000)
} else if (this.type === 'learning_certification') {
const res = await compareUserExamFaceCertify({
...otherParams,
USERAVATARPREFIX,
USERAVATARURL
})
await uni.$u.toast('人脸认证成功, 请进入考试答题')
setTimeout(() => {
uni.$u.route({
url: '/pages/train_management/course_exam',
params: {
...this.routeQueryparams
}
})
}, 1000)
}
} catch (e) {
console.log('扫描人脸过程中捕获的错误 :>>> ', e)
if (e && e.msg) {
uni.$u.toast(e.msg)
}
// this.showButton === "no" && this.snapshot();
}
}
reader.readAsDataURL(plus.io.convertLocalFileSystemURL(zipRes.target))
}, 4000)
}
)
}
}
}
</script> </script>
<style scoped> <style scoped>
.container { .container {
background-color: #fff; background-color: #fff;
} }
.livePusher { .livePusher {
width: 700upx; width: 700upx;
height: 700upx; height: 700upx;
} }
.livefater { .livefater {
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
margin-bottom: 100upx; margin-bottom: 100upx;
height: 700upx; height: 700upx;
} }
.fat { .fat {
margin: 100upx; margin: 100upx;
} }
.fatt { .fatt {
text-align: center; text-align: center;
font-size: 36upx; font-size: 36upx;
font-weight: 800; font-weight: 800;
} }
.gaiimg { .gaiimg {
width: 700upx; width: 700upx;
height: 700upx; height: 700upx;
margin-top: -700upx; margin-top: -700upx;
} }
</style> </style>

View File

@ -45,11 +45,13 @@
</template> </template>
<script> <script>
import { getClassList, getIsUploadFace } from '../../api' import { getClassList, getIsUploadFace } from '@/api';
import store from '@/store/index';
export default { export default {
data() { data() {
return { return {
verification: store.state.verification, //
pageSize: 10, pageSize: 10,
currentPage: 1, currentPage: 1,
totalPage: 0, totalPage: 0,
@ -65,27 +67,32 @@ export default {
/* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */ /* 监听页面显示,页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面 */
onShow() { onShow() {
this.resetList() // this.resetList();
}, },
async onLoad(query) { async onLoad(query) {
await this.getUserFaceCompleted() await this.getUserFaceCompleted()
await this.resetList()
}, },
methods: { methods: {
async getData() { async resetList() {
let resData = await getClassList({
showCount: this.pageSize,
currentPage: this.currentPage
})
this.trainList = [...this.trainList, ...resData.page.list]
this.totalPage = resData.page.totalPage
},
resetList() {
this.pageSize = 10 this.pageSize = 10
this.currentPage = 1 this.currentPage = 1
this.trainList = [] this.trainList = []
this.getData() await this.getData()
},
async getData() {
// verification --> 0:
// verification --> 1:
if (this.verification === '1') {
let resData = await getClassList({
showCount: this.pageSize,
currentPage: this.currentPage
})
this.trainList = [...this.trainList, ...resData.page.list]
this.totalPage = resData.page.totalPage
}
}, },
scrolltolower() { scrolltolower() {
this.currentPage++ this.currentPage++
@ -100,30 +107,39 @@ export default {
// scanType: ['qrCode'], // // scanType: ['qrCode'], //
onlyFromCamera: false, // onlyFromCamera: false, //
hideAlbum: false, // , hideAlbum: false, // ,
success: function (response) { success: (response) => {
const { stageexampaperinputId, classId, postId, studentId, numberofexams, type } = JSON.parse(response.result) const { stageexampaperinputId, classId, postId, studentId, numberofexams, type } = JSON.parse(response.result)
const findClassId = this.trainList.some((item) => item.classId === classId)
if (type === '0') { if (type === '0') {
// //
uni.$u.route({ if (findClassId) {
url: '/pages/train_management/realname_info_auth', uni.$u.route({
params: { url: '/pages/train_management/realname_info_auth',
type: 'scan_face', params: {
classId type: 'scan_face',
} classId
}) }
})
} else {
uni.$u.toast('您未在培训计划内,无法入班签到,请联系教师')
}
} else if (type === '1') { } else if (type === '1') {
// //
uni.$u.route({ if (findClassId) {
url: '/pages/train_management/face_authentication', uni.$u.route({
params: { url: '/pages/train_management/face_authentication',
type: 'learning_certification', params: {
stageexampaperinputId, type: 'learning_certification',
classId, stageexampaperinputId,
postId, classId,
studentId, postId,
numberofexams studentId,
} numberofexams
}) }
})
} else {
uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师')
}
} }
}, },
fail: function (error) { fail: function (error) {
@ -138,9 +154,10 @@ export default {
* 获取是否已经完成上传人脸信息 * 获取是否已经完成上传人脸信息
*/ */
async getUserFaceCompleted() { async getUserFaceCompleted() {
const userFaceData = await getIsUploadFace() // const userFaceData = await getIsUploadFace()
console.log('userFaceData :>> ', userFaceData) // verification --> 0:
if (!userFaceData?.data) { // verification --> 1:
if (this.verification === '0') {
uni.showModal({ uni.showModal({
title: '温馨提示', title: '温馨提示',
content: '检测到您还未完成人脸信息读取,请先完成人脸信息认证!', content: '检测到您还未完成人脸信息读取,请先完成人脸信息认证!',

View File

@ -68,7 +68,7 @@
</template> </template>
<script> <script>
import { getDataDictionary, joinClass } from '../../api' import { getDataDictionary, joinClass } from '@/api';
import Sign from '@/components/sign/sign.vue' import Sign from '@/components/sign/sign.vue'
import { validateFieldPhone, validateFieldIdCard } from '@/utils/formValidateField.js' import { validateFieldPhone, validateFieldIdCard } from '@/utils/formValidateField.js'

View File

@ -1,163 +1,191 @@
<template> <template>
<view class="content"> <view class="content">
<u-list @scrolltolower="scrolltolower"> <u-list @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in signList" :key="index"> <u-list-item v-for="(item, index) in signList" :key="index">
<view class="sign_item"> <view class="sign_item">
<view class="sign_item_avatar"> <view class="sign_item_avatar">
<!-- 用来给图片资源添加前置的统一的访问路径头部: $filePath, 这个将会用在下面的 u-image 组件中的 src 属性中, 示例为: src="$filePath + item.FILEPATH" --> <!-- 用来给图片资源添加前置的统一的访问路径头部: $filePath, 这个将会用在下面的 u-image 组件中的 src 属性中, 示例为: src="$filePath + item.FILEPATH" -->
<u-image <u-image width="200rpx" height="200rpx" model="widthFix" :src="item.useravatarurl" />
width="200rpx" </view>
height="200rpx" <view class="info_body">
model="widthFix" <view class="info_name">
:src="item.FILEPATH" <text>{{ item.userName }}</text>
/> </view>
</view> <view class="info_raw">
<view class="info_body"> <text class="content_label">班级名称: </text>
<view class="info_name"> <text class="content_value">{{ item.name }}</text>
<text>{{ item.userName }}</text> </view>
</view> <view class="info_raw">
<view class="info_raw"> <text class="content_label">签到时间: </text>
<text class="content_label">班级名称: </text> <text class="content_value">{{ item.studyStartTime }}</text>
<text class="content_value">{{ item.className }}</text> </view>
</view> <view class="info_raw">
<view class="info_raw"> <text class="content_label">培训地点: </text>
<text class="content_label">签到时间: </text> <text class="content_value">{{ item.trainingLocation }}</text>
<text class="content_value">{{ item.signTime }}</text> </view>
</view> <view class="info_raw flex_layout">
<view class="info_raw"> <text class="content_label">签到状态: </text>
<text class="content_label">培训地点: </text> <text class="tag" :class="studyStateMap[item.studystate].color">{{ studyStateMap[item.studystate].value }}</text>
<text class="content_value">{{ item.train }}</text> </view>
</view>
<view class="info_raw flex_layout"> <view class="info_raw flex_layout">
<text class="content_label">签到状态: </text> <text class="content_label">考试状态: </text>
<text class="tag_flag">{{ handleCalcSignStatus(item.trainStatus) }}</text> <text class="tag" :class="stageexamStateMap[item.stageexamstate].color">{{ stageexamStateMap[item.stageexamstate].value }}</text>
</view> </view>
</view> </view>
</view> </view>
</u-list-item> </u-list-item>
</u-list> </u-list>
</view> </view>
</template> </template>
<script> <script>
import { getSignInfo } from '@/api'
export default { export default {
data() { data() {
return { return {
pageSize: 10, routeQuery: {},
currentPage: 1, pageSize: 10,
totalPage: 0, currentPage: 1,
signList: [], totalPage: 0,
signStatusMap: { signList: [],
0: '认证签到', //
1: '考试签到' studyStateMap: {
} '0': {
} value: '未签到',
}, color: 'tag__red'
onShow() {
this.resetList()
},
methods: {
async getData() {
// let resData = await getCertificateInformationList({
// showCount: this.pageSize,
// currentPage: this.currentPage,
// });
this.signList = [
{
userName: '齐天大圣1',
FILEPATH:
'https://img.alicdn.com/img/i1/131787161/O1CN01z67Qvv22lnCzgPob4_!!0-saturn_solar.jpg_.webp',
className: '班级名称1班级名称1班级名称1班级名称1',
signTime: '2025-02-11 09:40',
train: '教三大教室',
trainStatus: 0 //
}, },
{ '1': {
userName: '齐天大圣2', value: '已签到',
FILEPATH: color: 'tag__green'
'https://img.alicdn.com/img/i1/131787161/O1CN01z67Qvv22lnCzgPob4_!!0-saturn_solar.jpg_.webp',
className: '班级名称2',
signTime: '2025-02-14 18:00',
train: '教一大教室',
trainStatus: 1 //
} }
] },
this.totalPage = 2 //
}, stageexamStateMap: {
resetList() { '0': {
this.pageSize = 10 value: '无需考试',
this.currentPage = 1 color: 'tag__orange'
this.trainList = [] },
this.getData() '1': {
}, value: '未签到',
scrolltolower() { color: 'tag__red'
this.currentPage++ },
if (this.totalPage >= this.currentPage) this.getData() '5': {
}, value: '已签到',
handleCalcSignStatus(type) { color: 'tag__green'
return this.signStatusMap[type] },
} },
} }
},
onShow() {
this.resetList()
},
onLoad(query) {
this.routeQuery = query
},
methods: {
async getData() {
const { classId } = this.routeQuery
// let resData = await getSignInfo({
// showCount: this.pageSize,
// currentPage: this.currentPage,
// classId
// });
// this.signList = [...this.signList, ...resData.page.list]
// this.totalPage = resData.page.totalPage
this.signList = [
{
userName: '齐天大圣1',
useravatarurl: 'https://img.alicdn.com/img/i1/131787161/O1CN01z67Qvv22lnCzgPob4_!!0-saturn_solar.jpg_.webp',
name: '班级名称1班级名称1班级名称1班级名称1',
studyStartTime: '2025-02-11 09:40',
trainingLocation: '教三大教室',
studystate: '0',
stageexamstate: '0'
},
]
this.totalPage = 2
},
resetList() {
this.pageSize = 10
this.currentPage = 1
this.trainList = []
this.getData()
},
scrolltolower() {
this.currentPage++
if (this.totalPage >= this.currentPage) this.getData()
}
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.sign_item { .sign_item {
display: flex; display: flex;
gap: 20rpx; gap: 20rpx;
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
.sign_item_avatar { .sign_item_avatar {
font-size: 0; font-size: 0;
} }
.info_body { .info_body {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 8rpx; gap: 8rpx;
.info_name { .info_name {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;
margin-bottom: 16rpx; margin-bottom: 16rpx;
} }
.info_raw { .info_raw {
color: #acafb3; color: #acafb3;
font-size: 30rpx; font-size: 30rpx;
.content_label { .content_label {
display: inline-block; display: inline-block;
width: 160rpx; width: 160rpx;
} }
.content_value { .content_value {
display: inline-block; display: inline-block;
vertical-align: bottom; vertical-align: bottom;
line-height: 1.2; padding: 0;
transform: translateY(8rpx); width: 300rpx;
padding: 0; overflow: hidden;
width: 300rpx; white-space: nowrap;
overflow: hidden; text-overflow: ellipsis;
white-space: nowrap; }
text-overflow: ellipsis; }
}
}
.tag_flag { .tag {
background: #5ac725;
color: #fff;
padding: 2rpx 6rpx; padding: 2rpx 6rpx;
border-radius: 8rpx; border-radius: 8rpx;
color: #fff;
} }
.flex_layout { .tag__orange {
display: flex; background: #ff9e43;
margin-top: 8rpx;
} }
}
.tag__green {
background: #5ac725;
}
.tag__red {
background: red;
}
.flex_layout {
display: flex;
}
}
} }
</style> </style>

BIN
static/images/my_ico2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -5,6 +5,8 @@ import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex) Vue.use(Vuex)
const store = new Vuex.Store({ const store = new Vuex.Store({
state: { state: {
/** 人脸检测验证状态 ["0": 未完成人脸认证; "1": 已完成人脸认证] */
verification: "0",
userInfo: { userInfo: {
CORPINFO_ID: '', CORPINFO_ID: '',
DEPARTMENT_ID: '', DEPARTMENT_ID: '',
@ -19,16 +21,23 @@ const store = new Vuex.Store({
}, },
getters: { getters: {
getUserInfo: state => state.userInfo, getUserInfo: state => state.userInfo,
getVerification: state => state.verification,
}, },
mutations: { mutations: {
setUserInfo(state, userInfo) { setUserInfo(state, userInfo) {
state.userInfo = userInfo state.userInfo = userInfo
} },
setVerification(state, verification) {
state.verification = verification
},
}, },
actions: { actions: {
setUserInfo({commit}, userInfo) { setUserInfo({commit}, userInfo) {
commit('setUserInfo', userInfo) commit('setUserInfo', userInfo)
} },
setVerification({commit}, verification) {
commit('setVerification', verification)
},
}, },
plugins: [ plugins: [
createPersistedState({ createPersistedState({

View File

@ -1,5 +1,5 @@
// let requestPath = 'https://qggf.qhdsafety.com/xgfApi/'; // 后台请求地址 // let requestPath = 'https://qggf.qhdsafety.com/xgfApi/'; // 后台请求地址
let requestPath = 'http://192.168.0.37:8058//xgf_gwj/'; // 后台请求地址 let requestPath = 'http://192.168.0.37:8058/xgf_gwj_2.0'; // 后台请求地址
// let requestPath = 'https://skqhdg.porthebei.com:9006/qa-prevention-xgf/'; // 后台请求地址 // let requestPath = 'https://skqhdg.porthebei.com:9006/qa-prevention-xgf/'; // 后台请求地址
// let requestPath = 'https://qgxgf.qhdsafety.com/qa-prevention-xgf/'; // 外网地址 // let requestPath = 'https://qgxgf.qhdsafety.com/qa-prevention-xgf/'; // 外网地址
import store from '../store/index' import store from '../store/index'