feat: 优化

This commit is contained in:
wangzhongjie 2024-02-23 10:03:43 +08:00
parent efc98c114b
commit 8e8afd92db
3 changed files with 257 additions and 322 deletions

View File

@ -1,4 +1,5 @@
export const CandidateData = [
export const CandidateData: Array<User> = [
{
sfzmhm: '342323199501470011',
xm: '测试学员1',
@ -19,8 +20,11 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '341182199308155624',
xm: '测试学员2',
lsh: '0000000000002',
@ -40,8 +44,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700003',
xm: '测试学员3',
lsh: '0000000000003',
@ -61,8 +67,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700004',
xm: '测试学员4',
lsh: '0000000000004',
@ -82,8 +90,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700005',
xm: '测试学员5',
lsh: '0000000000004',
@ -103,8 +113,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '342323199501470016',
xm: '测试学员6',
lsh: '0000000000005',
@ -124,8 +136,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700007',
xm: '测试学员7',
lsh: '0000000000007',
@ -145,8 +159,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700008',
xm: '测试学员8',
lsh: '0000000000008',
@ -166,8 +182,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: ""
},
{
sfzmhm: '3423231995014700009',
xm: '测试学员9',
lsh: '0000000000009',
@ -187,8 +205,10 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: ''
}, {
yycs: '',
ksy2sfzmhm: ""
},
{
sfzmhm: '34232319950147000010',
xm: '测试学员10',
lsh: '002',
@ -208,5 +228,30 @@ export const CandidateData = [
xb: '',
xh: '',
xldm: '',
yycs: '',
ksy2sfzmhm: "",
}]
export const EmptyCandidateObject = {
ksy2sfzmhm: "",
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}]
}

View File

@ -11,38 +11,14 @@ import { initJudgeUdp } from '../common/utils/UdpJudge'
import { writeObjectOut } from '../api/judge'
import testNapi from "@ohos.idcard";
import common from '@ohos.app.ability.common';
import { VideoConfig } from './interfaces'
import { VideoConfig, User } from './interfaces'
import WebRTCVoice from './webRTC/'
import promptAction from '@ohos.promptAction'
import { CandidateData } from "../mock/CandidateData"
export interface User {
sfzmhm: string
xm: string
lsh: string
ksy1: string
id: string
kszp: string
ksmjzp: string
bz1: string
jxmc: string
kchp: string
kscx: string
ksdd: string
kssycs: string
ksxl: string
ksy1sfzmhm: string
kszt: string
xb: string
xh: string
xldm: string
yycs: string
ksy2sfzmhm: string
}
import { CandidateData, EmptyCandidateObject } from "../mock/CandidateData"
@Entry
@Component
struct Index {
struct UserInfo {
@State pageIndex: number = 0
@State ratio: number = 850 / 960
@State index: number = 0
@ -58,31 +34,9 @@ struct Index {
@State url: string = ''
@State lsh: string = ''
@State qkFlag: boolean = false
@State currentUser: User = {
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: '',
ksy2sfzmhm: ''
}
@State dataList: Array<any> = []
@State list: Array<any> = []
@State currentUser: User = EmptyCandidateObject
@State dataList: Array<User> = []
@State list: Array<User> = []
@State param: VideoConfig = {
spls: '',
faceFlag: false,
@ -135,29 +89,7 @@ struct Index {
this.lsh = '0000000000000'
this.callBackFlag = false
globalThis.lsh = this.lsh
this.currentUser = {
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
this.currentUser = EmptyCandidateObject
globalThis.statue = 2
this.numCount = 0
globalThis.udpClient2 && globalThis.udpClient2.onMessage((val) => {
@ -167,6 +99,7 @@ struct Index {
this.getqkFn()
this.signNum = val.body[1]
}
} else if (val.id == '42') {
console.log('qkfnqkfn', val.body[0])
this.qkFn()
@ -181,7 +114,7 @@ struct Index {
} else {
console.error("zzctest Failed to Open Device");
}
// 如果是单机模式则模拟假数据
if (globalThis.singlePlay) {
// TODO 模拟假数据
this.list = CandidateData
@ -432,29 +365,7 @@ struct Index {
getExaminationStudentInfo(param).then(res => {
if (!res) {
this.dataList = []
this.currentUser = {
ksy2sfzmhm: "",
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
this.currentUser = EmptyCandidateObject
console.log('currentUser', JSON.stringify(this.currentUser))
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
return
@ -486,29 +397,7 @@ struct Index {
if (this.dataList.length) {
this.currentUser = this.dataList[0]
} else {
this.currentUser = {
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
this.currentUser = EmptyCandidateObject
}
this.lsh = this.currentUser.lsh
@ -590,29 +479,7 @@ struct Index {
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
this.pageIndex = 0
this.qkFlag = false
this.currentUser = {
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
this.currentUser = EmptyCandidateObject
this.getExaminationStudentInfoFn()
return
}

View File

@ -1,4 +1,27 @@
export interface User {
sfzmhm: string
xm: string
lsh: string
ksy1: string
id: string
kszp: string
ksmjzp: string
bz1: string
jxmc: string
kchp: string
kscx: string
ksdd: string
kssycs: string
ksxl: string
ksy1sfzmhm: string
kszt: string
xb: string
xh: string
xldm: string
yycs: string
ksy2sfzmhm: string
}
export interface VideoConfig{
videoNum?:string,
spls:string