refactor(qa-prevention):优化培训管理功能和数据处理- 清空 classInfo 数据,避免重复使用
- 修复考试记录按钮显示逻辑 - 优化签到流程,增加已签到提示 - 调整数据查询逻辑,提高数据准确性 - 添加日志输出,便于调试hyx_2025-01-13_xgf2.0
							parent
							
								
									e348a2248f
								
							
						
					
					
						commit
						b425d78223
					
				| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					@ -131,29 +133,29 @@
 | 
				
			||||||
							classId,
 | 
												classId,
 | 
				
			||||||
							stageexampaperinputId,
 | 
												stageexampaperinputId,
 | 
				
			||||||
							type,
 | 
												type,
 | 
				
			||||||
              CORPINFO_ID,
 | 
												CORPINFO_ID,
 | 
				
			||||||
							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)
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						switch (type) {
 | 
											switch (type) {
 | 
				
			||||||
							case "0": {
 | 
												case "0": {
 | 
				
			||||||
                let info = await setEntryV1({
 | 
													let info = await setEntryV1({
 | 
				
			||||||
                  userId: this.userInfo.USER_ID,
 | 
														userId: this.userInfo.USER_ID,
 | 
				
			||||||
                  corpinfoId: CORPINFO_ID,
 | 
														corpinfoId: CORPINFO_ID,
 | 
				
			||||||
                  RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME,
 | 
														RELEVANT_UNIT_NAME: RELEVANT_UNIT_NAME,
 | 
				
			||||||
                  postMethod: 'application/json'
 | 
														postMethod: 'application/json'
 | 
				
			||||||
                })
 | 
													})
 | 
				
			||||||
                if (info.code === 200) {
 | 
													if (info.code === 200) {
 | 
				
			||||||
                  uni.$u.toast('入职成功')
 | 
														uni.$u.toast('入职成功')
 | 
				
			||||||
                } else {
 | 
													} else {
 | 
				
			||||||
                  uni.$u.toast('入职失败,请联系管理员')
 | 
														uni.$u.toast('入职失败,请联系管理员')
 | 
				
			||||||
                }
 | 
													}
 | 
				
			||||||
								break;
 | 
													break;
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							// case "1": {
 | 
												// case "1": {
 | 
				
			||||||
| 
						 | 
					@ -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,20 +212,19 @@
 | 
				
			||||||
									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: {
 | 
																	type: 'learning_certification',
 | 
				
			||||||
													type: 'learning_certification',
 | 
																	stageexampaperinputId,
 | 
				
			||||||
													stageexampaperinputId,
 | 
																	classId,
 | 
				
			||||||
													classId,
 | 
																}
 | 
				
			||||||
												}
 | 
															})
 | 
				
			||||||
											})
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
									} else {
 | 
														} else {
 | 
				
			||||||
										uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师')
 | 
															uni.$u.toast('您未在培训计划内,无法进行考试,请联系教师')
 | 
				
			||||||
| 
						 | 
					@ -235,7 +236,7 @@
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							default: {
 | 
												default: {
 | 
				
			||||||
								break;
 | 
													break;
 | 
				
			||||||
							};
 | 
												}
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				})
 | 
									})
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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: {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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);
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue