1.补传错误码toast去除

2.界面错误数据修复
This commit is contained in:
lixiao 2025-05-21 19:08:23 +08:00
parent 14ef2d650e
commit c1633e80a7
6 changed files with 69 additions and 55 deletions

View File

@ -1,8 +1,15 @@
import http from '@ohos.net.http'; import http from '@ohos.net.http';
import convertxml from '@ohos.convertxml'; import convertxml from '@ohos.convertxml';
import prompt from '@ohos.prompt';
import Prompt from '@system.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 * @author: Renjun Su
@ -82,6 +89,7 @@ export default async function tempRequest<T>(req: any): Promise<T> {
resolve(res) resolve(res)
return return
} else { } else {
Prompt.showToast({ Prompt.showToast({
message: decodeURIComponent(resObj.resultMessage), message: decodeURIComponent(resObj.resultMessage),
duration: 3000 duration: 3000
@ -91,10 +99,6 @@ export default async function tempRequest<T>(req: any): Promise<T> {
} }
}).catch(Error => { }).catch(Error => {
console.info('test-error0' + url + ' error:resp: ' + JSON.stringify(Error.message)) 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) reject(Error)
}) })
@ -106,10 +110,6 @@ export default async function tempRequest<T>(req: any): Promise<T> {
code: -1 code: -1
}) })
} }
// Prompt.showToast({
// message: e?.message=='Failure when receiving data from the peer'?'网络异常,请重试':e?.message,
// duration: 5000
// });
reject({ reject({
code: e.code code: e.code
}) })
@ -159,7 +159,7 @@ function handleCenterCode(msgXml, isNewCenter) {
const result = msg?.data[0]?.result; const result = msg?.data[0]?.result;
if (result) { if (result) {
const { code, message, retval } = result const { code, message, retval } = result
if (code != '1') { if (!ifNeedRetry(code)) {
const rMessage = decodeURIComponent(message as string) const rMessage = decodeURIComponent(message as string)
Prompt.showToast({ Prompt.showToast({
message: rMessage, message: rMessage,
@ -178,14 +178,11 @@ function handleCenterCode(msgXml, isNewCenter) {
return patternArr && patternArr[1] return patternArr && patternArr[1]
}); });
if (code != '1') { if (!ifNeedRetry(code)) {
prompt.showToast({ Prompt.showToast({
message: decodeURIComponent(message as string), message: decodeURIComponent(message as string),
duration: 3000 duration: 3000
}); });
// globalThis.type='1'
// globalThis.title=decodeURIComponent(message as string)
// globalThis.errorDialog.open()
return { code, message: decodeURIComponent(message) } return { code, message: decodeURIComponent(message) }
} else { } else {
return { code, keystr, message } return { code, keystr, message }

View File

@ -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' }, { 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 = [ export const RoadData = [
{name:'路段组号',key:'MapRoad_Code_No'}, { name: '路段组号', key: 'MapRoad_Code_No' },
{name:'路段编码',key:'MapRoad_Name'}, { name: '路段编码', key: 'MapRoad_Name' },
{name:'车轮压线',key:['TouchLineType','TouchDir']}, { name: '车轮压线', key: ['TouchLineType', 'TouchDir'] },
{name:'车身碰线',key:['TouchLineTypeCS','TouchLineDirCS']}, { name: '车身碰线', key: ['TouchLineTypeCS', 'TouchLineDirCS'] },
{name:'基准车道',key:['BasePointInLaneNo','BaseLaneCount']}, { name: '基准车道', key: ['BasePointInLaneNo', 'BaseLaneCount'] },
{name:'前点车道',key:['FrontPointLaneNo','FrontPointLaneCount']}, { name: '前点车道', key: ['FrontPointLaneNo', 'FrontPointLaneCount'] },
{name:'后车点道',key:[]}, { name: '后车点道', key: [] },
{name:'左前/后车身距离',key:['Body_LF_ToLeftEdge','Body_LB_ToLeftEdge']}, { name: '左前/后车身距离', key: ['Body_LF_ToLeftEdge', 'Body_LB_ToLeftEdge'] },
{name:'右前/后车身距离',key:['Body_RF_ToRightEdge','Body_RB_ToRightEdge']}, { name: '右前/后车身距离', key: ['Body_RF_ToRightEdge', 'Body_RB_ToRightEdge'] },
{name:'右前/后车身边线',key:[]}, { name: '右前/后车身边线', key: [] },
{name:'右前/后轮距离',key:['Wheel_RF_ToRightEdge','Wheel_RB_ToRightEdge']}, { name: '右前/后轮距离', key: ['Wheel_RF_ToRightEdge', 'Wheel_RB_ToRightEdge'] },
{name:'右前/后轮边线',key:['Wheel_RF_ToBaseLine','Wheel_RF_ToBaseLine']}, { name: '右前/后轮边线', key: ['Wheel_RF_ToBaseLine', 'Wheel_RF_ToBaseLine'] },
{name:'左前/后轮距离',key:['Wheel_LF_ToRightEdge','Wheel_LB_ToRightEdge']}, { name: '左前/后轮距离', key: ['Wheel_LF_ToRightEdge', 'Wheel_LB_ToRightEdge'] },
{name:'左前/后轮边线',key:['Wheel_LF_ToBaseLine','Wheel_LB_ToBaseLine']}, { name: '左前/后轮边线', key: ['Wheel_LF_ToBaseLine', 'Wheel_LB_ToBaseLine'] },
{name:'车道属性',key:['BasePointInLaneDir','CrossLineAttr']}, { name: '车道属性', key: ['BasePointInLaneDir', 'CrossLineAttr'] },
{name:'形状',key:['InShapeAttr','ShapeNo','']}, { name: '形状', key: ['InShapeAttr', 'ShapeNo', ''] },
{name:'路段点',key:['CrossPointNo']}, { name: '路段点', key: ['CrossPointNo'] },
] ]

View File

@ -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' },
{ key: '经度因子', value: '0' }, { key: '经度因子', value: '0' },
{ key: '航向角', value: '0' }, { key: '航向角', value: '0' },
{ key: '俯仰角', value: '0' }, { key: '俯仰角', value: '0' },

View File

@ -2,10 +2,12 @@ import router from '@ohos.router';
import RealTime from '../compontents/judge/RealTime'; import RealTime from '../compontents/judge/RealTime';
import { GPSData, SignalData } from '../../mock'; import { GPSData, SignalData } from '../../mock';
import { SignalDataType } from '../../model'; import { SignalDataType } from '../../model';
import { convertGpsCoord2 } from '../../common/utils/tools';
@Component @Component
export default struct SignDisplayCom { export default struct SignDisplayCom {
@State showBack: boolean = false @State showBack: boolean = false
@Prop showTrajectory:boolean = false @Prop showTrajectory: boolean = false
@State scaleNum: number = 1 @State scaleNum: number = 1
@State msg: string = '' @State msg: string = ''
@State signArr: Array<any> = [] @State signArr: Array<any> = []
@ -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[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[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]) Text('度因子:' + this.signArr[88])
.fontColor('#FFB433') .fontColor('#FFB433')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.height(18 * this.ratio) .height(18 * this.ratio)
@ -212,9 +214,18 @@ export default struct SignDisplayCom {
.height(18 * this.ratio) .height(18 * this.ratio)
Text('年月日:' + this.signArr[93]).fontColor('#FFB433').fontSize(14 * this.ratio).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[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('经度:' + Number(convertGpsCoord2(Number(this.signArr[96])).toFixed(6)))
Text('纬度:' + this.signArr[96]).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) .fontColor('#FFB433')
Text('速度:' +((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString()).fontColor('#FFB433').fontSize(14 * this.ratio).height(18 * this.ratio) .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') .backgroundColor('#1A1A1A')
.width(170 * this.ratio) .width(170 * this.ratio)
@ -229,9 +240,10 @@ export default struct SignDisplayCom {
.backgroundImage($r('app.media.km_open')) .backgroundImage($r('app.media.km_open'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.visibility(this.active == 0 ? Visibility.Visible : Visibility.None) .visibility(this.active == 0 ? Visibility.Visible : Visibility.None)
Column() { Column() {
Column() { Column() {
Text( this.msg || '0') Text(this.msg || '0')
.fontColor('#FFF5E5') .fontColor('#FFF5E5')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)
.width('100%') .width('100%')
@ -251,6 +263,7 @@ export default struct SignDisplayCom {
.backgroundImage($r('app.media.km_open')) .backgroundImage($r('app.media.km_open'))
.backgroundImageSize({ width: '100%', height: '100%' }) .backgroundImageSize({ width: '100%', height: '100%' })
.visibility(this.active == 2 ? Visibility.Visible : Visibility.None) .visibility(this.active == 2 ? Visibility.Visible : Visibility.None)
Row() { Row() {
Flex({ direction: FlexDirection.Column }) { Flex({ direction: FlexDirection.Column }) {
Row() { Row() {
@ -293,7 +306,7 @@ export default struct SignDisplayCom {
.width(550 * this.ratio) .width(550 * this.ratio)
.height(380 * this.ratio) .height(380 * this.ratio)
.backgroundColor('#1A1A1A') .backgroundColor('#1A1A1A')
.margin({ top: 6 * this.ratio,}) .margin({ top: 6 * this.ratio, })
} }
.width(936 * this.ratio) .width(936 * this.ratio)
@ -325,7 +338,7 @@ export default struct SignDisplayCom {
if (showBack) { if (showBack) {
this.ratio = 1.4 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) console.log('getUDPonMessage_1bysignDisplay0', msg)
if (msg) { if (msg) {
getSignal(msg) getSignal(msg)
@ -350,7 +363,7 @@ export default struct SignDisplayCom {
const that = this const that = this
const showBack = this.showBack; const showBack = this.showBack;
if (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) console.log('getUDPonMessage_1bysignDisplay2', msg)
getSignal(msg) getSignal(msg)
@ -403,19 +416,23 @@ export default struct SignDisplayCom {
for (let i = 34; i <= 46; i++) { for (let i = 34; i <= 46; i++) {
this.sjxhColum[i].value = this.signArr[i+2] 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 let t = 0
for (let i = 83; i <= 97; i++) { 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++ t++
} }
this.GPSColum[14].value = ((Number((this.signArr[97]||0))*1.852).toFixed(2)).toString() this.GPSColum[14].value = ((Number((this.signArr[97] || 0)) * 1.852).toFixed(2)).toString()
const str0=this.signArr[93].substr(0,2) const str0 = this.signArr[93].substr(0, 2)
const str1=this.signArr[93].substr(2,2) const str1 = this.signArr[93].substr(2, 2)
const str2=this.signArr[93].substr(4.2) const str2 = this.signArr[93].substr(4.2)
this.signArr[93]=str2+str1+str0 this.signArr[93] = str2 + str1 + str0
this.GPSColum[10].value = this.signArr[93] 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.signArr[53]=192.168.7.170' // this.signArr[53]=192.168.7.170'
this.sjxhColum = JSON.parse(JSON.stringify((this.sjxhColum))) this.sjxhColum = JSON.parse(JSON.stringify((this.sjxhColum)))
that.signArr = JSON.parse(JSON.stringify((this.signArr))) that.signArr = JSON.parse(JSON.stringify((this.signArr)))

View File

@ -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[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[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[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]) Text('维度因子:' + this.signArr[88])
.fontColor('#FFB433') .fontColor('#FFB433')
.fontSize(14 * this.ratio) .fontSize(14 * this.ratio)

View File

@ -1,7 +1,7 @@
//考试回放开关 //考试回放开关
export const judgeConfig = { export const judgeConfig = {
// 外壳版本号 // 外壳版本号
version: "2025.05.20.01", version: "2025.05.21.01",
//本地目录开关 //本地目录开关
isTrajectoryOpen: false, isTrajectoryOpen: false,
//是否开启拍照 //是否开启拍照