fix: 优化了部分
This commit is contained in:
		
							parent
							
								
									6e4f0c282b
								
							
						
					
					
						commit
						ea12081e13
					
				| @ -12,18 +12,17 @@ import FileUtils from '../utils/FileUtils'; | ||||
| 
 | ||||
| export default class EntryAbility extends UIAbility { | ||||
|   async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { | ||||
|     console.log("多伦鸿蒙车载程序启动") | ||||
|     try { | ||||
|       await DB.init(this.context) | ||||
|       await InitTable() | ||||
|       let fileUtil = new FileUtils(this.context) | ||||
|       // 一些地址配置 | ||||
|       const data = await fileUtil.readFile(GlobalConfig.commonFileWriteAddress + '/config/ipConfig.txt'); | ||||
|       console.log("读取配置", data) | ||||
|       if (data !== '' && data !== undefined) { | ||||
|         console.log("配置设置") | ||||
|         const result: EnvironmentConfigurationType = JSON.parse(data) | ||||
|         AppStorage.setOrCreate<EnvironmentConfigurationType>("EnvironmentConfiguration", result) | ||||
|         const host = `http://${result.centerIp}:${result.centerPort}` | ||||
|         console.log("host",host) | ||||
|         AppStorage.setOrCreate<string>("host", host) | ||||
|       } | ||||
|     } catch (e) { | ||||
| @ -46,7 +45,6 @@ export default class EntryAbility extends UIAbility { | ||||
|     let rect = windowClass.getWindowProperties().windowRect | ||||
|     let width = rect.width | ||||
|     let height = rect.height | ||||
|     console.log("log", width, height) | ||||
|     AppStorage.setOrCreate<CarInfoType>('carInfo', {}) | ||||
|     AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {}) | ||||
|     AppStorage.setOrCreate<string>('lsh', '0000000000000') | ||||
|  | ||||
| @ -125,8 +125,8 @@ struct Index { | ||||
|   exam() { | ||||
|     this.loadingDialog.open() | ||||
|     if (!this.timeInfo) { | ||||
|       AppStorage.setOrCreate('type', 1) | ||||
|       AppStorage.setOrCreate('title', '时间同步接口连接失败') | ||||
|       // AppStorage.setOrCreate('type', 1) | ||||
|       // AppStorage.setOrCreate('title', '时间同步接口连接失败') | ||||
|       this.errorDialog.open() | ||||
|       promptAction.showToast({ | ||||
|         message: `时间同步接口连接失败`, | ||||
|  | ||||
| @ -131,6 +131,7 @@ export default function Request<T extends RequestResult>(options: RequestOption) | ||||
|       extraData: options.xml ? options.data : JSON.stringify(options.data), | ||||
|       readTimeout: options.timeout || 30 * 1000 | ||||
|     }).then(async data => { | ||||
|       console.log(RequestTag, options.url, "返回的数据", JSON.stringify(data)) | ||||
|       let result = options.xml ? xmlToJSON(data.result as string) : data.result | ||||
|       let resObj: object = new Object() | ||||
|       if (typeof result === 'string') { | ||||
|  | ||||
| @ -59,6 +59,7 @@ export default class UdpClient { | ||||
| 
 | ||||
| 
 | ||||
|   bindUdp(): Promise<void> | undefined { | ||||
|     console.log(UDPTag, "绑定udp",this.localIp,this.localIpPort) | ||||
|     return this.udp?.bind({ | ||||
|       address: this.localIp, port: parseInt(this.localIpPort), family: 1 | ||||
|     }).then(res => { | ||||
| @ -113,14 +114,14 @@ export default class UdpClient { | ||||
|   } | ||||
| 
 | ||||
|   async create(udpLocalIp: string, udpLocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) { | ||||
|     console.log(UDPTag,"udp 初始化") | ||||
|     console.log(UDPTag, "udp 初始化参数", udpLocalIp, udpLocalIpPort, udpOppositeIp, udpOppositeIpPort) | ||||
|     await this.close() | ||||
|     this.localIp = udpLocalIp | ||||
|     this.oppositeIp = udpOppositeIp | ||||
|     this.localIpPort = udpLocalIpPort | ||||
|     this.oppositeIpPort = udpOppositeIpPort | ||||
|     this.udp = socket.constructUDPSocketInstance(); | ||||
|     try { | ||||
|       this.udp = socket.constructUDPSocketInstance(); | ||||
|       this.bindUdp() | ||||
|       this.bindEvent() | ||||
|     } catch (e) { | ||||
|  | ||||
| @ -98,7 +98,7 @@ class ObtainUdpBusiness { | ||||
|   private initSecondGeneration() { | ||||
| 
 | ||||
|   } | ||||
| 
 | ||||
|   // 三代机udp初始化 | ||||
|   private initThirdGeneration() { | ||||
|     try { | ||||
|       let config: EnvironmentConfigurationType = | ||||
|  | ||||
| @ -2,8 +2,8 @@ | ||||
|   "lockfileVersion": 2, | ||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||
|   "specifiers": { | ||||
|     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19", | ||||
|     "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3" | ||||
|     "@ohos/crypto-js@2.0.3": "@ohos/crypto-js@2.0.3", | ||||
|     "@ohos/hypium@1.0.19": "@ohos/hypium@1.0.19" | ||||
|   }, | ||||
|   "packages": { | ||||
|     "@ohos/hypium@1.0.19": { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user