47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
// @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'; //科目三设备
|
|
// globalThis.deviceNo = 'J43405J003101'; //科目二设备
|
|
// globalThis.deviceNo = '00-E2-69-0A-9F-6E'; //设备mac
|
|
// // globalThis.deviceNo = 'FE-FC-FE-7C-5C-77'; //设备mac
|
|
// globalThis.diskId = '1231231231'; //硬盘号
|
|
// globalThis.hasAuth = true;
|
|
// // return null
|
|
return new Promise((resolve, reject) => {
|
|
getSyncData('DeviceInfoTable').then((result: Array<any>) => {
|
|
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
|
|
// globalThis.carInfo.carId=res.obtainCarExamInfoRsp.body.carId
|
|
globalThis.carInfo.plateNo = decodeURIComponent(globalThis.carInfo.plateNo)
|
|
}
|
|
return res
|
|
} |