Compare commits

...

6 Commits

Author SHA1 Message Date
0c89302ef9 依赖删除 2024-06-04 16:19:20 +08:00
8e6ca1a051 合并 2024-06-04 16:01:54 +08:00
84dafffd17 Merge pull request 'fix:提交视频文件mock数据' (#15) from wangzhongjie into main
Reviewed-on: #15
2024-06-04 15:04:36 +08:00
wangzhongjie
d30b6d67ab fix:提交视频文件mock数据 2024-06-04 15:08:27 +08:00
wangzhongjie
8ec6377f77 fix:提交视频文件mock数据 2024-06-04 15:04:30 +08:00
cce66ee074 Merge pull request 'fix:提交视频文件mock数据' (#14) from wangzhongjie into main
Reviewed-on: #14
2024-06-04 15:01:04 +08:00
8 changed files with 127 additions and 151 deletions

View File

@ -1,4 +1,5 @@
import {User} from "../pages/interfaces" import {User} from "../pages/interfaces"
// 候选人数据
export const CandidateData: Array<User> = [ export const CandidateData: Array<User> = [
{ {
sfzmhm: '342323199501470011', sfzmhm: '342323199501470011',

View File

@ -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',
}

View File

@ -0,0 +1,3 @@
export * from "./CandidateData"
export * from "./VideoData"

View File

@ -21,6 +21,7 @@ import {
} from '../common/service/indexService'; } from '../common/service/indexService';
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import promptAction from '@ohos.promptAction'; import promptAction from '@ohos.promptAction';
import { VideoConfigData } from '../mock';
@Entry @Entry
@Component @Component

View File

@ -92,9 +92,4 @@ export default struct Index {
outClick() { outClick() {
} }
saveLog() {
// this.FileLog.initFileLogo('d .0ateLog')
// this.FileLog.createFile('123')
}
} }

View File

@ -19,7 +19,7 @@ import {string2Bytes} from '../common/utils/tools'
import { getSyncData } from '../common/service/initable' import { getSyncData } from '../common/service/initable'
@Entry @Entry
@Component @Component
struct UserInfo { export default struct UserInfo {
@State pageIndex: number = 0 @State pageIndex: number = 0
@State ratio: number = 1700 / 960 @State ratio: number = 1700 / 960
@State index: number = 0 @State index: number = 0
@ -276,7 +276,7 @@ struct UserInfo {
that.getExaminationStudentInfoFn() that.getExaminationStudentInfoFn()
} }
}, 5000) }, 5000)
}else{ } else {
this.getExaminationItemFn() this.getExaminationItemFn()
} }
@ -411,10 +411,10 @@ struct UserInfo {
lsh: this.currentUser.lsh || '', lsh: this.currentUser.lsh || '',
examinationRoomId examinationRoomId
}); });
if(examItems?.getExaminationItemRsp?.body?.kssycs!=0){ if (examItems?.getExaminationItemRsp?.body?.kssycs != 0) {
this.getExaminationStudentInfoFn() this.getExaminationStudentInfoFn()
}else{ } else {
this.dataList=[] this.dataList = []
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
} }

View File

