dev #65
@ -5,6 +5,9 @@ import TopLogo from './compontents/TopLogo';
|
|||||||
import testNapi from '@ohos.hiserialsdk';
|
import testNapi from '@ohos.hiserialsdk';
|
||||||
import { dateFormat } from '../common/utils/tools';
|
import { dateFormat } from '../common/utils/tools';
|
||||||
import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock';
|
import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock';
|
||||||
|
import FileUtil from '../common/utils/File';
|
||||||
|
import { GlobalConfig } from '../config';
|
||||||
|
import common from '@ohos.app.ability.common';
|
||||||
|
|
||||||
@Entry
|
@Entry
|
||||||
@Component
|
@Component
|
||||||
@ -37,6 +40,7 @@ export default struct Index {
|
|||||||
@State stopFlag: boolean = false
|
@State stopFlag: boolean = false
|
||||||
@State fromIndex: boolean = false
|
@State fromIndex: boolean = false
|
||||||
private vocObj = null;
|
private vocObj = null;
|
||||||
|
private context = getContext(this) as common.UIAbilityContext;
|
||||||
|
|
||||||
// private AccountTable = new AccountTable(()=>{},CommonConstants);
|
// private AccountTable = new AccountTable(()=>{},CommonConstants);
|
||||||
aboutToAppear() {
|
aboutToAppear() {
|
||||||
@ -114,28 +118,66 @@ export default struct Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
carConfigurationInfoFn() {
|
async carConfigurationInfoFn() {
|
||||||
// const fileUtil = new FileUtil(context)
|
const fileUtil = new FileUtil(this.context)
|
||||||
// const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
|
const checkListStr = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/carcheck.txt');
|
||||||
// if (data === '' || data === undefined) {
|
|
||||||
// promptAction.showToast({
|
if (checkListStr === '' || checkListStr === undefined) {
|
||||||
// message: `请先进行设备注册`,
|
//模拟真实数据
|
||||||
// duration: 3000
|
const param = {
|
||||||
// });
|
"body":
|
||||||
// globalThis.type='1'
|
{
|
||||||
// globalThis.title=decodeURIComponent('请先进行设备注册')
|
"carIdString": globalThis.carInfo.carId, //考车ID
|
||||||
// globalThis.errorDialog.open()
|
"deviceNo": globalThis.deviceNo
|
||||||
// resolve('')
|
}
|
||||||
// } else {
|
}
|
||||||
// const fileData=JSON.parse(data)
|
|
||||||
// globalThis.deviceNo = fileData.deviceName
|
carConfigurationInfo(param).then(res => {
|
||||||
// console.log('globalThis.deviceNo', globalThis.deviceNo)
|
// @ts-ignore
|
||||||
// // getCarInfo()
|
console.log('ES_CHECK_CAR_ITEM',JSON.stringify(res.body))
|
||||||
// resolve(fileData.deviceName)
|
// @ts-ignore
|
||||||
// }
|
if(res?.body?.ES_CHECK_CAR_ITEM){
|
||||||
if (globalThis.singlePlay) {
|
// @ts-ignore
|
||||||
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 = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';');
|
||||||
const data = str.split(';')
|
this.checkList = []
|
||||||
|
const list = data
|
||||||
|
list.map(res => {
|
||||||
|
const arr = res.split(':')
|
||||||
|
this.checkList.push({
|
||||||
|
'key': parseInt(arr[0]) + 2, 'time': arr[1]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
||||||
|
}else{
|
||||||
|
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(';')
|
||||||
|
this.checkList = []
|
||||||
|
const list = data
|
||||||
|
list.map(res => {
|
||||||
|
const arr = res.split(':')
|
||||||
|
this.checkList.push({
|
||||||
|
'key': parseInt(arr[0]) + 2, 'time': arr[1]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
||||||
|
}
|
||||||
|
|
||||||
|
}).catch((error) => {
|
||||||
|
console.log('error12error' + error)
|
||||||
|
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(';')
|
||||||
|
this.checkList = []
|
||||||
|
const list = data
|
||||||
|
list.map(res => {
|
||||||
|
const arr = res.split(':')
|
||||||
|
this.checkList.push({
|
||||||
|
'key': parseInt(arr[0]) + 2, 'time': arr[1]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
||||||
|
})
|
||||||
|
}else {
|
||||||
|
const data = checkListStr.split(';')
|
||||||
this.checkList = []
|
this.checkList = []
|
||||||
const list = data
|
const list = data
|
||||||
list.map(res => {
|
list.map(res => {
|
||||||
@ -147,30 +189,7 @@ export default struct Index {
|
|||||||
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//模拟真实数据
|
|
||||||
const param = {
|
|
||||||
"body":
|
|
||||||
{
|
|
||||||
"carIdString": globalThis.carInfo.carId, //考车ID
|
|
||||||
"deviceNo": globalThis.deviceNo
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
carConfigurationInfo(param).then(res => {
|
|
||||||
// @ts-ignore
|
|
||||||
const data = res.body.ES_CHECK_CAR_ITEM[0].ITEMS.split(';');
|
|
||||||
this.checkList = []
|
|
||||||
const list = data
|
|
||||||
list.map(res => {
|
|
||||||
const arr = res.split(':')
|
|
||||||
this.checkList.push({
|
|
||||||
'key': parseInt(arr[0]) + 2, 'time': arr[1]
|
|
||||||
})
|
|
||||||
})
|
|
||||||
this.checkListCopy = JSON.parse(JSON.stringify(this.checkList))
|
|
||||||
}).catch((error) => {
|
|
||||||
console.log('error12error' + error)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async kszj() {
|
async kszj() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user