导航栏右侧按钮添加构建函数和其他
This commit is contained in:
parent
e31432bc3a
commit
ce439d4222
80
commons/basic/src/main/ets/components/HdSearchNav.ets
Normal file
80
commons/basic/src/main/ets/components/HdSearchNav.ets
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import { router } from '@kit.ArkUI'
|
||||||
|
import { emitter } from '@kit.BasicServicesKit'
|
||||||
|
import { BasicConstant } from '../../../../Index'
|
||||||
|
|
||||||
|
@Component
|
||||||
|
export struct HdSearchNav {
|
||||||
|
private rightItemAction: (value: string) => void = () => {};
|
||||||
|
@StorageProp('topHeight')
|
||||||
|
topHeight: number = 0
|
||||||
|
@Prop
|
||||||
|
bgColor: ResourceStr = $r('app.color.top_bg')
|
||||||
|
@Prop
|
||||||
|
hasBorder: boolean = false
|
||||||
|
@Prop
|
||||||
|
leftIcon: ResourceStr = $r('app.media.top_back')
|
||||||
|
@Prop
|
||||||
|
showRightIcon: boolean = true
|
||||||
|
@Prop
|
||||||
|
rightIcon: ResourceStr
|
||||||
|
@Prop
|
||||||
|
showRightText: boolean = false
|
||||||
|
@Prop
|
||||||
|
rightText: string = ''
|
||||||
|
@Prop
|
||||||
|
rightTextColor: ResourceStr
|
||||||
|
@Prop
|
||||||
|
rightbackColor: ResourceStr = $r('app.color.main_color')
|
||||||
|
|
||||||
|
@State textInputContent:string = ''
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Row() {
|
||||||
|
Row() {
|
||||||
|
Image(this.leftIcon)
|
||||||
|
.size({ width: 24, height: 24 })
|
||||||
|
.onClick(() => router.back())
|
||||||
|
.fillColor($r('app.color.black'))
|
||||||
|
}.size({ width: 50, height: 50 })
|
||||||
|
|
||||||
|
Row({space:10}){
|
||||||
|
Image($r('app.media.selected_hospital_ws'))
|
||||||
|
.width(25).height(25)
|
||||||
|
.margin({left:15})
|
||||||
|
TextInput({placeholder:'搜索视频、过往会议'})
|
||||||
|
.fontSize(15)
|
||||||
|
.margin({left:10})
|
||||||
|
.onChange((value:string)=>{
|
||||||
|
this.textInputContent = value;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.borderWidth(0.5).borderRadius(3).borderColor($r('app.color.main_color')).justifyContent(FlexAlign.Start)
|
||||||
|
|
||||||
|
if (this.showRightIcon) {
|
||||||
|
Row() {
|
||||||
|
Image(this.rightIcon)
|
||||||
|
.size({ width: 24, height: 24 })
|
||||||
|
.objectFit(ImageFit.Contain)
|
||||||
|
.onClick(()=>this.rightItemAction(this.textInputContent))
|
||||||
|
}
|
||||||
|
.size({ width: 50, height: 50 }).justifyContent(FlexAlign.End)
|
||||||
|
} else if (this.showRightText) {
|
||||||
|
Text(this.rightText)
|
||||||
|
.fontSize(16)
|
||||||
|
.fontColor(this.rightTextColor)
|
||||||
|
.backgroundColor(this.rightbackColor)
|
||||||
|
.borderRadius(4)
|
||||||
|
.onClick(()=>this.rightItemAction(this.textInputContent))
|
||||||
|
.width(50)
|
||||||
|
.textAlign(TextAlign.Center)
|
||||||
|
} else {
|
||||||
|
Blank()
|
||||||
|
.width(50)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.padding({ left: 16, right: 16, top: this.topHeight })
|
||||||
|
.height(56 + this.topHeight)
|
||||||
|
.width('100%')
|
||||||
|
.backgroundColor(this.bgColor)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -45,4 +45,7 @@ export class BasicConstant {
|
|||||||
'广西壮族自治区','海南省','重庆市','四川省','贵州省','云南省','西藏自治区',
|
'广西壮族自治区','海南省','重庆市','四川省','贵州省','云南省','西藏自治区',
|
||||||
'陕西省','甘肃省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
|
'陕西省','甘肃省','宁夏回族自治区','新疆维吾尔自治区','台湾省','香港特别行政区','澳门特别行政区']
|
||||||
|
|
||||||
}
|
//通知事件ID
|
||||||
|
static readonly notification_back_refreshData = 250529;//返回上页通知刷新数据
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,18 +4,19 @@ import { promptAction, router } from '@kit.ArkUI'
|
|||||||
import { BusinessError } from '@kit.BasicServicesKit';
|
import { BusinessError } from '@kit.BasicServicesKit';
|
||||||
import { HdLoadingDialog } from '@itcast/basic'
|
import { HdLoadingDialog } from '@itcast/basic'
|
||||||
import HashMap from '@ohos.util.HashMap';
|
import HashMap from '@ohos.util.HashMap';
|
||||||
|
import { VideoDetailModel } from '../model/VideoDetailModel'
|
||||||
|
import { PLVMockMediaResourceData } from '../polyv/PLVMockMediaResourceData'
|
||||||
|
import {
|
||||||
|
PLVMediaPlayerSingleVideoPageParam
|
||||||
|
} from 'media-player-common';
|
||||||
|
import { runCatching, seconds } from '@polyvharmony/media-player-sdk';
|
||||||
|
import { it } from '@ohos/hypium';
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export struct SwiperComp {
|
export struct SwiperComp {
|
||||||
@State
|
@State
|
||||||
list: VideoRoll[] = []
|
list: VideoRoll[] = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
hashMap: HashMap<string, string> = new HashMap();
|
|
||||||
|
|
||||||
dialog: CustomDialogController = new CustomDialogController({
|
dialog: CustomDialogController = new CustomDialogController({
|
||||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||||
customStyle: true,
|
customStyle: true,
|
||||||
@ -26,16 +27,15 @@ export struct SwiperComp {
|
|||||||
this.initData()
|
this.initData()
|
||||||
}
|
}
|
||||||
|
|
||||||
initData()
|
initData() {
|
||||||
{
|
const hashMap: HashMap<string, string> = new HashMap();
|
||||||
this.dialog.open()
|
this.dialog.open()
|
||||||
this.hashMap.clear();
|
hashMap.clear();
|
||||||
hdHttp.httpReq<string>(BasicConstant.videoRoll,this.hashMap).then(async (res: HdResponse<string>) => {
|
hdHttp.httpReq<string>(BasicConstant.videoRoll,hashMap).then(async (res: HdResponse<string>) => {
|
||||||
logger.info('Response meetingListV2'+res);
|
logger.info('Response meetingListV2'+res);
|
||||||
let json:VideoRollModel = JSON.parse(res+'') as VideoRollModel;
|
let json:VideoRollModel = JSON.parse(res+'') as VideoRollModel;
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
this.list = json.data
|
this.list = json.data
|
||||||
|
|
||||||
}).catch((err: BusinessError) => {
|
}).catch((err: BusinessError) => {
|
||||||
this.dialog.close();
|
this.dialog.close();
|
||||||
})
|
})
|
||||||
@ -61,10 +61,9 @@ export struct SwiperComp {
|
|||||||
.padding({right:100,left:5})
|
.padding({right:100,left:5})
|
||||||
.margin({ bottom: 0 })
|
.margin({ bottom: 0 })
|
||||||
}.onClick(()=>{
|
}.onClick(()=>{
|
||||||
|
this.getVideoDetail(item.uuid);
|
||||||
})
|
})
|
||||||
}, (item: VideoRoll) => JSON.stringify(item))
|
}, (item: VideoRoll) => JSON.stringify(item))
|
||||||
|
|
||||||
}
|
}
|
||||||
.indicator(
|
.indicator(
|
||||||
Indicator.dot()
|
Indicator.dot()
|
||||||
@ -82,10 +81,39 @@ export struct SwiperComp {
|
|||||||
.onChange((index: number) => {
|
.onChange((index: number) => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
.width('100%')
|
.width('100%')
|
||||||
|
}
|
||||||
|
|
||||||
|
getVideoDetail(video_uuid:string) {
|
||||||
|
const hashMap: HashMap<string, string> = new HashMap();
|
||||||
|
hashMap.clear();
|
||||||
|
hashMap.set('video_uuid', video_uuid)
|
||||||
|
hdHttp.httpReq<string>(BasicConstant.videoDetail,hashMap).then(async (res: HdResponse<string>) => {
|
||||||
|
logger.info('Response videoDetail'+res);
|
||||||
|
let json:VideoDetailModel = JSON.parse(res+'') as VideoDetailModel;
|
||||||
|
this.goPLVMediaPlayerSingleVideoPage(json.video.polyv_uuid,video_uuid)
|
||||||
|
}).catch((err: BusinessError) => {
|
||||||
|
this.goPLVMediaPlayerSingleVideoPage('','')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
async goPLVMediaPlayerSingleVideoPage(vid:string,video_uuid:string) {
|
||||||
|
const mediaResourcesResult = await runCatching(PLVMockMediaResourceData.getInstance().setupMediaResourcesFromLocal(vid))
|
||||||
|
if (mediaResourcesResult.success === false) {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: `'视频数据初始化失败': ${mediaResourcesResult.error}`,
|
||||||
|
duration: seconds(3).toMillis()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const mediaResource = mediaResourcesResult.data[0]
|
||||||
|
router.pushUrl({
|
||||||
|
url:'pages/VideoPage/PLVMediaPlayerSingleVideoPage',
|
||||||
|
params: {
|
||||||
|
video_uuid:video_uuid,
|
||||||
|
param:new PLVMediaPlayerSingleVideoPageParam(mediaResource)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ export struct VideoDetailsComment {
|
|||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
emitter.emit({
|
emitter.emit({
|
||||||
eventId: 250529,
|
eventId: BasicConstant.notification_back_refreshData,
|
||||||
priority: emitter.EventPriority.HIGH
|
priority: emitter.EventPriority.HIGH
|
||||||
})
|
})
|
||||||
promptAction.showToast({ message: '删除评论成功', duration: 1000 })
|
promptAction.showToast({ message: '删除评论成功', duration: 1000 })
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { HdNav } from '@itcast/basic'
|
import { HdNav, BasicConstant } from '@itcast/basic'
|
||||||
import { ListCompPast } from '../components/ListCompPast'
|
import { ListCompPast } from '../components/ListCompPast'
|
||||||
import { promptAction } from '@kit.ArkUI'
|
import { promptAction } from '@kit.ArkUI'
|
||||||
@Entry
|
@Entry
|
||||||
@ -25,13 +25,14 @@ export struct PastVideo {
|
|||||||
}
|
}
|
||||||
aboutToAppear(): void {
|
aboutToAppear(): void {
|
||||||
this.getYears()
|
this.getYears()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column()
|
Column()
|
||||||
{
|
{
|
||||||
HdNav({ title: '过往会议', showRightIcon: false, showLeftIcon: true})
|
HdNav({ title: '过往会议', showRightIcon: false, showLeftIcon: true,showRightText:true,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=>{
|
||||||
|
|
||||||
|
}})
|
||||||
Row() {
|
Row() {
|
||||||
Row() {
|
Row() {
|
||||||
if(this.timePosition!=-1)
|
if(this.timePosition!=-1)
|
||||||
|
|||||||
@ -1,19 +1,22 @@
|
|||||||
import { SecondaryLink } from '../components/SecondaryLink';
|
import { SecondaryLink } from '../components/SecondaryLink';
|
||||||
import router from '@ohos.router';
|
import router from '@ohos.router';
|
||||||
import { HdNav } from '@itcast/basic'
|
import { BasicConstant, HdNav } from '@itcast/basic'
|
||||||
import { SwiperComp } from '../components/SwiperComp'
|
import { SwiperComp } from '../components/SwiperComp'
|
||||||
|
import { emitter } from '@kit.BasicServicesKit';
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
export struct VideoGandan {
|
export struct VideoGandan {
|
||||||
build() {
|
|
||||||
|
|
||||||
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
HdNav({ title: '肝胆视频', showRightIcon: false, showLeftIcon: false })
|
HdNav({ title: '肝胆视频', showRightIcon: true, showLeftIcon: false,showRightText:false,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=>{
|
||||||
|
router.pushUrl({
|
||||||
|
url:'pages/SearchPage/VideoSearchPage',
|
||||||
|
params:{'pageName':'视频'}
|
||||||
|
})
|
||||||
|
}})
|
||||||
SwiperComp()
|
SwiperComp()
|
||||||
SecondaryLink()
|
SecondaryLink()
|
||||||
|
|
||||||
|
|
||||||
}.width('100%')
|
}.width('100%')
|
||||||
.height('100%').backgroundColor($r('app.color.top_bg'))
|
.height('100%').backgroundColor($r('app.color.top_bg'))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,11 +97,11 @@ export struct PerfectUserDataComp {
|
|||||||
this.handleState()
|
this.handleState()
|
||||||
// logger.info("Response this.photoPath "+this.photoPath)
|
// logger.info("Response this.photoPath "+this.photoPath)
|
||||||
|
|
||||||
emitter.on({ eventId: 250516 }, () => {
|
emitter.on({ eventId: 12 }, () => {
|
||||||
this.handleSave()
|
this.handleSave()
|
||||||
})
|
})
|
||||||
// 收到eventId为1的事件后执行回调函数
|
// 收到eventId为1的事件后执行回调函数
|
||||||
emitter.on({ eventId: 250517 }, (eventData: emitter.EventData) => {
|
emitter.on({ eventId: BasicConstant.notification_back_refreshData }, (eventData: emitter.EventData) => {
|
||||||
console.info(`eventData: ${JSON.stringify(eventData)}`);
|
console.info(`eventData: ${JSON.stringify(eventData)}`);
|
||||||
const params =eventData.data as Record<string, string>; // 获取传递过来的参数对象
|
const params =eventData.data as Record<string, string>; // 获取传递过来的参数对象
|
||||||
this.hospatilName=params.name
|
this.hospatilName=params.name
|
||||||
@ -114,8 +114,8 @@ export struct PerfectUserDataComp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
aboutToDisappear() {
|
aboutToDisappear() {
|
||||||
emitter.off(250516)
|
emitter.off(12)
|
||||||
emitter.off(250517)
|
emitter.off(BasicConstant.notification_back_refreshData)
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleState()
|
private handleState()
|
||||||
|
|||||||
@ -141,7 +141,7 @@ export struct SelectedHospitalComp {
|
|||||||
data: item
|
data: item
|
||||||
};
|
};
|
||||||
// 发送eventId为1的事件,事件内容为eventData。
|
// 发送eventId为1的事件,事件内容为eventData。
|
||||||
emitter.emit({ eventId: 250517 }, eventData);
|
emitter.emit({ eventId: BasicConstant.notification_back_refreshData }, eventData);
|
||||||
router.back({ url: 'pages/LoginPage/LoginSetInfoPage'})
|
router.back({ url: 'pages/LoginPage/LoginSetInfoPage'})
|
||||||
// router.back({ url: 'pages/LoginPage/LoginSetInfoPage',params: item})
|
// router.back({ url: 'pages/LoginPage/LoginSetInfoPage',params: item})
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,27 @@
|
|||||||
|
import { HdNav } from '@itcast/basic'
|
||||||
|
|
||||||
|
@Entry
|
||||||
|
@Component
|
||||||
|
struct VideoSearchPage {
|
||||||
|
@State message: string = 'Hello World';
|
||||||
|
|
||||||
|
build() {
|
||||||
|
Column() {
|
||||||
|
// HdNav({showLeftIcon:true,showRightText:true,rightText:'搜索'})
|
||||||
|
Text(this.message)
|
||||||
|
.id('VideoSearchPageHelloWorld')
|
||||||
|
.fontSize($r('app.float.page_text_font_size'))
|
||||||
|
.fontWeight(FontWeight.Bold)
|
||||||
|
.alignRules({
|
||||||
|
center: { anchor: '__container__', align: VerticalAlign.Center },
|
||||||
|
middle: { anchor: '__container__', align: HorizontalAlign.Center }
|
||||||
|
})
|
||||||
|
.onClick(() => {
|
||||||
|
this.message = 'Welcome';
|
||||||
|
})
|
||||||
|
}
|
||||||
|
.height('100%')
|
||||||
|
.width('100%')
|
||||||
|
.backgroundColor(Color.White)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -13,16 +13,6 @@ struct CommentReplyPage {
|
|||||||
@State finalContent: string = '';
|
@State finalContent: string = '';
|
||||||
hashMap: HashMap<string, string> = new HashMap();
|
hashMap: HashMap<string, string> = new HashMap();
|
||||||
|
|
||||||
aboutToAppear() {
|
|
||||||
emitter.on({ eventId: 250516 }, () => {
|
|
||||||
this.commitAction()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
aboutToDisappear() {
|
|
||||||
emitter.off(250516)
|
|
||||||
}
|
|
||||||
|
|
||||||
commitAction() {
|
commitAction() {
|
||||||
inputMethod.getController().hideTextInput();//关闭键盘
|
inputMethod.getController().hideTextInput();//关闭键盘
|
||||||
if (this.finalContent.length === 0) {
|
if (this.finalContent.length === 0) {
|
||||||
@ -38,7 +28,7 @@ struct CommentReplyPage {
|
|||||||
let json:CommentV2Model = JSON.parse(res+'') as CommentV2Model;
|
let json:CommentV2Model = JSON.parse(res+'') as CommentV2Model;
|
||||||
if(json.code == 200) {
|
if(json.code == 200) {
|
||||||
emitter.emit({
|
emitter.emit({
|
||||||
eventId: 250529,
|
eventId: BasicConstant.notification_back_refreshData,
|
||||||
priority: emitter.EventPriority.HIGH
|
priority: emitter.EventPriority.HIGH
|
||||||
})
|
})
|
||||||
promptAction.showToast({ message: '回复评论成功', duration: 1000 })
|
promptAction.showToast({ message: '回复评论成功', duration: 1000 })
|
||||||
@ -52,7 +42,9 @@ struct CommentReplyPage {
|
|||||||
|
|
||||||
build() {
|
build() {
|
||||||
Column() {
|
Column() {
|
||||||
HdNav({ title: '回复', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'确定'})
|
HdNav({ title: '回复', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'确定',rightItemAction:()=>{
|
||||||
|
this.commitAction()
|
||||||
|
}})
|
||||||
TextArea({placeholder:`回复:${this.params.replyName}`})
|
TextArea({placeholder:`回复:${this.params.replyName}`})
|
||||||
.fontSize(14)
|
.fontSize(14)
|
||||||
.width('100%')
|
.width('100%')
|
||||||
|
|||||||
@ -56,7 +56,7 @@ export struct PLVMediaPlayerSingleVideoPage {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
emitter.on({ eventId: 250529 }, () => {
|
emitter.on({ eventId: BasicConstant.notification_back_refreshData }, () => {
|
||||||
this.getCommentdata(this.params.video_uuid)
|
this.getCommentdata(this.params.video_uuid)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ export struct PLVMediaPlayerSingleVideoPage {
|
|||||||
windowInstance.setWindowKeepScreenOn(false)
|
windowInstance.setWindowKeepScreenOn(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
emitter.off(250529)
|
emitter.off(BasicConstant.notification_back_refreshData)
|
||||||
}
|
}
|
||||||
|
|
||||||
getVideoDetail(video_uuid:string) {
|
getVideoDetail(video_uuid:string) {
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
"pages/WebView/LivebroadcastPages",
|
"pages/WebView/LivebroadcastPages",
|
||||||
"pages/VideoPage/PastVideoPage",
|
"pages/VideoPage/PastVideoPage",
|
||||||
"pages/VideoPage/VideoGandanPage",
|
"pages/VideoPage/VideoGandanPage",
|
||||||
"pages/VideoPage/CommentReplyPage"
|
"pages/VideoPage/CommentReplyPage",
|
||||||
|
"pages/SearchPage/VideoSearchPage"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user