From c1633e80a78c9d50d284768cd7bdafb12d70197b Mon Sep 17 00:00:00 2001 From: lixiao <932184220@qq.com> Date: Wed, 21 May 2025 19:08:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=A1=A5=E4=BC=A0=E9=94=99=E8=AF=AF=E7=A0=81?= =?UTF-8?q?toast=E5=8E=BB=E9=99=A4=202.=E7=95=8C=E9=9D=A2=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E6=95=B0=E6=8D=AE=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/ets/common/utils/tempRequest.ts | 27 +++++----- entry/src/main/ets/mock/SignDisplay.ets | 38 ++++++------- entry/src/main/ets/mock/SignDisplay.ts | 2 +- .../ets/pages/compontents/SignDisplayCom.ets | 53 ++++++++++++------- .../ets/pages/compontents/SignDisplayCom2.ets | 2 +- .../ets/pages/judgeSDK/utils/judgeConfig.ts | 2 +- 6 files changed, 69 insertions(+), 55 deletions(-) diff --git a/entry/src/main/ets/common/utils/tempRequest.ts b/entry/src/main/ets/common/utils/tempRequest.ts index 2ec7c0a8..400925b0 100644 --- a/entry/src/main/ets/common/utils/tempRequest.ts +++ b/entry/src/main/ets/common/utils/tempRequest.ts @@ -1,8 +1,15 @@ import http from '@ohos.net.http'; import convertxml from '@ohos.convertxml'; -import prompt from '@ohos.prompt'; import Prompt from '@system.prompt'; +function ifNeedRetry(code: number | string): boolean { + let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"] + if (!arr.includes(code + "") && code != 1) { + return true + } + return false +} + /** * @author: Renjun Su @@ -82,6 +89,7 @@ export default async function tempRequest(req: any): Promise { resolve(res) return } else { + Prompt.showToast({ message: decodeURIComponent(resObj.resultMessage), duration: 3000 @@ -91,10 +99,6 @@ export default async function tempRequest(req: any): Promise { } }).catch(Error => { console.info('test-error0' + url + ' error:resp: ' + JSON.stringify(Error.message)) - // Prompt.showToast({ - // message: Error?.message == 'Failure when receiving data from the peer' ? '网络异常,请重试' : Error?.message, - // duration: 5000 - // }); reject(Error) }) @@ -106,10 +110,6 @@ export default async function tempRequest(req: any): Promise { code: -1 }) } - // Prompt.showToast({ - // message: e?.message=='Failure when receiving data from the peer'?'网络异常,请重试':e?.message, - // duration: 5000 - // }); reject({ code: e.code }) @@ -159,7 +159,7 @@ function handleCenterCode(msgXml, isNewCenter) { const result = msg?.data[0]?.result; if (result) { const { code, message, retval } = result - if (code != '1') { + if (!ifNeedRetry(code)) { const rMessage = decodeURIComponent(message as string) Prompt.showToast({ message: rMessage, @@ -178,14 +178,11 @@ function handleCenterCode(msgXml, isNewCenter) { return patternArr && patternArr[1] }); - if (code != '1') { - prompt.showToast({ + if (!ifNeedRetry(code)) { + Prompt.showToast({ message: decodeURIComponent(message as string), duration: 3000 }); - // globalThis.type='1' - // globalThis.title=decodeURIComponent(message as string) - // globalThis.errorDialog.open() return { code, message: decodeURIComponent(message) } } else { return { code, keystr, message } diff --git a/entry/src/main/ets/mock/SignDisplay.ets b/entry/src/main/ets/mock/SignDisplay.ets index 3e27eecc..0389421f 100644 --- a/entry/src/main/ets/mock/SignDisplay.ets +++ b/entry/src/main/ets/mock/SignDisplay.ets @@ -54,34 +54,34 @@ export const GPSData = [ { key: '海拔高', value: '0' }, { key: '高度差', value: '0' }, { key: '龄期', value: '0' }, - { key: '维度因子', value: '0' }, + { key: '纬度因子', value: '0' }, { key: '经度因子', value: '0' }, { key: '航向角', value: '0' }, { key: '俯仰角', value: '0' }, { key: '航向角状态-收星数', value: '0' }, { key: '年月日', value: '0' }, { key: '时分秒', value: '0' }, - { key: '经度', value: '0' }, { key: '纬度', value: '0' }, + { key: '经度', value: '0' }, { key: '速度', value: '0' }, ] export const RoadData = [ - {name:'路段组号',key:'MapRoad_Code_No'}, - {name:'路段编码',key:'MapRoad_Name'}, - {name:'车轮压线',key:['TouchLineType','TouchDir']}, - {name:'车身碰线',key:['TouchLineTypeCS','TouchLineDirCS']}, - {name:'基准车道',key:['BasePointInLaneNo','BaseLaneCount']}, - {name:'前点车道',key:['FrontPointLaneNo','FrontPointLaneCount']}, - {name:'后车点道',key:[]}, - {name:'左前/后车身距离',key:['Body_LF_ToLeftEdge','Body_LB_ToLeftEdge']}, - {name:'右前/后车身距离',key:['Body_RF_ToRightEdge','Body_RB_ToRightEdge']}, - {name:'右前/后车身边线',key:[]}, - {name:'右前/后轮距离',key:['Wheel_RF_ToRightEdge','Wheel_RB_ToRightEdge']}, - {name:'右前/后轮边线',key:['Wheel_RF_ToBaseLine','Wheel_RF_ToBaseLine']}, - {name:'左前/后轮距离',key:['Wheel_LF_ToRightEdge','Wheel_LB_ToRightEdge']}, - {name:'左前/后轮边线',key:['Wheel_LF_ToBaseLine','Wheel_LB_ToBaseLine']}, - {name:'车道属性',key:['BasePointInLaneDir','CrossLineAttr']}, - {name:'形状',key:['InShapeAttr','ShapeNo','']}, - {name:'路段点',key:['CrossPointNo']}, + { name: '路段组号', key: 'MapRoad_Code_No' }, + { name: '路段编码', key: 'MapRoad_Name' }, + { name: '车轮压线', key: ['TouchLineType', 'TouchDir'] }, + { name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] }, + { name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] }, + { name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] }, + { name: '后车点道', key: [] }, + { name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] }, + { name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] }, + { name: '右前/后车身边线', key: [] }, + { name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] }, + { name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RF_ToBaseLine'] }, + { name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] }, + { name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] }, + { name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr'] }, + { name: '形状', key: ['InShapeAttr', 'ShapeNo', ''] }, + { name: '路段点', key: ['CrossPointNo'] }, ] diff --git a/entry/src/main/ets/mock/SignDisplay.ts b/entry/src/main/ets/mock/SignDisplay.ts index 3e27eecc..572594ad 100644 --- a/entry/src/main/ets/mock/SignDisplay.ts +++ b/entry/src/main/ets/mock/SignDisplay.ts @@ -54,7 +54,7 @@ export const GPSData = [ { key: '海拔高', value: '0' }, { key: '高度差', value: '0' }, { key: '龄期', value: '0' }, - { key: '维度因子', value: '0' }, + { key: '纬度因子', value: '0' }, { key: '经度因子', value: '0' }, { key: '航向角', value: '0' }, { key: '俯仰角', value: '0' }, diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index 7b1821f0..1fc93fa0 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -2,10 +2,12 @@ import router from '@ohos.router'; import RealTime from '../compontents/judge/RealTime'; import { GPSData, SignalData } from '../../mock'; import { SignalDataType } from '../../model'; +import { convertGpsCoord2 } from '../../common/utils/tools'; + @Component export default struct SignDisplayCom { @State showBack: boolean = false - @Prop showTrajectory:boolean = false + @Prop showTrajectory: boolean = false @State scaleNum: number = 1 @State msg: string = '' @State signArr: Array = [] @@ -196,7 +198,7 @@ export default struct SignDisplayCom { Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) - Text('维度因子:' + this.signArr[88]) + Text('纬度因子:' + this.signArr[88]) .fontColor('#FFB433') .fontSize(14 * this.ratio) .height(18 * this.ratio) @@ -212,9 +214,18 @@ export default struct SignDisplayCom { .height(18 * this.ratio) Text('年月日:' + this.signArr[93]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('时分秒:' + this.signArr[94]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) - Text('经度:' + this.signArr[95]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) - Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) - Text('速度:' +((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString()).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) + Text('经度:' + Number(convertGpsCoord2(Number(this.signArr[96])).toFixed(6))) + .fontColor('#FFB433') + .fontSize(14 * this.ratio) + .height(18 * this.ratio) + Text('纬度:' + Number(convertGpsCoord2(Number(this.signArr[95])).toFixed(6))) + .fontColor('#FFB433') + .fontSize(14 * this.ratio) + .height(18 * this.ratio) + Text('速度:' + ((Number((this.signArr[97] || 0)) * 1.852).toFixed(2)).toString()) + .fontColor('#FFB433') + .fontSize(14 * this.ratio) + .height(18 * this.ratio) } .backgroundColor('#1A1A1A') .width(170 * this.ratio) @@ -229,9 +240,10 @@ export default struct SignDisplayCom { .backgroundImage($r('app.media.km_open')) .backgroundImageSize({ width: '100%', height: '100%' }) .visibility(this.active == 0 ? Visibility.Visible : Visibility.None) + Column() { Column() { - Text( this.msg || '0') + Text(this.msg || '0') .fontColor('#FFF5E5') .fontSize(14 * this.ratio) .width('100%') @@ -251,6 +263,7 @@ export default struct SignDisplayCom { .backgroundImage($r('app.media.km_open')) .backgroundImageSize({ width: '100%', height: '100%' }) .visibility(this.active == 2 ? Visibility.Visible : Visibility.None) + Row() { Flex({ direction: FlexDirection.Column }) { Row() { @@ -293,7 +306,7 @@ export default struct SignDisplayCom { .width(550 * this.ratio) .height(380 * this.ratio) .backgroundColor('#1A1A1A') - .margin({ top: 6 * this.ratio,}) + .margin({ top: 6 * this.ratio, }) } .width(936 * this.ratio) @@ -325,7 +338,7 @@ export default struct SignDisplayCom { if (showBack) { this.ratio = 1.4 - globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => { + globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { console.log('getUDPonMessage_1bysignDisplay0', msg) if (msg) { getSignal(msg) @@ -350,7 +363,7 @@ export default struct SignDisplayCom { const that = this const showBack = this.showBack; if (showBack) { - globalThis.udpClient.onMessage_1&&globalThis.udpClient.onMessage_1((msg) => { + globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { console.log('getUDPonMessage_1bysignDisplay2', msg) getSignal(msg) @@ -403,19 +416,23 @@ export default struct SignDisplayCom { for (let i = 34; i <= 46; i++) { this.sjxhColum[i].value = this.signArr[i+2] } + const hours = Number(this.signArr[94].substr(0, 2)) + 8 + this.signArr[94] = (hours > 9 ? hours : '0' + hours) + this.signArr[94].substr(2, this.signArr[94].length - 2) let t = 0 for (let i = 83; i <= 97; i++) { - this.GPSColum[t].value = this.signArr[i] + if ([95, 96].includes(i)) { + this.GPSColum[t].value = Number(convertGpsCoord2(Number(this.signArr[i])).toFixed(6)) + ""; + } else { + this.GPSColum[t].value = this.signArr[i] + } t++ } - this.GPSColum[14].value = ((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString() - const str0=this.signArr[93].substr(0,2) - const str1=this.signArr[93].substr(2,2) - const str2=this.signArr[93].substr(4.2) - this.signArr[93]=str2+str1+str0 - this.GPSColum[10].value = this.signArr[93] - const hours=Number(this.signArr[94].substr(0,2))+8 - this.signArr[94]=(hours>9?hours:'0'+hours)+this.signArr[94].substr(2,this.signArr[94].length-2) + this.GPSColum[14].value = ((Number((this.signArr[97] || 0)) * 1.852).toFixed(2)).toString() + const str0 = this.signArr[93].substr(0, 2) + const str1 = this.signArr[93].substr(2, 2) + const str2 = this.signArr[93].substr(4.2) + this.signArr[93] = str2 + str1 + str0 + this.GPSColum[10].value = this.signArr[93] // this.signArr[53]=192.168.7.170' this.sjxhColum = JSON.parse(JSON.stringify((this.sjxhColum))) that.signArr = JSON.parse(JSON.stringify((this.signArr))) diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom2.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom2.ets index 213fcc12..89bcd978 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom2.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom2.ets @@ -196,7 +196,7 @@ export default struct SignDisplayCom { Text('收星数:' + this.signArr[84]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('海拔高:' + this.signArr[85]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('高度差:' + this.signArr[86]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) - Text('龄期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) + Text('纬期:' + this.signArr[87]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) Text('维度因子:' + this.signArr[88]) .fontColor('#FFB433') .fontSize(14 * this.ratio) diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index 24555ad1..48b99e20 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -1,7 +1,7 @@ //考试回放开关 export const judgeConfig = { // 外壳版本号 - version: "2025.05.20.01", + version: "2025.05.21.01", //本地目录开关 isTrajectoryOpen: false, //是否开启拍照