From e348a2248f03f7cee7103f031f4f2dfb4109406f Mon Sep 17 00:00:00 2001 From: wangyan Date: Wed, 12 Mar 2025 14:01:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?refactor(train=5Fmanagement):=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=BA=E8=84=B8=E8=AE=A4=E8=AF=81=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=92=8C=E9=A6=96=E9=A1=B5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改了 face_authentication 页面的返回逻辑- 优化了 index 页面的扫码功能和人脸认证提示 -移除了生成二维码的冗余请求 --- pages/index/index.vue | 441 ++++++++++-------- .../train_management/face_authentication.nvue | 24 +- 2 files changed, 243 insertions(+), 222 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 8731e5e..a0eb1ec 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -26,16 +26,9 @@ - + @@ -45,220 +38,254 @@ diff --git a/pages/train_management/face_authentication.nvue b/pages/train_management/face_authentication.nvue index 430ccde..968d07c 100644 --- a/pages/train_management/face_authentication.nvue +++ b/pages/train_management/face_authentication.nvue @@ -43,6 +43,7 @@ }, 1000) }, onLoad(query) { + console.log('query: >> ', query) // facial_input 人脸认证 isFirst 1 第一次登录添加人脸 // scan_face 扫码 // update_facial_input 更新人脸 @@ -61,25 +62,18 @@ // this.showButton = query.showButton || "yes"; this.routeQueryparams = query ?? {} }, - onBackPress(event) { - // if (event.from === 'backbutton') { - // if ((this.type === 'scan_face' && this.isFirst === '1') || this.type === 'learning_certification' || this.type === 'facial_input') { - // uni.$u.toast('请完成人脸验证') - // return true - // } - // } - if (this.type === 'facial_input') { - uni.$u.route({ - type: 'redirect', - url: '/pages/index/index', - }) - } - return false - }, + // onBackPress(event) { + // return false + // }, onUnload() { this.startPreviewTimer && clearInterval(this.startPreviewTimer) }, methods: { + handleBack() { + uni.navigateBack({ + delta: 2, + }) + }, snapshot() { uni.showLoading({ title: '加载中' From b425d782236a0bbf8f14a6a057c72008bf58f3e9 Mon Sep 17 00:00:00 2001 From: wangyan Date: Wed, 12 Mar 2025 17:16:28 +0800 Subject: [PATCH 2/4] =?UTF-8?q?refactor(qa-prevention):=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E5=92=8C?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86-=20=E6=B8=85=E7=A9=BA=20cl?= =?UTF-8?q?assInfo=20=E6=95=B0=E6=8D=AE=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E4=BD=BF=E7=94=A8=20-=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E8=80=83=E8=AF=95=E8=AE=B0=E5=BD=95=E6=8C=89=E9=92=AE=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=80=BB=E8=BE=91=20-=20=E4=BC=98=E5=8C=96=E7=AD=BE?= =?UTF-8?q?=E5=88=B0=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B7=B2?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E6=8F=90=E7=A4=BA=20-=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E9=AB=98=E6=95=B0=E6=8D=AE=E5=87=86=E7=A1=AE=E6=80=A7?= =?UTF-8?q?=20-=20=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA?= =?UTF-8?q?=EF=BC=8C=E4=BE=BF=E4=BA=8E=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/index.vue | 59 +++++++++++---------- pages/train_management/index.vue | 6 ++- pages/train_management/sign_information.vue | 4 +- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index a0eb1ec..38df129 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -90,7 +90,8 @@ title: '培训管理', url: '/pages/train_management/index' } - ] + ], + classInfo: null, } }, computed: { @@ -123,6 +124,7 @@ }) }, async fnScan() { + this.classInfo = null; // 清空 classInfo uni.scanCode({ success: async (res) => { // let obj = JSON.parse(res.result) @@ -131,29 +133,29 @@ classId, stageexampaperinputId, type, - CORPINFO_ID, + CORPINFO_ID, RELEVANT_UNIT_NAME } = JSON.parse(res.result); if (type !== '0') { - const classInfo = await this.handleGetClassInfoByParams(classId); + this.classInfo = await this.handleGetClassInfoByParams(classId); const resData = await getStudentInfoApi({ - classId: classInfo.classId + classId: this.classInfo.classId }) await this.$store.dispatch('setStudentInfo', resData.studentInfo) } switch (type) { case "0": { - let info = await setEntryV1({ - userId: this.userInfo.USER_ID, - corpinfoId: CORPINFO_ID, - RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME, - postMethod: 'application/json' - }) - if (info.code === 200) { - uni.$u.toast('入职成功') - } else { - uni.$u.toast('入职失败,请联系管理员') - } + let info = await setEntryV1({ + userId: this.userInfo.USER_ID, + corpinfoId: CORPINFO_ID, + RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME, + postMethod: 'application/json' + }) + if (info.code === 200) { + uni.$u.toast('入职成功') + } else { + uni.$u.toast('入职失败,请联系管理员') + } break; } // case "1": { @@ -191,8 +193,8 @@ }) } if (store.getters.getVerification === '1') { - if (classInfo) { - if (classInfo.studystate === "3") { + if (this.classInfo) { + if (this.classInfo.studystate === "3") { uni.$u.toast("您已经入班签到,无需再次签到!") return; } @@ -210,20 +212,19 @@ uni.$u.toast('您还未完成人脸信息读取,请先完成人脸信息认证!') } break; - }; + } case "3": { // 考试二维码方式进入 [type: 3 --> 考试二维码方式进入] if (store.getters.getVerification === '1') { - if (classInfo) { - - uni.$u.route({ - url: '/pages/train_management/face_authentication', - params: { - type: 'learning_certification', - stageexampaperinputId, - classId, - } - }) + if (this.classInfo) { + uni.$u.route({ + url: '/pages/train_management/face_authentication', + params: { + type: 'learning_certification', + stageexampaperinputId, + classId, + } + }) } else { uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师') @@ -235,7 +236,7 @@ } default: { break; - }; + } } } }) diff --git a/pages/train_management/index.vue b/pages/train_management/index.vue index f16c27f..7d9369f 100644 --- a/pages/train_management/index.vue +++ b/pages/train_management/index.vue @@ -31,7 +31,7 @@ {{ handleCalcTaskStatus(item.state) }} - + @@ -127,6 +127,10 @@ export default { if (type === '2') { // 签到二维码方式进入, [type: 2 --> 签到二维码方式进入] if (classInfo) { + if (classInfo.studystate === "3") { + uni.$u.toast("您已经入班签到,无需再次签到!") + return; + } uni.$u.route({ url: '/pages/train_management/realname_info_auth', params: { diff --git a/pages/train_management/sign_information.vue b/pages/train_management/sign_information.vue index 6fd2b6d..c4b9aa7 100644 --- a/pages/train_management/sign_information.vue +++ b/pages/train_management/sign_information.vue @@ -19,7 +19,8 @@