wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  ref |> 对接直播置顶,取消置顶,上墙IM消息
... ... @@ -102,7 +102,8 @@ export function LiveMessageIsHistoryMessage(optionType: LiveMessageOptType): boo
case LiveMessageOptType.ZH_IMAGE_MSG:
case LiveMessageOptType.ZH_TEXT_AND_IMAGE_MSG:
case LiveMessageOptType.ZH_AUDIO_MSG:
case LiveMessageOptType.ZH_VIDEO_MSG: {
case LiveMessageOptType.ZH_VIDEO_MSG:
case LiveMessageOptType.ZH_WALL_MSG: {
isHistoryMessage = true
} break;
default:
... ...
... ... @@ -7,13 +7,14 @@ import {
LiveRoomItemBean,
ValueType
} from 'wdBean/Index'
import { LiveMessageIsHistoryMessage } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
import { LiveMessageIsHistoryMessage, LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
import { SpConstants } from 'wdConstant'
import { ContentDetailRequest } from 'wdDetailPlayApi/Index'
import { LazyDataSource, Logger, SPHelper } from 'wdKit/Index'
import { DateTimeUtils, LazyDataSource, Logger, SPHelper } from 'wdKit/Index'
import { ToastUtils } from 'wdKit/src/main/ets/utils/ToastUtils'
import { HttpUtils, ResponseDTO } from 'wdNetwork/Index'
import { LiveModel } from './LiveModel'
import { ArrayList } from '@kit.ArkTS'
const TAG = "LiveViewModel"
... ... @@ -242,4 +243,42 @@ export class LiveViewModel {
}
return index
}
///处理置顶/取消置顶消息
sortLiveRoomItemBean(liveRoomItemBean:LiveRoomItemBean, dataSource:LazyDataSource<LiveRoomItemBean>):LazyDataSource<LiveRoomItemBean> {
if (liveRoomItemBean.optionType == LiveMessageOptType.ZH_TOP_MSG || liveRoomItemBean.optionType == LiveMessageOptType.ZH_UN_TOP_MSG) {
const index = this.getLiveRoomItemBeanIndex(liveRoomItemBean, dataSource);
const currentLiveRoomItemBean = dataSource.get(index)
currentLiveRoomItemBean.isTop = liveRoomItemBean.isTop
dataSource.deleteItem(index)
dataSource.addFirstItem(currentLiveRoomItemBean)
}else {
if (LiveMessageIsHistoryMessage(liveRoomItemBean.optionType != undefined ? liveRoomItemBean.optionType :
liveRoomItemBean.dataType)) {
dataSource.addItem(liveRoomItemBean)
}
}
let resultMessageList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource()
let topMessageList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource()
let unTopMessageList: LazyDataSource<LiveRoomItemBean> = new LazyDataSource()
for (let itemBean of dataSource.getDataArray()) {
if (itemBean.isTop == 1) {
topMessageList.push(itemBean)
} else {
unTopMessageList.push(itemBean)
}
}
topMessageList.sort((item: LiveRoomItemBean, item2: LiveRoomItemBean) => {
let timeStamp1 = DateTimeUtils.parseDate(item.time, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
let timeStamp2 = DateTimeUtils.parseDate(item2.time, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
return timeStamp2 - timeStamp1
})
unTopMessageList.sort((item: LiveRoomItemBean, item2: LiveRoomItemBean) => {
let timeStamp1 = DateTimeUtils.parseDate(item.time, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
let timeStamp2 = DateTimeUtils.parseDate(item2.time, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)
return timeStamp2 - timeStamp1
})
resultMessageList.addItems(topMessageList.getDataArray())
resultMessageList.addItems(unTopMessageList.getDataArray())
return resultMessageList
}
}
... ...
... ... @@ -11,6 +11,7 @@ import { Logger } from 'wdKit'
import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout'
import { PeopleShipNoMoreData } from 'wdComponent/src/main/ets/components/reusable/PeopleShipNoMoreData'
import { LiveMessageOptType } from 'wdBean/src/main/ets/bean/live/LiveRoomBean'
import { ArrayList } from '@kit.ArkTS'
const TAG: string = 'TabLiveComponent';
... ... @@ -37,25 +38,28 @@ export struct TabLiveComponent {
Logger.debug(TAG, "1显示评论》》》: " + JSON.stringify(this.lastInputedComment))
switch (this.lastInputedComment.optionType) {
case LiveMessageOptType.ZH_UPDATE_MSG: {
const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment,this.liveList)
this.liveList.updateItem(this.lastInputedComment,index)
const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList)
this.liveList.updateItem(this.lastInputedComment, index)
return
} break
}
break
case LiveMessageOptType.ZH_DELETE_MSG: {
const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment,this.liveList)
const index = this.liveViewModel.getLiveRoomItemBeanIndex(this.lastInputedComment, this.liveList)
this.liveList.deleteItem(index);
return
}
break
case LiveMessageOptType.ZH_TOP_MSG: {
} break
case LiveMessageOptType.ZH_UN_TOP_MSG: {
} break
case LiveMessageOptType.ZH_WALL_MSG: {
} break
break
case LiveMessageOptType.ZH_TOP_MSG:
case LiveMessageOptType.ZH_UN_TOP_MSG:
case LiveMessageOptType.ZH_WALL_MSG:
default: {
let datas: LazyDataSource<LiveRoomItemBean> =
this.liveViewModel.sortLiveRoomItemBean(this.lastInputedComment, this.liveList)
this.liveList.replaceAll()
this.liveList.addItems(datas.getDataArray())
return
}
break
}
if (this.liveList.totalCount() === 0) {
... ...