fix: 学员列表更新
This commit is contained in:
parent
cf866ffa7f
commit
fdda0e9e58
@ -1,5 +1,5 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"lockfileVersion": 2,
|
||||
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
|
||||
"specifiers": {},
|
||||
"packages": {}
|
||||
|
||||
@ -145,7 +145,7 @@ struct ExaminerLoginPage {
|
||||
router.pushUrl({
|
||||
url: 'pages/UserInfo',
|
||||
params: {
|
||||
type: 1
|
||||
type: "1"
|
||||
}
|
||||
}, router.RouterMode.Single);
|
||||
}, remainingTime);
|
||||
|
||||
@ -43,7 +43,6 @@ import { CheckSignal, GetCurrentUserKeyValue, InitializeExamProcessData } from '
|
||||
import dayTs from '../utils/Date';
|
||||
import { GetCurrentTime, GetPhotoBase64, NumberToByteArray } from '../utils/Common';
|
||||
import DB from '../utils/DbSql';
|
||||
import { CenterUDPBusinessInstance } from '../utils/business/CenterUdpBusiness';
|
||||
import { JudgeEmitterInstance } from '../utils/business/UdpEvent';
|
||||
import { StartEndExamTag, StartExamTag, UserInfoTag } from '../config';
|
||||
import { dConsole } from '../utils/LogWorker';
|
||||
@ -220,32 +219,34 @@ struct UserInfoPage {
|
||||
{ label: '考试员名', key: 'ksy2' },
|
||||
]
|
||||
|
||||
async aboutToAppear() {
|
||||
async onPageShow() {
|
||||
this.avPlayer = new VoiceAnnounce(this.context);
|
||||
this.isExamStart = false
|
||||
this.startExam = false
|
||||
this.updateTimeLimit = false
|
||||
this.currentUser = EmptyCandidateObject
|
||||
this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
|
||||
dConsole.log("this.singlePlay", this.singlePlay)
|
||||
this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')!
|
||||
this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
|
||||
//语音功能on
|
||||
// new WebRTCVoice(this.context);
|
||||
//初始化数据
|
||||
try {
|
||||
this.initData()
|
||||
dConsole.log(UserInfoTag, "初始化数据完成")
|
||||
} catch (e) {
|
||||
dConsole.error(UserInfoTag, '初始化数据失败', JSON.stringify(e))
|
||||
}
|
||||
//身份证读卡器初始化
|
||||
// this.openDeviceByIDCard()
|
||||
const routerParam: RouteParamsType = router.getParams() as RouteParamsType
|
||||
dConsole.log('routerParam', JSON.stringify(routerParam))
|
||||
dConsole.log(UserInfoTag, 'routerParam', JSON.stringify(routerParam))
|
||||
|
||||
if (!this.singlePlay) {
|
||||
if (routerParam.type != "1") {
|
||||
if (!routerParam) {
|
||||
dConsole.log(UserInfoTag, "评判退出")
|
||||
this.list = await GetSyncData<User>("USERLIST")
|
||||
const data = await GetSyncData<User>("USER")
|
||||
dConsole.log('useruser,', JSON.stringify(this.list))
|
||||
dConsole.log('useruser1,', JSON.stringify(data))
|
||||
|
||||
const user = data[0]
|
||||
if (user && Number(user.kssycs)) {
|
||||
let flag = false
|
||||
@ -260,7 +261,6 @@ struct UserInfoPage {
|
||||
this.currentUser = (this.list.length ? this.list[0] : EmptyCandidateObject)
|
||||
}
|
||||
} else if (user && (user.kssycs == '0' || user.kssycs == '')) {
|
||||
dConsole.log('datadatadatadata')
|
||||
this.list = this.list.filter(res => {
|
||||
return res.sfzmhm != user.sfzmhm
|
||||
})
|
||||
@ -279,9 +279,15 @@ struct UserInfoPage {
|
||||
this.list.forEach((res, index) => {
|
||||
res.id = index.toString()
|
||||
})
|
||||
try {
|
||||
await SqlInsertTable("USERLIST", this.list || [])
|
||||
|
||||
} catch (e) {
|
||||
dConsole.error(UserInfoTag, '插入USERLIST表失败', JSON.stringify(e))
|
||||
}
|
||||
dConsole.log(UserInfoTag, '接口读取数据', JSON.stringify(this.currentUser))
|
||||
// await this.getExaminationStudentInfoFn()
|
||||
} else {
|
||||
// 考官登录拉取学员
|
||||
await this.getExaminationStudentInfoFn()
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,15 @@ export async function InitTable() {
|
||||
// 插表操作
|
||||
export function SqlInsertTable(tableName: string, data: Array<RecordType>, delFlag = true): Promise<boolean> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (data.length === 0) {
|
||||
DB.clearTable(tableName).then(() => {
|
||||
dConsole.log(DbOperationTag, '清空表成功', 'tableName', tableName)
|
||||
resolve(true)
|
||||
}).catch((err: BusinessError) => {
|
||||
dConsole.error(DbOperationTag, '清空表失败,', JSON.stringify(err), 'tableName', tableName)
|
||||
reject(err)
|
||||
})
|
||||
}
|
||||
data.forEach((element, index) => {
|
||||
element.id = !delFlag ? `${index + data.length}` : `${index}`
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user