liyubing

feat:大家聊,聊天图片未展示,见截图

1 import { commentItemModel } from './CommentModel' 1 import { commentItemModel } from './CommentModel'
2 2
  3 +/**
  4 + * 发布评论
  5 + */
3 @Observed 6 @Observed
4 export class publishCommentModel { 7 export class publishCommentModel {
5 8
@@ -8,6 +8,7 @@ import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index'; @@ -8,6 +8,7 @@ import { DateTimeUtils, Logger, ToastUtils } from 'wdKit/Index';
8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'; 8 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel';
9 import { PictureLoading } from '../widgets/vertical/PictureLoading'; 9 import { PictureLoading } from '../widgets/vertical/PictureLoading';
10 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index'; 10 import { TrackConstants, TrackingButton, TrackingPageBrowse } from 'wdTracking/Index';
  11 +import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
11 12
12 const TAG = 'DetailPlayLiveCommon' 13 const TAG = 'DetailPlayLiveCommon'
13 14
@@ -24,23 +25,39 @@ const TAG = 'DetailPlayLiveCommon' @@ -24,23 +25,39 @@ const TAG = 'DetailPlayLiveCommon'
24 export struct DetailPlayLiveCommon { 25 export struct DetailPlayLiveCommon {
25 private liveViewModel: LiveViewModel = new LiveViewModel() 26 private liveViewModel: LiveViewModel = new LiveViewModel()
26 pageShowTime: number = 0; 27 pageShowTime: number = 0;
  28 +
27 @Provide relId: string = '' 29 @Provide relId: string = ''
28 @Provide contentId: string = '' 30 @Provide contentId: string = ''
29 @Provide relType: string = '' 31 @Provide relType: string = ''
  32 +
  33 + // 直播状态
30 @Provide liveState: string = '' 34 @Provide liveState: string = ''
  35 + // 直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
31 @Provide liveStyle: number = -1 36 @Provide liveStyle: number = -1
  37 + // 直播地址
32 @Provide playUrl: string = '' 38 @Provide playUrl: string = ''
33 - @Provide imgUrl: string = '' 39 + // // 直播间背景图
  40 + // @Provide imgUrl: string = ''
  41 + // 全屏展示
34 @Provide pageShow: number = -1 42 @Provide pageShow: number = -1
  43 + // 关闭全屏
35 @Provide pageHide: number = -1 44 @Provide pageHide: number = -1
  45 + // 返回功能
36 @Provide pageBackPress: number = -1 46 @Provide pageBackPress: number = -1
  47 +
  48 +
  49 + @Provide liveDetailPageLogic :LiveDetailPageLogic = new LiveDetailPageLogic
  50 + // 直播详情内容
37 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 51 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
  52 + //发布评论 Model
38 @Provide publishCommentModel: publishCommentModel = new publishCommentModel() 53 @Provide publishCommentModel: publishCommentModel = new publishCommentModel()
  54 +
  55 + // 埋点
39 @Provide pageId: string = TrackConstants.PageName.Live_Detail 56 @Provide pageId: string = TrackConstants.PageName.Live_Detail
40 @Provide pageName: string = TrackConstants.PageName.Live_Detail 57 @Provide pageName: string = TrackConstants.PageName.Live_Detail
41 - // 横屏或竖屏 general-竖屏,news-横屏  
42 - @State liveLandscape: string = ''  
43 - @State isLoading: boolean = false 58 +
  59 + // 是否隐藏Loading view
  60 + @State isHideLoading: boolean = false
44 61
45 async aboutToAppear(): Promise<void> { 62 async aboutToAppear(): Promise<void> {
46 const par: Action = router.getParams() as Action; 63 const par: Action = router.getParams() as Action;
@@ -55,14 +72,14 @@ export struct DetailPlayLiveCommon { @@ -55,14 +72,14 @@ export struct DetailPlayLiveCommon {
55 build() { 72 build() {
56 Column() { 73 Column() {
57 // 直播预约或横屏直播统一进横屏直播 74 // 直播预约或横屏直播统一进横屏直播
58 - if (this.liveState === 'wait' || this.liveLandscape === 'news') { 75 + if (this.liveDetailPageLogic.isLangScapeScreenVideo()) {
59 // 非沉浸式直播 76 // 非沉浸式直播
60 DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType }) 77 DetailPlayLivePage({ contentId: this.contentId, relId: this.relId, relType: this.relType })
61 - } else if (this.liveLandscape === 'general') { 78 + } else if (this.liveDetailPageLogic.isVerticalScreenVideo()) {
62 // 沉浸式直播 79 // 沉浸式直播
63 DetailPlayVLivePage() 80 DetailPlayVLivePage()
64 } else { 81 } else {
65 - PictureLoading().visibility(this.isLoading ? Visibility.None : Visibility.Visible) 82 + PictureLoading().visibility(this.isHideLoading ? Visibility.None : Visibility.Visible)
66 } 83 }
67 } 84 }
68 .height('100%') 85 .height('100%')
@@ -93,13 +110,17 @@ export struct DetailPlayLiveCommon { @@ -93,13 +110,17 @@ export struct DetailPlayLiveCommon {
93 } 110 }
94 } 111 }
95 112
96 - this.liveLandscape =  
97 - detailData?.liveInfo?.liveLandScape 113 +
98 114
99 this.liveState = detailData.liveInfo?.liveState 115 this.liveState = detailData.liveInfo?.liveState
100 116
101 this.contentDetailData = data[0] 117 this.contentDetailData = data[0]
102 118
  119 + this.liveDetailPageLogic.contentDetailData = this.contentDetailData
  120 + this.liveDetailPageLogic.liveLandscape = detailData?.liveInfo?.liveLandScape
  121 + this.liveDetailPageLogic.liveState = detailData.liveInfo?.liveState
  122 + this.liveDetailPageLogic.resolvingRoomBackgroundImgUrl()
  123 +
103 this.publishCommentModel.targetId = String(detailData?.newsId || '') 124 this.publishCommentModel.targetId = String(detailData?.newsId || '')
104 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '') 125 this.publishCommentModel.targetRelId = String(detailData?.reLInfo?.relId || '')
105 this.publishCommentModel.targetTitle = detailData?.newsTitle 126 this.publishCommentModel.targetTitle = detailData?.newsTitle
@@ -110,22 +131,25 @@ export struct DetailPlayLiveCommon { @@ -110,22 +131,25 @@ export struct DetailPlayLiveCommon {
110 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '') 131 this.publishCommentModel.visitorComment = String(detailData?.visitorComment || '')
111 this.publishCommentModel.commentContent = '' 132 this.publishCommentModel.commentContent = ''
112 this.liveStyle = detailData.liveInfo?.liveStyle 133 this.liveStyle = detailData.liveInfo?.liveStyle
113 -  
114 - if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {  
115 - this.imgUrl = detailData.fullColumnImgUrls[0].url  
116 - } 134 + //
  135 + // if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
  136 + // this.contentDetailData.liveInfo.previewUrl.length > 0) {
  137 + // this.imgUrl = this.contentDetailData.liveInfo.previewUrl
  138 + // } else if (detailData.fullColumnImgUrls && detailData.fullColumnImgUrls.length > 0) {
  139 + // this.imgUrl = detailData.fullColumnImgUrls[0].url
  140 + // }
117 141
118 if (detailData.liveInfo.liveState == 'end') { 142 if (detailData.liveInfo.liveState == 'end') {
119 this.playUrl = detailData.liveInfo.vlive[0].replayUri 143 this.playUrl = detailData.liveInfo.vlive[0].replayUri
120 } 144 }
121 145
122 } else { 146 } else {
123 - this.isLoading 147 + this.isHideLoading = true
124 ToastUtils.shortToast('内容不存在') 148 ToastUtils.shortToast('内容不存在')
125 router.back() 149 router.back()
126 } 150 }
127 }, () => { 151 }, () => {
128 - this.isLoading 152 + this.isHideLoading = true
129 ToastUtils.shortToast('内容不存在') 153 ToastUtils.shortToast('内容不存在')
130 router.back() 154 router.back()
131 155
@@ -8,6 +8,7 @@ import { DisplayDirection } from 'wdConstant/Index'; @@ -8,6 +8,7 @@ import { DisplayDirection } from 'wdConstant/Index';
8 import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index'; 8 import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
9 import { PlayerEndView } from '../widgets/vertical/PlayerEndView'; 9 import { PlayerEndView } from '../widgets/vertical/PlayerEndView';
10 import { TrackConstants, TrackingButton } from 'wdTracking/Index'; 10 import { TrackConstants, TrackingButton } from 'wdTracking/Index';
  11 +import { LiveDetailPageLogic } from '../viewModel/LiveDetailPageLogic';
11 12
12 const storage = LocalStorage.getShared(); 13 const storage = LocalStorage.getShared();
13 const TAG = 'DetailPlayVLivePage' 14 const TAG = 'DetailPlayVLivePage'
@@ -29,12 +30,14 @@ export struct DetailPlayVLivePage { @@ -29,12 +30,14 @@ export struct DetailPlayVLivePage {
29 @Consume liveState: string 30 @Consume liveState: string
30 @Consume liveStyle: number 31 @Consume liveStyle: number
31 @Consume playUrl: string 32 @Consume playUrl: string
32 - @Consume imgUrl: string 33 + // @Consume imgUrl: string
33 @Consume @Watch('openFullScreen') pageShow: number 34 @Consume @Watch('openFullScreen') pageShow: number
34 @Consume @Watch('closeFullScreen') pageHide: number 35 @Consume @Watch('closeFullScreen') pageHide: number
35 @Consume contentId: string 36 @Consume contentId: string
36 @State swiperIndex: number = 1 37 @State swiperIndex: number = 1
37 38
  39 + @Consume liveDetailPageLogic :LiveDetailPageLogic
  40 +
38 aboutToAppear(): void { 41 aboutToAppear(): void {
39 this.openFullScreen() 42 this.openFullScreen()
40 this.getLiveRoomData() 43 this.getLiveRoomData()
@@ -61,7 +64,7 @@ export struct DetailPlayVLivePage { @@ -61,7 +64,7 @@ export struct DetailPlayVLivePage {
61 64
62 Stack() { 65 Stack() {
63 // 直播背景图,模糊处理 66 // 直播背景图,模糊处理
64 - Image(this.imgUrl) 67 + Image(this.liveDetailPageLogic.imgUrl)
65 .height('100%') 68 .height('100%')
66 .width('100%') 69 .width('100%')
67 .blur(100) 70 .blur(100)
  1 +import { ContentDetailDTO } from 'wdBean/Index'
  2 +
  3 +
  4 +/**
  5 + * 直播信息对象逻辑加工处理的工具类
  6 + */
  7 +export class LiveDetailPageLogic {
  8 + // 直播状态
  9 + liveState: string = ''
  10 + // 横屏或竖屏 general-竖屏,news-横屏
  11 + liveLandscape: string = ''
  12 + // 直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
  13 + liveStyle: number = -1
  14 + // 预告片图片/视频url
  15 + imgUrl: string = ''
  16 +
  17 +
  18 +
  19 + /**
  20 + * 直播详情页面,展示的直播信息对象
  21 + */
  22 + contentDetailData: ContentDetailDTO = new ContentDetailDTO
  23 +
  24 + /**
  25 + * 横屏直播
  26 + * @returns true:横屏直播;false:竖屏直播
  27 + */
  28 + isLangScapeScreenVideo(): boolean {
  29 +
  30 + return this.liveState === 'wait' || this.liveLandscape === 'news'
  31 + }
  32 +
  33 +
  34 + /**
  35 + * 竖屏直播
  36 + * @returns
  37 + */
  38 + isVerticalScreenVideo(): boolean {
  39 +
  40 + return this.liveLandscape === 'general'
  41 + }
  42 +
  43 +
  44 + /**
  45 + * 解析背景图片资源
  46 + */
  47 + resolvingRoomBackgroundImgUrl() {
  48 +
  49 + if (this.contentDetailData.liveInfo && this.contentDetailData.liveInfo.previewUrl &&
  50 + this.contentDetailData.liveInfo.previewUrl.length > 0) {
  51 + this.imgUrl = this.contentDetailData.liveInfo.previewUrl
  52 + } else if (this.contentDetailData.fullColumnImgUrls && this.contentDetailData.fullColumnImgUrls.length > 0) {
  53 + this.imgUrl = this.contentDetailData.fullColumnImgUrls[0].url
  54 + }
  55 + }
  56 +}
1 -import { ContentDetailDTO, LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' 1 +import { ContentDetailDTO, LiveRoomItemBean } from 'wdBean/Index'
2 import { CustomPullToRefresh, EmptyComponent, ErrorComponent, WDViewDefaultType } from 'wdComponent/Index' 2 import { CustomPullToRefresh, EmptyComponent, ErrorComponent, 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 RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout'  
5 import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' 4 import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean'
6 import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' 5 import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel'
7 import { ViewType } from 'wdConstant/Index' 6 import { ViewType } from 'wdConstant/Index'
8 import { LiveViewModel } from '../../viewModel/LiveViewModel' 7 import { LiveViewModel } from '../../viewModel/LiveViewModel'
9 import { TabChatItemComponent } from './TabChatItemComponent' 8 import { TabChatItemComponent } from './TabChatItemComponent'
10 -import { EmitterEventId, EmitterUtils, LazyDataSource, Logger } from 'wdKit'; 9 +import { EmitterEventId, EmitterUtils, LazyDataSource, Logger } from 'wdKit'
11 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel' 10 import { publishCommentModel } from 'wdComponent/src/main/ets/components/comment/model/PublishCommentModel'
12 -import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData'  
13 -import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'  
14 11
15 const TAG: string = 'TabChatComponent'; 12 const TAG: string = 'TabChatComponent';
16 13
@@ -23,14 +20,26 @@ export struct TabChatComponent { @@ -23,14 +20,26 @@ export struct TabChatComponent {
23 @State private pageModel: PageModel = new PageModel() 20 @State private pageModel: PageModel = new PageModel()
24 liveViewModel: LiveViewModel = new LiveViewModel() 21 liveViewModel: LiveViewModel = new LiveViewModel()
25 @State liveChatList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource(); 22 @State liveChatList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource();
26 -  
27 - // @State liveList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource();  
28 @Consume contentDetailData: ContentDetailDTO 23 @Consume contentDetailData: ContentDetailDTO
29 @Consume publishCommentModel: publishCommentModel 24 @Consume publishCommentModel: publishCommentModel
30 @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean 25 @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean
31 private scroller: Scroller = new Scroller() 26 private scroller: Scroller = new Scroller()
  27 + index: number = 0
  28 + @Prop @Watch('updateData') parentComponentIndex: number
  29 + private initUI: boolean = true
  30 +
  31 + /**
  32 + *
  33 + */
  34 + updateData() {
  35 +
  36 + if (this.index === this.parentComponentIndex && this.initUI) {
  37 + this.getLiveList()
  38 + }
  39 +
  40 + }
  41 +
32 aboutToAppear(): void { 42 aboutToAppear(): void {
33 - this.getLiveList()  
34 43
35 //注册通知 44 //注册通知
36 EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => { 45 EmitterUtils.receiveEvent(EmitterEventId.COMMENT_PUBLISH, async (targetId?: string) => {
@@ -66,7 +75,6 @@ export struct TabChatComponent { @@ -66,7 +75,6 @@ export struct TabChatComponent {
66 } else if (this.pageModel.viewType == ViewType.EMPTY) { 75 } else if (this.pageModel.viewType == ViewType.EMPTY) {
67 EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 }) 76 EmptyComponent({ emptyType: WDViewDefaultType.WDViewDefaultType_NoComment1 })
68 } else { 77 } else {
69 - // this.ListLayout()  
70 78
71 CustomPullToRefresh({ 79 CustomPullToRefresh({
72 alldata: this.liveChatList, 80 alldata: this.liveChatList,
@@ -79,6 +87,7 @@ export struct TabChatComponent { @@ -79,6 +87,7 @@ export struct TabChatComponent {
79 this.pageModel.currentPage = 1 87 this.pageModel.currentPage = 1
80 this.getLiveList(resolve) 88 this.getLiveList(resolve)
81 }, 89 },
  90 +
82 }) 91 })
83 } 92 }
84 } 93 }
@@ -99,24 +108,11 @@ export struct TabChatComponent { @@ -99,24 +108,11 @@ export struct TabChatComponent {
99 }, 108 },
100 (item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item) 109 (item: LiveRoomItemBean, contentIndex: number) => JSON.stringify(item)
101 ) 110 )
102 - // 加载更多  
103 - ListItem() {  
104 - if (this.pageModel.hasMore && this.liveChatList && this.liveChatList.totalCount() > 0) {  
105 - LoadMoreLayout({ isVisible: this.pageModel.hasMore })  
106 - } else if (!this.pageModel.hasMore && !this.pageModel.isLoading) {  
107 - PeopleShipNoMoreData()  
108 - }  
109 - }  
110 - } .edgeEffect(EdgeEffect.None) 111 +
  112 + }.edgeEffect(EdgeEffect.None)
111 .scrollBar(BarState.Off) 113 .scrollBar(BarState.Off)
112 - .onReachEnd(() => {  
113 - Logger.debug(TAG, "触底了");  
114 - if (!this.pageModel.isLoading && this.pageModel.hasMore) {  
115 - //加载分页数据  
116 - //this.currentPage++;  
117 - this.getLiveList()  
118 - }  
119 - }) 114 +
  115 +
120 } 116 }
121 117
122 @Builder 118 @Builder
@@ -141,7 +137,7 @@ export struct TabChatComponent { @@ -141,7 +137,7 @@ export struct TabChatComponent {
141 this.liveViewModel.getLiveChatList( 137 this.liveViewModel.getLiveChatList(
142 this.pageModel.currentPage, 138 this.pageModel.currentPage,
143 this.contentDetailData?.liveInfo?.mlive?.mliveId, 139 this.contentDetailData?.liveInfo?.mlive?.mliveId,
144 - String( this.contentDetailData.newsId), 140 + String(this.contentDetailData.newsId),
145 20,) 141 20,)
146 .then( 142 .then(
147 (data) => { 143 (data) => {
@@ -153,13 +149,21 @@ export struct TabChatComponent { @@ -153,13 +149,21 @@ export struct TabChatComponent {
153 resolve('') 149 resolve('')
154 } 150 }
155 } 151 }
156 - if(this.pageModel.currentPage ===1){ 152 + if (this.pageModel.currentPage === 1) {
157 this.liveChatList.clear() 153 this.liveChatList.clear()
158 } 154 }
159 Logger.debug(TAG, `${JSON.stringify(data)}`) 155 Logger.debug(TAG, `${JSON.stringify(data)}`)
160 if (data.barrageResponses && data.barrageResponses.length > 0) { 156 if (data.barrageResponses && data.barrageResponses.length > 0) {
161 this.pageModel.viewType = ViewType.LOADED; 157 this.pageModel.viewType = ViewType.LOADED;
162 this.liveChatList.push(...data.barrageResponses) 158 this.liveChatList.push(...data.barrageResponses)
  159 +
  160 + if (this.initUI) {
  161 + this.initUI = false
  162 + setTimeout(() => {
  163 + this.scroller.scrollToIndex(this.liveChatList.totalCount() - 1)
  164 + }, 300)
  165 + }
  166 +
163 if (data.barrageResponses.length === this.pageModel.pageSize) { 167 if (data.barrageResponses.length === this.pageModel.pageSize) {
164 this.pageModel.currentPage++; 168 this.pageModel.currentPage++;
165 this.pageModel.hasMore = true; 169 this.pageModel.hasMore = true;
@@ -16,37 +16,69 @@ export struct TabChatItemComponent { @@ -16,37 +16,69 @@ export struct TabChatItemComponent {
16 16
17 build() { 17 build() {
18 Row() { 18 Row() {
19 - Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl) 19 + Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') :
  20 + this.item.senderUserAvatarUrl)
20 .borderRadius(90) 21 .borderRadius(90)
21 .width(24) 22 .width(24)
22 .height(24) 23 .height(24)
23 Column() { 24 Column() {
24 - Row() {  
25 - Text() {  
26 - Span(this.item.senderUserName + ': ')  
27 - .fontColor('#666666')  
28 - Span(this.item.text)  
29 - .fontColor('#222222') 25 + if (this.item.dataType == 'ZH_IMAGE_MSG') {
  26 + Row() {
  27 + Text() {
  28 + Span(this.item.senderUserName + ': ')
  29 + .fontColor('#666666')
  30 + }
  31 + .margin({ left: 8 })
  32 + .lineHeight(20)
  33 + .layoutWeight(1)
  34 + .fontSize('14fp')
  35 + .fontWeight(400)
  36 + }
  37 + .alignItems(VerticalAlign.Top)
  38 +
  39 + if (this.item.pictureUrls && this.item.pictureUrls.length > 0) {
  40 + Image(this.item.pictureUrls[0])
  41 + .width(`100%`)
  42 + .objectFit(ImageFit.Contain)
  43 + .borderRadius(4)
  44 + .margin({
  45 + top: 10
  46 + })
  47 + .onClick(() => {
  48 + this.gotoMultipleListImagePage(this.item.pictureUrls[0])
  49 + })
  50 + }
  51 + } else {
  52 + Row() {
  53 + Text() {
  54 + Span(this.item.senderUserName + ': ')
  55 + .fontColor('#666666')
  56 + Span(this.item.text)
  57 + .fontColor('#222222')
  58 + }
  59 + .margin({ left: 8 })
  60 + .lineHeight(20)
  61 + .layoutWeight(1)
  62 + .fontSize('14fp')
  63 + .fontWeight(400)
  64 + }
  65 + .alignItems(VerticalAlign.Top)
  66 +
  67 + if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls &&
  68 + this.item.pictureUrls.length > 0) {
  69 + Image(this.item.pictureUrls[0])
  70 + .width(`100%`)
  71 + .objectFit(ImageFit.Contain)
  72 + .borderRadius(4)
  73 + .margin({
  74 + top: 10
  75 + })
  76 + .onClick(() => {
  77 + this.gotoMultipleListImagePage(this.item.pictureUrls[0])
  78 + })
30 } 79 }
31 - .margin({ left: 8 })  
32 - .lineHeight(20)  
33 - .layoutWeight(1)  
34 - .fontSize('14fp')  
35 - .fontWeight(400)  
36 - }  
37 - .alignItems(VerticalAlign.Top)  
38 - if (this.item.dataType == 'ZH_TEXT_AND_IMAGE_MSG' && this.item.pictureUrls && this.item.pictureUrls.length > 0) {  
39 - Image(this.item.pictureUrls[0])  
40 - .width(`100%`)  
41 - .objectFit(ImageFit.Contain)  
42 - .borderRadius(4)  
43 - .margin({  
44 - top: 10  
45 - })  
46 - .onClick(() => {  
47 - this.gotoMultipleListImagePage(this.item.pictureUrls[0])  
48 - })  
49 } 80 }
  81 +
50 } 82 }
51 .margin({ 83 .margin({
52 left: 8, 84 left: 8,
@@ -75,8 +107,8 @@ export struct TabChatItemComponent { @@ -75,8 +107,8 @@ export struct TabChatItemComponent {
75 height: 0, 107 height: 0,
76 picPath: imgUrl, 108 picPath: imgUrl,
77 picDesc: '', 109 picDesc: '',
78 - itemType:2,  
79 - id:0 110 + itemType: 2,
  111 + id: 0
80 }) 112 })
81 let taskAction: Action = { 113 let taskAction: Action = {
82 type: 'JUMP_DETAIL_PAGE', 114 type: 'JUMP_DETAIL_PAGE',
@@ -11,7 +11,7 @@ export struct TabComponent { @@ -11,7 +11,7 @@ export struct TabComponent {
11 @Prop @Watch('changeToChart') changeToTab: number 11 @Prop @Watch('changeToChart') changeToTab: number
12 @State fontColor: string = '#999999' 12 @State fontColor: string = '#999999'
13 @State selectedFontColor: string = '#222222' 13 @State selectedFontColor: string = '#222222'
14 - @State currentIndex: number = 0 14 + @Prop currentIndex: number = 0
15 // private controller: TabsController = new TabsController() 15 // private controller: TabsController = new TabsController()
16 private swiperController: SwiperController = new SwiperController() 16 private swiperController: SwiperController = new SwiperController()
17 @Prop tabs: string[] = [] 17 @Prop tabs: string[] = []
@@ -63,7 +63,11 @@ export struct TabComponent { @@ -63,7 +63,11 @@ export struct TabComponent {
63 } else if ('直播间' === item) { 63 } else if ('直播间' === item) {
64 TabLiveComponent({ lastInputedComment: this.lastInputedLiveComment }).backgroundColor('#F5F5F5') 64 TabLiveComponent({ lastInputedComment: this.lastInputedLiveComment }).backgroundColor('#F5F5F5')
65 } else if ('大家聊' === item) { 65 } else if ('大家聊' === item) {
66 - TabChatComponent({ lastInputedComment: this.lastInputedChatComment }).backgroundColor('#F5F5F5') 66 + TabChatComponent({
  67 + lastInputedComment: this.lastInputedChatComment,
  68 + index: index,
  69 + parentComponentIndex: this.currentIndex
  70 + }).backgroundColor('#F5F5F5')
67 } 71 }
68 72
69 }, (item: string, index: number) => { 73 }, (item: string, index: number) => {
@@ -74,6 +78,7 @@ export struct TabComponent { @@ -74,6 +78,7 @@ export struct TabComponent {
74 .vertical(false) 78 .vertical(false)
75 .indicator(false) 79 .indicator(false)
76 .loop(false) 80 .loop(false)
  81 + .cachedCount(-1)
77 .alignSelf(ItemAlign.Start) 82 .alignSelf(ItemAlign.Start)
78 .effectMode(EdgeEffect.None) 83 .effectMode(EdgeEffect.None)
79 .onChange((index: number) => { 84 .onChange((index: number) => {
@@ -25,7 +25,10 @@ export struct TabLiveComponent { @@ -25,7 +25,10 @@ export struct TabLiveComponent {
25 private scroller: Scroller = new Scroller() 25 private scroller: Scroller = new Scroller()
26 @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean 26 @Prop @Watch("lastInputedCommentChanged") lastInputedComment: LiveRoomItemBean
27 27
  28 +
  29 +
28 aboutToAppear(): void { 30 aboutToAppear(): void {
  31 +
29 this.getLiveList() 32 this.getLiveList()
30 } 33 }
31 34
@@ -92,7 +95,6 @@ export struct TabLiveComponent { @@ -92,7 +95,6 @@ export struct TabLiveComponent {
92 Logger.debug(TAG, "触底了"); 95 Logger.debug(TAG, "触底了");
93 if (!this.pageModel.isLoading && this.pageModel.hasMore) { 96 if (!this.pageModel.isLoading && this.pageModel.hasMore) {
94 //加载分页数据 97 //加载分页数据
95 - //this.currentPage++;  
96 this.getLiveList() 98 this.getLiveList()
97 } 99 }
98 }) 100 })
@@ -39,6 +39,10 @@ @@ -39,6 +39,10 @@
39 { 39 {
40 "name": "location_reason", 40 "name": "location_reason",
41 "value": " " 41 "value": " "
  42 + },
  43 + {
  44 + "name": "anchor_leaving",
  45 + "value": "主播暂时离开,马上回来"
42 } 46 }
43 ] 47 ]
44 } 48 }