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', sfzmhm: '342323199501470011',
xm: '测试学员1', xm: '测试学员1',
@ -19,8 +20,11 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '341182199308155624', sfzmhm: '341182199308155624',
xm: '测试学员2', xm: '测试学员2',
lsh: '0000000000002', lsh: '0000000000002',
@ -40,8 +44,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700003', sfzmhm: '3423231995014700003',
xm: '测试学员3', xm: '测试学员3',
lsh: '0000000000003', lsh: '0000000000003',
@ -61,8 +67,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700004', sfzmhm: '3423231995014700004',
xm: '测试学员4', xm: '测试学员4',
lsh: '0000000000004', lsh: '0000000000004',
@ -82,8 +90,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700005', sfzmhm: '3423231995014700005',
xm: '测试学员5', xm: '测试学员5',
lsh: '0000000000004', lsh: '0000000000004',
@ -103,8 +113,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '342323199501470016', sfzmhm: '342323199501470016',
xm: '测试学员6', xm: '测试学员6',
lsh: '0000000000005', lsh: '0000000000005',
@ -124,8 +136,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700007', sfzmhm: '3423231995014700007',
xm: '测试学员7', xm: '测试学员7',
lsh: '0000000000007', lsh: '0000000000007',
@ -145,8 +159,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: "",
},
{
sfzmhm: '3423231995014700008', sfzmhm: '3423231995014700008',
xm: '测试学员8', xm: '测试学员8',
lsh: '0000000000008', lsh: '0000000000008',
@ -166,8 +182,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: ""
},
{
sfzmhm: '3423231995014700009', sfzmhm: '3423231995014700009',
xm: '测试学员9', xm: '测试学员9',
lsh: '0000000000009', lsh: '0000000000009',
@ -187,8 +205,10 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' yycs: '',
}, { ksy2sfzmhm: ""
},
{
sfzmhm: '34232319950147000010', sfzmhm: '34232319950147000010',
xm: '测试学员10', xm: '测试学员10',
lsh: '002', lsh: '002',
@ -208,5 +228,30 @@ export const CandidateData = [
xb: '', xb: '',
xh: '', xh: '',
xldm: '', xldm: '',
yycs: '' 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 { writeObjectOut } from '../api/judge'
import testNapi from "@ohos.idcard"; import testNapi from "@ohos.idcard";
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { VideoConfig } from './interfaces' import { VideoConfig, User } from './interfaces'
import WebRTCVoice from './webRTC/' import WebRTCVoice from './webRTC/'
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction'
import { CandidateData } from "../mock/CandidateData" import { CandidateData, EmptyCandidateObject } 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
}
@Entry @Entry
@Component @Component
struct Index { struct UserInfo {
@State pageIndex: number = 0 @State pageIndex: number = 0
@State ratio: number = 850 / 960 @State ratio: number = 850 / 960
@State index: number = 0 @State index: number = 0
@ -58,31 +34,9 @@ struct Index {
@State url: string = '' @State url: string = ''
@State lsh: string = '' @State lsh: string = ''
@State qkFlag: boolean = false @State qkFlag: boolean = false
@State currentUser: User = { @State currentUser: User = EmptyCandidateObject
sfzmhm: '', @State dataList: Array<User> = []
xm: '', @State list: Array<User> = []
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 param: VideoConfig = { @State param: VideoConfig = {
spls: '', spls: '',
faceFlag: false, faceFlag: false,
@ -135,29 +89,7 @@ struct Index {
this.lsh = '0000000000000' this.lsh = '0000000000000'
this.callBackFlag = false this.callBackFlag = false
globalThis.lsh = this.lsh globalThis.lsh = this.lsh
this.currentUser = { this.currentUser = EmptyCandidateObject
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
globalThis.statue = 2 globalThis.statue = 2
this.numCount = 0 this.numCount = 0
globalThis.udpClient2 && globalThis.udpClient2.onMessage((val) => { globalThis.udpClient2 && globalThis.udpClient2.onMessage((val) => {
@ -167,6 +99,7 @@ struct Index {
this.getqkFn() this.getqkFn()
this.signNum = val.body[1] this.signNum = val.body[1]
} }
} else if (val.id == '42') { } else if (val.id == '42') {
console.log('qkfnqkfn', val.body[0]) console.log('qkfnqkfn', val.body[0])
this.qkFn() this.qkFn()
@ -181,7 +114,7 @@ struct Index {
} else { } else {
console.error("zzctest Failed to Open Device"); console.error("zzctest Failed to Open Device");
} }
// 如果是单机模式则模拟假数据
if (globalThis.singlePlay) { if (globalThis.singlePlay) {
// TODO 模拟假数据 // TODO 模拟假数据
this.list = CandidateData this.list = CandidateData
@ -432,29 +365,7 @@ struct Index {
getExaminationStudentInfo(param).then(res => { getExaminationStudentInfo(param).then(res => {
if (!res) { if (!res) {
this.dataList = [] this.dataList = []
this.currentUser = { this.currentUser = EmptyCandidateObject
ksy2sfzmhm: "",
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
console.log('currentUser', JSON.stringify(this.currentUser)) console.log('currentUser', JSON.stringify(this.currentUser))
this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage) this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage)
return return
@ -486,29 +397,7 @@ struct Index {
if (this.dataList.length) { if (this.dataList.length) {
this.currentUser = this.dataList[0] this.currentUser = this.dataList[0]
} else { } else {
this.currentUser = { this.currentUser = EmptyCandidateObject
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
} }
this.lsh = this.currentUser.lsh this.lsh = this.currentUser.lsh
@ -590,29 +479,7 @@ struct Index {
if (res.examinationStuAbsentRsp.head.resultCode == '0') { if (res.examinationStuAbsentRsp.head.resultCode == '0') {
this.pageIndex = 0 this.pageIndex = 0
this.qkFlag = false this.qkFlag = false
this.currentUser = { this.currentUser = EmptyCandidateObject
ksy2sfzmhm: '',
sfzmhm: '',
xm: '',
lsh: '',
ksy1: '',
id: '',
kszp: '',
ksmjzp: '',
bz1: '',
jxmc: '',
kchp: '',
kscx: '',
ksdd: '',
kssycs: '',
ksxl: '',
ksy1sfzmhm: '',
kszt: '',
xb: '',
xh: '',
xldm: '',
yycs: ''
}
this.getExaminationStudentInfoFn() this.getExaminationStudentInfoFn()
return 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{ export interface VideoConfig{
videoNum?:string, videoNum?:string,
spls:string spls:string