// @ts-nocheck import { obtainCarExamInfo} from '../../api/index' import { dateFormat} from '../utils/tools' import router from '@ohos.router' import { getSyncData } from '../../common/service/initable' //获取设备信息 export async function getDeviceInfo() { globalThis.deviceNo = 'HM-AC76'; //科目三设备 return new Promise((resolve, reject) => { getSyncData('DeviceInfoTable').then((result: Array) => { if (result.length) { globalThis.deviceNo = result[0].deviceId getCarInfo() resolve(result[0].deviceId) } else { // router.pushUrl({ // url: 'pages/Register', // }, router.RouterMode.Single); resolve('') } }) }) } //获取考车信息 export async function getCarInfo() { let date = new Date(); let params = { time: dateFormat(date), deviceNo: globalThis.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.carInfo',JSON.stringify(globalThis.carInfo)); // globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo) } return res }