globalThis 修改
This commit is contained in:
		
							parent
							
								
									4f34fc484c
								
							
						
					
					
						commit
						f888171929
					
				| @ -4,8 +4,7 @@ import { initCarInfoCache } from '../../api/index' | ||||
| //考官登录信息
 | ||||
| export async function examinerLoginService(params) { | ||||
|   let res: any = await examinerLogin(params) | ||||
| 
 | ||||
|   globalThis.examinerInfo = res?.examinerLoginRsp?.body || {} | ||||
|   AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body) | ||||
|   console.log('jiangsong1: examinerLoginService' + JSON.stringify(res)) | ||||
|   //{"examinerLoginRsp":{"head":{"resultCode":"0","resultMessage":"%E8%80%83%E8%AF%95%E5%91%98%E7%99%BB%E5%BD%95-%E6%88%90%E5%8A%9F","time":"2023-06-01 10:06:39"},"body":{"code":"006","name":"%E8%80%836","statusRgpp":"1"}}}
 | ||||
|   return res | ||||
| @ -14,7 +13,6 @@ export async function examinerLoginService(params) { | ||||
| //获取考车信息
 | ||||
| export async function initParseCarInfo(params) { | ||||
|   let res: any = await initCarInfoCache(params) | ||||
|   // globalThis.parseCarInfo=res.examinerLoginRsp.body
 | ||||
|   console.log('jiangsong1: examinerLoginService' + JSON.stringify(res)) | ||||
|   //{"examinerLoginRsp":{"head":{"resultCode":"0","resultMessage":"%E8%80%83%E8%AF%95%E5%91%98%E7%99%BB%E5%BD%95-%E6%88%90%E5%8A%9F","time":"2023-06-01 10:06:39"},"body":{"code":"006","name":"%E8%80%836","statusRgpp":"1"}}}
 | ||||
|   return res | ||||
|  | ||||
| @ -26,16 +26,15 @@ async function getliushuiNum(data) { | ||||
|     for (let i = 0; str.length <= 5; i++) { | ||||
|       str = '0' + str | ||||
|     } | ||||
|     globalThis.lshNo = str | ||||
|     AppStorage.setOrCreate('lshNo',str) | ||||
|   } else { | ||||
|     num = 0 | ||||
|     let str = num.toString() | ||||
|     for (let i = 0; str.length <= 5; i++) { | ||||
|       str = '0' + str | ||||
|     } | ||||
|     globalThis.lshNo = str | ||||
|     AppStorage.setOrCreate('lshNo',str) | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| export async function deleteAllFIleLog(path) { | ||||
| @ -221,13 +220,12 @@ export async function takePhotoFn(context) { | ||||
|     spzd1: false, | ||||
|     zdyz: '5', | ||||
|   } | ||||
|   globalThis.spzd = { | ||||
|    const spzd = { | ||||
|     spzd1: false, | ||||
|     spzd2: false, | ||||
|     spzd3: false, | ||||
|     spzd4: false, | ||||
|   } | ||||
|   globalThis.takePhotoNum = 0 | ||||
|   const map = {} | ||||
|   const fileUtil = new FileUtil(context) | ||||
|   const fileData = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); | ||||
| @ -252,7 +250,7 @@ export async function takePhotoFn(context) { | ||||
|             return | ||||
|           } | ||||
|           console.log('takePhototakePhoto', JSON.stringify(data)) | ||||
|           const zdyz = globalThis.param854Str ? Number(globalThis.param854Str) : Number(param.zdyz) | ||||
|           const zdyz = AppStorage.get('param854Str') ? Number(AppStorage.get('param854Str')) : Number(param.zdyz) | ||||
|           console.log('takePhototakePhoto', JSON.stringify(zdyz),) | ||||
| 
 | ||||
|           if (Number(data.fileSize) <= (zdyz * 1000)) { | ||||
| @ -261,11 +259,13 @@ export async function takePhotoFn(context) { | ||||
|               message: `视频遮挡`, | ||||
|               duration: 3000 | ||||
|             }); | ||||
|             globalThis.spzd[key1] = true | ||||
|             spzd[key1] = true | ||||
|           } else { | ||||
|             map[key1] = false | ||||
|             globalThis.spzd[key1] = false | ||||
|             spzd[key1] = false | ||||
|           } | ||||
|           AppStorage.setOrCreate('spzd',spzd) | ||||
| 
 | ||||
|           setTimeout(() => { | ||||
|             takePhotoFn() | ||||
|           }, 3000) | ||||
| @ -273,26 +273,23 @@ export async function takePhotoFn(context) { | ||||
| 
 | ||||
|       } | ||||
|     } | ||||
|     globalThis.takePhotoNum++ | ||||
|     if (globalThis.takePhotoNum >= 20) { | ||||
|       globalThis.takePhotoNum = 0 | ||||
|       // deleteAllFileByPiC('jt')
 | ||||
|     } | ||||
| 
 | ||||
|   }, 3000) | ||||
| } | ||||
| 
 | ||||
