更新视频跳转逻辑和精选

This commit is contained in:
XiuYun CHEN 2025-05-30 17:11:58 +08:00
parent 0c2b6c096c
commit db44d85747
13 changed files with 392 additions and 216 deletions

View File

@ -24,4 +24,6 @@ export { VideoList,DataModel,VideoData } from './src/main/ets/model/SearchDataMo
export { ItemCompPast } from './src/main/ets/components/ItemCompPastk'
export { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from './src/main/ets/model/ItemModel'
export { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from './src/main/ets/model/ItemModel'
export { VideoSelected } from './src/main/ets/pages/VideoSelected'

View File

@ -1,15 +1,8 @@
import { runCatching, seconds } from '@polyvharmony/media-player-sdk';
import { VideoMore } from '../model/VideoMoreModel'
import { BasicConstant } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI';
import { PLVMockMediaResourceData } from '../polyv/PLVMockMediaResourceData'
import {
PLVMediaPlayerSingleVideoPageParam
} from 'media-player-common';
import HashMap from '@ohos.util.HashMap';
import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import { VideoDetailModel } from '../model/VideoDetailModel'
import { videoTools } from '../polyv/VideoUtil'
@Preview
@Component
export struct ItemCompVideo {
@ -47,7 +40,7 @@ export struct ItemCompVideo {
}.backgroundColor(Color.White)
.borderRadius(5)
.onClick(()=>{
this.getVideoDetail(this.item.uuid)
videoTools.getVideoDetail(this.item.uuid)
})
.width('100%').clip(true)
@ -56,39 +49,7 @@ export struct ItemCompVideo {
}
getVideoDetail(video_uuid:string)
{
this.hashMap.clear();
this.hashMap.set('video_uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoDetail,this.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)
}
})
}

View File

@ -0,0 +1,135 @@
import { VideoMoreModel,VideoMore } from '../model/VideoMoreModel'
import { HdList, HdListController,BasicConstant,hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { promptAction, router } from '@kit.ArkUI'
import { BusinessError } from '@kit.BasicServicesKit';
import { HdLoadingDialog,EmptyViewComp } from '@itcast/basic'
import HashMap from '@ohos.util.HashMap';
import { videoTools } from '../polyv/VideoUtil'
@Component
export struct ListCompVideoSelect {
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@Prop
type_uuid:string=''
@State
list: VideoMore[] = []
controller = new HdListController()
@State
page: number = 1
@State
keyword: string = ''
hashMap: HashMap<string, string> = new HashMap();
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
onRefresh() {
this.page = 1
this.initData(0)
}
initData(type:number)
{
this.dialog.open()
this.hashMap.clear();
this.hashMap.set('page', this.page+"")
this.hashMap.set('typeUuid', this.type_uuid)
hdHttp.httpReq<string>(BasicConstant.videoByTypeNew,this.hashMap).then(async (res: HdResponse<string>) => {
logger.info('Response videoByTypeNew'+res);
let json:VideoMoreModel = JSON.parse(res+'') as VideoMoreModel;
this.dialog.close()
if(type==0)
{
this.controller.refreshed()
}
else
{
this.controller.loaded()
}
if(this.page==1)
{
this.list=[]
if(json.data!=null&&json.data.list!)
{
this.list = json.data.list
}
}
else if(this.page>1)
{
this.list.push(...json.data.list)
}
if (this.page >= json.data.totalPage) {
this.controller.finished()
} else {
this.page++
}
if (this.list.length>0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
}).catch((err: BusinessError) => {
this.dialog.close()
if (this.list.length>0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
})
}
build() {
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无数据',isVisibility:this.isEmptyViewVisible})
.width('100%')
.height('100%')
} else {
HdList({
lw: 1,
controller: this.controller,
onRefresh: () => {
this.onRefresh()
},
onLoad: () => {
this.initData(1)
}
}) {
ForEach(this.list, (items: VideoMore) => {
ListItem() {
Column()
{
Row()
{
Text(items.name) .textOverflow({ overflow: TextOverflow.Ellipsis })
.maxLines(1)
.textAlign(TextAlign.Start)
.layoutWeight(1)
.fontSize(16)
.padding(10)
Image($r('sys.media.ohos_ic_public_arrow_right'))
.width(15)
.height(15)
.margin({ right: 10})
}
.width('100%')
Text('').height(1).width('100%')
.backgroundColor($r('app.color.1a000000'))
}
.onClick(()=>{
videoTools.getVideoDetail(items.uuid)
})
}
})
}
}
}
}

View File

@ -11,7 +11,7 @@ import {
} from 'media-player-common';
import { runCatching, seconds } from '@polyvharmony/media-player-sdk';
import { it } from '@ohos/hypium';
import { videoTools } from '../polyv/VideoUtil'
@Component
export struct SwiperComp {
@State
@ -61,7 +61,7 @@ export struct SwiperComp {
.padding({right:100,left:5})
.margin({ bottom: 0 })
}.onClick(()=>{
this.getVideoDetail(item.uuid);
videoTools.getVideoDetail(item.uuid)
})
}, (item: VideoRoll) => JSON.stringify(item))
}
@ -85,35 +85,5 @@ export struct SwiperComp {
.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)
}
})
}
}

