This commit is contained in:
lvyuankang 2024-08-21 08:53:26 +08:00
parent 46cc3a311f
commit b76a2a3f58
3 changed files with 40 additions and 28 deletions

View File

@ -83,30 +83,7 @@ struct Index {
})
Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
.onClick(() => {
this.dialogVisiable = true
// promptAction.showDialog({
// title: '提示',
// message: '确认是否退出应用',
// buttons: [
// {
// text: '确认',
// color: '#000000',
// },
// {
// text: '取消',
// color: '#000000',
// }
// ],
// })
// .then(data => {
// if (data.index == 0) {
// router.back()
// }
// })
// .catch(err => {
// // reslove(false)
// })
})
}
}
@ -125,12 +102,14 @@ struct Index {
if (this.loading) {
return
}
this.loading = true
setTimeout(() => {
this.angle = 360
}, 1000)
this.angle = 0
if (!globalThis.timeInfo) {
globalThis.type='1'
AppStorage.SetOrCreate('errorMsg', 1);
globalThis.title='时间同步接口连接失败'
promptAction.showToast({
message: `时间同步接口连接失败`,
duration: 3000
@ -138,6 +117,17 @@ struct Index {
this.loading = false
return
}
if (!globalThis.carInfo) {
promptAction.showToast({
message: `车辆信息接口获取失败`,
duration: 3000
});
globalThis.type='1'
AppStorage.SetOrCreate('errorMsg', 1);
globalThis.title='车辆信息接口获取失败'
this.loading = false
return
}
this.testXMLToJSONInWorker()
@ -307,6 +297,9 @@ struct Index {
}
async testXMLToJSONInWorker() {
if (this.loading) {
return
}
let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts');
const param = {
carId: globalThis.carInfo?.carId,
@ -320,6 +313,8 @@ struct Index {
centerHost: globalThis.timeInfo.url,
singlePlay: globalThis.singlePlay
}
console.log('globalThis.timeInfo',JSON.stringify(globalThis.timeInfo),'globalThis.carInfo',JSON.stringify(globalThis.carInfo))
this.loading = true
workerInstance.postMessage(param);
workerInstance.onmessage = (e: MessageEvents): void => {
console.log("baoyihu after postMessage :", JSON.stringify(e.data));
@ -337,7 +332,7 @@ struct Index {
async heartMsg() {
const arr = [globalThis.signNum || 0, globalThis.statue || 1]
let tmpList = [];
let tmpList = [];d
tmpList.push(string2Bytes(arr[0], 1 * 8)[0])
tmpList.push(string2Bytes(arr[1], 1 * 8)[0])
const str = globalThis.lsh || '0000000000000'

View File

@ -59,6 +59,7 @@ struct Index {
.linearGradient({
angle: 0,
colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
}).onChange((value: string) => {
this.inputTextList1[index]=value

View File

@ -23,6 +23,8 @@ struct Index {
}
@State isAutoPlay: boolean = true
@State showFlag: boolean = false
@State videoStartFlag: boolean = false
@State takePhotoFlag: boolean = false
@State showControls: boolean = false
@State @Watch('outClick') outFlag: boolean = false;
@State oldParam: VideoConfig = VideoConfigData
@ -88,14 +90,19 @@ struct Index {
})
return
}
if(this.videoStartFlag){
return
}
if (this.rocordHandleObj.rocord_handle1 || this.rocordHandleObj.rocord_handle2 || this.rocordHandleObj.rocord_handle3 || this.rocordHandleObj.rocord_handle4) {
return
}
this.videoStartFlag=true
for (let i = 1; i <= 4; i++) {
if (this.param['videoRecord'+i]) {
this.getfilehandleCode(i)
await this.getfilehandleCode(i)
}
}
this.videoStartFlag=false
promptAction.showToast({
message: '录像开始',
duration: 3000
@ -131,12 +138,17 @@ struct Index {
})
return
}
if(this.takePhotoFlag){
return
}
this.takePhotoFlag=true
try {
await takePhoto(this.param, this.context, 'pz/')
promptAction.showToast({
message: '抓图完成',
duration: 3000
})
this.takePhotoFlag=false
// }).catch((err) => {
// console.log('daihai err: ' + err)
// })
@ -563,8 +575,12 @@ struct Index {
}
async getfilehandleCode(td) {
const record_handle = await startRecordVideo(this.param, td, this.context, 'lp')
this.rocordHandleObj['rocord_handle'+td] = record_handle
return new Promise(async (reslove,reject)=>{
const record_handle = await startRecordVideo(this.param, td, this.context, 'lp')
this.rocordHandleObj['rocord_handle'+td] = record_handle
reslove(true)
})
}
outClick() {