wangyong_wd
... ... @@ -19,30 +19,36 @@ export class HttpBizUtil {
* @param headers 请求header参数
* @returns 返回值
*/
static get<T = string>(url: string, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {
return new Promise<ResponseDTO<T>>((success, debug) => {
WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
Logger.debug(TAG, 'get: ' + resDTO.code)
Logger.debug(TAG, 'get: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (resDTO.code == 403 || resDTO.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
}
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
Logger.debug(TAG, 'get again: ' + resDTO.message)
success(resDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(resDTO)
static get<T = ResponseDTO<string>>(url: string, headers?: HashMap<string, string>): Promise<T> {
return new Promise<T>((success, debug) => {
WDHttp.get<T>(url, headers).then((originalRes: T) => {
try {
let resDTO = originalRes as ResponseDTO
Logger.debug(TAG, 'get: ' + resDTO.code)
Logger.debug(TAG, 'get: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (resDTO.code == 403 || resDTO.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
}
Logger.debug(TAG, 'get again send: ' + token)
// refreshToken为空场景不处理,直接请求接口。
WDHttp.get<T>(url, headers).then((againResDTO: T) => {
Logger.debug(TAG, 'get again: ' + againResDTO)
success(againResDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(originalRes)
}
} catch (e) {
debug(originalRes)
}
}).catch((res: object) => {
debug(res)
})
... ... @@ -56,27 +62,32 @@ export class HttpBizUtil {
* @param headers 请求header参数
* @returns 返回值
*/
static post<T = string>(url: string, data?: object, headers?: HashMap<string, string>): Promise<ResponseDTO<T>> {
return new Promise<ResponseDTO<T>>((success, debug) => {
WDHttp.post<ResponseDTO<T>>(url, data, headers).then((resDTO: ResponseDTO<T>) => {
Logger.debug(TAG, 'post: ' + resDTO.code)
Logger.debug(TAG, 'post: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (resDTO.code == 403 || resDTO.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
}
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<ResponseDTO<T>>(url, headers).then((resDTO: ResponseDTO<T>) => {
success(resDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(resDTO)
static post<T = ResponseDTO<string>>(url: string, data?: object, headers?: HashMap<string, string>): Promise<T> {
return new Promise<T>((success, debug) => {
WDHttp.post<T>(url, data, headers).then((originalRes: T) => {
try {
let resDTO = originalRes as ResponseDTO
Logger.debug(TAG, 'post: ' + resDTO.code)
Logger.debug(TAG, 'post: ' + resDTO.message)
// 403:临时token;406:强制下线、封禁、清空登录信息还要跳转登录页面
if (resDTO.code == 403 || resDTO.code == 406) {
HttpBizUtil.refreshToken().then((token: string) => {
if (headers) {
headers.replace('RMRB-X-TOKEN', token)
headers.replace('cookie', 'RMRB-X-TOKEN=' + token)
}
// refreshToken为空场景不处理,直接请求接口。
WDHttp.post<T>(url, headers).then((againResDTO: T) => {
success(againResDTO)
}).catch((res: object) => {
debug(res)
})
});
} else {
success(originalRes)
}
} catch (e) {
success(originalRes)
}
}).catch((res: object) => {
debug(res)
... ...
... ... @@ -230,10 +230,9 @@ export class HttpUrlUtils {
*/
static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
/**
* 搜索结果 显示list 详情
*/
* 搜索结果 显示list 详情
*/
static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
/**
* 创作者详情接口
*/
... ... @@ -242,17 +241,14 @@ export class HttpUrlUtils {
* 客态查询发布作品数量
*/
static readonly ARTICLE_COUNT_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/count";
/**
* 客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
*/
static readonly ARTICLE_LIST_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/articleList";
/**
* 客户端 客态主页页面-获取影响力
*/
static readonly CREATOR_INFLUENCE_HOTS_DATA_PATH: string = "/api/rmrb-bigdata-bi/zh/c/stats/creator/influence/info";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
... ... @@ -269,10 +265,14 @@ export class HttpUrlUtils {
* */
static readonly LIVE_REVIEW_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/channel/live/reviewList"; //?pageNum=1&pageSize=20
/**
* 正在直播-更多 type=1
* 直播预约-更多 type=2
* */
static readonly LIVE_MORE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/channel/live/list"; //?pageNum=1&pageSize=20
/**
* 早晚报获取PAGEID
* */
static readonly DAILY_PAPER_TOPIC: string = "/api/rmrb-bff-display-zh/display/zh/c/dailyPaperTopic";
/**
* app启动页 兴趣偏好
*/
... ... @@ -281,8 +281,6 @@ export class HttpUrlUtils {
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
/**
* 推荐列表
... ...
... ... @@ -88,6 +88,10 @@ export function registerRouter() {
return WDRouterPage.broadcastPage
} else if (action.params?.pageID == "SPACIAL_TOPIC_PAGE") {
return WDRouterPage.spacialTopicPage
} else if (action.params?.pageID == "LIVE_MORE_PAGE") {
return WDRouterPage.liveMorePage
} else if (action.params?.pageID == "ORDER_MORE_PAGE") {
return WDRouterPage.reserveMorePage
}
return undefined
})
... ...
... ... @@ -102,9 +102,7 @@ export class WDRouterPage {
static launchAdvertisingPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchAdvertisingPage");
//主页
static mainPage = new WDRouterPage("phone", "ets/pages/MainPage");
static launchInterestsPage = new WDRouterPage("phone", "ets/pages/launchPage/LaunchInterestsHobbiesPage");
// static loginProtocolPage = new WDRouterPage("wdLogin", "ets/pages/login/LoginProtocolWebview");
//播报页面
... ... @@ -115,4 +113,8 @@ export class WDRouterPage {
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
//人民号主页
static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage");
//直播更多页
static liveMorePage = new WDRouterPage("wdComponent", "ets/components/page/LiveMorePage");
//预约更多页
static reserveMorePage = new WDRouterPage("wdComponent", "ets/components/page/ReserveMorePage");
}
... ...
... ... @@ -4,8 +4,9 @@ import { VideoInfoDTO } from '../detail/VideoInfoDTO';
import { InteractDataDTO } from './InteractDataDTO';
import { slideShows } from '../morningevening/slideShows';
import { VoiceInfoDTO } from '../detail/VoiceInfoDTO';
import { RmhInfoDTO } from '../detail/RmhInfoDTO'
import {commentInfo} from './commentInfo'
import { RmhInfoDTO } from '../detail/RmhInfoDTO';
import { commentInfo } from './commentInfo';
export interface ContentDTO {
appStyle: string;
cityCode: string;
... ... @@ -25,6 +26,7 @@ export interface ContentDTO {
openComment?: number;
openUrl: string;
pageId: string;
// playUrls: any[];
programAuth: string;
programId: string;
... ... @@ -32,10 +34,12 @@ export interface ContentDTO {
programSource: number;
programType: number;
provinceCode: string;
// rankingList: any[];
showTitleEd: string;
showTitleIng: string;
showTitleNo: string;
// sortValue?: any;
startTime: string;
subType: string;
... ... @@ -43,27 +47,24 @@ export interface ContentDTO {
title: string;
vImageUrl: string;
screenType: string;
source: string;
objectId: string;
objectType: string;
channelId: string;
relId: string;
relType: string;
newsTitle:string;//单图卡/2行标题/3行标题
publishTime:string;
visitorComment:number;
fullColumnImgUrls:FullColumnImgUrlDTO[];
newsTitle: string; //单图卡/2行标题/3行标题
publishTime: string;
publishTimestamp: string;
visitorComment: number;
fullColumnImgUrls: FullColumnImgUrlDTO[];
liveInfo: LiveInfoDTO; // 直播新闻信息【BFF聚合】
videoInfo: VideoInfoDTO; // 视频新闻信息【BFF聚合】,视频非原片+清晰度最高的
newsSummary: string; //appstyle:2 ,新闻详情
// 二次请求接口,返回的数据,这里组装到content里;
interactData:InteractDataDTO;
interactData: InteractDataDTO;
hasMore: number,
slideShows: slideShows[],
voiceInfo: VoiceInfoDTO,
... ...
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
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 { router } from '@kit.ArkUI';
const TAG: string = 'LiveMorePage';
/**
* 直播更多:
* type=1 直播
* type=2 预约
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
@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 = {
// 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;
aboutToAppear(): void {
PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => {
// this.operDataList = []
// this.operDataList.push(...liveReviewDTO.list)
this.data.push(...liveReviewDTO.list)
})
}
build() {
// Navigation() {
// //滑动区域
// this.ListLayout()
// }
// .titleMode(NavigationTitleMode.Mini)
// .title('直播列表')
Column() {
this.TabbarNormal()
this.ListLayout()
}
.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) => {
ProcessUtils.processPage(this.contentDTO)
})
}
@Builder
ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => {
ListItem() {
// Column() {
// CompParser({ compDTO: compDTO, compIndex: compIndex });
// }
this.buildItem(contentDTO)
}
},
(contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString()
)
}
.scrollBar(BarState.Off)
.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;
})
}
/**
* 组件项
*
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItem(item: ContentDTO) {
Column() {
Text(item.newsTitle)
.fontSize(17)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, bottom: 8 })
.alignSelf(ItemAlign.Start)
Stack() {
Image(item.fullColumnImgUrls[0].url)
.width('100%')
.height(196)
.borderRadius(4)
this.LiveImage()
}
.alignContent(Alignment.BottomEnd)
Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.publishTimestamp)))
.fontSize(13)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 8, bottom: 8 })
.align(Alignment.Start)
.width('100%')
Divider()
.strokeWidth(1)
.margin({ top: 6 })
.width('100%')
.color('#f5f5f5')
}
.width('100%')
.onClick(() => {
ProcessUtils.processPage(item)
})
}
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back()
})
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
.height(44)
.width('100%')
}
@Builder
LiveImage() {
Row() {
Image($r('app.media.icon_live_status_running'))
.width(22)
.height(18)
Text('直播中')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.margin({ right: 8, bottom: 8 })
}
}
\ No newline at end of file
... ...
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from '../../utils/ProcessUtils';
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 { LazyDataSource } from 'wdKit/Index';
import { router } from '@kit.ArkUI';
const TAG: string = 'ReserveMorePage';
/**
* 预约更多:
* type=1 直播
* type=2 预约
* 卡片结构:上下结构
* 卡片宽度:充满父窗口
* 卡片高度,仅包含横板图片:图片高度由图片的宽度及宽高比决定,图片宽度占父窗口'100%',宽高比为16:9:
*/
@Entry
@Component
struct ReserveMorePage {
@State private pageModel: PageModel = new PageModel();
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
type: number = 2;
currentPage: number = 1;
pageSize: number = 20;
operDataList: ContentDTO[] = [];
title: string = '预约列表'
@State contentDTO: 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;
aboutToAppear(): void {
PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => {
// this.operDataList = []
// this.operDataList.push(...liveReviewDTO.list)
this.data.push(...liveReviewDTO.list)
})
}
build() {
// Navigation() {
// //滑动区域
// this.ListLayout()
// }
// .titleMode(NavigationTitleMode.Mini)
// .title('直播列表')
Column() {
Column() {
this.TabbarNormal()
this.ListLayout()
}
.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')
})
}
.backgroundColor('#F5F5F5')
// .onClick((event: ClickEvent) => {
// ProcessUtils.processPage(this.contentDTO)
// })
}
@Builder
ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage,
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
LazyForEach(this.data, (contentDTO: ContentDTO, contentIndex: number) => {
ListItem() {
// Column() {
// CompParser({ compDTO: compDTO, compIndex: compIndex });
// }
this.buildItem(contentDTO)
}
},
(contentDTO: ContentDTO, contentIndex: number) => contentDTO.pageId + contentIndex.toString()
)
}
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
.backgroundColor('#F5F5F5')
.onScrollIndex((start: number, end: number) => {
// Listen to the first index of the current list.
this.pageModel.startIndex = start;
// 包含了 头尾item,判断时需要考虑+2
this.pageModel.endIndex = end;
})
}
/**
* 组件项
*
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItem(item: ContentDTO) {
Column({ space: 8 }) {
Stack() {
Image(item.fullColumnImgUrls[0].url)
.width('100%')
.height(196)
.borderRadius(4)
this.LiveImage()
}
.alignContent(Alignment.BottomEnd)
Text(item.newsTitle)
.fontSize(17)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 16, left: 12, right: 12 })
.alignSelf(ItemAlign.Start)
Row() {
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)
.fontColor('#ED2800')
.fontFamily('PingFang SC-Medium')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 8, bottom: 8 })
.align(Alignment.Start)
Image($r('app.media.point_icon'))
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
.width(6)
.height(16)
.margin(2)
Text(this.getReserveDate(item.liveInfo.liveStartTime, 2))
.fontSize(12)
.fontWeight(500)
.fontColor('#ED2800')
.fontFamily('PingFang SC-Medium')
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 8, bottom: 8, right: 10 })
.align(Alignment.Start)
}
.backgroundColor('#F5F5F5')
.margin(12)
Flex({ justifyContent: FlexAlign.Center }) {
Text('预约')
.fontSize(12)
.fontWeight(400)
.fontFamily('PingFang SC-Regular')
.width(52)
.height(24)
.fontColor(Color.White)
.textAlign(TextAlign.Center)
}
.width(52)
.backgroundColor('#ED2800')
.borderRadius(3)
.margin({ right: 12 })
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
}
.borderRadius(4)
.backgroundColor(Color.White)
.width('100%')
.margin({ top: 12, bottom: 8 })
.onClick(() => {
ProcessUtils.processPage(item)
})
}
getReserveDate(eventDateTimeString: string, type: number): string {
// 解析事件的日期和时间
const eventDateTime = new Date(eventDateTimeString);
const currentDateTime = new Date();
// 截取事件时间的小时和分钟(假设事件时间是按照24小时制)
const eventHour = eventDateTime.getHours();
const eventMinutes = eventDateTime.getMinutes();
const eventTimeStr = `${eventHour}:${eventMinutes.toString().padStart(2, '0')}开始`; // 格式化时间,确保分钟是两位数
// 计算时间差
const timeDifference = eventDateTime.getTime() - currentDateTime.getTime();
// 如果事件在24小时内
if (type === 1) {
if (timeDifference > 0 && timeDifference <= 24 * 60 * 60 * 1000) {
return `今天`;
} else {
// 如果事件不在24小时内
const month = eventDateTime.getMonth() + 1; // 月份从0开始
const date = eventDateTime.getDate();
return `${month}月${date}日`;
}
} else {
return `${eventTimeStr}`;
}
}
/*导航栏*/
@Builder
TabbarNormal() {
RelativeContainer() {
//标题栏目
Image($r('app.media.icon_arrow_left'))
.width(24)
.height(24)
.objectFit(ImageFit.Auto)
.id("back_icon")
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back()
})
Text(this.title)// .height('42lpx')
.maxLines(1)
.id("title")
.fontSize('35lpx')
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.lineHeight('42lpx')
.alignRules({
center: { anchor: "__container__", align: VerticalAlign.Center },
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
.backgroundColor('#FFFFFF')
.height(44)
.width('100%')
}
@Builder
LiveImage() {
Row() {
Image($r('app.media.reserve_icon'))
.width(22)
.height(18)
Text('预约')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.margin({ right: 8, bottom: 8 })
}
}
\ No newline at end of file
... ...
... ... @@ -191,7 +191,8 @@ export struct SearchResultContentComponent{
corner: '',
rmhPlatform: 0,
newTags: '',
isSearch: true
isSearch: true,
publishTimestamp:""
}
this.data.push(contentDTO)
... ...
... ... @@ -2,7 +2,7 @@
import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent'
import { Action, CompDTO, ContentDTO, Params } from 'wdBean'
import { CommonConstants } from 'wdConstant'
import { WDRouterRule } from 'wdRouter/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { LiveModel } from '../../viewmodel/LiveModel'
... ... @@ -36,13 +36,17 @@ export struct LiveHorizontalCardComponent {
.height(14)
}
.onClick(() => {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: this.compDTO.linkUrl
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
if (this.compDTO.linkUrl) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
url: this.compDTO.linkUrl
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
} else {
this.jumpToLiveMorePage()
}
})
}
}.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -101,6 +105,17 @@ export struct LiveHorizontalCardComponent {
.backgroundColor($r("app.color.white"))
}
private jumpToLiveMorePage() {
// let taskAction: Action = {
// type: 'JUMP_INNER_NEW_PAGE',
// params: {
// pageID: 'LIVE_MORE_PAGE'
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
WDRouterRule.jumpWithPage(WDRouterPage.liveMorePage)
}
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
... ...
... ... @@ -5,7 +5,7 @@ import { CommonConstants } from 'wdConstant'
import { StringUtils } from 'wdKit/Index'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { LiveModel } from '../../viewmodel/LiveModel'
@Component
... ... @@ -36,6 +36,9 @@ export struct LiveHorizontalReservationComponent {
.width(14)
.height(14)
}
.onClick(() => {
this.jumpToReserveMorePage()
})
}
}.justifyContent(FlexAlign.SpaceBetween)
.padding({ left: 16, right: 16 })
... ... @@ -93,6 +96,17 @@ export struct LiveHorizontalReservationComponent {
.backgroundColor($r("app.color.white"))
}
private jumpToReserveMorePage() {
// let taskAction: Action = {
// type: 'JUMP_INNER_NEW_PAGE',
// params: {
// pageID: 'LIVE_MORE_PAGE'
// } as Params,
// };
// WDRouterRule.jumpWithAction(taskAction)
WDRouterRule.jumpWithPage(WDRouterPage.reserveMorePage)
}
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
... ...
... ... @@ -372,7 +372,7 @@ class MinePageDatasModel{
let url = HttpUrlUtils.getMineUserLevelDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
return HttpBizUtil.get<MineUserLevelItem>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers)
};
async getMineUserLevelDataLocal(context: Context): Promise<MineUserLevelItem> {
... ... @@ -411,7 +411,7 @@ class MinePageDatasModel{
let url = HttpUrlUtils.getMineUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
return HttpBizUtil.get<MineUserDetailItem>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers)
};
async getMineUserDetailDataLocal(context: Context): Promise<MineUserDetailItem> {
... ...
... ... @@ -111,6 +111,12 @@ export class PageRepository {
return url;
}
static getLiveMoreUrl(type: number, pageNum: number = 1, pageSize: number = 20) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_MORE_PATH + "?type=" + type + "&pageNum=" + pageNum + "&pageSize=" + pageSize;
Logger.info(TAG, "getLiveMoreUrl url = " + url)
return url;
}
static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH;
url = url + "?relId=" + relId
... ... @@ -390,6 +396,15 @@ export class PageRepository {
};
/**
* 获取更多直播/预约
* */
static fetchLiveMoreUrl(type: number,pageNum: number, pageSize: number) {
let url = PageRepository.getLiveMoreUrl(type,pageNum, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<LiveReviewDTO>>(url, headers)
};
/**
* 获取推荐列表
* https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/recommend/zh/c/list
* @param params
... ...
... ... @@ -354,6 +354,30 @@ export class PageViewModel extends BaseViewModel {
})
})
}
async getLiveMoreUrl(type: number, pageNum: number, pageSize: number): Promise<LiveReviewDTO> {
return new Promise<LiveReviewDTO>((success, error) => {
Logger.info(TAG, `getLiveMoreUrl pageInfo start`);
PageRepository.fetchLiveMoreUrl(type,pageNum, pageSize).then((resDTO: ResponseDTO<LiveReviewDTO>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getLiveMoreUrl then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getLiveMoreUrl then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
// let navResStr = JSON.stringify(navResDTO);
Logger.info(TAG, "getLiveMoreUrl then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
}).catch((err: Error) => {
Logger.error(TAG, `getLiveMoreUrl catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
... ...
... ... @@ -17,6 +17,8 @@
"pages/SearchPage",
"pages/SearchCreatorPage",
"components/page/PeopleShipHomePage",
"pages/MultiPictureListPage"
"pages/MultiPictureListPage",
"components/page/LiveMorePage",
"components/page/ReserveMorePage"
]
}
\ No newline at end of file
... ...
... ... @@ -224,7 +224,7 @@ export class LoginModel {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpBizUtil.post<string>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
if (!data) {
fail("数据为空")
return
... ...