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,36 +27,70 @@ export struct TabLiveComponent { @@ -20,36 +27,70 @@ 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 {
  37 + this.ListLayout()
  38 + }
  39 + }
  40 + .alignContent(Alignment.Top)
  41 + .backgroundColor('#F5F5F5')
  42 + .height('100%')
  43 + .width('100%')
  44 + }
  45 +
  46 + @Builder
  47 + ListLayout() {
26 List() { 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 +
27 ForEach(this.liveList, (item: LiveRoomItemBean) => { 57 ForEach(this.liveList, (item: LiveRoomItemBean) => {
28 ListItem() { 58 ListItem() {
29 TabLiveItemComponent({ item: item }) 59 TabLiveItemComponent({ item: item })
30 } 60 }
31 }) 61 })
  62 + // 加载更多
32 ListItem() { 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 {
33 ListHasNoMoreDataUI() 70 ListHasNoMoreDataUI()
34 } 71 }
35 } 72 }
36 } 73 }
37 } 74 }
38 - .alignContent(Alignment.Top)  
39 - .backgroundColor('#F5F5F5')  
40 - .height('100%')  
41 - .width('100%')  
42 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) => {
  93 + if (data.barrageResponses && data.barrageResponses.length > 0) {
53 /** 94 /**
54 * 在直播聊天添加一条新内容逻辑: 95 * 在直播聊天添加一条新内容逻辑:
55 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait" 96 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait"
@@ -58,13 +99,26 @@ export struct TabLiveComponent { @@ -58,13 +99,26 @@ export struct TabLiveComponent {
58 2.名称固定:人民日报主持人 99 2.名称固定:人民日报主持人
59 3.内容:详情接口的简介,newIntroduction 100 3.内容:详情接口的简介,newIntroduction
60 */ 101 */
61 - if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId) && this.liveDetailsBean && this.liveDetailsBean.liveInfo.liveState != 'wait') { 102 + if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId)
  103 + && this.liveDetailsBean
  104 + && this.liveDetailsBean.liveInfo.liveState != 'wait'
  105 + && this.pageModel.currentPage == 1) {
62 let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean 106 let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean
63 liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction 107 liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction
64 liveRoomItemBeanTemp.senderUserName = '人民日报主持人' 108 liveRoomItemBeanTemp.senderUserName = '人民日报主持人'
65 data.barrageResponses.push(liveRoomItemBeanTemp) 109 data.barrageResponses.push(liveRoomItemBeanTemp)
66 } 110 }
67 - this.liveList = data.barrageResponses 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;
  121 + }
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,8 +87,17 @@ export struct TabLiveItemComponent { @@ -86,8 +87,17 @@ 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)
  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 + })
89 } 98 }
90 }) 99 })
  100 + })
91 }.margin({ 101 }.margin({
92 left: 32, 102 left: 32,
93 top: 8 103 top: 8
@@ -200,6 +200,8 @@ export struct PlayUIComponent { @@ -200,6 +200,8 @@ export struct PlayUIComponent {
200 } else { 200 } else {
201 Blank() 201 Blank()
202 } 202 }
  203 + if (this.liveDetailsBean?.liveInfo?.liveState == 'running'
  204 + || this.liveDetailsBean?.liveInfo?.liveState == 'end') {
203 Image($r('app.media.icon_live_player_full_screen')) 205 Image($r('app.media.icon_live_player_full_screen'))
204 .width(24) 206 .width(24)
205 .height(24) 207 .height(24)
@@ -213,6 +215,7 @@ export struct PlayUIComponent { @@ -213,6 +215,7 @@ export struct PlayUIComponent {
213 window.Orientation.LANDSCAPE); 215 window.Orientation.LANDSCAPE);
214 }) 216 })
215 } 217 }
  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]] })
218 .width('100%') 221 .width('100%')
@@ -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) {