fix: 档位信号处理,信号显示界面无法进入问题解决
This commit is contained in:
		
							parent
							
								
									c717b169d0
								
							
						
					
					
						commit
						b92d31b661
					
				| @ -5,7 +5,6 @@ import apiJudgeSdk from 'libJudgeSdk.so' | |||||||
| import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' | import { DifferentialAndSignal } from '../../utils/business/DifferentialAndSignalWorker' | ||||||
| import { examJudgeMapSetScaling } from '../Judge/JudgeUtils' | import { examJudgeMapSetScaling } from '../Judge/JudgeUtils' | ||||||
| import { dConsole } from '../../utils/LogWorker' | import { dConsole } from '../../utils/LogWorker' | ||||||
| import { SignDisplayTag } from '../../config' |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @Component | @Component | ||||||
| @ -24,20 +23,14 @@ export default struct SignalDisplayComponent { | |||||||
|   @State laneSignal: PerLane = InitialPerLane |   @State laneSignal: PerLane = InitialPerLane | ||||||
| 
 | 
 | ||||||
|   aboutToAppear(): void { |   aboutToAppear(): void { | ||||||
|     DifferentialAndSignal.onMsg(this.getMsg) |     DifferentialAndSignal.onMsg((data: string) => { | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   getMsg(data: string) { |  | ||||||
|       const result: WorkerBackMessage = JSON.parse(data) |       const result: WorkerBackMessage = JSON.parse(data) | ||||||
|     dConsole.log(SignDisplayTag, "wzj", data) |       dConsole.log("wzj", data) | ||||||
|       if (result.type === "obtainUdpData") { |       if (result.type === "obtainUdpData") { | ||||||
|         this.getSignal(result.data as string) |         this.getSignal(result.data as string) | ||||||
|         this.rawData = result.data as string |         this.rawData = result.data as string | ||||||
|       } |       } | ||||||
|   } |     }) | ||||||
| 
 |  | ||||||
|   aboutToDisappear(): void { |  | ||||||
|     DifferentialAndSignal.offMsg(this.getMsg) |  | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   getSignal = (msg: string) => { |   getSignal = (msg: string) => { | ||||||
| @ -46,9 +39,11 @@ export default struct SignalDisplayComponent { | |||||||
|       return |       return | ||||||
|     } |     } | ||||||
|     this.signArr = newArr |     this.signArr = newArr | ||||||
|  | 
 | ||||||
|     for (let i = 0; i <= 12; i++) { |     for (let i = 0; i <= 12; i++) { | ||||||
|       this.vehicleSignal[i].value = this.signArr[i+2] |       this.vehicleSignal[i].value = this.signArr[i+2] | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     this.vehicleSignal[13].value = this.signArr[17] |     this.vehicleSignal[13].value = this.signArr[17] | ||||||
|     this.vehicleSignal[14].value = this.signArr[18] |     this.vehicleSignal[14].value = this.signArr[18] | ||||||
|     this.vehicleSignal[15].value = this.signArr[19] |     this.vehicleSignal[15].value = this.signArr[19] | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user