View File

@ -167,7 +167,7 @@ export struct PlayBack {
}
.width('100%')
.height('100%')
.padding({bottom:50})
}
getSelect()

View File

@ -8,7 +8,10 @@ export struct VideoMore {
build() {
Column() {
HdNav({ title: this.params.title, showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'精选' })
HdNav({ title: this.params.title, showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'精选',rightItemAction:()=>{
router.pushUrl({url:'pages/VideoPage/VideoSelectedPage',
params: this.params})
} })
Text('').height(1).width('100%')
.backgroundColor($r('app.color.1a000000'))
.margin({bottom:10})

View File

@ -0,0 +1,16 @@
import router from '@ohos.router';
import { HdNav } from '@itcast/basic'
import { ListCompVideoSelect } from '../components/ListCompVideoSelect'
@Component
export struct VideoSelected{
@State params:Record<string, string> = router.getParams() as Record<string, string>;
build() {
Column() {
HdNav({ title: this.params.title, showRightIcon: false, showLeftIcon: true })
ListCompVideoSelect({type_uuid:this.params.uuid}).backgroundColor(Color.White).height('100%')
}.width('100%')
.height('100%').backgroundColor($r('app.color.top_bg'))
}
}

View File

@ -0,0 +1,50 @@
import { runCatching, seconds } from '@polyvharmony/media-player-sdk';
import { BasicConstant } from '@itcast/basic'
import { promptAction, router } from '@kit.ArkUI';
import { PLVMockMediaResourceData } from '../polyv/PLVMockMediaResourceData'
import {
PLVMediaPlayerSingleVideoPageParam
} from 'media-player-common';
import HashMap from '@ohos.util.HashMap';
import { hdHttp, HdResponse ,logger} from '@itcast/basic/Index'
import { BusinessError } from '@kit.BasicServicesKit';
import { VideoDetailModel } from '../model/VideoDetailModel'
class VideoTools {
hashMap: HashMap<string, string> = new HashMap();
getVideoDetail(video_uuid:string)
{
this.hashMap.clear();
this.hashMap.set('video_uuid', video_uuid)
hdHttp.httpReq<string>(BasicConstant.videoDetail,this.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)
}
})
}
}
export const videoTools = new VideoTools()

View File

