语音修改
This commit is contained in:
		
							parent
							
								
									c1f27d8d5a
								
							
						
					
					
						commit
						ac95a82524
					
				| @ -39,7 +39,7 @@ export default async function request(req: any) { | |||||||
|     try { |     try { | ||||||
|         let baseUrl=host?host:globalThis.host |         let baseUrl=host?host:globalThis.host | ||||||
|         // let baseUrl=host?config.csptHost:config.host'
 |         // let baseUrl=host?config.csptHost:config.host'
 | ||||||
|         console.log('响应头地址' + baseUrl,url) |         console.log('响应头地址1' + baseUrl,url,options.extraData.length) | ||||||
|         const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, {...options}); |         const {result,responseCode} = await httpRequest.request(`${baseUrl}${url}${paramsStr}`, {...options}); | ||||||
|         // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 |         // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList))
 | ||||||
|         // writeLog({
 |         // writeLog({
 | ||||||
|  | |||||||
| @ -39,7 +39,7 @@ export default struct Index { | |||||||
|   private vocObj = null; |   private vocObj = null; | ||||||
| 
 | 
 | ||||||
|   // private AccountTable = new AccountTable(()=>{},CommonConstants); |   // private AccountTable = new AccountTable(()=>{},CommonConstants); | ||||||
|   onPageShow() { |   aboutToAppear() { | ||||||
|     const that = this |     const that = this | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |     this.vocObj = new voiceService(async (status, val, next) => { | ||||||
|       if (!that.breakFlag) { |       if (!that.breakFlag) { | ||||||
|  | |||||||
| @ -4,7 +4,7 @@ import { examinerLoginService } from '../common/service/ExaminerService'; | |||||||
| import Md5 from '../common/utils/md5'; | import Md5 from '../common/utils/md5'; | ||||||
| import promptAction from '@ohos.promptAction'; | import promptAction from '@ohos.promptAction'; | ||||||
| import errorMsgDialog from './compontents/errorMsgDialog' | import errorMsgDialog from './compontents/errorMsgDialog' | ||||||
| import { voiceService } from '../common/service/voiceService'; | // import { voiceService } from '../common/service/voiceService'; | ||||||
| import imageBtn from './compontents/imageBtn' | import imageBtn from './compontents/imageBtn' | ||||||
| 
 | 
 | ||||||
| @Entry | @Entry | ||||||
| @ -18,7 +18,7 @@ export default struct Index { | |||||||
|   @State currentInputIndex: number = 0 |   @State currentInputIndex: number = 0 | ||||||
|   @State limit: boolean = false |   @State limit: boolean = false | ||||||
|   @State @Watch('outClick') outFlag: boolean = false; |   @State @Watch('outClick') outFlag: boolean = false; | ||||||
|   private vocObj = null; |   // private vocObj = null; | ||||||
|   private title = '' |   private title = '' | ||||||
|   private type = '2' |   private type = '2' | ||||||
|   errorDialog: CustomDialogController = new CustomDialogController({ |   errorDialog: CustomDialogController = new CustomDialogController({ | ||||||
| @ -181,8 +181,8 @@ export default struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   onPageShow() { |   onPageShow() { | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |     // this.vocObj = new voiceService(async (status, val, next) => { | ||||||
|     }); |     // }); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   outClick() { |   outClick() { | ||||||
|  | |||||||
| @ -22,6 +22,7 @@ import UdpEvent from '../common/utils/UdpEvent' | |||||||
| import UIAbility from '@ohos.app.ability.UIAbility'; | import UIAbility from '@ohos.app.ability.UIAbility'; | ||||||
| import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService'; | import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService'; | ||||||
| import imageBtn from './compontents/imageBtn' | import imageBtn from './compontents/imageBtn' | ||||||
|  | import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
| 
 | 
 | ||||||
| // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
| 
 | 
 | ||||||
| @ -45,7 +46,8 @@ struct Index { | |||||||
|   fileHelper = null; |   fileHelper = null; | ||||||
|   private fileUtil: FileUtil |   private fileUtil: FileUtil | ||||||
|   private interval = null; |   private interval = null; | ||||||
|   private vocObj = null; |   // private vocObj = null; | ||||||
|  |   private avPlayer | ||||||
|   private workerInstance = null; |   private workerInstance = null; | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|   errorDialog: CustomDialogController = new CustomDialogController({ |   errorDialog: CustomDialogController = new CustomDialogController({ | ||||||
| @ -332,6 +334,8 @@ struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|  |     console.log('diyidiy') | ||||||
|  |     this.avPlayer = new VoiceAnnounce(); | ||||||
|     this.initParamFlag=false |     this.initParamFlag=false | ||||||
|     this.dialogVisiable = false |     this.dialogVisiable = false | ||||||
|     this.angle = 0 |     this.angle = 0 | ||||||
| @ -341,6 +345,10 @@ struct Index { | |||||||
|     globalThis.udpEvent = new UdpEvent(); |     globalThis.udpEvent = new UdpEvent(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   aboutToDisappear() { | ||||||
|  |     // this.vocObj && this.vocObj.releasePlayer() | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|   async testXMLToJSONInWorker() { |   async testXMLToJSONInWorker() { | ||||||
|     if (this.loading) { |     if (this.loading) { | ||||||
|       return |       return | ||||||
| @ -431,23 +439,25 @@ struct Index { | |||||||
|       globalThis.udpClient2.sendMsgExt(param, this.context) |       globalThis.udpClient2.sendMsgExt(param, this.context) | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 |  | ||||||
|   async onPageShow() { |   async onPageShow() { | ||||||
|     console.log('ttttt', 1111) |     console.log('ttttt', 1111) | ||||||
|     await this.userAuth(); |     await this.userAuth(); | ||||||
|     let resourceManager = this.context.resourceManager; |     let resourceManager = this.context.resourceManager; | ||||||
| 
 | 
 | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |     // this.vocObj = new voiceService(async (status, val, next) => { | ||||||
|     }); |     // }); | ||||||
| 
 | 
 | ||||||
|     console.log('globalThis.singlePlay', globalThis.singlePlay) |     console.log('globalThis.singlePlay', globalThis.singlePlay) | ||||||
|     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { |     if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { | ||||||
|       setVideoParam() |       // setVideoParam() | ||||||
|  |       console.log('diyidiy') | ||||||
|       this.context.resourceManager.getRawFileContent("welcome.wav").then(value => { |       this.context.resourceManager.getRawFileContent("welcome.wav").then(value => { | ||||||
|         this.vocObj.playAudio({ |         this.avPlayer.playAudio(['welcome.wav']) | ||||||
|           type: 1, | 
 | ||||||
|           name: 'welcome.wav' |         // this.vocObj.playAudio({ | ||||||
|         }) |         //   type: 1, | ||||||
|  |         //   name: 'welcome.wav' | ||||||
|  |         // }) | ||||||
|         // let rawFile = value; |         // let rawFile = value; | ||||||
|       }).catch(error => { |       }).catch(error => { | ||||||
|         console.log("getRawFileContent promise error is " + error); |         console.log("getRawFileContent promise error is " + error); | ||||||
|  | |||||||
| @ -11,7 +11,7 @@ export default struct Index { | |||||||
|   @State hasAuth: boolean = false; |   @State hasAuth: boolean = false; | ||||||
|   @State url: string = '' |   @State url: string = '' | ||||||
|   @State @Watch('outClick') outFlag: boolean = false; |   @State @Watch('outClick') outFlag: boolean = false; | ||||||
|   private vocObj = null; |   // private vocObj = null; | ||||||
| 
 | 
 | ||||||
|   build() { |   build() { | ||||||
|     Column() { |     Column() { | ||||||
| @ -87,8 +87,8 @@ export default struct Index { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   aboutToAppear() { |   aboutToAppear() { | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |     // this.vocObj = new voiceService(async (status, val, next) => { | ||||||
|     }); |     // }); | ||||||
|     this.carNum = globalThis.carInfo.plateNo; |     this.carNum = globalThis.carInfo.plateNo; | ||||||
|     this.version = globalThis.version; |     this.version = globalThis.version; | ||||||
|     this.hasAuth = globalThis.hasAuth; |     this.hasAuth = globalThis.hasAuth; | ||||||
|  | |||||||
| @ -133,7 +133,9 @@ struct UserInfo { | |||||||
|     alignment: DialogAlignment.Center, |     alignment: DialogAlignment.Center, | ||||||
|   }, |   }, | ||||||
|   ) |   ) | ||||||
| 
 |   aboutToAppear(){ | ||||||
|  |     this.avPlayer = new VoiceAnnounce(); | ||||||
|  |   } | ||||||
|   async onPageShow() { |   async onPageShow() { | ||||||
|     this.startExam=false |     this.startExam=false | ||||||
|     this.updateTimeLimit = false |     this.updateTimeLimit = false | ||||||
| @ -216,7 +218,6 @@ struct UserInfo { | |||||||
| 
 | 
 | ||||||
|     this.isExamStart = false |     this.isExamStart = false | ||||||
|     this.sczbkf = []; |     this.sczbkf = []; | ||||||
|     this.avPlayer = new VoiceAnnounce(); |  | ||||||
|     initJudgeUdp() |     initJudgeUdp() | ||||||
| 
 | 
 | ||||||
|     //监听远程开始考试 |     //监听远程开始考试 | ||||||
|  | |||||||
| @ -51,9 +51,6 @@ export default struct TopLogo { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     console.log('jiangsong: topLogo aboutToAppear1111') |  | ||||||
|     this.vocObj = new voiceService(async (status, val, next) => { |  | ||||||
|     }); |  | ||||||
|     this.timeText = await getCurrentTime(); |     this.timeText = await getCurrentTime(); | ||||||
|     this.timer = setInterval(async () => { |     this.timer = setInterval(async () => { | ||||||
|       this.timeText = await getCurrentTime(); |       this.timeText = await getCurrentTime(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user