优化了部分代码
This commit is contained in:
parent
da6a85f02a
commit
e65c48f1eb
@ -1,5 +1,3 @@
|
||||
import UdpClient from '../common/utils/UdpClient';
|
||||
import FileLog from './judgeSDK/utils/file-log';
|
||||
import signDisplayCom from './compontents/signDisplayCom';
|
||||
|
||||
@Entry
|
||||
@ -7,50 +5,54 @@ import signDisplayCom from './compontents/signDisplayCom';
|
||||
export default struct Index {
|
||||
@State signArr: Array<any> = []
|
||||
@State sjxhColum: Array<any> = [
|
||||
{ key: '左方向灯', value: '0' }, { key: '右方向灯', value: '0' }, {
|
||||
key: '喇叭',
|
||||
value: '0'
|
||||
}, { key: '点火1', value: '0' }, { key: '点火2', 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: '超声波1',
|
||||
value: '0'
|
||||
}, {
|
||||
key: '超声波2',
|
||||
value: '0'
|
||||
}, {
|
||||
key: 'NC',
|
||||
value: '0'
|
||||
}, { key: 'SA15', value: '0' }, { key: '其他门', value: '0' }, { key: '转速过高', value: '0' }, {
|
||||
key: '累计脉冲',
|
||||
value: '0'
|
||||
}, { key: '熄火次数', value: '0' }, { key: '发动机转速', value: '0' }, { key: '方向盘角度', value: '0' }, {
|
||||
key: '超声波3',
|
||||
value: '0'
|
||||
}, { key: '超声波4', value: '0' }, { key: '触摸1', value: '0' }, { key: '触摸2', value: '0' }, {
|
||||
key: '触摸3',
|
||||
value: '0'
|
||||
}, { key: 'SCIO', value: '0' }
|
||||
, { key: 'SC1A_C', value: '0' }, { key: 'SC1B_C', value: '0' }, { key: 'SC2A_C', value: '0' }, {
|
||||
key: 'SC2B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC3A_C', value: '0' }, { key: 'SC3B_C', value: '0' }, { key: 'SC4A_C', value: '0' }, {
|
||||
key: 'SC4B_C',
|
||||
value: '0'
|
||||
}, { key: 'SC5A_C', value: '0' }, { key: 'SC5B_C', value: '0' }, { key: 'SC6A_C', value: '0' }, {
|
||||
key: 'SC6B_C',
|
||||
value: '0'
|
||||
}]
|
||||
{ key: '左方向灯', value: '0' },
|
||||
{ key: '右方向灯', value: '0' },
|
||||
{ key: '喇叭', value: '0' },
|
||||
{ key: '点火1', value: '0' },
|
||||
{ key: '点火2', 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: '超声波1', value: '0' },
|
||||
{ key: '超声波2', value: '0' },
|
||||
{ key: 'NC', value: '0' },
|
||||
{ key: 'SA15', value: '0' },
|
||||
{ key: '其他门', value: '0' },
|
||||
{ key: '转速过高', value: '0' },
|
||||
{ key: '累计脉冲', value: '0' },
|
||||
{ key: '熄火次数', value: '0' },
|
||||
{ key: '发动机转速', value: '0' },
|
||||
{ key: '方向盘角度', value: '0' },
|
||||
{ key: '超声波3', value: '0' },
|
||||
{ key: '超声波4', value: '0' },
|
||||
{ key: '触摸1', value: '0' },
|
||||
{ key: '触摸2', value: '0' },
|
||||
{ key: '触摸3', value: '0' },
|
||||
{ key: 'SCIO', value: '0' },
|
||||
{ key: 'SC1A_C', value: '0' },
|
||||
{ key: 'SC1B_C', value: '0' },
|
||||
{ key: 'SC2A_C', value: '0' },
|
||||
{ key: 'SC2B_C', value: '0' },
|
||||
{ key: 'SC3A_C', value: '0' },
|
||||
{ key: 'SC3B_C', value: '0' },
|
||||
{ key: 'SC4A_C', value: '0' },
|
||||
{ key: 'SC4B_C', value: '0' },
|
||||
{ key: 'SC5A_C', value: '0' },
|
||||
{ key: 'SC5B_C', value: '0' },
|
||||
{ key: 'SC6A_C', value: '0' },
|
||||
{ key: 'SC6B_C', value: '0' }
|
||||
];
|
||||
@State GPSColum: Array<any> = [
|
||||
{ key: '状态', value: '0' },
|
||||
{ key: '收星数', value: '0' },
|
||||
@ -74,10 +76,6 @@ export default struct Index {
|
||||
@State msg: string = ''
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
@State url: string = ''
|
||||
private timer = null
|
||||
private udpClient: UdpClient = null
|
||||
private FileLog: FileLog
|
||||
private vocObj = null;
|
||||
|
||||
// @State gpsList: Array<any> = []
|
||||
build() {
|
||||
|
||||
@ -1,70 +1,66 @@
|
||||
|
||||
import router from '@ohos.router'
|
||||
import TopLogo from './compontents/topLogo'
|
||||
import TopLogo from './compontents/topLogo';
|
||||
import ethernet from '@ohos.net.ethernet';
|
||||
import prompt from '@ohos.prompt'
|
||||
import { upDateTableByArray} from '../common/service/initable'
|
||||
import { getSyncData} from '../common/service/initable'
|
||||
import { voiceService } from '../common/service/voiceService'
|
||||
import { GlobalConfig } from '../config/index'
|
||||
import { getUDP, getUDP2 } from '../common/utils/GlobleUdp';
|
||||
import { getTCP } from '../common/utils/GlobleTcp';
|
||||
import prompt from '@ohos.prompt';
|
||||
import { getSyncData, upDateTableByArray } from '../common/service/initable';
|
||||
import { getUDP, getUDP2 } from '../common/utils/GlobalUdp';
|
||||
import { getTCP } from '../common/utils/GlobalTcp';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State textList1: string[] = ['差分服务器Ip','响应端口','中心服务器IP','响应端口', '子网掩码','默认网关','dns','后置机IP ', '响应端口','前置机IP','本地端口','平台服务器Ip','响应端口']
|
||||
@State textList1: string[] = ['差分服务器Ip', '响应端口', '中心服务器IP', '响应端口', '子网掩码', '默认网关', 'dns', '后置机IP ', '响应端口', '前置机IP', '本地端口', '平台服务器Ip', '响应端口']
|
||||
// @State textList2: string[] = []
|
||||
@State ratio: number = 1700 / 960
|
||||
@State inputFontSize:number=12 //12
|
||||
@State inputFontSize: number = 12 //12
|
||||
//
|
||||
// @State inputTextList1: string[] = ['192.168.7.170','8084','192.168.7.170','20122','255.255.255.0','192.168.7.1','','','114.114.114.114','112.80.35.83','11055' +
|
||||
// '',]
|
||||
// @State inputTextList2: string[] = ['192.168.7.124','20022']
|
||||
|
||||
|
||||
@State inputTextList1: string[] = ['112.80.35.83','11055','112.80.35.83','11052','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122','112.80.35.83','11050']
|
||||
@State inputTextList1: string[] = ['112.80.35.83', '11055', '112.80.35.83', '11052', '255.255.255.0', '192.168.7.1', '114.114.114.114', '192.168.7.124', '20022', '192.168.7.170', '20122', '112.80.35.83', '11050']
|
||||
// @State inputTextList2: string[] = []
|
||||
// 112.80.35.83 11052
|
||||
// @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000']
|
||||
// @State inputTextList2: string[] = ['192.168.36.139','20022']
|
||||
|
||||
|
||||
|
||||
|
||||
@State @Watch('outClick') outFlag: boolean = false;
|
||||
private vocObj = null;
|
||||
scroller: Scroller = new Scroller()
|
||||
private vocObj = null;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
TopLogo({outFlag:$outFlag})
|
||||
TopLogo({ outFlag: $outFlag })
|
||||
Column() {
|
||||
Column() {
|
||||
Scroll(this.scroller){
|
||||
Flex({'wrap':FlexWrap.Wrap}) {
|
||||
ForEach(this.textList1, (item:string, index:number) => {
|
||||
Scroll(this.scroller) {
|
||||
Flex({ 'wrap': FlexWrap.Wrap }) {
|
||||
ForEach(this.textList1, (item: string, index: number) => {
|
||||
Row() {
|
||||
Text(item)
|
||||
.width('40%')
|
||||
.height('100%')
|
||||
.fontColor('#E5CBA1')
|
||||
.padding({'left': '35px'})
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
TextInput({'text':this.inputTextList1[index]?this.inputTextList1[index]: ''})
|
||||
.padding({ 'left': '35px' })
|
||||
.fontSize(this.inputFontSize * this.ratio)
|
||||
TextInput({ 'text': this.inputTextList1[index] ? this.inputTextList1[index] : '' })
|
||||
.width('50%')
|
||||
.height('60%')
|
||||
.fontColor('#fff')
|
||||
.borderColor('#E6E0D8')
|
||||
.borderRadius('10px')
|
||||
.borderWidth('2px')
|
||||
.fontSize(this.inputFontSize*this.ratio)
|
||||
.padding({top:0,bottom:0})
|
||||
.fontSize(this.inputFontSize * this.ratio)
|
||||
.padding({ top: 0, bottom: 0 })
|
||||
.linearGradient({
|
||||
angle: 0,
|
||||
colors: [[0x403C36, 0.0], [0x4D473D, 0.34], [0x3D3A34, 1.0]]
|
||||
}).onChange((value: string) => {
|
||||
this.inputTextList1[index]=value
|
||||
})
|
||||
.onChange((value: string) => {
|
||||
this.inputTextList1[index] = value
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
.width('50%')
|
||||
.height('16.7%')
|
||||
@ -74,28 +70,43 @@ struct Index {
|
||||
}
|
||||
.width('95%')
|
||||
.height('90%')
|
||||
.margin({'top': '2%'})
|
||||
.margin({ 'top': '2%' })
|
||||
.backgroundColor('#282828')
|
||||
.borderRadius('15px')
|
||||
}
|
||||
.width('100%')
|
||||
.height('80%')
|
||||
.borderRadius('25px')
|
||||
|
||||
Column() {
|
||||
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(()=>{
|
||||
upDateTableByArray('IpConfigTable',[{udplocalIp:this.inputTextList1[9],udplocalIpPort:this.inputTextList1[10],udpOppositeIp:this.inputTextList1[7],udpOppositeIpPort:this.inputTextList1[8],tcplocalIp:this.inputTextList1[9],tcplocalIpPort:'8088',tcpOppositeIp:this.inputTextList1[0],tcpOppositePort:this.inputTextList1[1],netMask:this.inputTextList1[4],gateway:this.inputTextList1[5],dnsServers:this.inputTextList1[6],centerIp:this.inputTextList1[2],centerPort:this.inputTextList1[3]}])
|
||||
Image($r('app.media.terminal_save')).width('20.5%').height('74%').onClick(() => {
|
||||
upDateTableByArray('IpConfigTable', [{
|
||||
udplocalIp: this.inputTextList1[9],
|
||||
udplocalIpPort: this.inputTextList1[10],
|
||||
udpOppositeIp: this.inputTextList1[7],
|
||||
udpOppositeIpPort: this.inputTextList1[8],
|
||||
tcplocalIp: this.inputTextList1[9],
|
||||
tcplocalIpPort: '8088',
|
||||
tcpOppositeIp: this.inputTextList1[0],
|
||||
tcpOppositePort: this.inputTextList1[1],
|
||||
netMask: this.inputTextList1[4],
|
||||
gateway: this.inputTextList1[5],
|
||||
dnsServers: this.inputTextList1[6],
|
||||
centerIp: this.inputTextList1[2],
|
||||
centerPort: this.inputTextList1[3]
|
||||
}])
|
||||
ethernet.setIfaceConfig("eth0", {
|
||||
mode: 0,
|
||||
ipAddr:this.inputTextList1[9],
|
||||
ipAddr: this.inputTextList1[9],
|
||||
route: "0.0.0.0",
|
||||
gateway: this.inputTextList1[5],//value.gateway网关
|
||||
netMask: this.inputTextList1[4],//value.netMask网络掩码
|
||||
gateway: this.inputTextList1[5], //value.gateway网关
|
||||
netMask: this.inputTextList1[4], //value.netMask网络掩码
|
||||
dnsServers: this.inputTextList1[6],
|
||||
// domain: ""
|
||||
}, (error) => {
|
||||
if (error) {
|
||||
prompt.showToast({
|
||||
message: '设置失败'+JSON.stringify(error),
|
||||
message: '设置失败' + JSON.stringify(error),
|
||||
duration: 3000
|
||||
});
|
||||
} else {
|
||||
@ -113,42 +124,43 @@ struct Index {
|
||||
.backgroundColor('#CCC4B8')
|
||||
.width('100%')
|
||||
.height('20%')
|
||||
.borderRadius({'bottomLeft':'25px','bottomRight':'25px'})
|
||||
.borderRadius({ 'bottomLeft': '25px', 'bottomRight': '25px' })
|
||||
.justifyContent(FlexAlign.SpaceAround)
|
||||
}
|
||||
.width('75%')
|
||||
.height('69.4%')
|
||||
.backgroundColor('#E6E3DF')
|
||||
.borderRadius('25px')
|
||||
.margin({'top':'7%'})
|
||||
.margin({ 'top': '7%' })
|
||||
.justifyContent(FlexAlign.SpaceAround)
|
||||
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundImagePosition({x: 0, y: 0})
|
||||
.backgroundImagePosition({ x: 0, y: 0 })
|
||||
.backgroundImage($r('app.media.index_bg'))
|
||||
.backgroundImageSize({ width: '100%', height: '100%' })
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
getSyncData('IpConfigTable').then((result:Array<any>)=>{
|
||||
console.log('result222',JSON.stringify(result))
|
||||
if(result.length){
|
||||
console.log('tagtag',JSON.stringify(result))
|
||||
this.inputTextList1[9]=result[0].udplocalIp
|
||||
this.inputTextList1[10]=result[0].udplocalIpPort
|
||||
this.inputTextList1[7]=result[0].udpOppositeIp
|
||||
this.inputTextList1[8]=result[0].udpOppositeIpPort
|
||||
getSyncData('IpConfigTable').then((result: Array<any>) => {
|
||||
console.log('result222', JSON.stringify(result))
|
||||
if (result.length) {
|
||||
console.log('tagtag', JSON.stringify(result))
|
||||
this.inputTextList1[9] = result[0].udplocalIp
|
||||
this.inputTextList1[10] = result[0].udplocalIpPort
|
||||
this.inputTextList1[7] = result[0].udpOppositeIp
|
||||
this.inputTextList1[8] = result[0].udpOppositeIpPort
|
||||
|
||||
// this.inputTextList1[0]=result[0].tcplocalIp
|
||||
// this.inputTextList1[13]=result[0].tcplocalIpPort
|
||||
this.inputTextList1[0]=result[0].tcpOppositeIp
|
||||
this.inputTextList1[1]=result[0].tcpOppositePort
|
||||
this.inputTextList1[5]=result[0].gateway
|
||||
this.inputTextList1[4]=result[0].netMask
|
||||
this.inputTextList1[6]=result[0].dnsServers
|
||||
this.inputTextList1[2]=result[0].centerIp
|
||||
this.inputTextList1[3]=result[0].centerPort
|
||||
this.inputTextList1[0] = result[0].tcpOppositeIp
|
||||
this.inputTextList1[1] = result[0].tcpOppositePort
|
||||
this.inputTextList1[5] = result[0].gateway
|
||||
this.inputTextList1[4] = result[0].netMask
|
||||
this.inputTextList1[6] = result[0].dnsServers
|
||||
this.inputTextList1[2] = result[0].centerIp
|
||||
this.inputTextList1[3] = result[0].centerPort
|
||||
}
|
||||
})
|
||||
ethernet.getIfaceConfig("eth0", (error, value) => {
|
||||
@ -166,10 +178,12 @@ struct Index {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
console.info('Index onPageShow');
|
||||
}
|
||||
outClick(){
|
||||
|
||||
outClick() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,6 @@ import USER from '../common/constants/USER';
|
||||
import { dateFormat, getCurrentTime, string2Bytes } from '../common/utils/tools';
|
||||
import MA_SYSSET from '../common//constants/MA_SYSSET';
|
||||
import FaceCompare from './compontents/FaceCompareByhaikang';
|
||||
// import { initJudgeUdp } from '../common/utils/UdpJudge'
|
||||
import { writeObjectOut } from '../api/judge';
|
||||
import testNapi from '@ohos.idcard';
|
||||
import common from '@ohos.app.ability.common';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user