@ -1,10 +1,12 @@
import TopLogo from './compontents/TopLogo' import TopLogo from './compontents/topLogo';
import FileUtil from '../common/utils/File' import FileUtil from '../common/utils/File';
import { VideoConfig } from './interfaces' import { VideoConfig } from './interfaces';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import promptAction from '@ohos.promptAction' import promptAction from '@ohos.promptAction';
import { startRecordVideo, endRecordVideo,takePhoto } from '../common/service/videoService' import { endRecordVideo, startRecordVideo, takePhoto } from '../common/service/videoService';
import { GlobalConfig } from '../config/index' import { GlobalConfig } from '../config/index';
import { VideoConfigData } from '../mock';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@ -13,100 +15,36 @@ struct Index {
@State previewUri: Resource = $r('app.media.2_nor') @State previewUri: Resource = $r('app.media.2_nor')
@State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X
@State inputFontSize: number = 10 //12 @State inputFontSize: number = 10 //12
@State rocordHandleObj:any = { @State rocordHandleObj: any = {
rocord_handle1:0, rocord_handle1: 0,
rocord_handle2:0, rocord_handle2: 0,
rocord_handle3:0, rocord_handle3: 0,
rocord_handle4:0 rocord_handle4: 0
} }
@State isAutoPlay: boolean = true @State isAutoPlay: boolean = true
@State showFlag: boolean = false @State showFlag: boolean = false
private vocObj = null;
@State showControls: boolean = false @State showControls: boolean = false
private fileUtil: FileUtil
@State @Watch('outClick') outFlag: boolean = false; @State @Watch('outClick') outFlag: boolean = false;
@State oldParam: VideoConfig = { @State oldParam: VideoConfig = VideoConfigData
videoNum:'1', @State param: VideoConfig = VideoConfigData
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 openFlag: boolean = true @State openFlag: boolean = true
@State lsArr: Array<any> = [ @State lsArr: Array<any> = [
{key:'第一路'}, { key: '第一路' },
{key:'第二路'}, { key: '第二路' },
{key:'第三路'}, { key: '第三路' },
{key:'第四路'}, { key: '第四路' },
] ]
private fileUtil: FileUtil
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private controller1: VideoController = new VideoController() private controller1: VideoController = new VideoController()
private controller2: VideoController = new VideoController() private controller2: VideoController = new VideoController()
private controller3: VideoController = new VideoController() private controller3: VideoController = new VideoController()
private controller4: VideoController = new VideoController() private controller4: VideoController = new VideoController()
@State videoArr: Array<any> = [ @State videoArr: Array<any> = [
{td:'td1',controller:this.controller1,src:''}, { td: 'td1', controller: this.controller1, src: '' },
{td:'td2',controller:this.controller2,src:''}, { td: 'td2', controller: this.controller2, src: '' },
{td:'td3',controller:this.controller3,src:''}, { td: 'td3', controller: this.controller3, src: '' },
{td:'td4',controller:this.controller4,src:''}, { td: 'td4', controller: this.controller4, src: '' },
] ]
private inputController: TextInputController = new TextInputController() private inputController: TextInputController = new TextInputController()
@ -114,8 +52,8 @@ struct Index {
Column() { Column() {
TopLogo({ outFlag: $outFlag }) TopLogo({ outFlag: $outFlag })
Flex({ justifyContent: FlexAlign.SpaceBetween }) { Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Flex({wrap:FlexWrap.Wrap,direction:FlexDirection.Row}) { Flex({ wrap: FlexWrap.Wrap, direction: FlexDirection.Row }) {
ForEach(this.videoArr,(item,index)=>{ ForEach(this.videoArr, (item, index) => {
Video({ 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` : '', 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, currentProgressRate: this.curRate,
@ -128,7 +66,7 @@ struct Index {
.controls(this.showControls) .controls(this.showControls)
.margin(10 * this.ratio) .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() { Column() {
Image($r('app.media.shezhi')) Image($r('app.media.shezhi'))
@ -170,7 +108,7 @@ struct Index {
.margin({ bottom: 10 * this.ratio }) .margin({ bottom: 10 * this.ratio })
.onClick(() => { .onClick(() => {
for (let i = 1; i <= 4; i++) { 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]) { if (this.rocordHandleObj['rocord_handle'+i]) {
endRecordVideo(this.rocordHandleObj['rocord_handle'+i]) endRecordVideo(this.rocordHandleObj['rocord_handle'+i])
this.rocordHandleObj['rocord_handle'+i] = 0 this.rocordHandleObj['rocord_handle'+i] = 0
@ -185,16 +123,16 @@ struct Index {
.width(215 * this.ratio) .width(215 * this.ratio)
.height(64 * this.ratio) .height(64 * this.ratio)
.onClick(async () => { .onClick(async () => {
const arr=['1','2','3','4'] const arr = ['1', '2', '3', '4']
if(!arr.includes(this.param.pztd)){ if (!arr.includes(this.param.pztd)) {
promptAction.showToast({ promptAction.showToast({
message: '请填写正确的拍照通道', message: '请填写正确的拍照通道',
duration: 3000 duration: 3000
}) })
return return
} }
try{ try {
await takePhoto(this.param,this.context,'pz/') await takePhoto(this.param, this.context, 'pz/')
promptAction.showToast({ promptAction.showToast({
message: '抓图完成', message: '抓图完成',
duration: 3000 duration: 3000
@ -203,8 +141,8 @@ struct Index {
// console.log('daihai err: ' + err) // console.log('daihai err: ' + err)
// }) // })
}catch (error){ } catch (error) {
console.log('daihai',error) console.log('daihai', error)
} }
}) })
@ -319,9 +257,10 @@ struct Index {
.width(34 * this.ratio) .width(34 * this.ratio)
.height(26 * this.ratio) .height(26 * this.ratio)
.fontSize(this.inputFontSize * this.ratio) .fontSize(this.inputFontSize * this.ratio)
.margin({ left: 10 * this.ratio, right: 15 * this.ratio }).onChange((value: string) => { .margin({ left: 10 * this.ratio, right: 15 * this.ratio })
this.param.zdyz = value .onChange((value: string) => {
}) this.param.zdyz = value
})
// Text('k').fontColor('#333333').fontSize(16 * this.ratio) // Text('k').fontColor('#333333').fontSize(16 * this.ratio)
// Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio) // Text('链接类型').fontColor('#333333').fontSize(16 * this.ratio)
// TextInput({ text: this.param.ljlx, controller: this.inputController }) // TextInput({ text: this.param.ljlx, controller: this.inputController })
@ -339,6 +278,7 @@ struct Index {
Row() { Row() {
Row() { Row() {
}.width(70 * this.ratio) }.width(70 * this.ratio)
Text('IP地址') Text('IP地址')
.width(158 * this.ratio) .width(158 * this.ratio)
.fontSize(16 * this.ratio) .fontSize(16 * this.ratio)
@ -371,7 +311,7 @@ struct Index {
.textAlign(TextAlign.Center) .textAlign(TextAlign.Center)
} }
ForEach(this.lsArr,(item,index)=>{ ForEach(this.lsArr, (item, index) => {
Row() { Row() {
Text(item.key) Text(item.key)
.width(70 * this.ratio) .width(70 * this.ratio)
@ -389,7 +329,7 @@ struct Index {
.onChange((value: string) => { .onChange((value: string) => {
this.param.ip = value 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) .type(InputType.Normal)
.borderRadius(2) .borderRadius(2)
.width(96 * this.ratio) .width(96 * this.ratio)
@ -398,7 +338,7 @@ struct Index {
.margin({ right: 10 * this.ratio }) .margin({ right: 10 * this.ratio })
.fontSize(this.inputFontSize * this.ratio) .fontSize(this.inputFontSize * this.ratio)
.onChange((value: string) => { .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 }) TextInput({ text: this.param.userName, controller: this.inputController })
.type(InputType.Normal) .type(InputType.Normal)
@ -498,7 +438,7 @@ struct Index {
.width(22 * this.ratio) .width(22 * this.ratio)
.height(22 * this.ratio) .height(22 * this.ratio)
.onChange((value: boolean) => { .onChange((value: boolean) => {
this.param.spzd1=value this.param.spzd1 = value
}) })
Text('一路').fontSize(16 * this.ratio).fontColor('#333333') Text('一路').fontSize(16 * this.ratio).fontColor('#333333')
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
@ -506,7 +446,7 @@ struct Index {
.width(22 * this.ratio) .width(22 * this.ratio)
.height(22 * this.ratio) .height(22 * this.ratio)
.onChange((value: boolean) => { .onChange((value: boolean) => {
this.param.spzd2=value this.param.spzd2 = value
}) })
Text('二路').fontSize(16 * this.ratio).fontColor('#333333') Text('二路').fontSize(16 * this.ratio).fontColor('#333333')
} }
@ -517,7 +457,7 @@ struct Index {
.width(22 * this.ratio) .width(22 * this.ratio)
.height(22 * this.ratio) .height(22 * this.ratio)
.onChange((value: boolean) => { .onChange((value: boolean) => {
this.param.spzd3=value this.param.spzd3 = value
}) })
Text('三路').fontSize(16 * this.ratio).fontColor('#333333') Text('三路').fontSize(16 * this.ratio).fontColor('#333333')
Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) Checkbox({ name: 'checkbox1', group: 'checkboxGroup' })
@ -525,7 +465,7 @@ struct Index {
.width(22 * this.ratio) .width(22 * this.ratio)
.height(22 * this.ratio) .height(22 * this.ratio)
.onChange((value: boolean) => { .onChange((value: boolean) => {
this.param.spzd4=value this.param.spzd4 = value
}) })
Text('四路').fontSize(16 * this.ratio).fontColor('#333333') Text('四路').fontSize(16 * this.ratio).fontColor('#333333')
} }
@ -620,27 +560,31 @@ struct Index {
this.fileUtil = fileUtil this.fileUtil = fileUtil
this.getVideoConfig() this.getVideoConfig()
} }
async getfilehandleCode(td){
const record_handle = await startRecordVideo(this.param,td,this.context,'lp') async getfilehandleCode(td) {
this.rocordHandleObj['rocord_handle'+td]=record_handle const record_handle = await startRecordVideo(this.param, td, this.context, 'lp')
this.rocordHandleObj['rocord_handle'+td] = record_handle
} }
outClick() { outClick() {
this.openFlag = false this.openFlag = false
} }
sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay)) sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay))
async onPageShow() { async onPageShow() {
} }
async getVideoConfig() { 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.oldParam = JSON.parse(data)
this.param = JSON.parse(data) this.param = JSON.parse(data)
} }
async writeConfig() { async writeConfig() {
this.oldParam = JSON.parse(JSON.stringify(this.param)) this.oldParam = JSON.parse(JSON.stringify(this.param))
this.videoArr=JSON.parse(JSON.stringify(this.videoArr)) this.videoArr = JSON.parse(JSON.stringify(this.videoArr))
console.log('kkkk',JSON.stringify(this.param)) console.log('kkkk', JSON.stringify(this.param))
const folderPath = await this.fileUtil.initFolder(`/config`); const folderPath = await this.fileUtil.initFolder(`/config`);
this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite') this.fileUtil.addFile(`${folderPath}/config3.txt`, JSON.stringify(this.param), 'overWrite')
this.showFlag = false this.showFlag = false

View File

@ -7,9 +7,6 @@
"deviceTypes": [ "deviceTypes": [
"default", "default",
"tablet", "tablet",
"pad",
"wearable",
"car",
], ],
"deliveryWithInstall": true, "deliveryWithInstall": true,
"installationFree": false, "installationFree": false,
@ -78,12 +75,12 @@
{ {
"name": "ohos.permission.MEDIA_LOCATION" "name": "ohos.permission.MEDIA_LOCATION"
}, },
{ {
"name": "ohos.permission.WRITE_MEDIA" "name": "ohos.permission.WRITE_MEDIA"
}, },
{ {
"name": "ohos.permission.READ_MEDIA" "name": "ohos.permission.READ_MEDIA"
}, },
{ {
"name": "ohos.permission.WRITE_IMAGEVIDEO", "name": "ohos.permission.WRITE_IMAGEVIDEO",
"usedScene": { "usedScene": {
@ -102,26 +99,26 @@
"when": "always" "when": "always"
} }
}, },
// { // {
// "name": "ohos.permission.READ_MEDIA", // "name": "ohos.permission.READ_MEDIA",
// "reason": "$string:module_desc", // "reason": "$string:module_desc",
// "usedScene": { // "usedScene": {
// "abilities": [ // "abilities": [
// "MainAbility" // "MainAbility"
// ], // ],
// "when": "always" // "when": "always"
// } // }
// }, // },
// { // {
// "name": "ohos.permission.WRITE_MEDIA", // "name": "ohos.permission.WRITE_MEDIA",
// "reason": "$string:module_desc", // "reason": "$string:module_desc",
// "usedScene": { // "usedScene": {
// "abilities": [ // "abilities": [
// "MainAbility" // "MainAbility"
// ], // ],
// "when": "always" // "when": "always"
// } // }
// }, // },
{ {
"name": "ohos.permission.FILE_ACCESS_MANAGER", "name": "ohos.permission.FILE_ACCESS_MANAGER",
"reason": "$string:module_desc", "reason": "$string:module_desc",