refactor(qa-prevention-xgf-app): 重构 api 调用和班级信息获取
-重命名 getListAll 为 getClassInfoByParams,提高代码可读性 - 在 api.js 中添加 getClassList 和 getStudentInfoApi调用 - 优化 store 中的 setStudentInfo action - 在首页和培训管理页面中集成新的 api 调用 - 添加人脸信息认证提示功能hyx_2025-01-13_xgf2.0
parent
d630c82b07
commit
83f1310d06
|
@ -9,3 +9,4 @@ export const setRefreshToken = (params) => post("/sys/refreshToken", params ); /
|
||||||
export const setEntryV1 = (params) => post("/app/sys/user/entry", params ); // 入职
|
export const setEntryV1 = (params) => post("/app/sys/user/entry", params ); // 入职
|
||||||
export const resignV1 = (params) => post("/app/sys/user/resign", params ); // 离职
|
export const resignV1 = (params) => post("/app/sys/user/resign", params ); // 离职
|
||||||
export const getStudentInfoApi = (params) => post("/app/student/getStudentInfo", params ); // 获取学员信息
|
export const getStudentInfoApi = (params) => post("/app/student/getStudentInfo", params ); // 获取学员信息
|
||||||
|
|
||||||
|
|
|
@ -84,5 +84,5 @@ export const compareUserFaceCertify = (params) => post('/app/user/compareFace',
|
||||||
export const compareUserVideoFaceCertify = (params) => post('/app/user/compareVideoFace', params) // 视频人脸验证
|
export const compareUserVideoFaceCertify = (params) => post('/app/user/compareVideoFace', params) // 视频人脸验证
|
||||||
export const compareUserExamFaceCertify = (params) => post('/app/user/compareExamFace', params) // 考试照片人脸认证
|
export const compareUserExamFaceCertify = (params) => post('/app/user/compareExamFace', params) // 考试照片人脸认证
|
||||||
export const compareUserExamVideoFaceCertify = (params) => post('/app/user/compareExamVideoFace', params) // 考试视频人脸认证
|
export const compareUserExamVideoFaceCertify = (params) => post('/app/user/compareExamVideoFace', params) // 考试视频人脸认证
|
||||||
export const getListAll = (params) => post("/app/stagestudentrelation/getClassInfoByParams", params);
|
export const getClassInfoByParams = (params) => post("/app/stagestudentrelation/getClassInfoByParams", params ); // 获取班级信息
|
||||||
// ********************* end ***********************
|
// ********************* end ***********************
|
||||||
|
|
|
@ -46,8 +46,9 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import updateVersion from '../../utils/updateVersion'
|
import updateVersion from '../../utils/updateVersion'
|
||||||
import { setEntry, getIsUploadFace } from '../../api'
|
import {setEntry, getIsUploadFace, getClassInfoByParams, getClassList} from '../../api'
|
||||||
import {setEntryV1} from "../../api/api";
|
import { getStudentInfoApi, setEntryV1} from "../../api/api";
|
||||||
|
import store from "../../store";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [updateVersion],
|
mixins: [updateVersion],
|
||||||
|
@ -103,10 +104,10 @@ export default {
|
||||||
this.getUserFaceCompleted()
|
this.getUserFaceCompleted()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleGetListAll(classId) {
|
handleGetClassInfoByParams(classId) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const userInfo = store.getters.getUserInfo
|
const userInfo = store.getters.getUserInfo
|
||||||
await getListAll({
|
await getClassInfoByParams({
|
||||||
classId,
|
classId,
|
||||||
userId: userInfo.USER_ID
|
userId: userInfo.USER_ID
|
||||||
})
|
})
|
||||||
|
@ -125,7 +126,9 @@ export default {
|
||||||
// let obj = JSON.parse(res.result)
|
// let obj = JSON.parse(res.result)
|
||||||
// let type = obj[0].CODE_TYPE
|
// let type = obj[0].CODE_TYPE
|
||||||
const { classId, type, RELEVANT_UNIT_NAME } = JSON.parse(res.result)
|
const { classId, type, RELEVANT_UNIT_NAME } = JSON.parse(res.result)
|
||||||
const classInfo = await this.handleGetListAll(classId);
|
const classInfo = await this.handleGetClassInfoByParams(classId);
|
||||||
|
const resData = await getStudentInfoApi({classId:classInfo.classId})
|
||||||
|
await this.$store.dispatch('setStudentInfo', resData.studentInfo)
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case "0": {
|
case "0": {
|
||||||
let info = await setEntryV1({
|
let info = await setEntryV1({
|
||||||
|
@ -154,6 +157,25 @@ export default {
|
||||||
// };
|
// };
|
||||||
case "2": {
|
case "2": {
|
||||||
// 签到二维码方式进入, [type: 2 --> 签到二维码方式进入]
|
// 签到二维码方式进入, [type: 2 --> 签到二维码方式进入]
|
||||||
|
if (store.getters.getVerification === '0') {
|
||||||
|
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.navigateBack({ delta: 1 })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
if (classInfo) {
|
if (classInfo) {
|
||||||
uni.$u.route({
|
uni.$u.route({
|
||||||
url: '/pages/train_management/realname_info_auth',
|
url: '/pages/train_management/realname_info_auth',
|
||||||
|
|
|
@ -45,8 +45,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getClassList, getIsUploadFace, getStudentInfoApi, getListAll } from '@/api'
|
|
||||||
import store from '@/store/index'
|
import store from '@/store/index'
|
||||||
|
import {getClassInfoByParams, getClassList} from "../../api";
|
||||||
|
import {getStudentInfoApi} from "../../api/api";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
@ -93,10 +94,10 @@ export default {
|
||||||
this.currentPage++
|
this.currentPage++
|
||||||
if (this.totalPage >= this.currentPage) this.getData()
|
if (this.totalPage >= this.currentPage) this.getData()
|
||||||
},
|
},
|
||||||
handleGetListAll(classId) {
|
handleGetClassInfoByParams(classId) {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const userInfo = store.getters.getUserInfo
|
const userInfo = store.getters.getUserInfo
|
||||||
await getListAll({
|
await getClassInfoByParams({
|
||||||
classId,
|
classId,
|
||||||
userId: userInfo.USER_ID
|
userId: userInfo.USER_ID
|
||||||
})
|
})
|
||||||
|
@ -113,9 +114,6 @@ export default {
|
||||||
* 右上角自定义扫码图标触发事件
|
* 右上角自定义扫码图标触发事件
|
||||||
*/
|
*/
|
||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
// 调用获取学员信息的方法
|
|
||||||
// this.getStudentInfoFunc();
|
|
||||||
|
|
||||||
// 只允许通过手机相机扫码
|
// 只允许通过手机相机扫码
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
// scanType: ['qrCode'], // 仅支持二维码扫码
|
// scanType: ['qrCode'], // 仅支持二维码扫码
|
||||||
|
@ -123,7 +121,9 @@ export default {
|
||||||
hideAlbum: false, // 显示相册,允许从相册选择图片
|
hideAlbum: false, // 显示相册,允许从相册选择图片
|
||||||
success:async (response) => {
|
success:async (response) => {
|
||||||
const { stageexampaperinputId, classId, type } = JSON.parse(response.result)
|
const { stageexampaperinputId, classId, type } = JSON.parse(response.result)
|
||||||
const classInfo = await this.handleGetListAll(classId);
|
// 调用获取学员信息的方法
|
||||||
|
await this.getStudentInfoFunc(classId);
|
||||||
|
const classInfo = await this.handleGetClassInfoByParams(classId);
|
||||||
if (type === '2') {
|
if (type === '2') {
|
||||||
// 签到二维码方式进入, [type: 2 --> 签到二维码方式进入]
|
// 签到二维码方式进入, [type: 2 --> 签到二维码方式进入]
|
||||||
if (classInfo) {
|
if (classInfo) {
|
||||||
|
@ -164,15 +164,15 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 使用网络接口获取学员信息
|
* 使用网络接口获取学员信息
|
||||||
*/
|
*/
|
||||||
async getStudentInfoFunc() {
|
async getStudentInfoFunc(classId) {
|
||||||
const resData = await getStudentInfoApi()
|
const resData = await getStudentInfoApi({classId})
|
||||||
|
console.log('resData :>> ', resData);
|
||||||
await this.$store.dispatch('studentInfo', resData.studentInfo)
|
await this.$store.dispatch('studentInfo', resData.studentInfo)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 获取是否已经完成上传人脸信息
|
* 获取是否已经完成上传人脸信息
|
||||||
*/
|
*/
|
||||||
async getUserFaceCompleted() {
|
async getUserFaceCompleted() {
|
||||||
// const userFaceData = await getIsUploadFace()
|
|
||||||
// verification --> 0: 未完成人脸认证
|
// verification --> 0: 未完成人脸认证
|
||||||
// verification --> 1: 已完成人脸认证
|
// verification --> 1: 已完成人脸认证
|
||||||
if (store.getters.getVerification === '0') {
|
if (store.getters.getVerification === '0') {
|
||||||
|
|
|
@ -181,6 +181,7 @@ export default {
|
||||||
|
|
||||||
onLoad(query) {
|
onLoad(query) {
|
||||||
this.routeQuery = query // 接收上一个页面传递过来的路由参数1
|
this.routeQuery = query // 接收上一个页面传递过来的路由参数1
|
||||||
|
|
||||||
const { name,// 学员姓名,
|
const { name,// 学员姓名,
|
||||||
phone, // 联系电话
|
phone, // 联系电话
|
||||||
userIdCard,// 身份证号
|
userIdCard,// 身份证号
|
||||||
|
|
|
@ -48,7 +48,7 @@ const store = new Vuex.Store({
|
||||||
setUserInfo({commit}, userInfo) {
|
setUserInfo({commit}, userInfo) {
|
||||||
commit('setUserInfo', userInfo)
|
commit('setUserInfo', userInfo)
|
||||||
},
|
},
|
||||||
setStudentInfo(state, studentInfo) {
|
setStudentInfo({commit}, studentInfo) {
|
||||||
commit('setStudentInfo', studentInfo)
|
commit('setStudentInfo', studentInfo)
|
||||||
},
|
},
|
||||||
setVerification({commit}, verification) {
|
setVerification({commit}, verification) {
|
||||||
|
|
Loading…
Reference in New Issue