彈框userlist修改
This commit is contained in:
		
							parent
							
								
									fb8e7bc7c5
								
							
						
					
					
						commit
						9a618adeff
					
				| @ -18,15 +18,15 @@ CommonConstants { | ||||
|   /** | ||||
|    * Rdb database config. | ||||
|    */ | ||||
|   static readonly STORE_CONFIG = { name: 'user.db' }; | ||||
|   static readonly STORE_CONFIG = { name: 'USER.db' }; | ||||
| 
 | ||||
|   /** | ||||
|    * Account table config. | ||||
|    */ | ||||
|   static readonly ACCOUNT_TABLE = { | ||||
|     tableName: 'USER', | ||||
|     sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id TEXT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT)', | ||||
|     columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl'] | ||||
|     sqlCreate: 'CREATE TABLE IF NOT EXISTS USER(id INTEGER PRIMARY KEY AUTOINCREMENT,sfzmhm TEXT,xm CHAR(20), lsh TEXT, kszp TEXT,ksdd TEXT,kssycs TEXT,kslx TEXT,kscx TEXT,ksxl TEXT,ksy1 TEXT)', | ||||
|     columns: ['id','sfzmhm','xm','lsh','kszp','ksdd','kssycs','kslx','kscx','ksxl','ksy1'] | ||||
|   }; | ||||
| 
 | ||||