@ -305,9 +305,31 @@ export struct EditUserDataComp {
this.certificatePhotoSheetDialog = new CustomDialogController({
builder: PhotoActionSheet({
controller: this.certificatePhotoSheetDialog,
onPhotoSelected: (url: string) => {
onPhotoSelected: async (url: string) => {
this.certificatePhoto = url;
console.log('Selected image URI:', url);
const base64String = await ChangeUtil.convertUriToBase64(url);
const updateDataUrl:string = BasicConstant.urlExpert + 'modify';
// 定义content请根据实际情况选择
const postContent = new rcp.MultipartForm({
'uuid': authStore.getUser().uuid,
'userName': authStore.getUser().userName,
'certificateImg': base64String,
'type':'2'
})
// 创建session
const session = rcp.createSession();
// 使用post发起请求使用Promise进行异步回调其中content以及destination为可选参数可根据实际情况选择
session.post(updateDataUrl, postContent)
.then((response) => {
console.info(`Response succeeded66: ${JSON.stringify(response.headers)}`);
console.info(`Response succeeded: ${JSON.stringify(response.statusCode)}`);
console.info(`Response succeeded22: ${JSON.stringify(response)}`);
// console.info(`Response succeeded: ${JSON.stringify(postContent)}`);
})
.catch((err: BusinessError) => {
console.error(`Response err: Code is ${JSON.stringify(err.code)}, message is ${JSON.stringify(err)}`);
})
}
}),
alignment: DialogAlignment.Bottom,
@ -434,12 +456,11 @@ export struct EditUserDataComp {
.height('auto')
}
.width('100%')
.height('100%')
.layoutWeight(1)// 占据剩余空间
}
.height('auto')
.scrollBar(BarState.Off)
.scrollable(ScrollDirection.Vertical)
.backgroundColor('#ffffff')
.height('calc(100% - 100vp)')
}
}

View File

@ -11,7 +11,7 @@ import { SpecialitySelectedSheet } from '@itcast/basic/src/main/ets/Views/Specia
import { emitter } from '@kit.BasicServicesKit'
import { BusinessError } from '@kit.BasicServicesKit';
import { rcp } from '@kit.RemoteCommunicationKit';
import { HdNav } from '@itcast/basic'
interface extraData {
uuid: string
}
@ -97,9 +97,6 @@ export struct PerfectUserDataComp {
this.handleState()
// logger.info("Response this.photoPath "+this.photoPath)
emitter.on({ eventId: 12 }, () => {
this.handleSave()
})
// 收到eventId为1的事件后执行回调函数
emitter.on({ eventId: BasicConstant.notification_back_refreshData }, (eventData: emitter.EventData) => {
console.info(`eventData: ${JSON.stringify(eventData)}`);
@ -114,7 +111,7 @@ export struct PerfectUserDataComp {
}
aboutToDisappear() {
emitter.off(12)
emitter.off(BasicConstant.notification_back_refreshData)
}
@ -481,126 +478,131 @@ export struct PerfectUserDataComp {
build() {
Scroll(this.scroller) {
Column() {
// 基本信息字段
EditUserDataItem({ label: '头像', required: false, content: this.photoPath, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.photoSheetDialog.open()
}
)
EditUserDataItem({ label: '姓名', required: false, content: this.name, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入姓名';
this.inputPlaceholder = this.name;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '性别', required: false, content: this.sex, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.sexSheetDilog.open()
})
EditUserDataItem({ label: '医院', required: false, content: this.hospatilName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
})
EditUserDataItem({ label: '科室', required: false, content: this.officeName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.officePickerDialog.open()
}
)
EditUserDataItem({ label: '科室电话', required: false, content: this.officePhone, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入所在科室电话';
this.inputPlaceholder = this.officePhone;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '职称', required: false, content: this.positionName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.positionPickerDialog.open()
}
)
EditUserDataItem({ label: '执业医师证编号', required: false, content: this.certificate ,hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入执业医师资格证号码';
this.inputPlaceholder = this.certificate;
this.perfactInputSheet.open()}
)
EditUserDataItem({ label: '执业医师证图片或胸牌', required: false, content: this.certificatePhoto, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.certificatePhotoSheetDialog.open()
})
EditUserDataItem({ label: '专长(可选一到十项)', required: false, content: this.diseaseName , hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.diseaseSheetDialog.open()
})
Column()
{
HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存',rightItemAction:()=>{
this.handleSave()
} })
Scroll(this.scroller) {
Column() {
// 基本信息字段
EditUserDataItem({ label: '头像', required: false, content: this.photoPath, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.photoSheetDialog.open()
}
)
EditUserDataItem({ label: '姓名', required: false, content: this.name, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入姓名';
this.inputPlaceholder = this.name;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '性别', required: false, content: this.sex, hasArrow:true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.sexSheetDilog.open()
})
EditUserDataItem({ label: '医院', required: false, content: this.hospatilName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
router.pushUrl({
url: 'pages/LoginPage/SelectedHospitalPage'
})
})
EditUserDataItem({ label: '科室', required: false, content: this.officeName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.officePickerDialog.open()
}
)
EditUserDataItem({ label: '科室电话', required: false, content: this.officePhone, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入所在科室电话';
this.inputPlaceholder = this.officePhone;
this.perfactInputSheet.open()
})
EditUserDataItem({ label: '职称', required: false, content: this.positionName, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.positionPickerDialog.open()
}
)
EditUserDataItem({ label: '执业医师证编号', required: false, content: this.certificate ,hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>{
if(!this.canEdit())
{
return
}
this.inputTitle = '请输入执业医师资格证号码';
this.inputPlaceholder = this.certificate;
this.perfactInputSheet.open()}
)
EditUserDataItem({ label: '执业医师证图片或胸牌', required: false, content: this.certificatePhoto, hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=> {
if(!this.canEdit())
{
return
}
this.certificatePhotoSheetDialog.open()
})
EditUserDataItem({ label: '专长(可选一到十项)', required: false, content: this.diseaseName , hasArrow: true, isLine:false })
.backgroundColor(Color.White)
.margin({top:8})
.onClick(()=>
{
if(!this.canEdit())
{
return
}
this.diseaseSheetDialog.open()
})
Text(this.info) .fontSize(18).fontColor('#ffff5454').padding(10).margin({top:20})
.visibility(this.info==''?Visibility.None:Visibility.Visible)
Column() {
Text(this.info) .fontSize(18).fontColor('#ffff5454').padding(10).margin({top:20})
.visibility(this.info==''?Visibility.None:Visibility.Visible)
// 登录按钮
Button({type:ButtonType.Normal}){
@ -624,20 +626,21 @@ export struct PerfectUserDataComp {
})
}
.width('100%')
.padding({top:50,bottom:20})
}
.width('100%')
.padding({top:50,bottom:20})
.padding(8)
.backgroundImage($r('app.media.bg_reg'))
.backgroundImageSize(ImageSize.FILL)
}
.width('100%')
.height('100%')
.padding(8)
.backgroundImage($r('app.media.bg_reg'))
.backgroundImageSize(ImageSize.FILL)
.layoutWeight(1)
.scrollable(ScrollDirection.Vertical)
.scrollBar(BarState.Off)
.backgroundColor('#ffffff')
}
.height('auto')
.scrollable(ScrollDirection.Vertical)
// .scrollBar(BarState.Off)
.backgroundColor('#ffffff')
.height('100%')
}
}

View File

@ -1,5 +1,5 @@
import { LoginSetInfo,PerfectUserDataComp } from 'register'
import { HdNav } from '@itcast/basic'
import { router } from '@kit.ArkUI';
@Entry
@ -10,7 +10,7 @@ struct LoginSetInfoPage {
build() {
Column() {
// LoginSetInfo()
HdNav({ title: '完善个人资料', showRightIcon: false, showLeftIcon: true,showRightText:true,rightText:'保存' })
PerfectUserDataComp({loginPhone:String(this.loginInputPhone.loginInputPhone),
state:Number(this.loginInputPhone.state),checkInfo:String(this.loginInputPhone.checkInfo)});
}

View File

@ -0,0 +1,14 @@
import { VideoSelected } from 'home'
@Entry
@Component
struct VideoSelectedPage {
build() {
RelativeContainer() {
VideoSelected()
}
.height('100%')
.width('100%')
}
}

View File

@ -26,6 +26,7 @@
"pages/VideoPage/PastVideoPage",
"pages/VideoPage/VideoGandanPage",
"pages/VideoPage/CommentReplyPage",
"pages/SearchPage/VideoSearchPage"
"pages/SearchPage/VideoSearchPage",
"pages/VideoPage/VideoSelectedPage"
]
}