diff --git a/entry/src/main/ets/common/utils/request.ts b/entry/src/main/ets/common/utils/request.ts index 489b2745..c7082726 100644 --- a/entry/src/main/ets/common/utils/request.ts +++ b/entry/src/main/ets/common/utils/request.ts @@ -39,7 +39,7 @@ export default async function request(req: any) { try { let baseUrl=host?host:globalThis.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}); // fileUtil.editFile(`${folderPath}/request.txt`, JSON.stringify(arrList)) // writeLog({ diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 37d48153..dcd684d7 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -39,7 +39,7 @@ export default struct Index { private vocObj = null; // private AccountTable = new AccountTable(()=>{},CommonConstants); - onPageShow() { + aboutToAppear() { const that = this this.vocObj = new voiceService(async (status, val, next) => { if (!that.breakFlag) { diff --git a/entry/src/main/ets/pages/ExaminerLogin.ets b/entry/src/main/ets/pages/ExaminerLogin.ets index a62e8ec7..95dd9122 100644 --- a/entry/src/main/ets/pages/ExaminerLogin.ets +++ b/entry/src/main/ets/pages/ExaminerLogin.ets @@ -4,7 +4,7 @@ import { examinerLoginService } from '../common/service/ExaminerService'; import Md5 from '../common/utils/md5'; import promptAction from '@ohos.promptAction'; import errorMsgDialog from './compontents/errorMsgDialog' -import { voiceService } from '../common/service/voiceService'; +// import { voiceService } from '../common/service/voiceService'; import imageBtn from './compontents/imageBtn' @Entry @@ -18,7 +18,7 @@ export default struct Index { @State currentInputIndex: number = 0 @State limit: boolean = false @State @Watch('outClick') outFlag: boolean = false; - private vocObj = null; + // private vocObj = null; private title = '' private type = '2' errorDialog: CustomDialogController = new CustomDialogController({ @@ -181,8 +181,8 @@ export default struct Index { } onPageShow() { - this.vocObj = new voiceService(async (status, val, next) => { - }); + // this.vocObj = new voiceService(async (status, val, next) => { + // }); } outClick() { diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index f189d662..0fcf06bf 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -22,6 +22,7 @@ import UdpEvent from '../common/utils/UdpEvent' import UIAbility from '@ohos.app.ability.UIAbility'; import { endRecordVideo, getUserAlbumItemByDisplayName, saveStartRecordVideo } from '../common/service/videoService'; import imageBtn from './compontents/imageBtn' +import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; // import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; @@ -45,7 +46,8 @@ struct Index { fileHelper = null; private fileUtil: FileUtil private interval = null; - private vocObj = null; + // private vocObj = null; + private avPlayer private workerInstance = null; private context = getContext(this) as common.UIAbilityContext; errorDialog: CustomDialogController = new CustomDialogController({ @@ -332,6 +334,8 @@ struct Index { } async aboutToAppear() { + console.log('diyidiy') + this.avPlayer = new VoiceAnnounce(); this.initParamFlag=false this.dialogVisiable = false this.angle = 0 @@ -341,6 +345,10 @@ struct Index { globalThis.udpEvent = new UdpEvent(); } + aboutToDisappear() { + // this.vocObj && this.vocObj.releasePlayer() + } + async testXMLToJSONInWorker() { if (this.loading) { return @@ -431,23 +439,25 @@ struct Index { globalThis.udpClient2.sendMsgExt(param, this.context) } } - async onPageShow() { console.log('ttttt', 1111) await this.userAuth(); 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) if (globalThis.singlePlay == undefined || globalThis.singlePlay == null) { - setVideoParam() + // setVideoParam() + console.log('diyidiy') this.context.resourceManager.getRawFileContent("welcome.wav").then(value => { - this.vocObj.playAudio({ - type: 1, - name: 'welcome.wav' - }) + this.avPlayer.playAudio(['welcome.wav']) + + // this.vocObj.playAudio({ + // type: 1, + // name: 'welcome.wav' + // }) // let rawFile = value; }).catch(error => { console.log("getRawFileContent promise error is " + error); diff --git a/entry/src/main/ets/pages/Settings.ets b/entry/src/main/ets/pages/Settings.ets index 9d533ce8..3a0a5c26 100644 --- a/entry/src/main/ets/pages/Settings.ets +++ b/entry/src/main/ets/pages/Settings.ets @@ -11,7 +11,7 @@ export default struct Index { @State hasAuth: boolean = false; @State url: string = '' @State @Watch('outClick') outFlag: boolean = false; - private vocObj = null; + // private vocObj = null; build() { Column() { @@ -87,8 +87,8 @@ export default struct Index { } aboutToAppear() { - this.vocObj = new voiceService(async (status, val, next) => { - }); + // this.vocObj = new voiceService(async (status, val, next) => { + // }); this.carNum = globalThis.carInfo.plateNo; this.version = globalThis.version; this.hasAuth = globalThis.hasAuth; diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 07c9ca69..2c990353 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -133,7 +133,9 @@ struct UserInfo { alignment: DialogAlignment.Center, }, ) - + aboutToAppear(){ + this.avPlayer = new VoiceAnnounce(); + } async onPageShow() { this.startExam=false this.updateTimeLimit = false @@ -216,7 +218,6 @@ struct UserInfo { this.isExamStart = false this.sczbkf = []; - this.avPlayer = new VoiceAnnounce(); initJudgeUdp() //监听远程开始考试 diff --git a/entry/src/main/ets/pages/compontents/TopLogo.ets b/entry/src/main/ets/pages/compontents/TopLogo.ets index 4bd727d1..5448c8b0 100644 --- a/entry/src/main/ets/pages/compontents/TopLogo.ets +++ b/entry/src/main/ets/pages/compontents/TopLogo.ets @@ -51,9 +51,6 @@ export default struct TopLogo { } async aboutToAppear() { - console.log('jiangsong: topLogo aboutToAppear1111') - this.vocObj = new voiceService(async (status, val, next) => { - }); this.timeText = await getCurrentTime(); this.timer = setInterval(async () => { this.timeText = await getCurrentTime();