Showing
1 changed file
with
23 additions
and
21 deletions
| @@ -10,7 +10,7 @@ import { LiveViewModel } from '../../viewModel/LiveViewModel' | @@ -10,7 +10,7 @@ import { LiveViewModel } from '../../viewModel/LiveViewModel' | ||
| 10 | import { Logger } from 'wdKit' | 10 | import { Logger } from 'wdKit' |
| 11 | import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | 11 | import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' |
| 12 | import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData' | 12 | import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData' |
| 13 | -import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean' | 13 | +import { LiveMessageIsHistoryMessage, LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean' |
| 14 | import { ArrayList } from '@kit.ArkTS' | 14 | import { ArrayList } from '@kit.ArkTS' |
| 15 | 15 | ||
| 16 | const TAG: string = 'TabLiveComponent'; | 16 | const TAG: string = 'TabLiveComponent'; |
| @@ -40,36 +40,34 @@ export struct TabLiveComponent { | @@ -40,36 +40,34 @@ export struct TabLiveComponent { | ||
| 40 | case LiveMessageOptType.ZH_UPDATE_MSG: { | 40 | case LiveMessageOptType.ZH_UPDATE_MSG: { |
| 41 | const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList) | 41 | const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList) |
| 42 | this.liveList.updateItem(this.lastInputedComment, index) | 42 | this.liveList.updateItem(this.lastInputedComment, index) |
| 43 | - return | ||
| 44 | - } | ||
| 45 | - break | 43 | + } break |
| 46 | case LiveMessageOptType.ZH_DELETE_MSG: { | 44 | case LiveMessageOptType.ZH_DELETE_MSG: { |
| 47 | const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList) | 45 | const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList) |
| 48 | this.liveList.deleteItem(index); | 46 | this.liveList.deleteItem(index); |
| 49 | - return | ||
| 50 | - } | ||
| 51 | - break | 47 | + } break |
| 52 | case LiveMessageOptType.ZH_TOP_MSG: | 48 | case LiveMessageOptType.ZH_TOP_MSG: |
| 53 | case LiveMessageOptType.ZH_UN_TOP_MSG: | 49 | case LiveMessageOptType.ZH_UN_TOP_MSG: |
| 54 | - case LiveMessageOptType.ZH_WALL_MSG: | 50 | + case LiveMessageOptType.ZH_WALL_MSG: { |
| 51 | + this.sortLiveRoomItemBean() | ||
| 52 | + } break | ||
| 55 | default: { | 53 | default: { |
| 56 | - let datas: LazyDataSource<LiveRoomItemBean> = | ||
| 57 | - this.liveViewModel.sortLiveRoomItemBean(this.lastInputedComment, this.liveList) | ||
| 58 | - this.liveList.replaceAll() | ||
| 59 | - this.liveList.addItems(datas.getDataArray()) | ||
| 60 | - return | ||
| 61 | - } | ||
| 62 | - break | 54 | + let optType = this.lastInputedComment.optionType != undefined ? this.lastInputedComment.optionType : this.lastInputedComment.dataType |
| 55 | + if (LiveMessageIsHistoryMessage(optType)) { | ||
| 56 | + this.sortLiveRoomItemBean() | ||
| 57 | + } | ||
| 58 | + } break | ||
| 63 | } | 59 | } |
| 64 | 60 | ||
| 65 | - if (this.liveList.totalCount() === 0) { | ||
| 66 | - this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) | ||
| 67 | - } else { | ||
| 68 | - this.liveList.addFirstItem(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) | ||
| 69 | - } | 61 | + // if (this.liveList.totalCount() === 0) { |
| 62 | + // this.liveList.push(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) | ||
| 63 | + // } else { | ||
| 64 | + // this.liveList.addFirstItem(this.liveViewModel.deepCopyLiveRoomItem(this.lastInputedComment)) | ||
| 65 | + // } | ||
| 70 | this.pageModel.viewType = ViewType.LOADED; | 66 | this.pageModel.viewType = ViewType.LOADED; |
| 71 | } | 67 | } |
| 72 | 68 | ||
| 69 | + | ||
| 70 | + | ||
| 73 | build() { | 71 | build() { |
| 74 | Stack() { | 72 | Stack() { |
| 75 | if (this.pageModel.viewType == ViewType.LOADING) { | 73 | if (this.pageModel.viewType == ViewType.LOADING) { |
| @@ -215,7 +213,11 @@ export struct TabLiveComponent { | @@ -215,7 +213,11 @@ export struct TabLiveComponent { | ||
| 215 | 213 | ||
| 216 | }) | 214 | }) |
| 217 | } | 215 | } |
| 218 | - | 216 | + sortLiveRoomItemBean() { |
| 217 | + let datas: LazyDataSource<LiveRoomItemBean> = this.liveViewModel.sortLiveRoomItemBean(this.lastInputedComment, this.liveList) | ||
| 218 | + this.liveList.replaceAll() | ||
| 219 | + this.liveList.addItems(datas.getDataArray()) | ||
| 220 | + } | ||
| 219 | updateLiveListData() { | 221 | updateLiveListData() { |
| 220 | let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean | 222 | let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean |
| 221 | liveRoomItemBeanTemp.text = this.contentDetailData.newIntroduction | 223 | liveRoomItemBeanTemp.text = this.contentDetailData.newIntroduction |
-
Please register or login to post a comment