diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 46f6573..353c490 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -1,6 +1,5 @@ import { examinationStuAbsent, getExaminationItem, getExaminationStudentInfo } from '../api/userInfo'; import router from '@ohos.router'; -import TopLogo from './compontents/TopLogo'; import FaceCompare from './compontents/FaceCompare'; import { writeObjectOut } from '../api/judge'; import testNapi from '@ohos.idcard'; @@ -14,7 +13,6 @@ import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup'; import LoadingPopup from './compontents/judge/LoadingPopup'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; -// import { initJudgeUdp } from '../common/utils/UdpJudge'; import imageBtn from './compontents/imageBtn'; import { CryptoJS } from '@ohos/crypto-js'; @@ -47,6 +45,10 @@ import { JudgeEmitterInstance } from '../utils/business/UdpEvent'; import errorMsgDialog from './compontents/errorMsgDialog'; import { JudgeConfig } from '../config'; 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 @Component @@ -1095,154 +1097,151 @@ struct UserInfoPage { build() { Column() { - - TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 }) - Row() { + HeaderComponent({ + shortLogo: true, + shouBackArea: true + }) + Column() { Row() { - ForEach(this.dataList, (item: User) => { - Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Column() { - CommText({ - ratio: this.ratio, - color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', - text: item.lsh - }) - CommText({ - ratio: this.ratio, - color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', - text: decodeURIComponent(item.xm) - }) + Row() { + ForEach(this.dataList, (item: User) => { + Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { + Column() { + CommTextComponent({ + color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', + text: item.lsh + }) + CommTextComponent({ + color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', + text: decodeURIComponent(item.xm) + }) + } } - } - .width(165 * this.ratio) - .height(85 * this.ratio) - .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : - $r('app.media.userboxbg')) - .backgroundImageSize({ width: '100%', height: '100%' }) - .onClick(() => { - dConsole.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart) - if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) || - (this.startExam && this.systemParam.Param364 == '2')) { - return - } - this.currentUser = EmptyCandidateObject - AppStorage.setOrCreate('lsh', item.lsh) - setTimeout(() => { - this.currentUser = item - this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || "" + .width(165 * this.ratio) + .height(85 * this.ratio) + .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : + $r('app.media.userboxbg')) + .backgroundImageSize({ width: '100%', height: '100%' }) + .onClick(() => { + dConsole.log('this.startExam', this.startExam, this.systemParam.Param364, this.isExamStart) + if ((this.isExamStart && !this.singlePlay && this.systemParam.Param341) || + (this.startExam && this.systemParam.Param364 == '2')) { + return + } + this.currentUser = EmptyCandidateObject + AppStorage.setOrCreate('lsh', item.lsh) + setTimeout(() => { + this.currentUser = item + 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')) - .width(90 * this.ratio) - .height(70 * this.ratio) - .margin({ left: 65 * this.ratio, right: 10 * this.ratio }) - .onClick(() => { + Image($r('app.media.dk_prev')) + .width(90 * this.ratio) + .height(70 * this.ratio) + .margin({ left: 65 * this.ratio, right: 10 * this.ratio }) + .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.prevClick() + this.nextClick() }) - Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => { - // this.avPlayer.playAudio(['button_media.wav']) - this.nextClick() - }) - }.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio }) + }.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio }) - Flex({ justifyContent: FlexAlign.SpaceBetween }) { - Row() { - Column() { - if (this.currentUser.kszp) { - Avatar({ - ratio: this.ratio, - url: this.currentUser.kszp ? this.currentUser.kszp : '' - }) - } else { - Avatar({ - ratio: this.ratio, - url: "" - }) + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + Row() { + Column() { + if (this.currentUser.kszp) { + AvatarComponent({ + url: this.currentUser.kszp ? this.currentUser.kszp : '' + }) + } else { + AvatarComponent({ + 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({ - ratio: this.ratio, - url: "" + Column() { + ForEach(this.labelBlocks, (item: LabelBlockType) => { + 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() { - ForEach(this.labelBlocks, (item: LabelBlockType) => { - 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') }) + imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.yydj_btn') }) .margin({ bottom: 12 * this.ratio }) - .onClick(async () => { - if (this.systemParam.Param612Str == '1') { + 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 } - 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.ksks_btn') }) + imageBtn({ btnWidth: 220 * this.ratio, btnHeight: 69 * this.ratio, imgSrc: $r('app.media.qk_btn') }) .margin({ bottom: 12 * this.ratio }) - .onClick(async () => { - if (this.systemParam.Param612Str == '1') { + .onClick(() => { + // 已开始考试不能缺考 已考过一次学员不能缺考 车上不能缺考 + if (this.ksksLimit || (this.systemParam.Param352Str == '1' && this.currentUser.kssycs == '1') || + this.systemParam.Param770Str == '1') { 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) { 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 }) - } -} diff --git a/entry/src/main/ets/pages/UserInfo/Avatar.ets b/entry/src/main/ets/pages/UserInfo/Avatar.ets new file mode 100644 index 0000000..d10862f --- /dev/null +++ b/entry/src/main/ets/pages/UserInfo/Avatar.ets @@ -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) + } + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo/CommText.ets b/entry/src/main/ets/pages/UserInfo/CommText.ets new file mode 100644 index 0000000..19043c9 --- /dev/null +++ b/entry/src/main/ets/pages/UserInfo/CommText.ets @@ -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) + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo/LabelBlock.ets b/entry/src/main/ets/pages/UserInfo/LabelBlock.ets new file mode 100644 index 0000000..7cbd3be --- /dev/null +++ b/entry/src/main/ets/pages/UserInfo/LabelBlock.ets @@ -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 + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo/MissAnExamDialog.ets b/entry/src/main/ets/pages/UserInfo/MissAnExamDialog.ets new file mode 100644 index 0000000..82d774b --- /dev/null +++ b/entry/src/main/ets/pages/UserInfo/MissAnExamDialog.ets @@ -0,0 +1,9 @@ +// 缺考考生弹窗 + +@CustomDialog +export default struct MissAnExamDialog { + private controller?: CustomDialogController; + + build() { + } +} \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo/StartTheExamDialog.ets b/entry/src/main/ets/pages/UserInfo/StartTheExamDialog.ets new file mode 100644 index 0000000..fadfcf9 --- /dev/null +++ b/entry/src/main/ets/pages/UserInfo/StartTheExamDialog.ets @@ -0,0 +1,9 @@ +// 开始考试弹窗 + +@CustomDialog +export default struct StartTheExamDialog { + private controller?: CustomDialogController; + + build() { + } +} \ No newline at end of file