外殼修改

This commit is contained in:
lvyuankang 2024-08-21 11:57:03 +08:00
parent b76a2a3f58
commit eac7d94b98
9 changed files with 237 additions and 200 deletions

View File

@ -41,16 +41,16 @@ export async function getliushuiNum(context) {
// return str
}
}
export async function deleteAllFIleLog(){
export async function deleteAllFIleLog(path){
let options = {
"recursion": false,
"listNum": 0,
};
let filenames = fs.listFileSync(GlobalConfig.comoonfileWriteAddress+'/PLC/', options);
let filenames = fs.listFileSync(path, options);
console.info("listFile succeed",JSON.stringify(filenames));
for (let i = 0; i < filenames.length; i++) {
if(isSevenDaysAgo(filenames[i])){
fs.rmdir(GlobalConfig.comoonfileWriteAddress+'/PLC/'+filenames[i], (err) => {
fs.rmdir(path+filenames[i], (err) => {
if (err) {
console.error("rmdir failed with error message: " + err.message + ", error code: " + err.code);
} else {
@ -157,8 +157,9 @@ export async function getDoubleCeneterTable(param) {
//单中心存表
export async function getSingleCenterTable(param) {
return new Promise((reslove, reject) => {
try{
upDataZhongxinginitialization(param).then((result) => {
console.log('teststetfinsh01')
console.log('teststetfinsh01',result)
if (result) {
reslove(true)
@ -194,7 +195,9 @@ export async function getSingleCenterTable(param) {
reslove(false)
console.log(error)
})
}catch (e){
reslove(false)
}
})
}

View File

@ -360,6 +360,7 @@ export async function upDataZhongxinginitialization(param) {
resolve(flag)
return
}
try{
const str = {
"carId": param.carId, // 表名
"examinationRoomId": param.examinationRoomId, //考试平台kdid
@ -372,7 +373,8 @@ export async function upDataZhongxinginitialization(param) {
initialization(str).then(async (res) => {
console.log('daihai3', JSON.stringify(res))
if (!res) {
if (!res||res.initializationRsp.head.resultCode==1) {
console.log('daihai34', JSON.stringify(res))
resolve(false)
return
}
@ -396,6 +398,9 @@ export async function upDataZhongxinginitialization(param) {
}).catch((Error) => {
resolve(false)
})
}catch (error){
resolve(false)
}
})
}

View File

@ -103,12 +103,12 @@ export default class TcpClient {
}, timeout: 6000
});
promise.then(() => {
console.log('testTagtestTag000',)
this.tcp.setExtraOptions({
keepAlive: true,
}, err => {
if (err) {
console.log('testTagtestTagerrrrr,success')
console.log('testTagtestTag000,error')
if(this.num>3){
return
}
@ -119,7 +119,7 @@ export default class TcpClient {
return;
}
});
console.log('testTagtestTagconnect,success')
console.log('testTagtestTag000,success')
globalThis.getCloseTcp = false
resolve(true)
@ -133,7 +133,7 @@ export default class TcpClient {
getTCP()
resolve(false)
}, 2000)
console.log('testTagtestTagconnect,error')
console.log('testTagtestTag000,error')
});
})

View File

@ -78,19 +78,22 @@ export default async function request(req: any) {
message: decodeURIComponent(resultMessage),
duration: 3000
});
return
return false
}
}
for( let i in res ) {
resObj = res[i].head
}
console.info('jiangsong:res in request' + url + JSON.stringify(res))
console.info('jiangsong:res in request' + url + JSON.stringify(resObj))
if(resObj.resultCode === '0') {
return res
}else {
globalThis.type='1'
if(!host){
AppStorage.SetOrCreate('errorMsg', 1);
globalThis.title=decodeURIComponent(resObj.resultMessage)
}
prompt.showToast({
message: decodeURIComponent(resObj.resultMessage),
duration: 3000

View File

@ -30,8 +30,8 @@ export default class EntryAbility extends UIAbility {
globalThis.hasAuth = false
// globalThis.version = '2022.08.13.01'
// globalThis.judgeVersion = '2022.12.05.1'
globalThis.version = '2024.11.22.14'
globalThis.judgeVersion = '2024.11.22.14'
globalThis.version = '2001.11.22.14'
globalThis.judgeVersion = '2001.11.22.14'
globalThis.videoVersion= '1.0'
// globalThis.version = '2023.12.13.01'
// globalThis.judgeVersion = '2023.09.30.1'

View File

@ -93,6 +93,7 @@ export default struct Index {
this.errorDialog.open()
this.limit=true
console.log('carInfo', JSON.stringify(globalThis.carInfo))
try{
examinerLoginService(param).then(res => {
console.log('res?.examinerLoginRsp?.head?.resultCode',res?.examinerLoginRsp?.head?.resultCode,JSON.stringify(res))
this.errorDialog.close()
@ -116,7 +117,15 @@ export default struct Index {
globalThis.username = this.inputTextArr[0]
}).catch(err=>{
console.log('jiangsong12',JSON.stringify(err))
this.errorDialog.close()
this.limit=false
})
}catch(eroor){
console.log('erroreee')
this.errorDialog.close()
this.limit=false
}
})
} else {
Image(item).width('18%').height('24%').onClick(() => {

View File

@ -17,6 +17,7 @@ import promptAction from '@ohos.promptAction'
import { voiceService } from '../common/service/voiceService';
import errorMsgDialog from './compontents/errorMsgDialog'
import { getSyncData } from '../common/service/initable';
import { GlobalConfig } from '../config/index'
@Entry
@Component
@ -416,7 +417,7 @@ struct Index {
}
async initParams() {
deleteAllFIleLog()
deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress+'/PLC/')
//设置plc udp 同步requesthost
await getUDP(this.context, false)
this.loading = false

View File

@ -79,7 +79,6 @@ struct UserInfo {
@State Param803Str: string = ''
private title = ''
private type = '2'
// 过程照片拍照
getPhoto = async (empty?: boolean) => {
const singlePlay = globalThis.singlePlay
@ -118,9 +117,10 @@ struct UserInfo {
alignment: DialogAlignment.Center,
},
)
async onPageShow() {
this.updateTimeLimit=false
this.ksksLimit=false
this.updateTimeLimit = false
this.ksksLimit = false
console.log('响应头地址响应头地址')
const mediaTest = new FilePhoto(this.context);
this.filePhoto = new FilePhoto(this.context);
@ -130,42 +130,42 @@ struct UserInfo {
this.initData()
//身份证读卡器初始化
// this.openDeviceByIDCard()
const routerParam=router.getParams()||{type :0};
console.log('routerParam',JSON.stringify(routerParam))
if(!globalThis.singlePlay){
const routerParam = router.getParams() || { type: 0 };
console.log('routerParam', JSON.stringify(routerParam))
if (!globalThis.singlePlay) {
// @ts-ignore
if(routerParam.type!=1){
if (routerParam.type != 1) {
// @ts-ignore
this.list =await getSyncData('USERLIST')
this.list = await getSyncData('USERLIST')
// @ts-ignore
const data=await getSyncData('USER')
const user=data[0]
if(user&&Number(user.kssycs)){
this.list.forEach(res=>{
if(res.sfzmhm==user.sfzmhm){
res.kssycs=user.kssycs
const data = await getSyncData('USER')
const user = data[0]
if (user && Number(user.kssycs)) {
this.list.forEach(res => {
if (res.sfzmhm == user.sfzmhm) {
res.kssycs = user.kssycs
this.getCurrentStudent(res.sfzmhm)
}
})
}else if(user&&(user.kssycs=='0'||user.kssycs=='')){
} else if (user && (user.kssycs == '0' || user.kssycs == '')) {
console.log('datadatadatadata')
this.list=this.list.filter(res=>{
return res.sfzmhm!=user.sfzmhm
this.list = this.list.filter(res => {
return res.sfzmhm != user.sfzmhm
})
this.pageIndex=0
this.pageIndex = 0
this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4)
if(this.dataList.length){
this.currentUser=this.dataList[0]
}else{
this.currentUser=EmptyCandidateObject
if (this.dataList.length) {
this.currentUser = this.dataList[0]
} else {
this.currentUser = EmptyCandidateObject
}
}
this.list.forEach((res,index)=>{
res.id=index.toString()
this.list.forEach((res, index) => {
res.id = index.toString()
})
await upDateTableByArray('USERLIST', this.list||[])
}else{
await upDateTableByArray('USERLIST', this.list || [])
} else {
this.getExaminationStudentInfoFn()
}
}
@ -226,7 +226,7 @@ struct UserInfo {
this.stopDeviceById()
// globalThis.statue=4
router.pushUrl({
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
url: examSubject == 3 ? 'pages/c' : 'pages/Judge',
params: {
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf,
@ -243,7 +243,7 @@ struct UserInfo {
if (!flag) {
globalThis.lsh = '0000000000000'
await upDateTableByArray('USER', [])
this.currentUser=this.list[0]
this.currentUser = this.list[0]
// promptAction.showToast({
// message: '未匹配到对应下载学员',
// duration: 3000
@ -401,7 +401,7 @@ struct UserInfo {
that.openDeviceByIDCard()
}
}
if(that.list.length){
if (that.list.length) {
return
}
//0不自动更新 1自动更新不限次数 2没有考生更新2次
@ -460,16 +460,17 @@ struct UserInfo {
return
}
await upDateTableByArray('USER', [])
this.type='2'
this.type = '2'
this.errorDialog.open()
this.updateTimeLimit = true
const param = `<getExaminationStudentInfoReq><head><checkCode>${Md5.Instance.get_md5(globalThis.carInfo.carId + globalThis.carInfo.examinationRoomId + globalThis.username)}</checkCode></head><body><carId>${globalThis.carInfo.carId}</carId><examinationRoomId>${globalThis.carInfo.examinationRoomId}</examinationRoomId><examinerName>${globalThis.username}</examinerName></body></getExaminationStudentInfoReq>`
try {
getExaminationStudentInfo(param).then(async (res) => {
this.errorDialog.close()
setTimeout(() => {
this.updateTimeLimit = false
}, 3000)
if (!res||res?.getExaminationStudentInfoRsp?.head?.resultCode=='1') {
if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') {
return
}
let dataList = []
@ -488,15 +489,15 @@ struct UserInfo {
}
this.list = JSON.parse(JSON.stringify(dataList))
this.list.forEach((listData,index) => {
listData.id=index.toString()
this.list.forEach((listData, index) => {
listData.id = index.toString()
for (let i in listData) {
listData[i] = decodeURI(listData[i])
}
listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp
})
await upDateTableByArray('USERLIST', this.list||[])
await upDateTableByArray('USERLIST', this.list || [])
dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list;
this.dataList = dataList
@ -518,13 +519,19 @@ struct UserInfo {
})
}).catch((error) => {
this.updateTimeLimit = false
this.errorDialog.close()
console.log('error12error' + error)
})
} catch (error) {
this.updateTimeLimit = false
this.errorDialog.close()
console.log('error14error' + error)
}
}
qkFn() {
this.faceCompareSucess = 0
this.ksksLimit=false
this.ksksLimit = false
if (globalThis.singlePlay) {
this.qkFlag = false
return
@ -612,7 +619,7 @@ struct UserInfo {
})
return
}
this.currentUser.id='0'
this.currentUser.id = '0'
await upDateTableByArray('USER', [this.currentUser])
this.stepFlag = false
this.isLoadingPopupVisible = false
@ -623,10 +630,10 @@ struct UserInfo {
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf,
//真实监管项目
kString:keystr || ''
kString: keystr || ''
}
}, router.RouterMode.Single);
this.updateTimeLimit=false
this.updateTimeLimit = false
this.stopDeviceById()
this.stepFlag = false
})
@ -818,7 +825,7 @@ struct UserInfo {
.backgroundImageSize({ width: '100%', height: '100%' })
.onClick(() => {
globalThis.lsh = item.lsh;
if (this.isExamStart&&!globalThis.singlePlay) {
if (this.isExamStart && !globalThis.singlePlay) {
return
}
this.currentUser = item
@ -893,10 +900,10 @@ struct UserInfo {
Image($r('app.media.qk_btn'))
.commStyle()
.onClick(() => {
if(this.ksksLimit){
if (this.ksksLimit) {
return
}
this.ksksLimit=true
this.ksksLimit = true
this.qkFlag = true
})
@ -906,7 +913,7 @@ struct UserInfo {
try {
await this.checkSignal()
this.isExamStart = true
this.currentUser.id='0'
this.currentUser.id = '0'
await upDateTableByArray('USER', [this.currentUser])
globalThis.statue = 4
this.isBoardPrePareSetPopupShow = true;
@ -921,7 +928,7 @@ struct UserInfo {
Image($r('app.media.ksks_btn'))
.commStyle()
.onClick(async () => {
if(this.ksksLimit){
if (this.ksksLimit) {
return
}
console.log('routerParamrouterParam')
@ -932,11 +939,11 @@ struct UserInfo {
if (!this.currentUser.xm) {
return
}
this.ksksLimit=true
this.ksksLimit = true
if (globalThis.singlePlay) {
const {examSubject} = globalThis.carInfo;
this.currentUser.id='0'
this.currentUser.id = '0'
await upDateTableByArray('USER', [this.currentUser])
router.pushUrl({
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
@ -945,7 +952,7 @@ struct UserInfo {
kfdm: this.sczbkf,
}
}, router.RouterMode.Single);
this.ksksLimit=false
this.ksksLimit = false
this.stopDeviceById()
return
@ -986,7 +993,7 @@ struct UserInfo {
}
.commStyle()
.onClick(() => {
this.ksksLimit=false
this.ksksLimit = false
this.qkFlag = false
})
@ -1088,7 +1095,11 @@ struct LabelBlock {
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)
Text(decodeURIComponent(this.value))
.fontColor('#fff')
.textAlign(TextAlign.Center)
.width('100%')
.fontSize(18 * this.ratio)
}
.commLabelStyle()
}.margin({ bottom: 10 * this.ratio })

View File

@ -30,8 +30,9 @@ workerPort.onmessage = (e: MessageEvents): void => {
console.log('baoyihu,onmessage',JSON.stringify(param))
if(param.mode=='1'){
//单中心
try{
getSingleCenterTable(param).then((ret) => {
console.log('teststetfinsh1')
console.log('teststetfinsh1',ret)
if (ret) {
workerPort.postMessage({ isComplete: true });
}else{
@ -39,6 +40,10 @@ workerPort.onmessage = (e: MessageEvents): void => {
}
})
}catch(error){
workerPort.postMessage({ isComplete: false });
}
}else if(param.mode=='3'){
//双中心
getDoubleCeneterTable(param).then((ret)=>{