Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhaojunkai
2024-04-01 18:19:35 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a78525d6080d7d4cb1de914751510ad799c3143e
a78525d6
1 parent
33432bdd
更改
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
288 additions
and
282 deletions
sight_harmony/build-profile.json5
sight_harmony/features/wdComponent/Index.ets
sight_harmony/features/wdComponent/src/main/ets/components/AudioDetailComponent.ets
sight_harmony/products/phone/src/main/ets/components/AVPlayer.ets
sight_harmony/products/phone/src/main/ets/pages/detail/AudioDetail.ets
sight_harmony/products/phone/src/main/ets/pages/viewModel/Song.ets
sight_harmony/build-profile.json5
View file @
a78525d
...
...
@@ -5,13 +5,13 @@
"name"
:
"default"
,
"type"
:
"HarmonyOS"
,
"material"
:
{
"certpath"
:
"/Users/jrl/.ohos/config/auto_debug_sight_harmony_com.wondertek.sight_2850086000431478878.cer"
,
"storePassword"
:
"0000001B1B59DAB22B389A8BCD25A2C43C89DE581FD6AC3EEE1D3FC227D46727A7763AAE553A50B5E81310"
,
"certpath"
:
"C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.cer"
,
"storePassword"
:
"0000001AB256FAF47AA4D68E4841C95D357490DE9FBB26A3A9161AD3069E31B3623E25CB49409CCA9CF7"
,
"keyAlias"
:
"debugKey"
,
"keyPassword"
:
"0000001B2B0EDD642E43906A1B9A6B72A79F40316E908829B79DD96467FE5C3A8D1DF9E40957DA733DF77F"
,
"profile"
:
"/Users/jrl/.ohos/config/auto_debug_sight_harmony_com.wondertek.sight_2850086000431478878.p7b"
,
"keyPassword"
:
"0000001AFB06818C2BC8DC275326668AAC62B91EBF7D3F84E8BE0F156D02623AA0F4F8C6B73F362CB371"
,
"profile"
:
"C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=.p7b"
,
"signAlg"
:
"SHA256withECDSA"
,
"storeFile"
:
"
/Users/jrl/.ohos/config/auto_debug_sight_harmony_com.wondertek.sight_2850086000431478878
.p12"
"storeFile"
:
"
C:\\Users\\pc\\.ohos\\config\\default_sight_harmony_l75MehGV9G3TUayEtL68-EIWqyYDqfVXfu9D-DPJ7I0=
.p12"
}
}
],
...
...
sight_harmony/features/wdComponent/Index.ets
View file @
a78525d
...
...
@@ -53,3 +53,5 @@ export { HeadPictureCardComponent } from "./src/main/ets/components/view/HeadPic
export { ZhGridLayoutComponent } from "./src/main/ets/components/view/ZhGridLayoutComponent"
export { MultiPictureDetailPageComponent } from "./src/main/ets/components/MultiPictureDetailPageComponent"
export { AudioDetailComponent } from "./src/main/ets/components/AudioDetailComponent"
...
...
sight_harmony/features/wdComponent/src/main/ets/components/AudioDetailComponent.ets
0 → 100644
View file @
a78525d
import { Logger } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO, PhotoListBean } from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
const TAG = 'AudioDetailComponent'
@Component
export struct AudioDetailComponent {
private relId: string = ''
private contentId: string = ''
private relType: string = ''
// private avPlayer:media.AVPlayer
@State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[]
@State iocClock: string = '定时';
@State iconTheOriginal: string = '原文';
@State iconList: string = '列表';
@State text: string = ''
@State coverImage:string = 'app.media.audio'
@State newsTitle:string = '夜读'
@State palyIcon:string = "app.media.playicon"
@State showList: boolean = false
@State outSetValueOne:number = 40
//
// @State @Watch('onIsPlayChanged')isPlay: boolean = false
// onIsPlayChanged(){
// if(this.isPlay){
// this.avPlayer.play()
// this.palyIcon = "app.media.suspend"
// }else{
// this.avPlayer.pause()
// this.palyIcon = "app.media.playicon"
// }
// }
//
async aboutToAppear() {
this.getContentDetailData()
// // 创建avPlayer实例对象
// this.avPlayer = await media.createAVPlayer()
// // 创建状态机变化回调函数
// this.setAVPlayerCallback()
}
//
// // 注册avplayer回调函数
// setAVPlayerCallback() {
// // seek操作结果回调函数
// this.avPlayer.on('seekDone', (seekDoneTime) => {
// console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
// })
// // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
// this.avPlayer.on('error', (err) => {
// console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
// this.avPlayer.reset(); // 调用reset重置资源,触发idle状态
// })
// // 状态机变化回调函数
// this.avPlayer.on('stateChange', async (state, reason) => {
// switch (state) {
// case 'idle': // 成功调用reset接口后触发该状态机上报
// console.info('AVPlayer state idle called.');
// this.avPlayer.release(); // 调用release接口销毁实例对象
// this.isPlay = false
// break;
// case 'initialized': // avplayer 设置播放源后触发该状态上报
// console.info('AVPlayerstate initialized called.');
// this.avPlayer.prepare().then(() => {
// console.info('AVPlayer prepare succeeded.');
// })
// this.isPlay = false
// break;
// case 'prepared': // prepare调用成功后上报该状态机
// console.info('AVPlayer state prepared called.');
// this.isPlay = false
// this.avPlayer.play(); // 调用播放接口开始播放
// break;
// case 'playing': // play成功调用后触发该状态机上报
// console.info('AVPlayer state playing called.');
// this.isPlay = true
// break;
// case 'paused': // pause成功调用后触发该状态机上报
// console.info('AVPlayer state paused called.');
// this.avPlayer.play(); // 再次播放接口开始播放
// this.isPlay = false
// break;
// case 'completed': // 播放结束后触发该状态机上报
// console.info('AVPlayer state completed called.');
// this.avPlayer.stop(); //调用播放结束接口
// break;
// case 'stopped': // stop接口成功调用后触发该状态机上报
// console.info('AVPlayer state stopped called.');
// this.avPlayer.reset(); // 调用reset接口初始化avplayer状态
// this.isPlay = false
// break;
// case 'released':
// console.info('AVPlayer state released called.');
// break;
// default:
// console.info('AVPlayer state unknown called.');
// break;
// }
// })
// }
// gotoPlay(){
// this.avPlayer.url = this.contentDetailData[0].audioList[0].audioUrl
// }
build() {
Row() {
Column() {
// 封面
Row() {
Image($r('app.media.audio'))
.width(240)
.height(160)
.borderRadius('0')
}
.justifyContent(FlexAlign.Center)
.width('100%')
.margin({ top: 64 })
// 标题
Row() {
Text(this.newsTitle)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#ffffff')
.textAlign(TextAlign.Center)
.lineHeight(28)
.fontFamily('PingFang SC, PingFang SC')
}
.padding({ left: 34, right: 34 })
.margin({ top: 32 })
// 操作矩阵
Row() {
// 定时
Column() {
Image($r('app.media.clock'))
.width(28)
.height(28)
Text(this.iocClock)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
// 原文
Column() {
Image($r('app.media.theOriginal'))
.width(28)
.height(28)
Text(this.iconTheOriginal)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
// 列表
Column() {
Image($r('app.media.list'))
.width(28)
.height(28)
Text(this.iconList)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
.onClick(() => {
this.showList = !this.showList
Logger.info(TAG,'这里')
console.log('列表', this.showList)
})
}
.width('100%')
.padding({ left: 49, right: 49 })
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 60 })
Column(){
// 进度条
Row(){
Slider({
value: this.outSetValueOne,
min: 0,
max: 100,
style: SliderStyle.OutSet
})
.trackColor('rgba(0,0,0,0.5)')
.selectedColor('#ED2800')
.showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValueOne = value
console.info('value:' + value + 'mode:' + mode.toString())
})
}
.width('100%')
.padding({left:24,right:24})
.margin({top:110})
// 播放按钮
Row(){
Image($r('app.media.loop'))
.width(24)
.height(24)
Image($r('app.media.Backward'))
.width(24)
.height(24)
Stack(){
Image($r('app.media.playicon'))
.width(32)
.height(32)
}
.backgroundColor('rgba(255,255,255,0.1)')
.width(60)
.height(60)
.borderRadius(50)
.alignContent(Alignment.Center)
.onClick(()=>{
// this.gotoPlay()
console.log('播放')
this.getContentDetailData()
})
Image($r('app.media.fastForward'))
.width(24)
.height(24)
Image($r('app.media.doubleSpeed'))
.width(24)
.height(24)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.margin({top:56})
.padding({left:32,right:32})
}
// OperRowListView()
}
}
}
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data;
this.coverImage = this.contentDetailData[0].audioList[0].fullColumnImgUrls[0].url
this.newsTitle = this.contentDetailData[0].newsTitle
Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`)
console.log(JSON.stringify(this.contentDetailData))
console.log(this.newsTitle)
console.log(this.coverImage)
} catch (exception) {
}
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/components/AVPlayer.ets
deleted
100644 → 0
View file @
33432bd
@Component
export struct AVPlayer {
@State outSetValueOne:number = 40
build() {
Column(){
// 进度条
Row(){
Slider({
value: this.outSetValueOne,
min: 0,
max: 100,
style: SliderStyle.OutSet
})
.trackColor('rgba(0,0,0,0.5)')
.selectedColor('#ED2800')
.showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValueOne = value
console.info('value:' + value + 'mode:' + mode.toString())
})
}
.width('100%')
.padding({left:24,right:24})
.margin({top:110})
// 播放按钮
Row(){
Image($r('app.media.loop'))
.width(24)
.height(24)
Image($r('app.media.Backward'))
.width(24)
.height(24)
Stack(){
Image($r("app.media.playicon"))
.width(32)
.height(32)
}
.backgroundColor('rgba(255,255,255,0.1)')
.width(60)
.height(60)
.padding(14)
.borderRadius(50)
.onClick(()=>{
// this.avPlayerUrl()
})
Image($r('app.media.fastForward'))
.width(24)
.height(24)
Image($r('app.media.doubleSpeed'))
.width(24)
.height(24)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.margin({top:56})
.padding({left:32,right:32})
}
}
}
\ No newline at end of file
sight_harmony/products/phone/src/main/ets/pages/detail/AudioDetail.ets
View file @
a78525d
import media from '@ohos.multimedia.media';
import { Song } from '../viewModel/Song'
import { AVPlayer } from '../../components/AVPlayer'
import { Logger } from 'wdKit';
import { AudioDetailComponent } from 'wdComponent';
import router from '@ohos.router';
import { Params, Action } from 'wdBean';
const TAG = 'AudioDetail';
@Entry
@Component
struct AudioDetail {
@State message: string = '大自然的奇迹展览在中国国家博物馆拉开帷幕';
@State iocClock: string = '定时';
@State iconTheOriginal: string = '原文';
@State iconList: string = '列表';
@State text: string = ''
@State showList: boolean = false
controller: TextInputController = new TextInputController()
// 音频
@State songs: Song[] = []
// private avPlayer:media.AVPlayer
async aboutToAppear() {
//加载音乐列表
// let response = await axios({
// method:'get',
// url:''
// })
// //创建avPlayer实例对象
// this.avPlayer = await media.createAVPlayer()
// //创建状态机变化回调函数
// this.setAVPlayerCallback()
// // this.avPlayer.url =
}
// 注册avplayer回调函数
// setAVPlayerCallback() {
// // seek操作结果回调函数
// this.avPlayer.on('seekDone', (seekDoneTime) => {
// console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`);
// })
// // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
// this.avPlayer.on('error', (err) => {
// console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
// this.avPlayer.reset(); // 调用reset重置资源,触发idle状态
// })
// // 状态机变化回调函数
// this.avPlayer.on('stateChange', async (state, reason) => {
// switch (state) {
// case 'idle': // 成功调用reset接口后触发该状态机上报
// console.info('AVPlayer state idle called.');
// this.avPlayer.release(); // 调用release接口销毁实例对象
// break;
// case 'initialized': // avplayer 设置播放源后触发该状态上报
// console.info('AVPlayerstate initialized called.');
// this.avPlayer.prepare().then(() => {
// console.info('AVPlayer prepare succeeded.');
// })
// break;
// case 'prepared': // prepare调用成功后上报该状态机
// console.info('AVPlayer state prepared called.');
// this.avPlayer.play(); // 调用播放接口开始播放
// break;
// case 'playing': // play成功调用后触发该状态机上报
// console.info('AVPlayer state playing called.');
// break;
// case 'paused': // pause成功调用后触发该状态机上报
// console.info('AVPlayer state paused called.');
// this.avPlayer.play(); // 再次播放接口开始播放
// break;
// case 'completed': // 播放结束后触发该状态机上报
// console.info('AVPlayer state completed called.');
// this.avPlayer.stop(); //调用播放结束接口
// break;
// case 'stopped': // stop接口成功调用后触发该状态机上报
// console.info('AVPlayer state stopped called.');
// this.avPlayer.reset(); // 调用reset接口初始化avplayer状态
// break;
// case 'released':
// console.info('AVPlayer state released called.');
// break;
// default:
// console.info('AVPlayer state unknown called.');
// break;
// }
// })
// }
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
build() {
Column() {
Row() {
Column() {
// 封面
Row() {
Image($r('app.media.audio'))
.width(240)
.height(160)
.borderRadius('0.00vp')
}
.justifyContent(FlexAlign.Center)
.width('100%')
.margin({ top: 64 })
// 标题
Row() {
Text(this.message)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#ffffff')
.textAlign(TextAlign.Center)
.lineHeight(28)
.fontFamily('PingFang SC, PingFang SC')
}
.padding({ left: 34, right: 34 })
.margin({ top: 32 })
// 操作矩阵
Row() {
// 定时
Column() {
Image($r('app.media.clock'))
.width(28)
.height(28)
Text(this.iocClock)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
// 原文
Column() {
Image($r('app.media.theOriginal'))
.width(28)
.height(28)
Text(this.iconTheOriginal)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
// 列表
Column() {
Image($r('app.media.list'))
.width(28)
.height(28)
Text(this.iconList)
.fontColor('#fff')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
.onClick(() => {
this.showList = !this.showList
console.log('列表', this.showList)
AudioDetailComponent({
relId: this.relId,
contentId: this.contentId,
relType: this.relType
})
}
.width('100%')
.padding({ left: 49, right: 49 })
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 60 })
AVPlayer()
}
}
.height('100%-56')
Row() {
Image($r('app.media.leftArrow'))
.width(24)
.height(24)
TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller })
.placeholderColor('#999999')
.placeholderFont({ size: 12, weight: 400 })
.caretColor(Color.White)
.height(30)
.width(115)
.fontSize(12)
.fontColor('#999999')
.backgroundColor('rgba(255,255,255,0.1)')
.borderRadius(0)
.backgroundColor('[UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor')
.onChange((value: string) => {
this.text = value
})
// 消息
Badge({
count: 100,
style: { fontSize: 12, badgeColor: '#FA2A2D' },
}) {
Image($r('app.media.news'))
.width(24)
.height(24)
}
// 点赞
Badge({
count: 100,
style: { fontSize: 12, badgeColor: '#FA2A2D' },
}) {
Image($r('app.media.like'))
.width(24)
.height(24)
}
// 收藏
Image($r('app.media.collection'))
.width(24)
.height(24)
// 分享
Image($r('app.media.share'))
.width(24)
.height(24)
}
.height(56)
.width('100%')
.padding(13)
.justifyContent(FlexAlign.SpaceBetween)
// 播放列表
}
.height('100%')
.width('100%')
.backgroundColor('#20272E')
.justifyContent(FlexAlign.SpaceBetween)
}
aboutToAppear() {
let par:Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
Logger.info(TAG, 'aboutToAppear');
Logger.info(TAG, 'params', JSON.stringify(params));
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/ets/pages/viewModel/Song.ets
deleted
100644 → 0
View file @
33432bd
export class Song{
}
\ No newline at end of file
Please
register
or
login
to post a comment