diff --git a/build-profile.json5 b/build-profile.json5 index cc014a42..7a576700 100644 --- a/build-profile.json5 +++ b/build-profile.json5 @@ -4,13 +4,13 @@ { "name": "default", "material": { - "certpath": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.cer", - "storePassword": "0000001B0C5B52D8C8C6F415D4216EAD2848AA4A376B36FD72006E4072C15BA3D11E6E65C0D1FFA92A6D86", + "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.cer", + "storePassword": "0000001BC865153A35BD7DDD2950D70622A2081C58D17D2F5BBE67AE83F469B41A05EED0BB09AA66043089", "keyAlias": "debugKey", - "keyPassword": "0000001B8DCA3C8913C86858A0CDEAEB6BEE0DC29FCE9932930CA1FFE68FFF84341736AADF81F056CDD683", - "profile": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p7b", + "keyPassword": "0000001BB839AC92D8CB8AF4765ADD271E687C74C82EC1D0ED2072093ADB1E831C3E99148406836748BCD7", + "profile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p7b", "signAlg": "SHA256withECDSA", - "storeFile": "/Users/surenjun/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p12" + "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/auto_ohos_default_subject-two_com.oh.dts.p12" } } ], diff --git a/entry/src/main/ets/mock/CandidateData.ts b/entry/src/main/ets/mock/CandidateData.ts index a2a98904..e338fcfe 100644 --- a/entry/src/main/ets/mock/CandidateData.ts +++ b/entry/src/main/ets/mock/CandidateData.ts @@ -1,4 +1,5 @@ import {User} from "../pages/interfaces" +// 候选人数据 export const CandidateData: Array = [ { sfzmhm: '342323199501470011', diff --git a/entry/src/main/ets/mock/VideoData.ets b/entry/src/main/ets/mock/VideoData.ets new file mode 100644 index 00000000..48271ee9 --- /dev/null +++ b/entry/src/main/ets/mock/VideoData.ets @@ -0,0 +1,35 @@ +import { VideoConfig } from '../pages/interfaces' + +// 视频配置默认数据 +export const VideoConfigData: VideoConfig = { + videoNum: '1', + spls: '1', + wz: '0,0', + faceFlag: false, + shuiying: true, + pztd: '2', + ljlx: '', + ip: '192.168.36.94', + port: '554', + userName: 'admin', + pwd: '12345qwe', + td1: '1', + td2: '2', + td3: '3', + td4: '4', + videoRecord1: false, + videoRecord2: true, + videoRecord3: false, + videoRecord4: false, + text1: '', + text2: '', + text3: '', + dolt: '', + fontSize: '', + rlls: '1', + spzd4: false, + spzd3: false, + spzd2: false, + spzd1: false, + zdyz: '5', +} \ No newline at end of file diff --git a/entry/src/main/ets/mock/index.ets b/entry/src/main/ets/mock/index.ets new file mode 100644 index 00000000..61cf6ef0 --- /dev/null +++ b/entry/src/main/ets/mock/index.ets @@ -0,0 +1,3 @@ +export * from "./CandidateData" + +export * from "./VideoData" \ No newline at end of file diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index ffb24321..fc7d49ae 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -13,7 +13,7 @@ import common from '@ohos.app.ability.common'; import { User, VideoConfig } from './interfaces'; import WebRTCVoice from './webRTC/'; import promptAction from '@ohos.promptAction'; -import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData'; +import { CandidateData, EmptyCandidateObject } from '../mock'; import { getSyncData } from '../common/service/initable'; @Entry diff --git a/entry/src/main/ets/pages/VideoConfig.ets b/entry/src/main/ets/pages/VideoConfig.ets index cc30d8dd..4bef36a6 100644 --- a/entry/src/main/ets/pages/VideoConfig.ets +++ b/entry/src/main/ets/pages/VideoConfig.ets @@ -1,10 +1,12 @@ -import TopLogo from './compontents/topLogo' -import FileUtil from '../common/utils/File' -import { VideoConfig } from './interfaces' +import TopLogo from './compontents/topLogo'; +import FileUtil from '../common/utils/File'; +import { VideoConfig } from './interfaces'; import common from '@ohos.app.ability.common'; -import promptAction from '@ohos.promptAction' -import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService' -import { GlobalConfig } from '../config/index' +import promptAction from '@ohos.promptAction'; +import { endRecordVideo, startRecordVideo, takePhoto } from '../common/service/videoService'; +import { GlobalConfig } from '../config/index'; +import { VideoConfigData } from '../mock'; + @Entry @Component struct Index { @@ -13,100 +15,37 @@ struct Index { @State previewUri: Resource = $r('app.media.2_nor') @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X @State inputFontSize: number = 10 //12 - @State rocordHandleObj:any = { - rocord_handle1:0, - rocord_handle2:0, - rocord_handle3:0, - rocord_handle4:0 + @State rocordHandleObj: any = { + rocord_handle1: 0, + rocord_handle2: 0, + rocord_handle3: 0, + rocord_handle4: 0 } @State isAutoPlay: boolean = true @State showFlag: boolean = false - private vocObj = null; @State showControls: boolean = false - private fileUtil: FileUtil @State @Watch('outClick') outFlag: boolean = false; - @State oldParam: VideoConfig = { - videoNum:'1', - spls: '1', - wz: '0,0', - faceFlag: false, - shuiying: true, - pztd: '2', - ljlx: '', - ip: '192.168.36.94', - port: '554', - userName: 'admin', - pwd: '12345qwe', - td1: '1', - td2: '2', - td3: '3', - td4: '4', - videoRecord1: false, - videoRecord2: true, - videoRecord3: false, - videoRecord4: false, - text1: '', - text2: '', - text3: '', - dolt: '', - fontSize: '', - rlls: '1', - spzd4:false, - spzd3:false, - spzd2:false, - spzd1:false, - zdyz:'5', - } - @State param: VideoConfig = { - videoNum:'1', - spls: '1', - wz: '0,0', - faceFlag: false, - shuiying: true, - pztd: '2', - ljlx: '', - ip: '192.168.36.94', - port: '554', - userName: 'admin', - pwd: '12345qwe', - td1: '1', - td2: '2', - td3: '3', - td4: '4', - videoRecord1: false, - videoRecord2: true, - videoRecord3: false, - videoRecord4: false, - text1: '', - text2: '', - text3: '', - dolt: '', - fontSize: '', - rlls: '1', - spzd4:false, - spzd3:false, - spzd2:false, - spzd1:false, - zdyz:'5', - } + @State oldParam: VideoConfig = VideoConfigData + @State param: VideoConfig = VideoConfigData @State openFlag: boolean = true @State lsArr: Array = [ - {key:'第一路'}, - {key:'第二路'}, - {key:'第三路'}, - {key:'第四路'}, + { key: '第一路' }, + { key: '第二路' }, + { key: '第三路' }, + { key: '第四路' }, ] - + private vocObj = null; + private fileUtil: FileUtil private context = getContext(this) as common.UIAbilityContext; private controller1: VideoController = new VideoController() private controller2: VideoController = new VideoController() private controller3: VideoController = new VideoController() private controller4: VideoController = new VideoController() @State videoArr: Array = [ - {td:'td1',controller:this.controller1,src:''}, - {td:'td2',controller:this.controller2,src:''}, - {td:'td3',controller:this.controller3,src:''}, - {td:'td4',controller:this.controller4,src:''}, + { td: 'td1', controller: this.controller1, src: '' }, + { td: 'td2', controller: this.controller2, src: '' }, + { td: 'td3', controller: this.controller3, src: '' }, + { td: 'td4', controller: this.controller4, src: '' }, ] private inputController: TextInputController = new TextInputController() @@ -114,8 +53,8 @@ struct Index { Column() { TopLogo({ outFlag: $outFlag }) Flex({ justifyContent: FlexAlign.SpaceBetween }) { - Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row}) { - ForEach(this.videoArr,(item,index)=>{ + Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row }) { + ForEach(this.videoArr, (item, index) => { Video({ src: this.openFlag ? `rtsp://${this.param.userName}:${this.param.pwd}@${this.param.ip}:${this.param.port}/h264/ch${this.param[item.td]}/main/av_stream` : '', currentProgressRate: this.curRate, @@ -128,7 +67,7 @@ struct Index { .controls(this.showControls) .margin(10 * this.ratio) }) - }.margin({ top: 37 * this.ratio, left: 30 * this.ratio }).width(600*this.ratio).height(600*this.ratio) + }.margin({ top: 37 * this.ratio, left: 30 * this.ratio }).width(600 * this.ratio).height(600 * this.ratio) Column() { Image($r('app.media.shezhi')) @@ -170,7 +109,7 @@ struct Index { .margin({ bottom: 10 * this.ratio }) .onClick(() => { for (let i = 1; i <= 4; i++) { - console.log('rocord_handle',i,JSON.stringify(this.rocordHandleObj)) + console.log('rocord_handle', i, JSON.stringify(this.rocordHandleObj)) if (this.rocordHandleObj['rocord_handle'+i]) { endRecordVideo(this.rocordHandleObj['rocord_handle'+i]) this.rocordHandleObj['rocord_handle'+i] = 0 @@ -185,16 +124,16 @@ struct Index { .width(215 * this.ratio) .height(64 * this.ratio) .onClick(async () => { - const arr=['1','2','3','4'] - if(!arr.includes(this.param.pztd)){ + const arr = ['1', '2', '3', '4'] + if (!arr.includes(this.param.pztd)) { promptAction.showToast({ message: '请填写正确的拍照通道', duration: 3000 }) return } - try{ - await takePhoto(this.param,this.context,'pz/') + try { + await takePhoto(this.param, this.context, 'pz/') promptAction.showToast({ message: '抓图完成', duration: 3000 @@ -203,8 +142,8 @@ struct Index { // console.log('daihai err: ' + err) // }) - }catch (error){ - console.log('daihai',error) + } catch (error) { + console.log('daihai', error) } }) @@ -319,9 +258,10 @@ struct Index { .width(34 * this.ratio) .height(26 * this.ratio) .fontSize(this.inputFontSize * this.ratio) - .margin({ left: 10 * this.ratio, right: 15 * this.ratio }).onChange((value: string) => { - this.param.zdyz = value - }) + .margin({ left: 10 * this.ratio, right: 15 * this.ratio }) + .onChange((value: string) => { + this.param.zdyz = value + }) // Text('k').fontColor('#333333').fontSize(16 * this.ratio) // Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio) // TextInput({ text: this.param.ljlx, controller: this.inputController }) @@ -339,6 +279,7 @@ struct Index { Row() { Row() { }.width(70 * this.ratio) + Text('IP地址') .width(158 * this.ratio) .fontSize(16 * this.ratio) @@ -371,7 +312,7 @@ struct Index { .textAlign(TextAlign.Center) } - ForEach(this.lsArr,(item,index)=>{ + ForEach(this.lsArr, (item, index) => { Row() { Text(item.key) .width(70 * this.ratio) @@ -389,7 +330,7 @@ struct Index { .onChange((value: string) => { this.param.ip = value }) - TextInput({ text: this.param['td'+(Number(index)+1)], controller: this.inputController }) + TextInput({ text: this.param['td'+(Number(index) + 1)], controller: this.inputController }) .type(InputType.Normal) .borderRadius(2) .width(96 * this.ratio) @@ -398,7 +339,7 @@ struct Index { .margin({ right: 10 * this.ratio }) .fontSize(this.inputFontSize * this.ratio) .onChange((value: string) => { - this.param['td'+(Number(index)+1)] = value + this.param['td'+(Number(index) + 1)] = value }) TextInput({ text: this.param.userName, controller: this.inputController }) .type(InputType.Normal) @@ -498,7 +439,7 @@ struct Index { .width(22 * this.ratio) .height(22 * this.ratio) .onChange((value: boolean) => { - this.param.spzd1=value + this.param.spzd1 = value }) Text('一路').fontSize(16 * this.ratio).fontColor('#333333') Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) @@ -506,7 +447,7 @@ struct Index { .width(22 * this.ratio) .height(22 * this.ratio) .onChange((value: boolean) => { - this.param.spzd2=value + this.param.spzd2 = value }) Text('二路').fontSize(16 * this.ratio).fontColor('#333333') } @@ -517,7 +458,7 @@ struct Index { .width(22 * this.ratio) .height(22 * this.ratio) .onChange((value: boolean) => { - this.param.spzd3=value + this.param.spzd3 = value }) Text('三路').fontSize(16 * this.ratio).fontColor('#333333') Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) @@ -525,7 +466,7 @@ struct Index { .width(22 * this.ratio) .height(22 * this.ratio) .onChange((value: boolean) => { - this.param.spzd4=value + this.param.spzd4 = value }) Text('四路').fontSize(16 * this.ratio).fontColor('#333333') } @@ -620,27 +561,31 @@ struct Index { this.fileUtil = fileUtil this.getVideoConfig() } - async getfilehandleCode(td){ - const record_handle = await startRecordVideo(this.param,td,this.context,'lp') - this.rocordHandleObj['rocord_handle'+td]=record_handle + + async getfilehandleCode(td) { + const record_handle = await startRecordVideo(this.param, td, this.context, 'lp') + this.rocordHandleObj['rocord_handle'+td] = record_handle } + outClick() { this.openFlag = false } + sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)) + async onPageShow() { } async getVideoConfig() { - const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress+'/config/config3.txt'); + const data = await this.fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/config3.txt'); this.oldParam = JSON.parse(data) this.param = JSON.parse(data) } async writeConfig() { this.oldParam = JSON.parse(JSON.stringify(this.param)) - this.videoArr=JSON.parse(JSON.stringify(this.videoArr)) - console.log('kkkk',JSON.stringify(this.param)) + this.videoArr = JSON.parse(JSON.stringify(this.videoArr)) + console.log('kkkk', JSON.stringify(this.param)) const folderPath = await this.fileUtil.initFolder(`/config`); this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite') this.showFlag = false diff --git a/entry/src/main/module.json5 b/entry/src/main/module.json5 index f32cc5b7..cc86565c 100644 --- a/entry/src/main/module.json5 +++ b/entry/src/main/module.json5 @@ -75,12 +75,12 @@ { "name": "ohos.permission.MEDIA_LOCATION" }, - { - "name": "ohos.permission.WRITE_MEDIA" - }, - { - "name": "ohos.permission.READ_MEDIA" - }, + { + "name": "ohos.permission.WRITE_MEDIA" + }, + { + "name": "ohos.permission.READ_MEDIA" + }, { "name": "ohos.permission.WRITE_IMAGEVIDEO", "usedScene": { @@ -99,26 +99,26 @@ "when": "always" } }, -// { -// "name": "ohos.permission.READ_MEDIA", -// "reason": "$string:module_desc", -// "usedScene": { -// "abilities": [ -// "MainAbility" -// ], -// "when": "always" -// } -// }, -// { -// "name": "ohos.permission.WRITE_MEDIA", -// "reason": "$string:module_desc", -// "usedScene": { -// "abilities": [ -// "MainAbility" -// ], -// "when": "always" -// } -// }, + // { + // "name": "ohos.permission.READ_MEDIA", + // "reason": "$string:module_desc", + // "usedScene": { + // "abilities": [ + // "MainAbility" + // ], + // "when": "always" + // } + // }, + // { + // "name": "ohos.permission.WRITE_MEDIA", + // "reason": "$string:module_desc", + // "usedScene": { + // "abilities": [ + // "MainAbility" + // ], + // "when": "always" + // } + // }, { "name": "ohos.permission.FILE_ACCESS_MANAGER", "reason": "$string:module_desc",