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,15 +54,15 @@ 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' },
]

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,6 +2,8 @@ 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
@ -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,6 +240,7 @@ 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')
@ -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() {
@ -403,9 +416,15 @@ 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()
@ -414,8 +433,6 @@ export default struct SignDisplayCom {
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,
//是否开启拍照