fix: 优化考生列表

This commit is contained in:
wangzhongjie 2025-06-26 11:18:07 +08:00
parent 019b582940
commit 7c0f24d4cf
6 changed files with 199 additions and 189 deletions

View File

@ -1,6 +1,5 @@
import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } from '../api/userInfo'; import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } from '../api/userInfo';
import router from '@ohos.router'; import router from '@ohos.router';
import TopLogo from './compontents/TopLogo';
import FaceCompare from './compontents/FaceCompare'; import FaceCompare from './compontents/FaceCompare';
import { writeObjectOut } from '../api/judge'; import { writeObjectOut } from '../api/judge';
import testNapi from '@ohos.idcard'; import testNapi from '@ohos.idcard';
@ -14,7 +13,6 @@ import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
import LoadingPopup from './compontents/judge/LoadingPopup'; import LoadingPopup from './compontents/judge/LoadingPopup';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
// import { initJudgeUdp } from '../common/utils/UdpJudge';
import imageBtn from './compontents/imageBtn'; import imageBtn from './compontents/imageBtn';
import { CryptoJS } from '@ohos/crypto-js'; import { CryptoJS } from '@ohos/crypto-js';
@ -47,6 +45,10 @@ import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
import errorMsgDialog from './compontents/errorMsgDialog'; import errorMsgDialog from './compontents/errorMsgDialog';
import { JudgeConfig } from '../config'; import { JudgeConfig } from '../config';
import { dConsole } from '../utils/LogWorker'; import { dConsole } from '../utils/LogWorker';
import HeaderComponent from './compontents/Header';
import AvatarComponent from './UserInfo/Avatar';
import CommTextComponent from './UserInfo/CommText';
import LabelBlockComponent from './UserInfo/LabelBlock';
@Entry @Entry
@Component @Component
@ -1095,154 +1097,151 @@ struct UserInfoPage {
build() { build() {
Column() { Column() {
HeaderComponent({
TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 }) shortLogo: true,
Row() { shouBackArea: true
})
Column() {
Row() { Row() {
ForEach(this.dataList, (item: User) => { Row() {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { ForEach(this.dataList, (item: User) => {
Column() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
CommText({ Column() {
ratio: this.ratio, CommTextComponent({
color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000',
text: item.lsh text: item.lsh
}) })
CommText({ CommTextComponent({
ratio: this.ratio, color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000',
color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', text: decodeURIComponent(item.xm)
text: decodeURIComponent(item.xm) })
}) }
} }
} .width(165 * this.ratio)
.width(165 * this.ratio) .height(85 * this.ratio)
.height(85 * this.ratio) .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') :
.backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg'))
$r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => {
.onClick(() => { dConsole.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart)
dConsole.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart) if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) ||
if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) || (this.startExam && this.systemParam.Param364 == '2')) {
(this.startExam && this.systemParam.Param364 == '2')) { return
return }
} this.currentUser = EmptyCandidateObject
this.currentUser = EmptyCandidateObject AppStorage.setOrCreate('lsh', item.lsh)
AppStorage.setOrCreate('lsh', item.lsh) setTimeout(() => {
setTimeout(() => { this.currentUser = item
this.currentUser = item this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
}, 200) }, 200)
})
}) })
}) }.width(640 * this.ratio).margin({ left: 30 * this.ratio })
}.width(640 * this.ratio).margin({ left: 30 * this.ratio })
Image($r('app.media.dk_prev')) Image($r('app.media.dk_prev'))
.width(90 * this.ratio) .width(90 * this.ratio)
.height(70 * this.ratio) .height(70 * this.ratio)
.margin({ left: 65 * this.ratio, right: 10 * this.ratio }) .margin({ left: 65 * this.ratio, right: 10 * this.ratio })
.onClick(() => { .onClick(() => {
// this.avPlayer.playAudio(['button_media.wav'])
this.prevClick()
})
Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => {
// this.avPlayer.playAudio(['button_media.wav']) // this.avPlayer.playAudio(['button_media.wav'])
this.prevClick() this.nextClick()
}) })
Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => { }.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio })
// this.avPlayer.playAudio(['button_media.wav'])
this.nextClick()
})
}.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio })
Flex({ justifyContent: FlexAlign.SpaceBetween }) { Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() { Row() {
Column() { Column() {
if (this.currentUser.kszp) { if (this.currentUser.kszp) {
Avatar({ AvatarComponent({
ratio: this.ratio, url: this.currentUser.kszp ? this.currentUser.kszp : ''
url: this.currentUser.kszp ? this.currentUser.kszp : '' })
}) } else {
} else { AvatarComponent({
Avatar({ url: ""
ratio: this.ratio, })
url: "" }
}) if (this.currentUser.ksmjzp) {
AvatarComponent({
url: this.currentUser.ksmjzp ? this.currentUser.ksmjzp : ''
})
} else {
AvatarComponent({
url: ""
})
}
} }
if (this.currentUser.ksmjzp) {
Avatar({
ratio: this.ratio,
url: this.currentUser.ksmjzp ? this.currentUser.ksmjzp : ''
})
} else {
Avatar({ Column() {
ratio: this.ratio, ForEach(this.labelBlocks, (item: LabelBlockType) => {
url: "" LabelBlockComponent({
label: item.label,
value: GetCurrentUserKeyValue(this.currentUser, item.key)
})
}) })
} }
} }
.width(664 * this.ratio)
.height(339 * this.ratio)
.backgroundImage($r('app.media.dkbg'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ left: 53 * this.ratio })
Column() { Column() {
ForEach(this.labelBlocks, (item: LabelBlockType) => { imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.yydj_btn') })
LabelBlock({
label: item.label,
ratio: this.ratio,
value: GetCurrentUserKeyValue(this.currentUser, item.key)
})
})
}
}
.width(664 * this.ratio)
.height(339 * this.ratio)
.backgroundImage($r('app.media.dkbg'))
.backgroundImageSize({ width: '100%', height: '100%' })
.margin({ left: 53 * this.ratio })
Column() {
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.yydj_btn') })
.margin({ bottom: 12 * this.ratio })
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.gx_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(() => {
if (this.isExamStart && !this.singlePlay) {
return
}
this.faceCompareSucess = 0
this.numCount = 0
this.getExaminationStudentInfoFn()
})
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.qk_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(() => {
// 已开始考试不能缺考 已考过一次学员不能缺考 车上不能缺考
if (this.ksksLimit || (this.systemParam.Param352Str == '1' && this.currentUser.kssycs == '1') ||
this.systemParam.Param770Str == '1') {
return
}
this.ksksLimit = true
this.qkFlag = true
})
if (this.isBoardPrePareSetPopupOpen &&
(this.isSecondBoardPrePareSetPopupOpen && this.currentUser.kssycs == '2') &&
!this.isFirstBoardPrePareSetPopupBtnShow) {
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.sczb_btn') })
.margin({ bottom: 12 * this.ratio }) .margin({ bottom: 12 * this.ratio })
.onClick(async () => { imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.gx_btn') })
if (this.systemParam.Param612Str == '1') { .margin({ bottom: 12 * this.ratio })
.onClick(() => {
if (this.isExamStart && !this.singlePlay) {
return return
} }
await this.prePareSCZB() this.faceCompareSucess = 0
this.numCount = 0
this.getExaminationStudentInfoFn()
}) })
} else { imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.qk_btn') })
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.ksks_btn') })
.margin({ bottom: 12 * this.ratio }) .margin({ bottom: 12 * this.ratio })
.onClick(async () => { .onClick(() => {
if (this.systemParam.Param612Str == '1') { // 已开始考试不能缺考 已考过一次学员不能缺考 车上不能缺考
if (this.ksksLimit || (this.systemParam.Param352Str == '1' && this.currentUser.kssycs == '1') ||
this.systemParam.Param770Str == '1') {
return return
} }
await this.prePareExam() this.ksksLimit = true
this.qkFlag = true
}) })
if (this.isBoardPrePareSetPopupOpen &&
(this.isSecondBoardPrePareSetPopupOpen && this.currentUser.kssycs == '2') &&
!this.isFirstBoardPrePareSetPopupBtnShow) {
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.sczb_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(async () => {
if (this.systemParam.Param612Str == '1') {
return
}
await this.prePareSCZB()
})
} else {
imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.ksks_btn') })
.margin({ bottom: 12 * this.ratio })
.onClick(async () => {
if (this.systemParam.Param612Str == '1') {
return
}
await this.prePareExam()
})
}
} }
} }
} }.backgroundColor("#1E1E1E").width("100%").height("100%")
if (this.showFaceCompare) { if (this.showFaceCompare) {
FaceCompare({ FaceCompare({
@ -1328,70 +1327,5 @@ struct UserInfoPage {
} }
} }
// 头像组件
@Component
struct Avatar {
@State ratio: number = 0
@State url: string = ""
build() {
Row() {
Image(this.url)
.width(93 * this.ratio)
.height(130.5 * this.ratio)
.margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio })
.backgroundColor('orange')
.border({ color: '#fff', width: 1, style: BorderStyle.Solid })
.syncLoad(true)
}
}
}
// 横向滚动学员列表里面文字
@Component
struct CommText {
@Prop text: string
@Prop color: string
@Prop ratio: number
build() {
Text(this.text)
.fontSize(19.5 * this.ratio)
.lineHeight(30 * this.ratio)
.fontWeight(500)
.fontColor(this.color)
}
}
// 考生信息的labelBlock组件
@Component
struct LabelBlock {
@State label: string = ''
@State ratio: number = 0
@Prop value: string = ''
@Styles
commLabelStyle(){
.width(280 * this.ratio)
.height(35 * this.ratio)
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 8 * this.ratio })
.align(Alignment.Center)
}
build() {
Row() {
Text(this.label).fontSize(20 * this.ratio).fontColor('#99948A')
Row() {
Text(decodeURIComponent(this.value || '') || '')
.fontColor('#fff')
.textAlign(TextAlign.Center)
.width('100%')
.fontSize(18 * this.ratio)
}
.commLabelStyle()
}.margin({ bottom: 10 * this.ratio })
}
}