|   /** | ||||
|  | ||||
| @ -91,6 +91,11 @@ function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) { | ||||
| 
 | ||||
|         // console.log('表长度',result.length,tableName)
 | ||||
|         if (result.length == 0) { | ||||
|           console.log('sqlsqlinsert',resultArr.length) | ||||
|           if(resultArr.length==0){ | ||||
|             resolve(false) | ||||
|             return | ||||
|           } | ||||
|           let INSERT_SQL = "INSERT INTO " + tableName | ||||
|             + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES " | ||||
| 
 | ||||
|  | ||||
| @ -75,7 +75,10 @@ export default async function request(req: any) { | ||||
|             if(res.head.resultCode === '0'){ | ||||
|                 return res | ||||
|             }else{ | ||||
|                 globalThis.type='1' | ||||
|                 const resultMessage = res?.body?.resultMessage || res?.head?.resultMessage | ||||
|                 AppStorage.SetOrCreate('errorMsg', 1); | ||||
|                 globalThis.title=decodeURIComponent(resultMessage) | ||||
|                 prompt.showToast({ | ||||
|                     message: decodeURIComponent(resultMessage), | ||||
|                     duration: 3000 | ||||
| @ -90,6 +93,9 @@ export default async function request(req: any) { | ||||
|         if(resObj.resultCode === '0') { | ||||
|             return res | ||||
|         }else { | ||||
|             globalThis.type='1' | ||||
|             AppStorage.SetOrCreate('errorMsg', 1); | ||||
|             globalThis.title=decodeURIComponent(resObj.resultMessage) | ||||
|             prompt.showToast({ | ||||
|                 message: decodeURIComponent(resObj.resultMessage), | ||||
|                 duration: 3000 | ||||
| @ -102,7 +108,6 @@ export default async function request(req: any) { | ||||
|             return false | ||||
|         } | ||||
|         const code = e?.code; | ||||
| 
 | ||||
|         prompt.showToast({ | ||||
|             message: e?.message, | ||||
|             duration: 5000 | ||||
|  | ||||
| @ -93,10 +93,10 @@ export default struct Index { | ||||
|                     console.log('res?.examinerLoginRsp?.head?.resultCode',res?.examinerLoginRsp?.head?.resultCode,JSON.stringify(res)) | ||||
|                     this.errorDialog.close() | ||||
|                     if(res?.examinerLoginRsp?.head?.resultCode=='1'){ | ||||
|                       this.type='1' | ||||
|                       this.title=decodeURIComponent(res.examinerLoginRsp.head.resultMessage) | ||||
|                       console.log('this.titlt',this.title) | ||||
|                       this.errorDialog.open() | ||||
|                       // this.type='1' | ||||
|                       // this.title=decodeURIComponent(res.examinerLoginRsp.head.resultMessage) | ||||
|                       // console.log('this.titlt',this.title) | ||||
|                       // this.errorDialog.open() | ||||
|                       return | ||||
|                     } | ||||
|                     router.pushUrl({ | ||||
|  | ||||
| @ -42,19 +42,19 @@ struct Index { | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
|   private title = '' | ||||
|   private type = '2' | ||||
|   // dialogControllerTwo: CustomDialogController = new CustomDialogController({ | ||||
|   //   builder: errorMsgDialog({ | ||||
|   //     title: this.title, | ||||
|   //     type: this.type, | ||||
|   //     cancel: () => { | ||||
|   //     }, | ||||
|   //     confirm: () => { | ||||
|   //     } | ||||
|   //   }), | ||||
|   //   customStyle: true, | ||||
|   //   alignment: DialogAlignment.Center, | ||||
|   // }, | ||||
|   // ) | ||||
|   errorDialog: CustomDialogController = new CustomDialogController({ | ||||
|     builder: errorMsgDialog({ | ||||
|       title: globalThis.title, | ||||
|       type: globalThis.type, | ||||
|       cancel: () => { | ||||
|       }, | ||||
|       confirm: () => { | ||||
|       } | ||||
|     }), | ||||
|     customStyle: true, | ||||
|     alignment: DialogAlignment.Center, | ||||
|   }, | ||||
|   ) | ||||
| 
 | ||||
|   @Styles | ||||
|   commStyle(){ | ||||
| @ -445,6 +445,11 @@ struct Index { | ||||
|       if (this.num >= 3) { | ||||
|         this.heartMsg() | ||||
|       } | ||||
|       const data=AppStorage.Get('errorMsg'); // returns 47 | ||||
|       console.log('1123',data) | ||||
|       if(data==1){ | ||||
|         this.errorDialog.open() | ||||
|       } | ||||
|     }, 1000) | ||||
|     //下载模型 | ||||
|     // await this.getModel() | ||||
|  | ||||
| @ -132,6 +132,9 @@ struct UserInfo { | ||||
|     this.list =await getSyncData('USERLIST') | ||||
|     // @ts-ignore | ||||
|     const data=await getSyncData('USER') | ||||
|     console.log('datadata',JSON.stringify(data)); | ||||
|     console.log('datadata2',JSON.stringify(this.list)) | ||||
| 
 | ||||
|     const user=data[0] | ||||
|     if(user&&Number(user.kssycs)){ | ||||
|       this.list.forEach(res=>{ | ||||
| @ -140,15 +143,24 @@ struct UserInfo { | ||||
|           this.getCurrentStudent(res.sfzmhm) | ||||
|         } | ||||
|       }) | ||||
|     }else if(user&&!Number(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.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 | ||||
|       } | ||||
|     } | ||||
|     this.list.forEach((res,index)=>{ | ||||
|       res.id=index.toString() | ||||
|     }) | ||||
|     await upDateTableByArray('USERLIST', this.list) | ||||
|     await upDateTableByArray('USERLIST', this.list||[]) | ||||
| 
 | ||||
|     // 如果是单机模式则模拟假数据 | ||||
|     //获取sysset表数据 | ||||
| @ -444,20 +456,14 @@ struct UserInfo { | ||||
|     this.errorDialog.open() | ||||
|     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>` | ||||
|     getExaminationStudentInfo(param).then(async (res) => { | ||||
|       this.errorDialog.close() | ||||
|       setTimeout(() => { | ||||
|         this.updateTimeLimit = true | ||||
|       }, 30000) | ||||
|       this.updateTimeLimit = false | ||||
|       if (!res||res?.examinerLoginRsp?.head?.resultCode=='1') { | ||||
|         this.dataList = [] | ||||
|         this.currentUser = EmptyCandidateObject | ||||
|         this.errorMsg = decodeURI(res.getExaminationStudentInfoRsp.head.resultMessage) | ||||
|         this.type='1' | ||||
|         this.title=res.getExaminationStudentInfoRsp.head.resultMessage | ||||
|       if (!res||res?.getExaminationStudentInfoRsp?.head?.resultCode=='1') { | ||||
|         return | ||||
|       } | ||||
|       this.errorDialog.close() | ||||
| 
 | ||||
|       let dataList = [] | ||||
|       this.list = [] | ||||
| 
 | ||||
| @ -474,13 +480,15 @@ struct UserInfo { | ||||
|       } | ||||
| 
 | ||||
|       this.list = JSON.parse(JSON.stringify(dataList)) | ||||
|       this.list.forEach(listData => { | ||||
|       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||[]) | ||||
|       dataList = this.list.length > 4 ? this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) : this.list; | ||||
| 
 | ||||
|       this.dataList = dataList | ||||
|  | ||||
| @ -929,7 +929,7 @@ export default class Judge { | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     const USER = getSyncData('USER'); | ||||
|     const USER =await getSyncData('USER'); | ||||
|     await upDateTableByArray('USER', [{...USER[0],kssycs:kssycs == 2 ? 1 : 0}]) | ||||
| 
 | ||||
|     console.info(judgeTag, `考试成绩:${totalScore}`) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user