| let fd | ||||
| const devPath = "/dev/ttyS3" | ||||
| 
 | ||||
| let chuankoufd | ||||
| function openChuankouFn(callback) { | ||||
|   console.log('SerialOpen in indexservice, path=' + devPath) | ||||
| 
 | ||||
|   //TODO 自动挡车不读取串口
 | ||||
|   testNapi.SerialOpenAsync(devPath, (fd) => { | ||||
|     globalThis.fd = fd; | ||||
|     globalThis.num = 0 | ||||
|     chuankoufd=fd | ||||
|     // AppStorage.setOrCreate('fd',fd)
 | ||||
|     // AppStorage.setOrCreate('num',0)
 | ||||
|     let parity = 0x4e; // 'N'
 | ||||
|     let ret = testNapi.SerialSetAsync(globalThis.fd, 115200, 0, 8, 1, parity, (ret) => { | ||||
|     let ret = testNapi.SerialSetAsync(chuankoufd, 115200, 0, 8, 1, parity, (ret) => { | ||||
|       callback() | ||||
|     }); | ||||
|   }); | ||||
| @ -301,15 +298,14 @@ function openChuankouFn(callback) { | ||||
| function getChuankouFnMsg() { | ||||
|   let timeout = 50000; // 2秒超时
 | ||||
|   let databuff = [0x61, 0xAA, 0x0A, 0X15, 0X00]; // send ABCDE
 | ||||
|   testNapi.SerialSendAsync(globalThis.fd, databuff, (ret) => { | ||||
|     testNapi.SerialRecvAsync(globalThis.fd, timeout, (revTestInfo) => { | ||||
|   testNapi.SerialSendAsync(chuankoufd, databuff, (ret) => { | ||||
|     testNapi.SerialRecvAsync(chuankoufd, timeout, (revTestInfo) => { | ||||
| 
 | ||||
|       const message = revTestInfo?.recevedBuf?.toString() | ||||
|       if (message == '') { | ||||
|         globalThis.num = 1 | ||||
|         // clearInterval(chuankou)
 | ||||
|         testNapi.SerialClose(globalThis.fd); | ||||
|         globalThis.fd = null | ||||
|         testNapi.SerialClose(chuankoufd); | ||||
|         chuankoufd= null | ||||
|         setTimeout(() => { | ||||
|           getChuankouFn() | ||||
|         }, 2000) | ||||
| @ -323,7 +319,7 @@ function getChuankouFnMsg() { | ||||
|       } else if (msg.length < 12) { | ||||
| 
 | ||||
|       } else { | ||||
|         globalThis.chuankoMsg = msg[9] | ||||
|         AppStorage.setOrCreate('chuankoMsg',msg[9]) | ||||
|       } | ||||
| 
 | ||||
|       setTimeout(() => { | ||||
| @ -336,14 +332,13 @@ function getChuankouFnMsg() { | ||||
|     }); | ||||
| 
 | ||||
|   }); | ||||
|   // let revTestInfo = testNapi?.SerialRecv(globalThis.fd, timeout);
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| let chuankou | ||||
| 
 | ||||
| export async function getChuankouFn() { | ||||
|   if (globalThis.fd) { | ||||
|   if (chuankoufd) { | ||||
|     return | ||||
|   } | ||||
|   openChuankouFn(getChuankouFnMsg) | ||||
|  | ||||
| @ -30,6 +30,7 @@ import FileUtil from '../../common/utils/File'; | ||||
| import { GlobalConfig } from '../../config/index'; | ||||
| import prompt from '@ohos.promptAction'; | ||||
| import DB, { ColumnType } from '../database/DbSql'; | ||||
| import App from '@system.app'; | ||||
| 
 | ||||
| //读表
 | ||||
| //参数平台
 | ||||
| @ -345,7 +346,8 @@ export async function delSyncTable(tableName, context?) { | ||||
| //获取车模、场地模型
 | ||||
| export async function getEsCarModel(context) { | ||||
|   const date = new Date() | ||||
|   if (!globalThis.timeInfo?.paraKdid) { | ||||
|   const timeInfo=AppStorage.get('timeInfo') | ||||
|   if (!timeInfo?.paraKdid) { | ||||
|     prompt.showToast({ | ||||
|       message: 'paraKdid获取失败', | ||||
|       duration: 3000 | ||||
| @ -358,10 +360,10 @@ export async function getEsCarModel(context) { | ||||
|     { | ||||
|       "rtkType": "1", //1:车模 2:场地模型
 | ||||
|       "rspType": "0", //返回类型
 | ||||
|       "paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
 | ||||
|       "examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
 | ||||
|       "paraKdid": timeInfo.paraKdid, //参数平台kdid
 | ||||
|       "examinationRoomId": timeInfo.kdid, //考试平台kdid
 | ||||
|       // "carMac":"MAC-HCPAD-210",
 | ||||
|       "carMac": globalThis.deviceNo | ||||
|       "carMac": AppStorage.get('deviceNo') | ||||
|     } | ||||
|   } | ||||
|   const venueStr = { | ||||
| @ -370,10 +372,10 @@ export async function getEsCarModel(context) { | ||||
|     { | ||||
|       "rtkType": "2", //1:车模 2:场地模型
 | ||||
|       "rspType": "0", //返回类型
 | ||||
|       "paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
 | ||||
|       "examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
 | ||||
|       "paraKdid": timeInfo.paraKdid, //参数平台kdid
 | ||||
|       "examinationRoomId": timeInfo.kdid, //考试平台kdid
 | ||||
|       // "carMac":"MAC-HCPAD-210",
 | ||||
|       "carMac": globalThis.deviceNo | ||||
|       "carMac": AppStorage.get('deviceNo') | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -14,14 +14,14 @@ export async function getDeviceInfo(context) { | ||||
|         message: `请先进行设备注册`, | ||||
|         duration: 3000 | ||||
|       }); | ||||
|       globalThis.type = '1' | ||||
|       globalThis.title = decodeURIComponent('请先进行设备注册') | ||||
|       AppStorage.setOrCreate('type', 1) | ||||
|       AppStorage.setOrCreate('title', '请先进行设备注册') | ||||
|       globalThis.errorDialog.open() | ||||
|       resolve('') | ||||
|     } else { | ||||
|       const fileData = JSON.parse(data) | ||||
|       globalThis.deviceNo = fileData.deviceName | ||||
|       console.log('globalThis.deviceNo', globalThis.deviceNo) | ||||
| 
 | ||||
|       AppStorage.setOrCreate('deviceNo', fileData.deviceName) | ||||
|       // getCarInfo()
 | ||||
|       resolve(fileData.deviceName) | ||||
|     } | ||||
| @ -31,19 +31,18 @@ export async function getDeviceInfo(context) { | ||||
| //获取考车信息
 | ||||
| export async function getCarInfo() { | ||||
|   let date = new Date(); | ||||
|   console.log('globalThis.carInfo2222', globalThis.deviceNo) | ||||
| 
 | ||||
|   let params = { time: dateFormat(date), deviceNo: globalThis.deviceNo }; | ||||
|   let params = { time: dateFormat(date), deviceNo: AppStorage.get('deviceNo') }; | ||||
|   let res: any = await obtainCarExamInfo(params) | ||||
|   if (!res?.obtainCarExamInfoRsp?.body) { | ||||
|     // router.pushUrl({
 | ||||
|     //     url: 'pages/Register',
 | ||||
|     // }, router.RouterMode.Single);
 | ||||
|   } else { | ||||
|     globalThis.carInfo = res.obtainCarExamInfoRsp.body | ||||
|     console.log('globalThis.carInfo2222', JSON.stringify(res)); | ||||
|     // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
 | ||||
|     globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo) | ||||
|     const carInfo=res.obtainCarExamInfoRsp.body | ||||
|     carInfo.plateNo= decodeURIComponent(carInfo.plateNo) | ||||
|     AppStorage.setOrCreate('carInfo',carInfo) | ||||
| 
 | ||||
|   } | ||||
|   return res | ||||
| } | ||||
| @ -44,6 +44,7 @@ export default class EntryAbility extends UIAbility { | ||||
|     AppStorage.setOrCreate('lsh','0000000000000') | ||||
|     AppStorage.setOrCreate('statue',1)//考试状态
 | ||||
|     AppStorage.setOrCreate('signNum',0)//心跳指令编号
 | ||||
|     AppStorage.setOrCreate('deviceNo',0)//设备号
 | ||||
|     AppStorage.setOrCreate('baseInfo',{ | ||||
|       hasAuth:false, | ||||
|       version:GlobalConfig.version.jn.km3[0], | ||||
| @ -54,7 +55,6 @@ export default class EntryAbility extends UIAbility { | ||||
|       pathDir: this.context.filesDir, | ||||
|       context: this.context, | ||||
|       isJudgeInitBool:false, | ||||
|       deviceNo:''//设备号
 | ||||
|     }) | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -1,3 +1,5 @@ | ||||
| import common from '@ohos.app.ability.common' | ||||
| 
 | ||||
| export interface User { | ||||
|   sfzmhm: string | ||||
|   xm: string | ||||
| @ -73,3 +75,14 @@ export interface VideoConfig { | ||||
| export interface CommonType { | ||||
|   key: string; | ||||
| } | ||||
| export interface baseInfo { | ||||
|   hasAuth: boolean, | ||||
|   version:string, | ||||
|   judgeVersion:string, | ||||
|   tcpSendNum:number, | ||||
|   videoVersion:string, | ||||
|   ratio:number, | ||||
|   pathDir:string, | ||||
|   context:common.UIAbilityContext, | ||||
|   isJudgeInitBool:boolean, | ||||
| } | ||||
| @ -5,6 +5,7 @@ import TopLogo from './compontents/TopLogo'; | ||||
| import testNapi from '@ohos.hiserialsdk'; | ||||
| import { dateFormat } from '../common/utils/tools'; | ||||
| import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock'; | ||||
| import { baseInfo } from '../model/Common'; | ||||
| 
 | ||||
| @Entry | ||||
| @Component | ||||
| @ -36,11 +37,13 @@ struct Index { | ||||
|   @State devPath: string = "/dev/ttyS3" | ||||
|   @State stopFlag: boolean = false | ||||
|   @State fromIndex: boolean = false | ||||
|   @State carinfo: object = {} | ||||
|   private vocObj: ESObject; | ||||
| 
 | ||||
|   // private AccountTable = new AccountTable(()=>{},CommonConstants); | ||||
|   aboutToAppear() { | ||||
|     const that = this | ||||
|     this.carInfo=AppStorage.get('carInfo') | ||||
|     this.vocObj = new voiceService(async (status: string, val: string) => { | ||||
|       if (!that.breakFlag) { | ||||
|         return | ||||
| @ -93,7 +96,7 @@ struct Index { | ||||
|     if (msg[0] != '98' || msg[1] != '85' || msg.length < 9) { | ||||
|       return | ||||
|     } | ||||
|     globalThis.chuankoMsg = msg[9] | ||||
|     AppStorage.setOrCreate('chuankoMsg', msg[9]) | ||||
|     if (msg[9] == this.dwMap[this.index]) { | ||||
|       this.warnFlag[this.index] = '2' | ||||
|     } | ||||
| @ -115,25 +118,7 @@ struct Index { | ||||
| 
 | ||||
|   // | ||||
|   carConfigurationInfoFn() { | ||||
|     // const fileUtil = new FileUtil(context) | ||||
|     // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); | ||||
|     // if (data === '' || data === undefined) { | ||||
|     //   promptAction.showToast({ | ||||
|     //     message: `请先进行设备注册`, | ||||
|     //     duration: 3000 | ||||
|     //   }); | ||||
|     //   globalThis.type='1' | ||||
|     //   globalThis.title=decodeURIComponent('请先进行设备注册') | ||||
|     //   globalThis.errorDialog.open() | ||||
|     //   resolve('') | ||||
|     // } else { | ||||
|     //   const fileData=JSON.parse(data) | ||||
|     //   globalThis.deviceNo = fileData.deviceName | ||||
|     //   console.log('globalThis.deviceNo', globalThis.deviceNo) | ||||
|     //   // getCarInfo() | ||||
|     //   resolve(fileData.deviceName) | ||||
|     // } | ||||
|     if (globalThis.singlePlay) { | ||||
|     if (AppStorage.get('singlePlay')) { | ||||
|       const str = | ||||
|         "1:5;2:5;3:5;4:5;5:5;6:5;7:5;8:5;9:5;10:5;11:5;12:5;13:5;14:5;15:5;16:5;17:5;18:5;19:5;20:5;21:5;22:2;23:5;24:5" | ||||
|       const data = str.split(';') | ||||
| @ -148,12 +133,13 @@ struct Index { | ||||
|       this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) | ||||
|       return | ||||
|     } | ||||
|     const baseInfo=AppStorage.get('baseInfo') as baseInfo | ||||
|     //模拟真实数据 | ||||
|     const param = { | ||||
|       "body": | ||||
|       { | ||||
|         "carIdString": globalThis.carInfo.carId, //考车ID | ||||
|         "deviceNo": globalThis.deviceNo | ||||
|         "carIdString": this.carInfo.carId, //考车ID | ||||
|         "deviceNo": baseInfo.deviceNo | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
| @ -284,15 +270,15 @@ struct Index { | ||||
|           type: 1, | ||||
|           name: flag ? 'zjwtg.wav' : 'zjtg.wav' | ||||
|         }) | ||||
|         if (globalThis.singlePlay) { | ||||
|         if (AppStorage.get('singlePlay')) { | ||||
|           return | ||||
|         } | ||||
|         let date = new Date(); | ||||
|         const data = { | ||||
|           time: dateFormat(date), | ||||
|           carId: globalThis.carInfo.carId, | ||||
|           examinationRoomId: globalThis.carInfo.examinationRoomId, | ||||
|           plateNo: globalThis.carInfo.plateNo, | ||||
|           carId: this.carInfo.carId, | ||||
|           examinationRoomId: this.carInfo.examinationRoomId, | ||||
|           plateNo: this.carInfo.plateNo, | ||||
|           flag: flag ? 'N' : 'Y', | ||||
|           condition: flag ? '自检不通过' : '自检通过' | ||||
|         } | ||||
| @ -321,11 +307,9 @@ struct Index { | ||||
|       that.passArray[index] = true | ||||
|       if (index == 2) { | ||||
|         let flag = false | ||||
|         console.log('globalThis.spzd[key]', globalThis.spzd) | ||||
| 
 | ||||
|         for (let key in globalThis.spzd) { | ||||
|           console.log('globalThis.spzd[key]', globalThis.spzd[key]) | ||||
|           if (globalThis.spzd[key]) { | ||||
|         const spzd=AppStorage.get('spzd') | ||||
|         for (let key in pzd) { | ||||
|           if (spzd[key]) { | ||||
|             that.warnFlag[index] = '1' | ||||
|             flag = true | ||||
|           } | ||||
|  | ||||
| @ -93,16 +93,16 @@ struct Index { | ||||
|                     if (this.limit) { | ||||
|                       return | ||||
|                     } | ||||
|                     const carInfo=AppStorage.get('carInfo') | ||||
|                     const param: UserLoginType = { | ||||
|                       carId: globalThis.carInfo.carId as string, | ||||
|                       examinationRoomId: globalThis.carInfo.examinationRoomId as string, | ||||
|                       carId: carInfo.carId as string, | ||||
|                       examinationRoomId: carInfo.examinationRoomId as string, | ||||
|                       username: this.inputTextArr[0], | ||||
|                       password: Md5.Instance.get_md5(this.inputTextArr[1]) | ||||
|                     } | ||||
|                     this.type = '2' | ||||
|                     this.errorDialog.open() | ||||
|                     this.limit = true | ||||
|                     console.log('carInfo', JSON.stringify(globalThis.carInfo)) | ||||
|                     try { | ||||
|                       // TODO | ||||
|                       examinerLoginService(param).then((res: ESObject) => { | ||||
| @ -126,10 +126,9 @@ struct Index { | ||||
|                         }, router.RouterMode.Single); | ||||
| 
 | ||||
|                         console.log('res11', JSON.stringify(res)) | ||||
|                         globalThis.ksyxm = res.examinerLoginRsp.body.ksyxm | ||||
|                         globalThis.kgxm = res.examinerLoginRsp.body.name | ||||
| 
 | ||||
|                         globalThis.username = this.inputTextArr[0] | ||||
|                         const examinerLoginInfo=res.examinerLoginRsp.body | ||||
|                         examinerLoginInfo.username= this.inputTextArr[0] | ||||
|                         AppStorage.setOrCreate('examinerLoginInfo',examinerLoginInfo) | ||||
|                       }).catch((err: BusinessError) => { | ||||
|                         console.log('jiangsong12', JSON.stringify(err)) | ||||
|                         this.errorDialog.close() | ||||
|  | ||||
| @ -18,7 +18,7 @@ import UdpEvent from '../common/utils/UdpEvent'; | ||||
| import { delPic } from '../service/videoService'; | ||||
| import imageBtn from './compontents/imageBtn'; | ||||
| import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| 
 | ||||
| import {baseInfo} from '../model/Common' | ||||
| // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||
| 
 | ||||
| @Entry | ||||
| @ -30,7 +30,7 @@ struct Index { | ||||
|   @State hasAuth: boolean = false; | ||||
|   @State dialogVisiable: boolean = false; | ||||
|   @State singlePlay: boolean = false; | ||||
|   @State baseInfo: object = {  }; | ||||
|   @State baseInfo: baseInfo = {}; | ||||
|   @State deviceId: string = ''; | ||||
|   @State angle: number = 0 | ||||
|   @State dialogRatio: number = 0.8 | ||||
| @ -363,16 +363,10 @@ struct Index { | ||||
|     this.dialogVisiable = false | ||||
|     this.angle = 0 | ||||
|     this.loading = false | ||||
|     const baseInfo=AppStorage.get('baseInfo') | ||||
|     baseInfo.lsh = '1111111111111' | ||||
|     AppStorage.setOrCreate('baseInfo',baseInfo) | ||||
|     AppStorage.set('lsh','1111111111111') | ||||
|     globalThis.errorDialog = this.errorDialog | ||||
|     globalThis.udpEvent = new UdpEvent(); | ||||
|     getSyncData('MA_SYSSET').then(async data => { | ||||
| 
 | ||||
|       console.log('datadata', JSON.stringify(data)) | ||||
|       // @ts-ignore | ||||
| 
 | ||||
|       // @ts-ignore | ||||
|       data.forEach(async sys => { | ||||
|         //判断是否能点开始考试 | ||||
| @ -527,7 +521,7 @@ struct Index { | ||||
|   async onPageShow() { | ||||
|     console.log('ttttt', 1111) | ||||
|     this.singlePlay=AppStorage.get('singlePlay') | ||||
|     this.baseInfo=AppStorage.get('baseInfo') | ||||
|     this.baseInfo=AppStorage.get('baseInfo') as baseInfo | ||||
|     await this.userAuth(); | ||||
|     if (this.singlePlay == undefined || this.singlePlay == null) { | ||||
|       // setVideoParam() | ||||
|  | ||||
| @ -21,7 +21,6 @@ struct Index { | ||||
|   private context = getContext(this) as common.UIAbilityContext; | ||||
| 
 | ||||
|   onPageShow() { | ||||
|     // this.plateNo=globalThis.carInfo.plateNo | ||||
|     console.log('createDeviceManagerstart') | ||||
|     try { | ||||
|       deviceManager.createDeviceManager('com.oh.dts', (error: string, value: deviceManager.DeviceManager) => { | ||||
| @ -32,7 +31,7 @@ struct Index { | ||||
|         this.deviceName = value.getLocalDeviceInfoSync().deviceName | ||||
|         this.deviceNo = value.getLocalDeviceInfoSync().deviceId.substring(0, 10).toUpperCase() | ||||
|         this.ip = 'MAC-' + this.deviceNo | ||||
|         globalThis.deviceNo = 'MAC-' + this.deviceNo | ||||
|         AppStorage.setOrCreate('deviceNo','MAC-' + this.deviceNo) | ||||
|       }); | ||||
| 
 | ||||
|     } catch (error) { | ||||
| @ -53,7 +52,8 @@ struct Index { | ||||
|                 this.subType = '2' | ||||
|               } | ||||
|               this.ip = 'MAC-' + this.deviceNo | ||||
|               globalThis.deviceNo = this.ip | ||||
|               AppStorage.setOrCreate('deviceNo', this.ip) | ||||
| 
 | ||||
|             }) | ||||
|             Text('网卡').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * this.ratio }) | ||||
|           } | ||||
| @ -66,7 +66,7 @@ struct Index { | ||||
|                 this.subType = '3' | ||||
|               } | ||||
|               this.ip = 'DISK-' + this.deviceNo | ||||
|               globalThis.deviceNo = this.ip | ||||
|               AppStorage.setOrCreate('deviceNo', this.ip) | ||||
|               // this.ip = ip | ||||
|             }) | ||||
|             Text('硬盘').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 83 * this.ratio }) | ||||
| @ -124,8 +124,7 @@ struct Index { | ||||
|     const fileUtil = new FileUtil(this.context) | ||||
|     const folderPath = await fileUtil.initFolder(`/config`); | ||||
|     fileUtil.addFile(`${folderPath}/deviceNo.txt`, JSON.stringify(param)) | ||||
|     globalThis.deviceNo = this.ip | ||||
|     console.log('globalThis.deviceNo', globalThis.deviceNo) | ||||
|     AppStorage.setOrCreate('deviceNo', this.ip) | ||||
|     // upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }]) | ||||
|     registrationDeviceNo(param).then((res: ESObject) => { | ||||
|       if (res.registrationDeviceNoRsp.head.resultCode == '0') { | ||||
|  | ||||
| @ -1,4 +1,5 @@ | ||||
| import router from '@ohos.router' | ||||
| import { baseInfo } from '../model/Common' | ||||
| import TopLogo from './compontents/TopLogo' | ||||
| 
 | ||||
| @Entry | ||||
| @ -9,6 +10,9 @@ struct Index { | ||||
|   @State version: string = '' | ||||
|   @State hasAuth: boolean = false; | ||||
|   @State url: string = '' | ||||
|   @State baseinfo: baseinfo = {} | ||||
|   @State carInfo: object = {} | ||||
| 
 | ||||
|   @State @Watch('outClick') outFlag: boolean = false; | ||||
| 
 | ||||
|   // private vocObj = null; | ||||
| @ -68,7 +72,7 @@ struct Index { | ||||
|           } | ||||
|           .margin({ left: 24 * this.ratio }) | ||||
| 
 | ||||
|           Text('考车号:' + globalThis.carInfo.carNo) | ||||
|           Text('考车号:' + this.carInfo.carNo) | ||||
|             .fontColor('#CCAE7A') | ||||
|             .fontSize(22 * this.ratio) | ||||
|             .margin({ right: 24 * this.ratio }) | ||||
| @ -89,9 +93,11 @@ struct Index { | ||||
|   aboutToAppear() { | ||||
|     // this.vocObj = new voiceService(async (status, val, next) => { | ||||
|     // }); | ||||
|     this.carNum = globalThis.carInfo.plateNo; | ||||
|     this.version = globalThis.version; | ||||
|     this.hasAuth = globalThis.hasAuth; | ||||
|     this.carInfo=AppStorage.get('carInfo') | ||||
|     this.baseinfo=AppStorage.get('baseinfo') as baseInfo | ||||
|     this.carNum = this.carInfo.plateNo; | ||||
|     this.version = baseinfo.version; | ||||
|     this.hasAuth = baseinfo.hasAuth; | ||||
|   } | ||||
| 
 | ||||
|   outClick() { | ||||
|  | ||||
| @ -583,7 +583,8 @@ struct Index { | ||||
|   } | ||||
| 
 | ||||
|   aboutToAppear() { | ||||
|     this.ratio = globalThis.ratio | ||||
|     const radio=AppStorage.get('ratio') as number | ||||
|     this.ratio = radio | ||||
|     this.openFlag = true | ||||
|     const fileUtil = new FileUtil(this.context) | ||||
|     this.fileUtil = fileUtil | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user