2024-01-05 11:11:15 +08:00
|
|
|
// @ts-nocheck
|
2024-07-17 10:19:16 +08:00
|
|
|
import { obtainCarExamInfo } from '../../api/index'
|
|
|
|
|
import { dateFormat } from '../utils/tools'
|
2024-03-12 15:32:48 +08:00
|
|
|
import router from '@ohos.router'
|
|
|
|
|
import { getSyncData } from '../../common/service/initable'
|
2024-07-17 10:19:16 +08:00
|
|
|
import { GlobalConfig } from '../../config/index'
|
|
|
|
|
import FileUtil from '../../common/utils/File'
|
2024-01-05 11:11:15 +08:00
|
|
|
|
|
|
|
|
//获取设备信息
|
2024-07-17 10:19:16 +08:00
|
|
|
export async function getDeviceInfo(context) {
|
|
|
|
|
// globalThis.deviceNo = '153216400880'; //科目三设备
|
2024-08-08 18:09:06 +08:00
|
|
|
// globalThis.deviceNo = '150667400235'; //科目三设备
|
|
|
|
|
// globalThis.deviceNo = '1649018001275'; //洛阳科目三设备
|
2024-07-31 13:47:40 +08:00
|
|
|
// globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489
|
|
|
|
|
// globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备
|
|
|
|
|
|
2024-07-17 10:19:16 +08:00
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
|
const fileUtil = new FileUtil(context)
|
|
|
|
|
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
|
|
|
|
|
if (data === '' || data === undefined) {
|
|
|
|
|
router.pushUrl({
|
|
|
|
|
url: 'pages/Register',
|
|
|
|
|
}, router.RouterMode.Single);
|
|
|
|
|
resolve('')
|
|
|
|
|
} else {
|
|
|
|
|
const fileData=JSON.parse(data)
|
|
|
|
|
globalThis.deviceNo = fileData.deviceName
|
|
|
|
|
getCarInfo()
|
|
|
|
|
resolve(fileData.deviceName)
|
|
|
|
|
}
|
|
|
|
|
})
|
2024-01-05 11:11:15 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//获取考车信息
|
|
|
|
|
export async function getCarInfo() {
|
2024-07-17 10:19:16 +08:00
|
|
|
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
|
2024-01-05 11:11:15 +08:00
|
|
|
}
|