From c3c5c2063ce6d46376ba0ba09adfc48ac198a212 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Wed, 29 May 2024 12:59:48 +0800 Subject: [PATCH] =?UTF-8?q?ui=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/common/service/videoService.ts | 80 ++--- entry/src/main/ets/pages/CarCheck.ets | 162 ++++----- entry/src/main/ets/pages/ExaminerLogin.ets | 14 +- entry/src/main/ets/pages/Index.ets | 29 +- entry/src/main/ets/pages/RealTime.ets | 3 +- entry/src/main/ets/pages/Settings.ets | 10 +- entry/src/main/ets/pages/TerminalInfos.ets | 4 +- entry/src/main/ets/pages/UserInfo.ets | 80 ++--- entry/src/main/ets/pages/VideoConfig.ets | 334 +++++++++--------- .../ets/pages/compontents/judge/real-time.ets | 8 +- .../src/main/ets/pages/judgeSDK/api/index.ts | 4 +- entry/src/main/ets/pages/register.ets | 28 +- 12 files changed, 379 insertions(+), 377 deletions(-) diff --git a/entry/src/main/ets/common/service/videoService.ts b/entry/src/main/ets/common/service/videoService.ts index 0ecf4faa..b35f6b73 100644 --- a/entry/src/main/ets/common/service/videoService.ts +++ b/entry/src/main/ets/common/service/videoService.ts @@ -6,8 +6,8 @@ import fs from '@ohos.file.fs' import photoAccessHelper from '@ohos.file.photoAccessHelper' import dataSharePredicates from '@ohos.data.dataSharePredicates' import { getCurrentTime } from '../utils/tools' -// import rtsp_server from '@ohos.rtsprecord'; -import record from '@ohos.rtsprecord'; +import rtsp_server from '@ohos.rtsprecord'; +// import record from '@ohos.rtsprecord'; import { FileHelper } from './FileHelper'; // const rtsp_server = record.createServer(); @@ -28,7 +28,7 @@ photoAccessHelper.PhotoKeys.TITLE, photoAccessHelper.PhotoKeys.POSITION, photoAccessHelper.PhotoKeys.DATE_TRASHED, photoAccessHelper.PhotoKeys.HIDDEN]; -const rtsp_server = record.createServer(); +// const rtsp_server = record.createServer(); export async function startRecordVideo(param, td, context, dir) { return new Promise((reslove, reject) => { @@ -92,43 +92,43 @@ interface takePhotoParam { */ const fileHelper = new FileHelper(); export async function takePhoto(param, context,dir,flag=1,callback?) { - - var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`; - // var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`; - - const num = Math.floor(Math.random() * 10000) - const fileName = `picture_record${num}.jpg` - - - console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName:` + fileName); - // @ts-ignore - // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir); - if(flag==0){ - rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{ - console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize); - callback({fileSize:snapResult.fileSize }) - }); - // rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{ - // console.log(`baoyihu getVideoSnapshot return `); - // console.log(`baoyihu getVideoSnapshot file_name:` + snapResult.fileName); - // console.log(`baoyihu getVideoSnapshot file_path:` + snapResult.filePath); - // console.log(`baoyihu getVideoSnapshot fileSize:` + snapResult.fileSize); - // fileHelper.addFile(fileName,1) - // callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize }) - // console.log('getmyLog01') - // }); - } - else{ - return new Promise((resolve,reject)=>{ - rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ - console.log('getPhtot') - resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize }) - }); - }) - console.log('getmyLog02') - - } - console.log('getmyLog03') + // + // var video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`; + // // var video_uri = `rtsp://admin:openharmony1@192.168.1.66:554/Streaming/Channels/3`; + // + // const num = Math.floor(Math.random() * 10000) + // const fileName = `picture_record${num}.jpg` + // + // + // console.log(`baoyihu Rtsprecord baohaowen getVideoSnapshot fileName:` + fileName); + // // @ts-ignore + // // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir); + // if(flag==0){ + // rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{ + // console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize); + // callback({fileSize:snapResult.fileSize }) + // }); + // // rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,false,(err,snapResult)=>{ + // // console.log(`baoyihu getVideoSnapshot return `); + // // console.log(`baoyihu getVideoSnapshot file_name:` + snapResult.fileName); + // // console.log(`baoyihu getVideoSnapshot file_path:` + snapResult.filePath); + // // console.log(`baoyihu getVideoSnapshot fileSize:` + snapResult.fileSize); + // // fileHelper.addFile(fileName,1) + // // callback({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize }) + // // console.log('getmyLog01') + // // }); + // } + // else{ + // return new Promise((resolve,reject)=>{ + // rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ + // console.log('getPhtot') + // resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize }) + // }); + // }) + // console.log('getmyLog02') + // + // } + // console.log('getmyLog03') } diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 8a8f551b..0cbc168d 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -567,44 +567,44 @@ struct Index { build() { Column() { - TopLogo({ outFlag: $outFlag }).margin({ bottom: 25.5 * this.ratio }) + TopLogo({ outFlag: $outFlag }).margin({ bottom: 25.5 * globalThis.ratio }) Flex({ justifyContent: FlexAlign.SpaceBetween }) { Column() { Row() { Image(this.passArray[0] ? (this.warnFlag[0] == '0' ? $r('app.media.cheliangmoxing') : (this.warnFlag[0] == '1' ? $r('app.media.cheliangmoxing_r') : $r('app.media.cheliangmoxing_g'))) : $r('app.media.cheliangmoxing')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[1] ? (this.warnFlag[1] == '0' ? $r('app.media.weixingxinhao') : (this.warnFlag[1] == '1' ? $r('app.media.weixingxinhao_r') : $r('app.media.weixingxinhao_g'))) : $r('app.media.weixingxinhao')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[2] ? (this.warnFlag[2] == '0' ? $r('app.media.shipinjiankong') : (this.warnFlag[2] == '1' ? $r('app.media.shipingjiankong_r') : $r('app.media.shipinjiankong_g'))) : $r('app.media.shipinjiankong')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[3] ? (this.warnFlag[3] == '0' ? $r('app.media.anquandai') : (this.warnFlag[3] == '1' ? $r('app.media.anquandai_r') : $r('app.media.anquandai_g'))) : $r('app.media.anquandai')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[4] ? (this.warnFlag[4] == '0' ? $r('app.media.liheqi') : (this.warnFlag[4] == '1' ? $r('app.media.liheqi_r') : $r('app.media.leheqi_g'))) : $r('app.media.liheqi')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) } Row() { Image(this.passArray[5] ? (this.warnFlag[5] == '0' ? $r('app.media.shousha') : (this.warnFlag[5] == '1' ? $r('app.media.shousha_r') : $r('app.media.shousha_g'))) : $r('app.media.shousha')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[6] ? (this.warnFlag[6] == '0' ? $r('app.media.jiaosha') : (this.warnFlag[6] == '1' ? $r('app.media.jiaosha_r') : $r('app.media.jiaosha_g'))) : $r('app.media.jiaosha')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[7] ? (this.warnFlag[7] == '0' ? $r('app.media.chemen') : (this.warnFlag[7] == '1' ? $r('app.media.chemen_r') : $r('app.media.chemeen_g'))) : $r('app.media.chemen')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[8] ? (this.warnFlag[8] == '0' ? $r('app.media.fusha') : (this.warnFlag[8] == '1' ? $r('app.media.fusha_r') : $r('app.media.fusha_g'))) : $r('app.media.fusha')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) Image(this.passArray[9] ? (this.warnFlag[9] == '0' ? $r('app.media.dianhuo') : (this.warnFlag[9] == '1' ? $r('app.media.dianhuo_r') : $r('app.media.dianhuo_g'))) : $r('app.media.dianhuo')) - .width(138.5 * this.ratio) - .height(112.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(112.5 * globalThis.ratio) } } @@ -612,9 +612,9 @@ struct Index { if (this.breakFlag) { Column() { Image($r('app.media.open_loading')) - .width(100 * this.ratio) + .width(100 * globalThis.ratio) .rotate({ angle: this.angle }) - .height(100 * this.ratio) + .height(100 * globalThis.ratio) .animation({ duration: 5000, // 动画时长 curve: Curve.EaseOut, // 动画曲线 @@ -622,7 +622,7 @@ struct Index { iterations: -1, // 播放次数 playMode: PlayMode.Normal, // 动画模式 }) - Text('等待检测…').fontSize(24 * this.ratio).fontColor('#FFB133').margin({ top: 35 * this.ratio }) + Text('等待检测…').fontSize(24 * globalThis.ratio).fontColor('#FFB133').margin({ top: 35 * globalThis.ratio }) }.align(Alignment.Center).flexGrow(1) } @@ -634,99 +634,99 @@ struct Index { Column() { Row() { Image(this.warnFlag[10] == '1' ? $r('app.media.zq_r') : this.warnFlag[10] == '2' ? $r('app.media.zq') : '') - .width(102 * this.ratio) - .height(118.5 * this.ratio) + .width(102 * globalThis.ratio) + .height(118.5 * globalThis.ratio) .visibility(this.passArray[10] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[11] == '1' ? $r('app.media.yq_r') : this.warnFlag[11] == '2' ? $r('app.media.yq') : '') - .width(102 * this.ratio) - .height(118.5 * this.ratio) + .width(102 * globalThis.ratio) + .height(118.5 * globalThis.ratio) .visibility(this.passArray[11] ? Visibility.Visible : Visibility.Hidden) } Row() { Image(this.warnFlag[12] == '1' ? $r('app.media.zh_r') : this.warnFlag[12] == '2' ? $r('app.media.zh') : '') - .width(103 * this.ratio) - .height(118.5 * this.ratio) + .width(103 * globalThis.ratio) + .height(118.5 * globalThis.ratio) .visibility(this.passArray[12] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[13] == '1' ? $r('app.media.yh_r') : this.warnFlag[13] == '2' ? $r('app.media.yh') : '') - .width(103 * this.ratio) - .height(118.5 * this.ratio) + .width(103 * globalThis.ratio) + .height(118.5 * globalThis.ratio) .visibility(this.passArray[13] ? Visibility.Visible : Visibility.Hidden) } } .backgroundImage($r('app.media.rc')) .backgroundImageSize({ width: '100%', height: '100%' }) - .width(206 * this.ratio) - .height(235.5 * this.ratio) + .width(206 * globalThis.ratio) + .height(235.5 * globalThis.ratio) //档位 Column() { Image(this.warnFlag[14] == '1' ? $r('app.media.1_r') : this.warnFlag[14] == '2' ? $r('app.media.1') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 25 * this.ratio, y: 57 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 25 * globalThis.ratio, y: 57 * globalThis.ratio }) .visibility(this.passArray[14] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[16] == '1' ? $r('app.media.3_r') : this.warnFlag[16] == '2' ? $r('app.media.3') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 82.5 * this.ratio, y: 57 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 82.5 * globalThis.ratio, y: 57 * globalThis.ratio }) .visibility(this.passArray[16] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[18] == '1' ? $r('app.media.5_r') : this.warnFlag[18] == '2' ? $r('app.media.5') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 139.5 * this.ratio, y: 57 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 139.5 * globalThis.ratio, y: 57 * globalThis.ratio }) .visibility(this.passArray[18] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[15] == '1' ? $r('app.media.2_r') : this.warnFlag[15] == '2' ? $r('app.media.2') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 25 * this.ratio, y: 173.5 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 25 * globalThis.ratio, y: 173.5 * globalThis.ratio }) .visibility(this.passArray[15] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[17] == '1' ? $r('app.media.4_r') : this.warnFlag[17] == '2' ? $r('app.media.4') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 82.5 * this.ratio, y: 173.5 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 82.5 * globalThis.ratio, y: 173.5 * globalThis.ratio }) .visibility(this.passArray[17] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[19] == '1' ? $r('app.media.R_r') : this.warnFlag[19] == '2' ? $r('app.media.R') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 139.5 * this.ratio, y: 173.5 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 139.5 * globalThis.ratio, y: 173.5 * globalThis.ratio }) .visibility(this.passArray[19] ? Visibility.Visible : Visibility.Hidden) Image(this.warnFlag[20] == '1' ? $r('app.media.N_r') : this.warnFlag[20] == '2' ? $r('app.media.N') : '') - .width(44.5 * this.ratio) - .height(44.5 * this.ratio) - .position({ x: 82.5 * this.ratio, y: 115.5 * this.ratio }) + .width(44.5 * globalThis.ratio) + .height(44.5 * globalThis.ratio) + .position({ x: 82.5 * globalThis.ratio, y: 115.5 * globalThis.ratio }) .visibility(this.passArray[20] ? Visibility.Visible : Visibility.Hidden) } .backgroundImage($r('app.media.dw')) .backgroundImageSize({ width: '100%', height: '100%' }) - .width(206 * this.ratio) - .height(235.5 * this.ratio) + .width(206 * globalThis.ratio) + .height(235.5 * globalThis.ratio) Column() { Row() { Image(this.passArray[21] ? (this.warnFlag[21] == '0' ? $r('app.media.zuo') : (this.warnFlag[21] == '1' ? $r('app.media.zuo_r') : $r('app.media.zuo_g'))) : $r('app.media.zuo')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) Image(this.passArray[22] ? (this.warnFlag[22] == '0' ? $r('app.media.you') : (this.warnFlag[22] == '1' ? $r('app.media.you_r') : $r('app.media.you_g'))) : $r('app.media.you')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) } Row() { Image(this.passArray[23] ? (this.warnFlag[23] == '0' ? $r('app.media.zuo1') : (this.warnFlag[23] == '1' ? $r('app.media.yuanguangdeng_r') : $r('app.media.yuanguangdeng_g'))) : $r('app.media.zuo1')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) Image(this.passArray[24] ? (this.warnFlag[24] == '0' ? $r('app.media.jinguangdeng') : (this.warnFlag[24] == '1' ? $r('app.media.jinguangdeng_r') : $r('app.media.jinguangdeng_g'))) : $r('app.media.jinguangdeng')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) } Row() { Image(this.passArray[25] ? (this.warnFlag[25] == '0' ? $r('app.media.guzhang') : (this.warnFlag[25] == '1' ? $r('app.media.guzhang_r') : $r('app.media.guzhang_g'))) : $r('app.media.guzhang')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) Image(this.passArray[26] ? (this.warnFlag[26] == '0' ? $r('app.media.jinzhi') : (this.warnFlag[26] == '1' ? $r('app.media.jinzhi_r') : $r('app.media.jinzhi_g'))) : $r('app.media.jinzhi')) - .width(138.5 * this.ratio) - .height(81.5 * this.ratio) + .width(138.5 * globalThis.ratio) + .height(81.5 * globalThis.ratio) } } } @@ -736,20 +736,20 @@ struct Index { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { } - .width(215 * this.ratio) - .height(64 * this.ratio) - .margin({ bottom: 10 * this.ratio }) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { }) .zIndex(11) } else { Image($r('app.media.xhxs_btn')) - .width(215 * this.ratio) - .height(64 * this.ratio) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 10 * this.ratio }) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { console.log('xhsx') this.xhxs() @@ -758,21 +758,21 @@ struct Index { } Image($r('app.media.tczj_btn')) - .width(215 * this.ratio) - .height(64 * this.ratio) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 10 * this.ratio }) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { this.stopCheck() }) .zIndex(11) Image($r('app.media.kszj_btn')) - .width(215 * this.ratio) - .height(64 * this.ratio) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) .backgroundImage($r('app.media.anniu_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 10 * this.ratio }) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { this.kszj() this.getPLCInfo() diff --git a/entry/src/main/ets/pages/ExaminerLogin.ets b/entry/src/main/ets/pages/ExaminerLogin.ets index ff6de14f..d1b067d5 100644 --- a/entry/src/main/ets/pages/ExaminerLogin.ets +++ b/entry/src/main/ets/pages/ExaminerLogin.ets @@ -19,14 +19,14 @@ struct Index { Column() { TopLogo({outFlag:$outFlag}) Column() { - Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36*this.ratio) + Text('请考官输入用户名密码').fontColor('#FFAD33').fontSize(36*globalThis.ratio) Row() { ForEach(this.inputPlaceholderArr, (item:any, index:number) => { Row(){ TextInput({ placeholder: `${item}`,text: this.inputTextArr[index] }) - .fontSize(42*this.ratio) + .fontSize(42*globalThis.ratio) .fontColor('white') - .placeholderFont({ size: 42*this.ratio }) + .placeholderFont({ size: 42*globalThis.ratio }) .placeholderColor('gray') .caretColor('white') .backgroundColor('transparent') @@ -45,7 +45,7 @@ struct Index { }) } .width('90%') - .margin({top: 25*this.ratio}) //20 + .margin({top: 25*globalThis.ratio}) //20 .justifyContent(FlexAlign.SpaceBetween) Column() { Flex({wrap: FlexWrap.Wrap, @@ -110,13 +110,13 @@ struct Index { } .height('100%') } - .margin({top: 20*this.ratio}) + .margin({top: 20*globalThis.ratio}) .width('90%') .height('62.7%') .backgroundColor('#E5E3DF') - .borderRadius(20*this.ratio) + .borderRadius(20*globalThis.ratio) } - .margin({top: -10*this.ratio}) + .margin({top: -10*globalThis.ratio}) .justifyContent(FlexAlign.SpaceAround) } .width('100%') diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 8ef45bf7..bc7efe06 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -155,12 +155,12 @@ struct Index { Column() { Text('V ' + globalThis.version) .fontColor('#CCAE7A') - .fontSize(22 * this.ratio) + .fontSize(22 * globalThis.ratio) .width('30%') .margin({ bottom: 10 }) Text('授权信息:' + (this.hasAuth ? '已授权' : '未授权')) .fontColor('#CCAE7A') - .fontSize(22 * this.ratio) + .fontSize(22 * globalThis.ratio) .width('30%') } .margin({ left: 24 }) @@ -176,7 +176,7 @@ struct Index { ) ) - Text('考车号:' + globalThis.deviceNo).fontColor('#CCAE7A').fontSize(22 * this.ratio).margin({ right: 24 }) + Text('考车号:' + globalThis.deviceNo).fontColor('#CCAE7A').fontSize(22 * globalThis.ratio).margin({ right: 24 }) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) @@ -186,9 +186,9 @@ struct Index { if (this.loading) { Column() { Image($r('app.media.open_loading')) - .width(200 * this.ratio) + .width(200 * globalThis.ratio) .rotate({ angle: this.angle }) - .height(200 * this.ratio) + .height(200 * globalThis.ratio) .animation({ duration: 5000, // 动画时长 curve: Curve.EaseOut, // 动画曲线 @@ -196,18 +196,18 @@ struct Index { iterations: -1, // 播放次数 playMode: PlayMode.Normal, // 动画模式 }) - .margin({ top: 30 * this.ratio }) + .margin({ top: 30 * globalThis.ratio }) Image($r('app.media.car')) - .width(80 * this.ratio) - .height(80 * this.ratio) - .position({ x: 288 * this.ratio, y: 89 * this.ratio }) - Text('获取考车信息,请稍候……').fontSize(24 * this.ratio).margin({ top: 20 * this.ratio }).fontWeight(400) + .width(80 * globalThis.ratio) + .height(80 * globalThis.ratio) + .position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio }) + Text('获取考车信息,请稍候……').fontSize(24 * globalThis.ratio).margin({ top: 20 * globalThis.ratio }).fontWeight(400) } - .width(660 * this.ratio) - .height(360 * this.ratio) - .position({ x: 150 * this.ratio, y: 98 * this.ratio }) + .width(660 * globalThis.ratio) + .height(360 * globalThis.ratio) + .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) .backgroundColor('#E6E3DF') - .borderRadius(19 * this.ratio) + .borderRadius(19 * globalThis.ratio) } } .width('100%') @@ -219,6 +219,7 @@ struct Index { } aboutToAppear() { + globalThis.ratio=0.7 this.angle = 0 this.loading = false } diff --git a/entry/src/main/ets/pages/RealTime.ets b/entry/src/main/ets/pages/RealTime.ets index 33eb061a..caf2579a 100644 --- a/entry/src/main/ets/pages/RealTime.ets +++ b/entry/src/main/ets/pages/RealTime.ets @@ -1,5 +1,6 @@ import hilog from '@ohos.hilog'; -import apiJudgeSdk from 'libJudgeSdk.so'; +// @ts-ignore +import apiJudgeSdk from '@ohos.judgesdk'; import Judge from './judgeSDK/utils/judge-real' import {Project,ProjectObj,MarkRule} from './judgeSDK/api/judgeSDK.d' import AccountTable from '../common/database/tables/AccountTable'; diff --git a/entry/src/main/ets/pages/Settings.ets b/entry/src/main/ets/pages/Settings.ets index 01ce4a16..b4d78763 100644 --- a/entry/src/main/ets/pages/Settings.ets +++ b/entry/src/main/ets/pages/Settings.ets @@ -42,15 +42,15 @@ struct Index { Column() { Row() { Column() { - Text('V ' + this.version).fontColor('#CCAE7A').fontSize(22*this.ratio).width('30%').margin({bottom:10*this.ratio}) - Text('授权信息:' + (this.hasAuth?'已授权':'未授权')).fontColor('#CCAE7A').fontSize(22*this.ratio).width('30%') + Text('V ' + this.version).fontColor('#CCAE7A').fontSize(22*globalThis.ratio).width('30%').margin({bottom:10*globalThis.ratio}) + Text('授权信息:' + (this.hasAuth?'已授权':'未授权')).fontColor('#CCAE7A').fontSize(22*globalThis.ratio).width('30%') } - .margin({left: 24*this.ratio}) - Text('考车号:' + globalThis.deviceNo).fontColor('#CCAE7A').fontSize(22*this.ratio).margin({right: 24*this.ratio}) + .margin({left: 24*globalThis.ratio}) + Text('考车号:' + globalThis.deviceNo).fontColor('#CCAE7A').fontSize(22*globalThis.ratio).margin({right: 24*globalThis.ratio}) } .width('100%') .justifyContent(FlexAlign.SpaceBetween) - .margin({bottom: 10*this.ratio}) + .margin({bottom: 10*globalThis.ratio}) } } .width('100%') diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index eff4ba59..43fa99b3 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -45,7 +45,7 @@ struct Index { .height('100%') .fontColor('#E5CBA1') .padding({'left': '35px'}) - .fontSize(this.inputFontSize*this.ratio) + .fontSize(this.inputFontSize*globalThis.ratio) TextInput({'text':this.inputTextList1[index]?this.inputTextList1[index]: ''}) .width('50%') .height('60%') @@ -53,7 +53,7 @@ struct Index { .borderColor('#E6E0D8') .borderRadius('10px') .borderWidth('2px') - .fontSize(this.inputFontSize*this.ratio) + .fontSize(this.inputFontSize*globalThis.ratio) .padding({top:0,bottom:0}) .linearGradient({ angle: 0, diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 49e267fd..8271a4de 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -529,11 +529,11 @@ struct UserInfo { // 几个按钮公共样式 @Styles commStyle(){ - .width(220 * this.ratio) - .height(69 * this.ratio) + .width(220 * globalThis.ratio) + .height(69 * globalThis.ratio) .backgroundImage($r('app.media.button_nor')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ bottom: 12 * this.ratio }) + .margin({ bottom: 12 * globalThis.ratio }) } private labelBlocks = [ @@ -554,38 +554,38 @@ struct UserInfo { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Column() { CommText({ - ratio: this.ratio, + ratio: globalThis.ratio, color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', text: item.lsh }) CommText({ - ratio: this.ratio, + ratio: globalThis.ratio, color: item.sfzmhm != this.currentUser.sfzmhm ? '#FFFFFF' : '#000000', text: decodeURIComponent(item.xm) }) } } - .width(165 * this.ratio) - .height(85 * this.ratio) + .width(165 * globalThis.ratio) + .height(85 * globalThis.ratio) .backgroundImage(item.sfzmhm != this.currentUser.sfzmhm ? $r('app.media.userbox2') : $r('app.media.userboxbg')) .backgroundImageSize({ width: '100%', height: '100%' }) .onClick(() => { this.currentUser = item }) }) - }.width(640 * this.ratio).margin({ left: 30 * this.ratio }) + }.width(640 * globalThis.ratio).margin({ left: 30 * globalThis.ratio }) Image($r('app.media.dk_prev')) - .width(90 * this.ratio) - .height(70 * this.ratio) - .margin({ left: 65 * this.ratio, right: 10 * this.ratio }) + .width(90 * globalThis.ratio) + .height(70 * globalThis.ratio) + .margin({ left: 65 * globalThis.ratio, right: 10 * globalThis.ratio }) .onClick(() => { this.prevClick() }) - Image($r('app.media.dk_next')).width(90 * this.ratio).height(70 * this.ratio).onClick(() => { + Image($r('app.media.dk_next')).width(90 * globalThis.ratio).height(70 * globalThis.ratio).onClick(() => { this.nextClick() }) - }.margin({ top: 40 * this.ratio, bottom: 10 * this.ratio }) + }.margin({ top: 40 * globalThis.ratio, bottom: 10 * globalThis.ratio }) Flex({ justifyContent: FlexAlign.SpaceBetween }) { Row() { @@ -593,24 +593,24 @@ struct UserInfo { if (this.currentUser['kszp']) { Avatar({ - ratio: this.ratio, + ratio: globalThis.ratio, url: this.currentUser['kszp'] ? this.currentUser['kszp'] : '' }) } else { Avatar({ - ratio: this.ratio, + ratio: globalThis.ratio, url: "" }) } if (this.currentUser['ksmjzp']) { Avatar({ - ratio: this.ratio, + ratio: globalThis.ratio, url: this.currentUser['ksmjzp'] ? this.currentUser['ksmjzp'] : '' }) } else { Avatar({ - ratio: this.ratio, + ratio: globalThis.ratio, url: "" }) } @@ -618,15 +618,15 @@ struct UserInfo { Column() { ForEach(this.labelBlocks, (item) => { - LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] }) + LabelBlock({ label: item.label, ratio: globalThis.ratio, value: this.currentUser[item.key] }) }) } } - .width(664 * this.ratio) - .height(339 * this.ratio) + .width(664 * globalThis.ratio) + .height(339 * globalThis.ratio) .backgroundImage($r('app.media.dkbg')) .backgroundImageSize({ width: '100%', height: '100%' }) - .margin({ left: 53 * this.ratio }) + .margin({ left: 53 * globalThis.ratio }) Column() { Image($r('app.media.yydj_btn')) @@ -706,11 +706,11 @@ struct UserInfo { if (this.qkFlag) { Column() { Text('确认考生:' + this.currentUser.xm + '是否缺考') - .fontSize(28 * this.ratio) - .position({ x: 160 * this.ratio, y: 122 * this.ratio }) + .fontSize(28 * globalThis.ratio) + .position({ x: 160 * globalThis.ratio, y: 122 * globalThis.ratio }) Row() { Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Text(' 取 消 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) + Text(' 取 消 ').fontSize(24 * globalThis.ratio).fontColor('#fff').width(100 * globalThis.ratio) } .commStyle() .onClick(() => { @@ -718,20 +718,20 @@ struct UserInfo { }) Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { - Text(' 确 定 ').fontSize(24 * this.ratio).fontColor('#fff').width(100 * this.ratio) + Text(' 确 定 ').fontSize(24 * globalThis.ratio).fontColor('#fff').width(100 * globalThis.ratio) } .commStyle() .onClick(() => { this.qkFn() }) - }.position({ y: 265 * this.ratio, x: 115 * this.ratio }) + }.position({ y: 265 * globalThis.ratio, x: 115 * globalThis.ratio }) } - .width(660 * this.ratio) - .height(360 * this.ratio) - .position({ x: 150 * this.ratio, y: 98 * this.ratio }) + .width(660 * globalThis.ratio) + .height(360 * globalThis.ratio) + .position({ x: 150 * globalThis.ratio, y: 98 * globalThis.ratio }) .backgroundColor('#E6E3DF') - .borderRadius(19 * this.ratio) + .borderRadius(19 * globalThis.ratio) } } .height('100%') @@ -750,9 +750,9 @@ struct Avatar { build() { Row() { Image(this.url) - .width(93 * this.ratio) - .height(130.5 * this.ratio) - .margin({ bottom: 10 * this.ratio, right: 58 * this.ratio, left: 55 * this.ratio }) + .width(93 * globalThis.ratio) + .height(130.5 * globalThis.ratio) + .margin({ bottom: 10 * globalThis.ratio, right: 58 * globalThis.ratio, left: 55 * globalThis.ratio }) .backgroundColor('orange') .border({ color: '#fff', width: 1, style: BorderStyle.Solid }) } @@ -768,8 +768,8 @@ struct CommText { build() { Text(this.text) - .fontSize(16 * this.ratio) - .lineHeight(30 * this.ratio) + .fontSize(16 * globalThis.ratio) + .lineHeight(30 * globalThis.ratio) .fontWeight(500) .fontColor(this.color) } @@ -784,21 +784,21 @@ struct LabelBlock { @Styles commLabelStyle(){ - .width(280 * this.ratio) - .height(35 * this.ratio) + .width(280 * globalThis.ratio) + .height(35 * globalThis.ratio) .backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImage($r('app.media.userbox')) - .margin({ left: 8 * this.ratio }) + .margin({ left: 8 * globalThis.ratio }) .align(Alignment.Center) } build() { Row() { - Text(this.label).fontSize(16 * this.ratio).fontColor('#99948A') + Text(this.label).fontSize(16 * globalThis.ratio).fontColor('#99948A') Row() { Text(this.value).fontColor('#fff').textAlign(TextAlign.Center).width('100%') } .commLabelStyle() - }.margin({ bottom: 10 * this.ratio }) + }.margin({ bottom: 10 * globalThis.ratio }) } } \ No newline at end of file diff --git a/entry/src/main/ets/pages/VideoConfig.ets b/entry/src/main/ets/pages/VideoConfig.ets index d9faab67..64824184 100644 --- a/entry/src/main/ets/pages/VideoConfig.ets +++ b/entry/src/main/ets/pages/VideoConfig.ets @@ -121,27 +121,27 @@ struct Index { currentProgressRate: this.curRate, controller: item.controller }) - .width(200 * this.ratio) + .width(200 * globalThis.ratio) .muted(true) - .height(180 * this.ratio) + .height(180 * globalThis.ratio) .autoPlay(this.isAutoPlay) .controls(this.showControls) - .margin(10 * this.ratio) + .margin(10 * globalThis.ratio) }) - }.margin({ top: 37 * this.ratio, left: 30 * this.ratio }).width(600*this.ratio).height(600*this.ratio) + }.margin({ top: 37 * globalThis.ratio, left: 30 * globalThis.ratio }).width(600*globalThis.ratio).height(600*globalThis.ratio) Column() { Image($r('app.media.shezhi')) - .width(215 * this.ratio) - .height(64 * this.ratio) - .margin({ bottom: 10 * this.ratio }) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { this.showFlag = true }) Image($r('app.media.luxiang')) - .width(215 * this.ratio) - .height(64 * this.ratio) - .margin({ bottom: 10 * this.ratio }) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(async () => { if (!this.param.videoRecord4 && !this.param.videoRecord3 && !this.param.videoRecord2 && !this.param.videoRecord1) { promptAction.showToast({ @@ -164,10 +164,10 @@ struct Index { }) }) Image($r('app.media.tingzhi')) - .width(215 * this.ratio) - .height(64 * this.ratio) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) - .margin({ bottom: 10 * this.ratio }) + .margin({ bottom: 10 * globalThis.ratio }) .onClick(() => { for (let i = 1; i <= 4; i++) { console.log('rocord_handle',i,JSON.stringify(this.rocordHandleObj)) @@ -183,8 +183,8 @@ struct Index { }) }) Image($r('app.media.zhuatu')) - .width(215 * this.ratio) - .height(64 * this.ratio) + .width(215 * globalThis.ratio) + .height(64 * globalThis.ratio) .onClick(async () => { const arr=['1','2','3','4'] if(!arr.includes(this.param.pztd)){ @@ -209,18 +209,18 @@ struct Index { } }) - .margin({ bottom: 10 * this.ratio }) - }.margin({ right: 38 * this.ratio, top: 110 * this.ratio }) + .margin({ bottom: 10 * globalThis.ratio }) + }.margin({ right: 38 * globalThis.ratio, top: 110 * globalThis.ratio }) }.backgroundColor('#1A1A1A') // Column() { // Text('提示信息:') - // .fontSize(18 * this.ratio) + // .fontSize(18 * globalThis.ratio) // .fontColor('#fff') - // .margin({ left: 29 * this.ratio, top: 13 * this.ratio }) + // .margin({ left: 29 * globalThis.ratio, top: 13 * globalThis.ratio }) // .align(Alignment.Start) // .width('100%') - // }.width('100%').height(70 * this.ratio).backgroundColor('#333230').position({ x: 0, y: 470 * this.ratio }) + // }.width('100%').height(70 * globalThis.ratio).backgroundColor('#333230').position({ x: 0, y: 470 * globalThis.ratio }) if (this.showFlag) { Column() { @@ -228,197 +228,197 @@ struct Index { Text('视频参数设置') .width('100%') .align(Alignment.Start) - .fontSize(24 * this.ratio) + .fontSize(24 * globalThis.ratio) .fontColor('#333333') - .margin({ left: 20 * this.ratio, top: 22 * this.ratio }) + .margin({ left: 20 * globalThis.ratio, top: 22 * globalThis.ratio }) Row() { - Image($r('app.media.fh')).width(117 * this.ratio).height(50 * this.ratio).onClick(() => { + Image($r('app.media.fh')).width(117 * globalThis.ratio).height(50 * globalThis.ratio).onClick(() => { // this.oldParam = JSON.parse(JSON.stringify(this.param)) this.param = JSON.parse(JSON.stringify(this.oldParam)) this.showFlag = false }) Image($r('app.media.bc')) - .width(117 * this.ratio) - .height(50 * this.ratio) - .margin({ left: 15 * this.ratio }) + .width(117 * globalThis.ratio) + .height(50 * globalThis.ratio) + .margin({ left: 15 * globalThis.ratio }) .onClick(() => { console.log('111111') this.writeConfig() }) - }.margin({ right: 135 * this.ratio, top: 10 * this.ratio }) + }.margin({ right: 135 * globalThis.ratio, top: 10 * globalThis.ratio }) } Column() { Row() { - Text('视频路数').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 13 * this.ratio }) + Text('视频路数').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 13 * globalThis.ratio }) TextInput({ text: this.param.videoNum, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(34 * this.ratio) - .height(26 * this.ratio) + .width(34 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ left: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) + .margin({ left: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) .onChange((value) => { this.param.spls = value }) Column() { - Image($r('app.media.shang')).width(15 * this.ratio).height(15 * this.ratio).onClick(() => { + Image($r('app.media.shang')).width(15 * globalThis.ratio).height(15 * globalThis.ratio).onClick(() => { this.param.videoNum = (parseInt(this.param.videoNum) + 1).toString() }) - Image($r('app.media.xia')).width(15 * this.ratio).height(15 * this.ratio).onClick(() => { + Image($r('app.media.xia')).width(15 * globalThis.ratio).height(15 * globalThis.ratio).onClick(() => { this.param.videoNum = (parseInt(this.param.videoNum) - 1).toString() }) - }.margin({ left: 5 * this.ratio, right: 10 * this.ratio }) + }.margin({ left: 5 * globalThis.ratio, right: 10 * globalThis.ratio }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.faceFlag) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.faceFlag = value console.info('Checkbox1 change is' + value) }) - Text('启用过程人脸比对').fontColor('#333333').fontSize(16 * this.ratio) + Text('启用过程人脸比对').fontColor('#333333').fontSize(16 * globalThis.ratio) TextInput({ text: this.param.rlls, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(34 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) - .height(26 * this.ratio) + .width(34 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ left: 10 * this.ratio, right: 15 * this.ratio }) + .margin({ left: 10 * globalThis.ratio, right: 15 * globalThis.ratio }) .onChange((value) => { this.param.rlls = value }) - Text('拍照通道').fontColor('#333333').fontSize(16 * this.ratio) + Text('拍照通道').fontColor('#333333').fontSize(16 * globalThis.ratio) TextInput({ text: this.param.pztd, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) .padding({ top: 0, bottom: 0 }) - .width(34 * this.ratio) - .height(26 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) - .margin({ left: 10 * this.ratio, right: 15 * this.ratio }) + .width(34 * globalThis.ratio) + .height(26 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio, right: 15 * globalThis.ratio }) .onChange((value: string) => { this.param.pztd = value }) - Text('设备类型').fontColor('#333333').fontSize(16 * this.ratio) + Text('设备类型').fontColor('#333333').fontSize(16 * globalThis.ratio) TextInput({ text: '海康', controller: this.inputController }) .borderRadius(0) .padding({ bottom: 0, top: 0 }) - .width(67 * this.ratio) - .height(26 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) - .margin({ left: 10 * this.ratio, right: 15 * this.ratio }) - Text('视频遮挡报警阀值:').fontColor('#333333').fontSize(16 * this.ratio) + .width(67 * globalThis.ratio) + .height(26 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio, right: 15 * globalThis.ratio }) + Text('视频遮挡报警阀值:').fontColor('#333333').fontSize(16 * globalThis.ratio) TextInput({ text: this.param.zdyz, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) .padding({ top: 0, bottom: 0 }) - .width(34 * this.ratio) - .height(26 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) - .margin({ left: 10 * this.ratio, right: 15 * this.ratio }).onChange((value: string) => { + .width(34 * globalThis.ratio) + .height(26 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio, right: 15 * globalThis.ratio }).onChange((value: string) => { this.param.zdyz = value }) - // Text('k').fontColor('#333333').fontSize(16 * this.ratio) - // Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio) + // Text('k').fontColor('#333333').fontSize(16 * globalThis.ratio) + // Text('链接类型').fontColor('#333333').fontSize(16 * globalThis.ratio) // TextInput({ text: this.param.ljlx, controller: this.inputController }) // .type(InputType.Normal) // .borderRadius(0) // .padding({ top: 0, bottom: 0 }) - // .width(34 * this.ratio) - // .height(26 * this.ratio) - // .fontSize(this.inputFontSize * this.ratio) - // .margin({ left: 10 * this.ratio, right: 5 * this.ratio }) + // .width(34 * globalThis.ratio) + // .height(26 * globalThis.ratio) + // .fontSize(this.inputFontSize * globalThis.ratio) + // .margin({ left: 10 * globalThis.ratio, right: 5 * globalThis.ratio }) }.width('100%').align(Alignment.Start).backgroundColor('#E5E3DF') Row() { Column() { Row() { Row() { - }.width(70 * this.ratio) + }.width(70 * globalThis.ratio) Text('IP地址') - .width(158 * this.ratio) - .fontSize(16 * this.ratio) + .width(158 * globalThis.ratio) + .fontSize(16 * globalThis.ratio) .fontColor('#666666') - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .textAlign(TextAlign.Center) Text('通道号') - .width(96 * this.ratio) - .fontSize(16 * this.ratio) + .width(96 * globalThis.ratio) + .fontSize(16 * globalThis.ratio) .fontColor('#666666') - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .textAlign(TextAlign.Center) Text('用户名') - .width(120 * this.ratio) - .fontSize(16 * this.ratio) + .width(120 * globalThis.ratio) + .fontSize(16 * globalThis.ratio) .fontColor('#666666') - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .textAlign(TextAlign.Center) Text('密码') - .width(120 * this.ratio) - .fontSize(16 * this.ratio) + .width(120 * globalThis.ratio) + .fontSize(16 * globalThis.ratio) .fontColor('#666666') - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .textAlign(TextAlign.Center) Text('端口号') - .width(60 * this.ratio) - .fontSize(16 * this.ratio) + .width(60 * globalThis.ratio) + .fontSize(16 * globalThis.ratio) .fontColor('#666666') - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .textAlign(TextAlign.Center) } ForEach(this.lsArr,(item,index)=>{ Row() { Text(item.key) - .width(70 * this.ratio) + .width(70 * globalThis.ratio) .fontColor('#333333') - .fontSize(16 * this.ratio) + .fontSize(16 * globalThis.ratio) .textAlign(TextAlign.Center) TextInput({ text: this.param.ip, controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) - .width(158 * this.ratio) - .height(26 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) + .width(158 * globalThis.ratio) + .height(26 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ right: 10 * this.ratio }) + .margin({ right: 10 * globalThis.ratio }) .onChange((value: string) => { this.param.ip = value }) TextInput({ text: this.param['td'+(Number(index)+1)], controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) - .width(96 * this.ratio) - .height(26 * this.ratio) + .width(96 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ right: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) + .margin({ right: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) .onChange((value: string) => { this.param['td'+(Number(index)+1)] = value }) TextInput({ text: this.param.userName, controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) - .width(120 * this.ratio) - .height(26 * this.ratio) - .margin({ right: 10 * this.ratio }) + .width(120 * globalThis.ratio) + .height(26 * globalThis.ratio) + .margin({ right: 10 * globalThis.ratio }) .padding({ top: 0, bottom: 0 }) - .fontSize(this.inputFontSize * this.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) .onChange((value: string) => { this.param.userName = value }) TextInput({ text: this.param.pwd, controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) - .width(120 * this.ratio) - .height(26 * this.ratio) - .fontSize(this.inputFontSize * this.ratio) - .margin({ right: 10 * this.ratio }) + .width(120 * globalThis.ratio) + .height(26 * globalThis.ratio) + .fontSize(this.inputFontSize * globalThis.ratio) + .margin({ right: 10 * globalThis.ratio }) .padding({ top: 0, bottom: 0 }) .onChange((value: string) => { this.param.pwd = value @@ -426,190 +426,190 @@ struct Index { TextInput({ text: this.param.port, controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) - .width(60 * this.ratio) - .height(26 * this.ratio) + .width(60 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ right: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) + .margin({ right: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) .onChange((value: string) => { this.param.port = value }) - }.margin({ top: 10 * this.ratio }) + }.margin({ top: 10 * globalThis.ratio }) }) - }.width(672 * this.ratio).height(174 * this.ratio).backgroundColor('#EDEBE8') + }.width(672 * globalThis.ratio).height(174 * globalThis.ratio).backgroundColor('#EDEBE8') Column() { Row() { - Text('录像范围').fontSize(16 * this.ratio).fontColor('#333333').margin({ top: 10 * this.ratio }) + Text('录像范围').fontSize(16 * globalThis.ratio).fontColor('#333333').margin({ top: 10 * globalThis.ratio }) Row() { Column() { Row() { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.videoRecord1) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.videoRecord1 = value console.info('Checkbox1 change is' + value) }) - Text('一路').fontSize(16 * this.ratio).fontColor('#333333') + Text('一路').fontSize(16 * globalThis.ratio).fontColor('#333333') Checkbox({ name: 'checkbox2', group: 'checkboxGroup' }) .select(this.param.videoRecord2) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.videoRecord2 = value console.info('Checkbox1 change is' + value) }) - Text('二路').fontSize(16 * this.ratio).fontColor('#333333') + Text('二路').fontSize(16 * globalThis.ratio).fontColor('#333333') } Row() { Checkbox({ name: 'checkbox3', group: 'checkboxGroup' }) .select(this.param.videoRecord3) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.videoRecord3 = value console.info('Checkbox1 change is' + value) }) - Text('三路').fontSize(16 * this.ratio).fontColor('#333333') + Text('三路').fontSize(16 * globalThis.ratio).fontColor('#333333') Checkbox({ name: 'checkbox4', group: 'checkboxGroup' }) .select(this.param.videoRecord4) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.videoRecord4 = value console.info('Checkbox1 change is' + value) }) - Text('四路').fontSize(16 * this.ratio).fontColor('#333333') + Text('四路').fontSize(16 * globalThis.ratio).fontColor('#333333') } } } }.alignItems(VerticalAlign.Top).justifyContent(FlexAlign.Start) Row() { - Text('视频遮挡').fontSize(16 * this.ratio).fontColor('#333333').margin({ top: 10 * this.ratio }) + Text('视频遮挡').fontSize(16 * globalThis.ratio).fontColor('#333333').margin({ top: 10 * globalThis.ratio }) Row() { Column() { Row() { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.spzd1) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.spzd1=value }) - Text('一路').fontSize(16 * this.ratio).fontColor('#333333') + Text('一路').fontSize(16 * globalThis.ratio).fontColor('#333333') Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.spzd2) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.spzd2=value }) - Text('二路').fontSize(16 * this.ratio).fontColor('#333333') + Text('二路').fontSize(16 * globalThis.ratio).fontColor('#333333') } Row() { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.spzd3) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.spzd3=value }) - Text('三路').fontSize(16 * this.ratio).fontColor('#333333') + Text('三路').fontSize(16 * globalThis.ratio).fontColor('#333333') Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.spzd4) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { this.param.spzd4=value }) - Text('四路').fontSize(16 * this.ratio).fontColor('#333333') + Text('四路').fontSize(16 * globalThis.ratio).fontColor('#333333') } } } }.alignItems(VerticalAlign.Top).justifyContent(FlexAlign.Start) - }.width(267 * this.ratio).height(174 * this.ratio).margin({ left: 7 * this.ratio, top: 10 * this.ratio }) + }.width(267 * globalThis.ratio).height(174 * globalThis.ratio).margin({ left: 7 * globalThis.ratio, top: 10 * globalThis.ratio }) }.width('100%') Row() { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.param.shuiying) - .width(22 * this.ratio) - .height(22 * this.ratio) + .width(22 * globalThis.ratio) + .height(22 * globalThis.ratio) .onChange((value: boolean) => { console.info('Checkbox1 change is' + value) }) - Text('照片叠加文字').fontColor('#333333').fontSize(16 * this.ratio) - Text('位置').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 24 * this.ratio }) + Text('照片叠加文字').fontColor('#333333').fontSize(16 * globalThis.ratio) + Text('位置').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 24 * globalThis.ratio }) TextInput({ text: this.param.wz, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(79 * this.ratio) - .height(26 * this.ratio) + .width(79 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .fontSize(this.inputFontSize * this.ratio) - .margin({ left: 10 * this.ratio }) - Text('叠加内容').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 24 * this.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio }) + Text('叠加内容').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 24 * globalThis.ratio }) TextInput({ text: this.param.text1, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(79 * this.ratio) - .height(26 * this.ratio) + .width(79 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ left: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) - Text('+').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 5 * this.ratio }) + .margin({ left: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) + Text('+').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 5 * globalThis.ratio }) TextInput({ text: this.param.text2, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(79 * this.ratio) - .height(26 * this.ratio) + .width(79 * globalThis.ratio) + .height(26 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .margin({ left: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) - Text('+').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 5 * this.ratio }) + .margin({ left: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) + Text('+').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 5 * globalThis.ratio }) TextInput({ text: this.param.text3, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(79 * this.ratio) + .width(79 * globalThis.ratio) .padding({ top: 0, bottom: 0 }) - .height(26 * this.ratio) - .margin({ left: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) - Text('分隔符').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 24 * this.ratio }) + .height(26 * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) + Text('分隔符').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 24 * globalThis.ratio }) TextInput({ text: this.param.dolt, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(67 * this.ratio) - .height(26 * this.ratio) - .margin({ left: 10 * this.ratio }) + .width(67 * globalThis.ratio) + .height(26 * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio }) .padding({ top: 0, bottom: 0 }) - .fontSize(this.inputFontSize * this.ratio) - Text('文字大小').fontColor('#333333').fontSize(16 * this.ratio).margin({ left: 24 * this.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) + Text('文字大小').fontColor('#333333').fontSize(16 * globalThis.ratio).margin({ left: 24 * globalThis.ratio }) TextInput({ text: this.param.fontSize, controller: this.inputController }) .type(InputType.Normal) .borderRadius(0) - .width(34 * this.ratio) - .height(26 * this.ratio) - .margin({ left: 10 * this.ratio }) - .fontSize(this.inputFontSize * this.ratio) + .width(34 * globalThis.ratio) + .height(26 * globalThis.ratio) + .margin({ left: 10 * globalThis.ratio }) + .fontSize(this.inputFontSize * globalThis.ratio) .padding({ top: 0, bottom: 0 }) }.width('100%').align(Alignment.Start).backgroundColor('#E5E3DF') - }.width(946 * this.ratio).height(336 * this.ratio).backgroundColor('#E5E3DF').margin({ top: 13 * this.ratio }) + }.width(946 * globalThis.ratio).height(336 * globalThis.ratio).backgroundColor('#E5E3DF').margin({ top: 13 * globalThis.ratio }) } .width('100%') - .height(395 * this.ratio) + .height(395 * globalThis.ratio) .backgroundColor('#CCC4B8') - .position({ x: 0, y: 146 * this.ratio }) - .border({ radius: { topLeft: 24 * this.ratio, topRight: 24 * this.ratio } }) + .position({ x: 0, y: 146 * globalThis.ratio }) + .border({ radius: { topLeft: 24 * globalThis.ratio, topRight: 24 * globalThis.ratio } }) } }.backgroundColor('#1A1A1A').width('100%').height('100%') diff --git a/entry/src/main/ets/pages/compontents/judge/real-time.ets b/entry/src/main/ets/pages/compontents/judge/real-time.ets index 4b033deb..b30bd8e4 100644 --- a/entry/src/main/ets/pages/compontents/judge/real-time.ets +++ b/entry/src/main/ets/pages/compontents/judge/real-time.ets @@ -1,7 +1,7 @@ // @ts-nocheck import hilog from '@ohos.hilog'; -import apiJudgeSdk from 'libJudgeSdk.so'; -// import apiJudgeSdk from '@ohos.judgesdk'; +// import apiJudgeSdk from 'libJudgeSdk.so'; +import apiJudgeSdk from '@ohos.judgesdk'; import Judge from '../../judgeSDK/utils/judge-real' // import Judge from '../../judgeSDK/judge-track-playback' @@ -43,8 +43,8 @@ struct RealTime { XComponent({ id: 'duolun_plugin_id_draw', //显示轨迹窗口id名称,注意这个ID要和C++侧一致,不能变 type: 'surface', - libraryname: 'JudgeSdk' - // libraryname: 'judgesdk' + // libraryname: 'JudgeSdk' + libraryname: 'judgesdk' }) .width(this.width) .height(this.height) diff --git a/entry/src/main/ets/pages/judgeSDK/api/index.ts b/entry/src/main/ets/pages/judgeSDK/api/index.ts index 6ca305c4..94307f62 100644 --- a/entry/src/main/ets/pages/judgeSDK/api/index.ts +++ b/entry/src/main/ets/pages/judgeSDK/api/index.ts @@ -1,6 +1,6 @@ -import libJudgeSdk from 'libJudgeSdk.so' +// import libJudgeSdk from 'libJudgeSdk.so' //@ts-ignore -// import libJudgeSdk from '@ohos.judgesdk' +import libJudgeSdk from '@ohos.judgesdk' /** * 苏仁君 * @date 2023/04/10 diff --git a/entry/src/main/ets/pages/register.ets b/entry/src/main/ets/pages/register.ets index f39c1c2a..b13c2383 100644 --- a/entry/src/main/ets/pages/register.ets +++ b/entry/src/main/ets/pages/register.ets @@ -47,7 +47,7 @@ struct Index { this.ip='MAC-'+this.deviceNo globalThis.deviceNo=this.ip }) - Text('网卡').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * this.ratio }) + Text('网卡').fontSize(34 * globalThis.ratio).fontColor('#FFE0B2').margin({ right: 98.5 * globalThis.ratio }) } Row() { @@ -60,35 +60,35 @@ struct Index { globalThis.deviceNo=this.ip // this.ip = ip }) - Text('硬盘').fontSize(34 * this.ratio).fontColor('#FFE0B2').margin({ right: 83 * this.ratio }) + Text('硬盘').fontSize(34 * globalThis.ratio).fontColor('#FFE0B2').margin({ right: 83 * globalThis.ratio }) } - }.margin({ top: 35 * this.ratio }) + }.margin({ top: 35 * globalThis.ratio }) Row() { Column(){ Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) { Text(this.ip).fontColor('#fff') - .fontSize(33.6 * this.ratio) + .fontSize(33.6 * globalThis.ratio) } .width('100%') .height('100%') - .padding({ left: 30 * this.ratio, right: 30 * this.ratio }) + .padding({ left: 30 * globalThis.ratio, right: 30 * globalThis.ratio }) } .backgroundImage($r('app.media.xk')) .backgroundImageSize({ width: '100%', height: '100%' }) - .width(610 * this.ratio) - .height(108 * this.ratio) - .margin({ left: 22 * this.ratio }) + .width(610 * globalThis.ratio) + .height(108 * globalThis.ratio) + .margin({ left: 22 * globalThis.ratio }) - }.margin({ top: 30 * this.ratio }) + }.margin({ top: 30 * globalThis.ratio }) } - .width(720 * this.ratio) - .height(310 * this.ratio) + .width(720 * globalThis.ratio) + .height(310 * globalThis.ratio) .backgroundColor('#333230') - .margin({ top: 37 * this.ratio }) - .borderRadius(19 * this.ratio) + .margin({ top: 37 * globalThis.ratio }) + .borderRadius(19 * globalThis.ratio) - Image($r('app.media.zhuce_nor')).width(320 * this.ratio).height(92 * this.ratio).margin({ top: 30 * this.ratio }).onClick(()=>{ + Image($r('app.media.zhuce_nor')).width(320 * globalThis.ratio).height(92 * globalThis.ratio).margin({ top: 30 * globalThis.ratio }).onClick(()=>{ this.registrationDeviceNoFn() }) }