Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
surenjun 2024-08-21 08:59:13 +08:00
commit 5dda1b57d3
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%') Image($r('app.media.btn_back')).width('14.4%').height('12.2%')
.onClick(() => { .onClick(() => {
this.dialogVisiable = true 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) { if (this.loading) {
return return
} }
this.loading = true
setTimeout(() => { setTimeout(() => {
this.angle = 360 this.angle = 360
}, 1000) }, 1000)
this.angle = 0 this.angle = 0
if (!globalThis.timeInfo) { if (!globalThis.timeInfo) {
globalThis.type='1'
AppStorage.SetOrCreate('errorMsg', 1);
globalThis.title='时间同步接口连接失败'
promptAction.showToast({ promptAction.showToast({
message: `时间同步接口连接失败`, message: `时间同步接口连接失败`,
duration: 3000 duration: 3000
@ -138,6 +117,17 @@ struct Index {
this.loading = false this.loading = false
return return
} }
if (!globalThis.carInfo) {
promptAction.showToast({
message: `车辆信息接口获取失败`,
duration: 3000
});
globalThis.type='1'
AppStorage.SetOrCreate('errorMsg', 1);
globalThis.title='车辆信息接口获取失败'
this.loading = false
return
}
this.testXMLToJSONInWorker() this.testXMLToJSONInWorker()
@ -307,6 +297,9 @@ struct Index {
} }
async testXMLToJSONInWorker() { async testXMLToJSONInWorker() {
if (this.loading) {
return
}
let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts'); let workerInstance = new worker.ThreadWorker('entry/ets/workers/worker.ts');
const param = { const param = {
carId: globalThis.carInfo?.carId, carId: globalThis.carInfo?.carId,
@ -320,6 +313,8 @@ struct Index {
centerHost: globalThis.timeInfo.url, centerHost: globalThis.timeInfo.url,
singlePlay: globalThis.singlePlay singlePlay: globalThis.singlePlay
} }
console.log('globalThis.timeInfo',JSON.stringify(globalThis.timeInfo),'globalThis.carInfo',JSON.stringify(globalThis.carInfo))
this.loading = true
workerInstance.postMessage(param); workerInstance.postMessage(param);
workerInstance.onmessage = (e: MessageEvents): void => { workerInstance.onmessage = (e: MessageEvents): void => {
console.log("baoyihu after postMessage :", JSON.stringify(e.data)); console.log("baoyihu after postMessage :", JSON.stringify(e.data));
@ -337,7 +332,7 @@ struct Index {
async heartMsg() { async heartMsg() {
const arr = [globalThis.signNum || 0, globalThis.statue || 1] 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[0], 1 * 8)[0])
tmpList.push(string2Bytes(arr[1], 1 * 8)[0]) tmpList.push(string2Bytes(arr[1], 1 * 8)[0])
const str = globalThis.lsh || '0000000000000' const str = globalThis.lsh || '0000000000000'

View File

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

View File

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