refactor(qa-prevention):优化培训管理功能和数据处理- 清空 classInfo 数据,避免重复使用

- 修复考试记录按钮显示逻辑
- 优化签到流程,增加已签到提示
- 调整数据查询逻辑,提高数据准确性
- 添加日志输出,便于调试
hyx_2025-01-13_xgf2.0
wangyan 2025-03-12 17:16:28 +08:00
parent e348a2248f
commit b425d78223
3 changed files with 38 additions and 31 deletions

View File

@ -90,7 +90,8 @@
title: '培训管理', title: '培训管理',
url: '/pages/train_management/index' url: '/pages/train_management/index'
} }
] ],
classInfo: null,
} }
}, },
computed: { computed: {
@ -123,6 +124,7 @@
}) })
}, },
async fnScan() { async fnScan() {
this.classInfo = null; // classInfo
uni.scanCode({ uni.scanCode({
success: async (res) => { success: async (res) => {
// let obj = JSON.parse(res.result) // let obj = JSON.parse(res.result)
@ -135,9 +137,9 @@
RELEVANT_UNIT_NAME RELEVANT_UNIT_NAME
} = JSON.parse(res.result); } = JSON.parse(res.result);
if (type !== '0') { if (type !== '0') {
const classInfo = await this.handleGetClassInfoByParams(classId); this.classInfo = await this.handleGetClassInfoByParams(classId);
const resData = await getStudentInfoApi({ const resData = await getStudentInfoApi({
classId: classInfo.classId classId: this.classInfo.classId
}) })
await this.$store.dispatch('setStudentInfo', resData.studentInfo) await this.$store.dispatch('setStudentInfo', resData.studentInfo)
} }
@ -191,8 +193,8 @@
}) })
} }
if (store.getters.getVerification === '1') { if (store.getters.getVerification === '1') {
if (classInfo) { if (this.classInfo) {
if (classInfo.studystate === "3") { if (this.classInfo.studystate === "3") {
uni.$u.toast("您已经入班签到,无需再次签到!") uni.$u.toast("您已经入班签到,无需再次签到!")
return; return;
} }
@ -210,12 +212,11 @@
uni.$u.toast('您还未完成人脸信息读取,请先完成人脸信息认证!') uni.$u.toast('您还未完成人脸信息读取,请先完成人脸信息认证!')
} }
break; break;
}; }
case "3": { case "3": {
// [type: 3 --> ] // [type: 3 --> ]
if (store.getters.getVerification === '1') { if (store.getters.getVerification === '1') {
if (classInfo) { if (this.classInfo) {
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/face_authentication', url: '/pages/train_management/face_authentication',
params: { params: {
@ -235,7 +236,7 @@
} }
default: { default: {
break; break;
}; }
} }
} }
}) })

View File

@ -31,7 +31,7 @@
<view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.state) }} </view> <view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.state) }} </view>
<view class="action-row"> <view class="action-row">
<u-button size="mini" type="primary" text="签到信息" :disabled="item.userSignPath === '0'" @click="signInInformation(item.classId)" /> <u-button size="mini" type="primary" text="签到信息" :disabled="item.userSignPath === '0'" @click="signInInformation(item.classId)" />
<u-button size="mini" type="primary" text="考试记录" :disabled="item.stageexamstate === '1' || item.stageexamstate === '4'" @click="ExamRecord(item)" /> <u-button v-if="item.examination === '1'" size="mini" type="primary" text="考试记录" :disabled="item.stageexamstate === '1' || item.stageexamstate === '4'" @click="ExamRecord(item)" />
</view> </view>
</view> </view>
</view> </view>
@ -127,6 +127,10 @@ export default {
if (type === '2') { if (type === '2') {
// , [type: 2 --> ] // , [type: 2 --> ]
if (classInfo) { if (classInfo) {
if (classInfo.studystate === "3") {
uni.$u.toast("您已经入班签到,无需再次签到!")
return;
}
uni.$u.route({ uni.$u.route({
url: '/pages/train_management/realname_info_auth', url: '/pages/train_management/realname_info_auth',
params: { params: {

View File

@ -19,7 +19,8 @@
</template> </template>
<script> <script>
import { getSignInfo } from '@/api'
import {getSignInfo} from "../../api";
export default { export default {
data() { data() {
@ -93,6 +94,7 @@ export default {
classId classId
}); });
this.signInfo = resData.page.list[0] this.signInfo = resData.page.list[0]
console.log(this.signInfo);
}, },
} }
} }