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 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<T>(req: any): Promise<T> {
resolve(res)
return
} else {
Prompt.showToast({
message: decodeURIComponent(resObj.resultMessage),
duration: 3000
@ -91,10 +99,6 @@ export default async function tempRequest<T>(req: any): Promise<T> {
}
}).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<T>(req: any): Promise<T> {
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 }

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' },
]
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'] },
]

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' },

View File

@ -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<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[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++) {
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[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.signArr[53]=192.168.7.170'
this.sjxhColum = JSON.parse(JSON.stringify((this.sjxhColum)))
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[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)

View File

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