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: '培训管理',
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;
};
}
}
}
})

View File

@ -31,7 +31,7 @@
<view> <text class="content_label">任务状态: </text>{{ handleCalcTaskStatus(item.state) }} </view>
<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.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>
@ -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: {

View File

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