Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yanlu
2024-05-14 17:04:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
556edbb0196a16ac7a96e171421b44a453eea309
556edbb0
1 parent
615608c5
fix:17066 功能缺陷-【生产环境】直播列表-分页,“已显示全部内容” 未显示
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
279 additions
and
109 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
sight_harmony/features/wdComponent/src/main/ets/components/reserveMore/ReserveMorePage.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageViewModel.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_live_new_running.png
sight_harmony/features/wdComponent/src/main/resources/base/media/point_live_icon.png
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
556edbb
...
...
@@ -329,6 +329,11 @@ export class HttpUrlUtils {
*/
static readonly MESSAGE_UN_READ_DATA_PATH: string = "/api/rmrb-inside-mail/zh/c/inside-mail/private/polymerizationInfo?createTime=";
/**
* 直播详情-直播人数
*/
static readonly LIVE_ROOM_BATCH_ALL_DATA_PATH: string = "/api/live-center-message/zh/a/live/room/number/batch/all";
static getHost(): string {
return HostManager.getHost();
}
...
...
@@ -746,4 +751,12 @@ export class HttpUrlUtils {
let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/common/user/c/device/push";
return url;
}
//获取直播人数
static getLiveRoomBatchAllDataUrl() {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_ROOM_BATCH_ALL_DATA_PATH
return url
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/LiveMorePage.ets
View file @
556edbb
import { ContentDTO } from 'wdBean';
import { ContentDTO
, LiveRoomDataBean
} from 'wdBean';
import { ProcessUtils } from 'wdRouter';
import { CommonConstants } from 'wdConstant/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
import RefreshLayout from '../page/RefreshLayout';
import { RefreshLayoutBean } from '../page/RefreshLayoutBean';
import PageModel from '../../viewmodel/PageModel';
import { DateTimeUtils, LazyDataSource } from 'wdKit/Index';
import { DateTimeUtils, LazyDataSource, Logger } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
import { ViewType } from 'wdConstant/src/main/ets/enum/ViewType';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
import { EmptyComponent } from '../view/EmptyComponent';
import { ErrorComponent } from '../view/ErrorComponent';
import LoadMoreLayout from '../page/LoadMoreLayout'
const TAG: string = 'LiveMorePage';
...
...
@@ -21,60 +24,22 @@ const TAG: string = 'LiveMorePage';
@Entry
@Component
struct LiveMorePage {
@State private pageModel: PageModel = new PageModel();
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
type: number = 1;
currentPage: number = 1;
pageSize: number = 20;
operDataList: ContentDTO[] = [];
title: string = '直播列表'
@State contentDTO: ContentDTO = new ContentDTO();
// appStyle: '15',
// coverType: 1,
// objectType: '9',
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
// fullColumnImgUrls: [
// {
// landscape: 2,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/img/2024/0413/VL20Z09ISBEKXZU_963672030241091584.jpeg?x-oss-process=image/resize,m_fill,h_450,w_800/quality,q_90',
// weight: 1170
// }
// ],
// newsTitle: '押解画面公开!被湖北民警从柬埔寨押解回国被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们被湖北民警从柬埔寨押解回国的130名涉赌诈嫌疑人是他们的130名涉赌诈嫌疑人是他们',
// publishTime: '1712993333000',
// rmhInfo: {
// authIcon: '',
// authTitle: '',
// authTitle2: '',
// banControl: 0,
// cnIsAttention: 1,
// rmhDesc: '中共武汉市委机关报长江日报官方人民号',
// rmhHeadUrl: 'https://uatjdcdnphoto.aikan.pdnews.cn/vod/content/202302/202302Sa121448724/TUw.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhId: '4255270',
// rmhName: '长江日报',
// userId: '513696944662469',
// userType: '3'
// },
// videoInfo: {
// firstFrameImageUri: '',
// videoDuration: 12,
// // videoLandscape: 2,
// videoUrl: 'https://rmrbcmsonline.peopleapp.com/rb_recsys/video/2024/0413/VL20Z09ISBEKXZU_963672027208609792.mp4'
// },
// photoNum: '9',
// voiceInfo: {
// voiceDuration: 12
// }
// } as ContentDTO;
@State private hasMore: boolean = true
@State private currentPage: number = 1
@State private isLoading: boolean = false
@State viewType: ViewType = ViewType.LOADING
private scroller: Scroller = new Scroller()
@State liveRoomList: LiveRoomDataBean[] = []
aboutToAppear(): void {
PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => {
// this.operDataList = []
// this.operDataList.push(...liveReviewDTO.list)
this.data.push(...liveReviewDTO.list)
})
this.currentPage = 1
this.getData()
}
build() {
...
...
@@ -88,48 +53,78 @@ struct LiveMorePage {
Column() {
this.TabbarNormal()
if (this.viewType == ViewType.LOADING) {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
.onTouch(() => {
if (this.viewType === ViewType.ERROR) {
this.getData()
}
})
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
} else {
CustomPullToRefresh({
alldata: this.data,
scroller: this.scroller,
hasMore: false,
customList: () => {
this.ListLayout()
},
onRefresh: (resolve) => {
this.currentPage = 1
this.getData(resolve)
},
})
}
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((
event: ClickEvent
) => {
.onClick(() => {
ProcessUtils.processPage(this.contentDTO)
})
}
@Builder
ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
LoadingLayout() {
}
LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => {
@Builder
ListLayout() {
List({scroller: this.scroller}) {
// 下拉刷新
LazyForEach(this.data, (contentDTO: ContentDTO) => {
ListItem() {
// Column() {
// CompParser({ compDTO: compDTO, compIndex: compIndex });
// }
this.buildItem(contentDTO)
}
},
(contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString()
)
// 加载更多
ListItem() {
if (this.hasMore && this.data && this.data.totalCount() > 0) {
LoadMoreLayout({ isVisible: this.hasMore })
} else if (!this.hasMore && !this.isLoading) {
PeopleShipNoMoreData()
}
}
}
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
.onScrollIndex((start: number, end: number) => {
// Listen to the first index of the current list.
this.pageModel.startIndex = start;
// 包含了 头尾item,判断时需要考虑+2
this.pageModel.endIndex = end;
.height('calc(100% - 44vp)')
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if(!this.isLoading && this.hasMore){
//加载分页数据
this.currentPage++;
this.getData()
}
})
}
...
...
@@ -148,22 +143,45 @@ struct LiveMorePage {
.margin({ top: 16, bottom: 8 })
.alignSelf(ItemAlign.Start)
Stack() {
if (item.fullColumnImgUrls && item.fullColumnImgUrls.length > 0) {
Image(item.fullColumnImgUrls[0].url)
.width('100%')
.height(196)
.borderRadius(4)
this.LiveImage()
}
this.LiveImage(item)
}
.alignContent(Alignment.BottomEnd)
Row() {
if (item.rmhInfo && item.rmhInfo.rmhName) {
Text(item.rmhInfo.rmhName)
.fontSize(12)
.fontWeight(400)
.fontColor($r('app.color.color_B0B0B0'))
.fontFamily('PingFang SC-Medium')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.align(Alignment.Start)
Image($r('app.media.point_live_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width(16)
.height(16)
.margin(2)
}
Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp)))
.fontSize(13
)
.fontSize(12
)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 8, bottom: 8 })
.align(Alignment.Start)
.width('100%')
.fontColor($r('app.color.color_B0B0B0'))
}
.margin({ top: 8, bottom: 8 })
Divider()
.strokeWidth(1)
...
...
@@ -198,10 +216,10 @@ struct LiveMorePage {
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('
35lpx
')
.fontSize('
18vp
')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('
42lpx
')
.lineHeight('
22vp
')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
...
...
@@ -212,17 +230,141 @@ struct LiveMorePage {
}
@Builder
LiveImage() {
LiveImage(
item: ContentDTO
) {
Row() {
Image($r('app.media.icon_live_status_running'))
.width(22)
.height(18)
Image($r('app.media.icon_live_new_running'))
.width(14)
.height(14)
.margin({
right: '2vp'
})
Text('直播中')
.fontSize('11fp')
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
.margin({
right: '5vp'
})
Divider()
.vertical(true)
.strokeWidth(1)
.height('12vp')
.margin({ top: 2, bottom: 2 })
.color(Color.White)
if (this.getLiveRoomNumber(item).length > 0) {
Text(this.getLiveRoomNumber(item))
.fontSize('12vp')
.fontWeight(400)
.fontColor(Color.White)
.margin({
left: '5vp'
})
}
}
.
backgroundColor('#4D000000'
)
.
justifyContent(FlexAlign.End
)
.margin({ right: 8, bottom: 8 })
}
private async getData(resolve?: (value: string | PromiseLike<string>) => void) {
if (this.isLoading) {
if (resolve) {
resolve('已更新至最新')
}
return
}
this.isLoading = true
try {
const liveReviewDTO = await PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize)
if (liveReviewDTO && liveReviewDTO.list && liveReviewDTO.list.length > 0) {
if (liveReviewDTO.list.length === this.pageSize) {
this.hasMore = true;
} else {
this.hasMore = false;
}
if (this.currentPage == 1) {
this.data.clear()
}
this.data.push(...liveReviewDTO.list)
this.getLiveRoomDataInfo(liveReviewDTO.list)
} else {
this.hasMore = false;
}
this.resolveEnd(true, resolve)
if (liveReviewDTO.list.length == 0 && this.currentPage == 1) {
this.viewType = ViewType.EMPTY
}
}catch (exception) {
this.resolveEnd(false, resolve)
}
// PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
// // this.operDataList = []
// // this.operDataList.push(...liveReviewDTO.list)
// this.data.push(...liveReviewDTO.list)
//
// // this.getAppointmentInfo()
// })
}
private resolveEnd(isTop: boolean, resolve?: (value: string | PromiseLike<string>) => void) {
if (resolve) {
if (this.currentPage == 1 && isTop) {
resolve('已更新至最新')
}else {
resolve('')
}
}
if (this.currentPage == 1 && !isTop) {
this.viewType = ViewType.ERROR
} else {
this.viewType = ViewType.LOADED
}
this.isLoading = false
}
private getLiveDetailIds(list: ContentDTO[]): string {
let idList: string[] = []
list.forEach(item => {
idList.push(item.objectId)
});
return idList.join(',')
}
// 获取评论数
async getLiveRoomDataInfo(list: ContentDTO[]) {
const reserveIds = this.getLiveDetailIds(list)
Logger.debug(TAG,'是否预约数据:' +` ${reserveIds}`)
PageViewModel.getLiveRoomBatchInfo(reserveIds).then((result) => {
Logger.debug(TAG,'是否预约数据:' +` ${JSON.stringify(result)}`)
if (result && result.length > 0) {
this.liveRoomList.push(...result)
this.data.reloadData()
}
}).catch(() =>{
// this.data.push(...list)
})
}
// 判断是否预约
getLiveRoomNumber(item: ContentDTO): string {
const objc = this.liveRoomList.find((element: LiveRoomDataBean) => {
return element.liveId.toString() == item.objectId
})
if (objc && objc.pv && objc.pv > 0) {
return this.computeShowNum(objc.pv)
}
return ''
}
private computeShowNum(count: number): string {
if (count >= 10000) {
let num = ( count / 10000).toFixed(1)
if (Number(num.substring(num.length-1)) == 0) {
num = num.substring(0, num.length-2)
}
return num + '万人参加'
}
return `${count}人参加`
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/reserveMore/ReserveMorePage.ets
View file @
556edbb
...
...
@@ -107,7 +107,7 @@ struct ReserveMorePage {
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.backgroundColor('#F5F5F5')
.
layoutWeight(1
)
.
height('calc(100% - 44vp)'
)
.onReachEnd(() => {
Logger.debug(TAG, "触底了");
if(!this.isLoading && this.hasMore){
...
...
@@ -144,13 +144,13 @@ struct ReserveMorePage {
.margin({ top: 4, left: 12, right: 12 })
.alignSelf(ItemAlign.Start)
Row() {
if (item.liveInfo && item.liveInfo.liveStartTime) {
Row() {
Image($r('app.media.reserve_play_icon'))
.width(20)
.height(20)
.margin({ left: 10, top: 2, bottom: 2, right: 6 })
// Text(DateTimeUtils.formatDate(item.liveInfo.liveStartTime, "MM月dd日 HH:mm"))
Text(this.getReserveDate(item.liveInfo.liveStartTime, 1))
.fontSize(12)
.fontWeight(500)
...
...
@@ -180,25 +180,8 @@ struct ReserveMorePage {
}
.backgroundColor('#F5F5F5')
.margin(12)
// Flex({ justifyContent: FlexAlign.Center }) {
// Text(this.isAppointmentLive ? '已预约' : '预约')
// .fontSize(12)
// .fontWeight(400)
// .fontFamily('PingFang SC-Regular')
// .width(52)
// .height(24)
// .fontColor(Color.White)
// .textAlign(TextAlign.Center)
// .onClick(() => {
// this.liveAppointment(item)
// })
// }
// .width(52)
// .backgroundColor('#ED2800')
// .borderRadius(3)
// ReserveMoreAttentionComponent({reserveItem: this.getAttentionItem(item), })
// .margin({ right: 12 })
}
// 预约
Row() {
LoadingProgress()
.width(20)
...
...
@@ -522,9 +505,5 @@ struct ReserveMorePage {
}
}
async liveAppointment(item: ContentDTO) {
const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
556edbb
...
...
@@ -24,7 +24,8 @@ import {
postInteractAccentionOperateParams,
postRecommendListParams,
GoldenPositionExtraBean,
FeedbackTypeBean
FeedbackTypeBean,
LiveRoomDataBean
} from 'wdBean';
import { PageUIReqBean } from '../components/page/bean/PageUIReqBean';
import { ArrayList } from '@kit.ArkTS';
...
...
@@ -470,4 +471,13 @@ export class PageRepository {
url = url + "?dictCode=" + "CN_OPINION_TYPE";
return WDHttp.get<ResponseDTO<FeedbackTypeBean[]>>(url)
};
/**
* 获取更多直播间人数
* */
static fetchLiveRoomBatchAllUrl(ids: string) {
let url = HttpUrlUtils.getLiveRoomBatchAllDataUrl()
url = url + "?liveIdList=" + ids;
return WDHttp.get<ResponseDTO<LiveRoomDataBean[]>>(url)
};
}
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageViewModel.ets
View file @
556edbb
...
...
@@ -10,7 +10,8 @@ import {
PageInfoBean,
PageInfoDTO,
GoldenPositionExtraBean,
NavigationDetailDTO
NavigationDetailDTO,
LiveRoomDataBean
} from 'wdBean';
import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit';
...
...
@@ -439,6 +440,31 @@ export class PageViewModel extends BaseViewModel {
})
})
}
async getLiveRoomBatchInfo(ids: string): Promise<LiveRoomDataBean[]> {
return new Promise<LiveRoomDataBean[]>((success, error) => {
Logger.info(TAG, `getLiveRoomBatchInfo pageInfo start`);
PageRepository.fetchLiveRoomBatchAllUrl(ids).then((resDTO: ResponseDTO<LiveRoomDataBean[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getLiveRoomBatchInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getLiveRoomBatchInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getLiveRoomBatchInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `getLiveRoomBatchInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/icon_live_new_running.png
0 → 100644
View file @
556edbb
1.35 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/point_live_icon.png
0 → 100644
View file @
556edbb
495 Bytes
Please
register
or
login
to post a comment