wangyujian_wd

fix:1)直播详情页面修改优化

@@ -69,3 +69,5 @@ export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" @@ -69,3 +69,5 @@ export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
69 69
70 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" 70 export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
71 71
  72 +export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
  73 +
@@ -11,7 +11,7 @@ export struct LiveCommentComponent { @@ -11,7 +11,7 @@ export struct LiveCommentComponent {
11 11
12 build() { 12 build() {
13 Row() { 13 Row() {
14 - Image($r('app.media.back_icon')) 14 + Image($r('app.media.iv_back_left_black'))
15 .width(24) 15 .width(24)
16 .height(24) 16 .height(24)
17 .margin({ 17 .margin({
@@ -71,7 +71,7 @@ export struct LiveCommentComponent { @@ -71,7 +71,7 @@ export struct LiveCommentComponent {
71 left: 6, 71 left: 6,
72 right: 2 72 right: 2
73 }) 73 })
74 - Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal')) 74 + Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal'))
75 .width(24) 75 .width(24)
76 .height(24) 76 .height(24)
77 .margin({ 77 .margin({
1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' 1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
2 -import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index' 2 +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI,WDViewDefaultType } from 'wdComponent/Index'
3 import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' 3 import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
4 import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' 4 import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
5 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' 5 import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
@@ -79,7 +79,7 @@ export struct TabChatComponent { @@ -79,7 +79,7 @@ export struct TabChatComponent {
79 getLiveChatList() { 79 getLiveChatList() {
80 this.pageModel.currentPage = 1 80 this.pageModel.currentPage = 1
81 this.liveViewModel.getLiveChatList( 81 this.liveViewModel.getLiveChatList(
82 - 1, 82 + this.pageModel.currentPage,
83 this.liveDetailsBean?.liveInfo?.mlive?.mliveId, 83 this.liveDetailsBean?.liveInfo?.mlive?.mliveId,
84 this.liveDetailsBean?.newsId, 84 this.liveDetailsBean?.newsId,
85 20,) 85 20,)
1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' 1 import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index'
2 -import { ListHasNoMoreDataUI } from 'wdComponent/Index' 2 +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index'
3 import { StringUtils } from 'wdKit/Index' 3 import { StringUtils } from 'wdKit/Index'
4 import { LiveViewModel } from '../../viewModel/LiveViewModel' 4 import { LiveViewModel } from '../../viewModel/LiveViewModel'
5 import { TabLiveItemComponent } from './TabLiveItemComponent' 5 import { TabLiveItemComponent } from './TabLiveItemComponent'
  6 +import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout'
  7 +import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
  8 +import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
  9 +import { ViewType } from 'wdConstant/Index'
  10 +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
  11 +import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'
6 12
7 @Component 13 @Component
8 export struct TabLiveComponent { 14 export struct TabLiveComponent {
9 liveViewModel: LiveViewModel = new LiveViewModel() 15 liveViewModel: LiveViewModel = new LiveViewModel()
10 @State liveList: Array<LiveRoomItemBean> = [] 16 @State liveList: Array<LiveRoomItemBean> = []
11 @Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean 17 @Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean
  18 + @State private pageModel: PageModel = new PageModel()
12 19
13 updateDate() { 20 updateDate() {
14 this.getLiveList() 21 this.getLiveList()
@@ -20,51 +27,98 @@ export struct TabLiveComponent { @@ -20,51 +27,98 @@ export struct TabLiveComponent {
20 27
21 build() { 28 build() {
22 Stack() { 29 Stack() {
23 - if (this.liveList.length == 0) {  
24 - ListHasNoMoreDataUI({ style: 2 }) 30 + if (this.pageModel.viewType == ViewType.LOADING) {
  31 + this.LoadingLayout()
  32 + } else if (this.pageModel.viewType == ViewType.ERROR) {
  33 + ErrorComponent()
  34 + } else if (this.pageModel.viewType == ViewType.EMPTY) {
  35 + EmptyComponent()
25 } else { 36 } else {
26 - List() {  
27 - ForEach(this.liveList, (item: LiveRoomItemBean) => {  
28 - ListItem() {  
29 - TabLiveItemComponent({ item: item })  
30 - }  
31 - })  
32 - ListItem() {  
33 - ListHasNoMoreDataUI()  
34 - }  
35 - } 37 + this.ListLayout()
36 } 38 }
37 } 39 }
38 .alignContent(Alignment.Top) 40 .alignContent(Alignment.Top)
39 .backgroundColor('#F5F5F5') 41 .backgroundColor('#F5F5F5')
40 .height('100%') 42 .height('100%')
41 .width('100%') 43 .width('100%')
  44 + }
42 45
  46 + @Builder
  47 + ListLayout() {
  48 + List() {
  49 + ListItem() {
  50 + // 下拉刷新
  51 + RefreshLayout({
  52 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
  53 + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
  54 + })
  55 + }
  56 +
  57 + ForEach(this.liveList, (item: LiveRoomItemBean) => {
  58 + ListItem() {
  59 + TabLiveItemComponent({ item: item })
  60 + }
  61 + })
  62 + // 加载更多
  63 + ListItem() {
  64 + if (this.pageModel.hasMore) {
  65 + LoadMoreLayout({
  66 + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
  67 + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
  68 + })
  69 + } else {
  70 + ListHasNoMoreDataUI()
  71 + }
  72 + }
  73 + }
  74 + }
  75 +
  76 + @Builder
  77 + LoadingLayout() {
  78 + CustomRefreshLoadLayout({
  79 + refreshBean: new RefreshLayoutBean(true,
  80 + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight)
  81 + })
43 } 82 }
44 83
45 getLiveList() { 84 getLiveList() {
  85 + this.pageModel.currentPage = 1
46 this.liveViewModel.getLiveList( 86 this.liveViewModel.getLiveList(
47 - 1, 87 + this.pageModel.currentPage,
48 this.liveDetailsBean?.liveInfo?.mlive?.mliveId, 88 this.liveDetailsBean?.liveInfo?.mlive?.mliveId,
49 this.liveDetailsBean?.newsId, 89 this.liveDetailsBean?.newsId,
50 20) 90 20)
51 .then( 91 .then(
52 (data) => { 92 (data) => {
53 - /**  
54 - * 在直播聊天添加一条新内容逻辑:  
55 - 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait"  
56 - 消息内容:  
57 - 1.头像固定:APP默认头像  
58 - 2.名称固定:人民日报主持人  
59 - 3.内容:详情接口的简介,newIntroduction  
60 - */  
61 - if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId) && this.liveDetailsBean && this.liveDetailsBean.liveInfo.liveState != 'wait') {  
62 - let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean  
63 - liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction  
64 - liveRoomItemBeanTemp.senderUserName = '人民日报主持人'  
65 - data.barrageResponses.push(liveRoomItemBeanTemp) 93 + if (data.barrageResponses && data.barrageResponses.length > 0) {
  94 + /**
  95 + * 在直播聊天添加一条新内容逻辑:
  96 + 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait"
  97 + 消息内容:
  98 + 1.头像固定:APP默认头像
  99 + 2.名称固定:人民日报主持人
  100 + 3.内容:详情接口的简介,newIntroduction
  101 + */
  102 + if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId)
  103 + && this.liveDetailsBean
  104 + && this.liveDetailsBean.liveInfo.liveState != 'wait'
  105 + && this.pageModel.currentPage == 1) {
  106 + let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
  107 + liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
  108 + liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
  109 + data.barrageResponses.push(liveRoomItemBeanTemp)
  110 + }
  111 + this.pageModel.viewType = ViewType.LOADED;
  112 + this.liveList.push(...data.barrageResponses)
  113 + if (data.barrageResponses.length === this.pageModel.pageSize) {
  114 + this.pageModel.currentPage++;
  115 + this.pageModel.hasMore = true;
  116 + } else {
  117 + this.pageModel.hasMore = false;
  118 + }
  119 + } else {
  120 + this.pageModel.viewType = ViewType.EMPTY;
66 } 121 }
67 - this.liveList = data.barrageResponses  
68 }, 122 },
69 () => { 123 () => {
70 124
1 -import { LiveRoomItemBean } from 'wdBean/Index' 1 +import { LiveRoomItemBean, PhotoListBean } from 'wdBean/Index'
2 import { DateTimeUtils, StringUtils } from 'wdKit/Index' 2 import { DateTimeUtils, StringUtils } from 'wdKit/Index'
3 3
4 @Component 4 @Component
5 export struct TabLiveItemComponent { 5 export struct TabLiveItemComponent {
6 item: LiveRoomItemBean = {} as LiveRoomItemBean 6 item: LiveRoomItemBean = {} as LiveRoomItemBean
  7 + photoList: PhotoListBean[] = []
7 8
8 aboutToAppear(): void { 9 aboutToAppear(): void {
9 10
@@ -86,7 +87,16 @@ export struct TabLiveItemComponent { @@ -86,7 +87,16 @@ export struct TabLiveItemComponent {
86 .aspectRatio(310 / 174) 87 .aspectRatio(310 / 174)
87 .objectFit(ImageFit.Auto) 88 .objectFit(ImageFit.Auto)
88 .borderRadius(4) 89 .borderRadius(4)
89 - } 90 + }.onClick(() => {
  91 + for (let item of this.item.pictureUrls) {
  92 + this.photoList.push({
  93 + width: 0,
  94 + height: 0,
  95 + picPath: item,
  96 + picDesc: ''
  97 + })
  98 + }
  99 + })
90 }) 100 })
91 }.margin({ 101 }.margin({
92 left: 32, 102 left: 32,
@@ -200,18 +200,21 @@ export struct PlayUIComponent { @@ -200,18 +200,21 @@ export struct PlayUIComponent {
200 } else { 200 } else {
201 Blank() 201 Blank()
202 } 202 }
203 - Image($r('app.media.icon_live_player_full_screen'))  
204 - .width(24)  
205 - .height(24)  
206 - .onClick(() => {  
207 - this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL  
208 - WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?  
209 - window.Orientation.PORTRAIT :  
210 - window.Orientation.LANDSCAPE)  
211 - devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?  
212 - window.Orientation.PORTRAIT :  
213 - window.Orientation.LANDSCAPE);  
214 - }) 203 + if (this.liveDetailsBean?.liveInfo?.liveState == 'running'
  204 + || this.liveDetailsBean?.liveInfo?.liveState == 'end') {
  205 + Image($r('app.media.icon_live_player_full_screen'))
  206 + .width(24)
  207 + .height(24)
  208 + .onClick(() => {
  209 + this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
  210 + WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
  211 + window.Orientation.PORTRAIT :
  212 + window.Orientation.LANDSCAPE)
  213 + devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
  214 + window.Orientation.PORTRAIT :
  215 + window.Orientation.LANDSCAPE);
  216 + })
  217 + }
215 } 218 }
216 .alignItems(VerticalAlign.Center) 219 .alignItems(VerticalAlign.Center)
217 .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) 220 .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] })
@@ -85,7 +85,7 @@ export struct WDPlayerRenderLiveView { @@ -85,7 +85,7 @@ export struct WDPlayerRenderLiveView {
85 console.log('insId===', this.insId) 85 console.log('insId===', this.insId)
86 this.xComponentController.setXComponentSurfaceSize({ 86 this.xComponentController.setXComponentSurfaceSize({
87 surfaceWidth: 1920, 87 surfaceWidth: 1920,
88 - surfaceHeight: 1080 88 + surfaceHeight: 720
89 }); 89 });
90 this.playerController?.setXComponentController(this.xComponentController) 90 this.playerController?.setXComponentController(this.xComponentController)
91 if (this.onLoad) { 91 if (this.onLoad) {