View File

@ -0,0 +1,16 @@
@Component
export default struct AvatarComponent {
@State url: string = ""
build() {
Row() {
Image(this.url)
.width(165)
.height(231)
.margin({ bottom: 18, right: 102, left: 97 })
.backgroundColor('orange')
.border({ color: '#fff', width: 1, style: BorderStyle.Solid })
.syncLoad(true)
}
}
}

View File

@ -0,0 +1,13 @@
@Component
export default struct CommTextComponent {
@Prop text: string
@Prop color: string
build() {
Text(this.text)
.fontSize(35)
.lineHeight(52)
.fontWeight(500)
.fontColor(this.color)
}
}

View File

@ -0,0 +1,29 @@
@Component
export default struct LabelBlockComponent {
@State label: string = ''
@Prop value: string = ''
@Styles
commLabelStyle(){
.width(496)
.height(62) // 35 * 1.770833 ≈ 61.979155
.backgroundImageSize({ width: '100%', height: '100%' })
.backgroundImage($r('app.media.userbox'))
.margin({ left: 14.166664 }) // 8 * 1.770833 ≈ 14.166664
.align(Alignment.Center)
}
build() {
Row() {
Text(this.label).fontSize(35).fontColor('#99948A') // 20 * 1.770833 ≈ 35.41666
Row() {
Text(decodeURIComponent(this.value || '') || '')
.fontColor('#fff')
.textAlign(TextAlign.Center)
.width('100%')
.fontSize(32) // 18 * 1.770833 ≈ 31.874994
}
.commLabelStyle()
}.margin({ bottom: 18 }) // 10 * 1.770833 ≈ 17.70833
}
}

View File

@ -0,0 +1,9 @@
// 缺考考生弹窗
@CustomDialog
export default struct MissAnExamDialog {
private controller?: CustomDialogController;
build() {
}
}

View File

@ -0,0 +1,9 @@
// 开始考试弹窗
@CustomDialog
export default struct StartTheExamDialog {
private controller?: CustomDialogController;
build() {
}
}