douaojie

Merge remote-tracking branch 'origin/main'

Showing 48 changed files with 846 additions and 182 deletions
... ... @@ -24,4 +24,6 @@ export class SpConstants{
static SETTING_SUSPENSION_SWITCH = "setting_suspension_switch" //悬浮窗 开关
static SETTING_PUSH_SWITCH = "setting_push_switch" //推送 开关
//未登录保存兴趣标签
static PUBLICVISUTORMODE_INTERESTTAGS = 'PublicVisitorMode_InterestTags'
}
\ No newline at end of file
... ...
... ... @@ -2,7 +2,7 @@
* ResponseDTO
*/
export interface ResponseDTO<T = string> {
success:boolean;
success: boolean;
// 服务请求响应值/微服务响应状态码”
code: number;
... ... @@ -12,6 +12,7 @@ export interface ResponseDTO<T = string> {
// 响应结果
data?: T;
totalCount?: number;
// 请求响应时间戳(unix格式)
timestamp?: number;
... ...
... ... @@ -258,6 +258,10 @@ export class HttpUrlUtils {
* app启动页 兴趣偏好
*/
static readonly INTERESTS_HOTS_DATA_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/queryTags";
/**
* 更新 兴趣偏好
*/
static readonly INTERESTS_UPDATETAG_PATH: string = "/api/rmrb-user-center/user/zh/c/tag/updateUserTag";
private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
... ... @@ -663,6 +667,11 @@ export class HttpUrlUtils {
}
static getUpdateInterestsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERESTS_UPDATETAG_PATH;
return url;
}
static getLiveDetailsUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_DETAILS_PATH
return url
... ...
... ... @@ -43,6 +43,7 @@ export class WDRouterPage {
static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
// 直播详情页
static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
// 多图(图集)详情页
static multiPictureDetailPage = new WDRouterPage("phone", "ets/pages/detail/MultiPictureDetailPage");
// 音乐详情页
... ...
... ... @@ -167,16 +167,19 @@ export interface LiveDetailsBean {
}
export interface LiveInfo {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
//直播新闻-直播状态 wait 待开播 running 直播中 end 已结束cancel已取消paused暂停
liveState: string
//2024-04-12 15:00:00 直播开始时间
planStartTime: string
liveStyle: number;
vlive: Array<Vlive>
mlive:MLive
mlive: MLive
}
export interface MLive {
mliveId:string
mliveId: string
}
export interface FullColumnImgUrls {
url: string
}
... ...
... ... @@ -63,3 +63,5 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
... ...
... ... @@ -35,63 +35,63 @@ export struct DynamicDetailComponent {
//logo、日期
Row() {
Image($r('app.media.ic_article_rmh'))
.width(80)
.height(28)
.margin({ left: 16 })
.width($r('app.float.margin_80'))
.height($r('app.float.margin_28'))
.margin({ left: $r('app.float.margin_16') })
Blank()
Text("2023年03月14日 08:16")
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(12)
.lineHeight(28)
.margin({ right: 16 })
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_28'))
.margin({ right: $r('app.float.margin_16') })
}
.height(48)
.height($r('app.float.margin_48'))
.width('100%')
//分割线
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height(7)
.margin({left: 16, right: 16} )
.height($r('app.float.margin_7'))
.margin({left: $r('app.float.margin_16'), right: $r('app.float.margin_16')} )
//号主信息
Row() {
//头像
Stack() {
Image(this.contentDetailData.rmhInfo?.rmhHeadUrl)
.alt(this.contentDetailData.rmhInfo?.userType=='1'?$r('app.media.default_head'):$r('app.media.icon_default_head_mater'))
.width('32')
.height('32')
.width($r('app.float.margin_32'))
.height($r('app.float.margin_32'))
.objectFit(ImageFit.Cover)
.borderRadius(16)
.borderRadius($r('app.float.margin_16'))
Image($r('app.media.icon_border_test'))
.width('48')
.height('48')
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.objectFit(ImageFit.Cover)
.borderRadius(24)
.borderRadius($r('app.float.margin_24'))
}
.width(48)
.height(48)
.width($r('app.float.margin_48'))
.height($r('app.float.margin_48'))
.alignContent(Alignment.Center)
Column(){
//昵称
Text("this.contentDetailData.rmhInfo?.rmhName")
.fontSize(14)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
.margin({ left: $r('app.float.margin_5') })
//简介
Text("this.contentDetailData.rmhInfo?.rmhDesc")
.fontSize(14)
.fontSize($r('app.float.font_size_14'))
.fontColor($r('app.color.color_B0B0B0'))
.fontWeight(FontWeight.Medium)
.margin({ left: 5 })
.margin({ left: $r('app.float.margin_5') })
}
if (!this.followStatus) {
Text('关注')
.width(60)
.height(24)
.height($r('app.float.margin_48'))
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.button_border_radius'))
.borderRadius($r('app.float.vp_3'))
.backgroundColor($r('app.color.color_ED2800'))
.fontColor($r('app.color.color_fff'))
.onClick(() => {
... ... @@ -99,12 +99,12 @@ export struct DynamicDetailComponent {
})
} else {
Text('已关注')
.width(60)
.height(24)
.width($r('app.float.margin_60'))
.height($r('app.float.margin_48'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
.borderRadius($r('app.float.button_border_radius'))
.borderRadius($r('app.float.vp_3'))
.borderColor($r('app.color.color_CCCCCC'))
.fontColor($r('app.color.color_CCCCCC'))
.onClick(() => {
... ... @@ -113,6 +113,53 @@ export struct DynamicDetailComponent {
}
}
.width('100%')
//内容
Text("这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里这里展示标题这里展示标题这里展示标题这里")
.fontColor($r('app.color.color_222222'))
.fontSize($r('app.float.font_size_18'))
.lineHeight($r('app.float.margin_25'))
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
//特别声明
Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
.fontColor($r('app.color.color_CCCCCC'))
.fontSize($r('app.float.font_size_12'))
.lineHeight($r('app.float.margin_16'))
.margin({ top: $r('app.float.margin_16')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
//微信/朋友圈/微博
Row(){
Image($r('app.media.xxhdpi_pic_wechat'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_pyq'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
Image($r('app.media.xxhdpi_pic_wb'))
.width($r('app.float.margin_116'))
.height($r('app.float.margin_36'))
.margin({ left: $r('app.float.margin_4_negative')})
.objectFit(ImageFit.Cover)
}
.margin({ top: $r('app.float.margin_24')})
//点赞
Row(){
Image($r('app.media.icon_like_selected_redheart'))
.width($r('app.float.margin_24'))
.height($r('app.float.margin_24'))
.objectFit(ImageFit.Cover)
Text("2.6万")
.fontColor($r('app.color.color_999999'))
.fontSize($r('app.float.font_size_16'))
.lineHeight($r('app.float.margin_20'))
.margin({ left: $r('app.float.margin_2')})
}
//评论组件/底部组件
}
}
.backgroundColor('#FFFFFFFF')
... ...
... ... @@ -2,6 +2,7 @@ import { Action, NewspaperListItemBean, NewspaperPositionItemBean, Params } from
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO';
import { StringUtils } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { newsSkeleton } from './skeleton/newsSkeleton';
@Component
export struct ENewspaperItemComponent {
... ... @@ -11,13 +12,20 @@ export struct ENewspaperItemComponent {
private startX: number = 0
private startY: number = 0
private itemBeanClicked: NewspaperPositionItemBean = {} as NewspaperPositionItemBean
@State isShowSkeleton: boolean = true
build() {
Stack() {
newsSkeleton()
.visibility(this.isShowSkeleton ? Visibility.Visible : Visibility.None)
Image(this.newspaperListItemBean.pagePic)
.width('100%')
.aspectRatio(378 / 566)
.objectFit(ImageFit.Fill)
.onComplete(() => {
this.isShowSkeleton = false
})
.visibility(this.isShowSkeleton ? Visibility.None : Visibility.Visible)
Canvas(this.context)
.width('100%')
... ... @@ -62,7 +70,7 @@ export struct ENewspaperItemComponent {
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: this.itemBeanClicked.relType ?? '',
relId: ''+this.itemBeanClicked.relId,
relId: '' + this.itemBeanClicked.relId,
sourcePage: '5'
} as ExtraDTO
} as Params,
... ...
... ... @@ -110,11 +110,11 @@ export struct ENewspaperPageComponent {
})
Row() {
Text(this.calendarDate)
Text(this.calendarDate?.replace('-', '.')?.replace('-', '.'))
.fontSize($r('app.float.font_size_20'))
.fontColor($r('app.color.white'))
.fontFamily('BebasNeue_Regular')
.fontWeight(FontWeight.Bold)
.fontWeight(FontWeight.Regular)
Image($r('app.media.icon_triangle'))
.width($r('app.float.border_radius_6'))
... ... @@ -167,6 +167,7 @@ export struct ENewspaperPageComponent {
.autoPlay(false)
.cachedCount(3)
.indicator(false)
.loop(false)
.displayCount(1)
.margin({ top: 35, left: 10, right: 10 })
.id('e_newspaper_content')
... ... @@ -191,12 +192,13 @@ export struct ENewspaperPageComponent {
.id('e_newspaper_shadow')
Row() {
Text('滑动查看下一版')
Text(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? '已到底部,可以选择其他日期' : '滑动查看下一版')
.fontColor(Color.White)
.fontSize($r('app.float.font_size_14'))
Image($r('app.media.icon_next_page'))
.width($r('app.float.vp_16'))
.height($r('app.float.vp_16'))
.visibility(this.swiperIndex + 1 == this.newspaperListBean?.list?.length ? Visibility.None : Visibility.Visible)
}
.justifyContent(FlexAlign.Center)
.margin({ top: $r('app.float.margin_16') })
... ...
import { CompDTO, ContentDTO } from 'wdBean';
import { CommonConstants } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger, StringUtils, ToastUtils } from 'wdKit/Index';
import PageViewModel from '../../viewmodel/PageViewModel';
const TAG = 'Zh_Grid_Layout-02';
const FULL_PARENT: string = '100%';
... ... @@ -11,46 +13,76 @@ let listSize: number = 2;
* Zh_Grid_Layout-02
*
*/
@Preview
@Component
export struct ZhGridLayout02 {
@State compDTO: CompDTO = {} as CompDTO
@State operDataList: ContentDTO[] = []
currentPage = 1
pageSize = 12
aboutToAppear() {
if (this.compDTO.operDataList) {
listSize = this.compDTO.operDataList.length > 5 ? 2 : this.compDTO.operDataList.length;
}
Logger.debug(TAG, 'aboutToAppear ' + this.compDTO.objectTitle)
this.currentPage = 1
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList = []
this.operDataList.push(...liveReviewDTO.list)
})
}
build() {
Column() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text(this.compDTO.objectTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.compDTO.operDataList, (item: ContentDTO, index: number) => {
GridCol() {
this.buildItemCard(this.compDTO.operDataList[index]);
Scroll() {
Column() {
Row() {
Image($r("app.media.redLine"))
.width(3)
.height(16)
.margin({ right: 4 })
Text(this.compDTO.objectTitle)
.fontSize($r("app.float.font_size_17"))
.fontColor($r("app.color.color_222222"))
.fontWeight(600)
}
.justifyContent(FlexAlign.Start)
.margin({ top: 8, bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
GridRow({
columns: { sm: listSize, md: 2 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.operDataList, (item: ContentDTO, index: number) => {
GridCol() {
this.buildItemCard(item);
}
})
}
})
}
}
.width("100%")
.height("100%")
// .layoutWeight(1)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.onReachStart(() => {
Logger.debug(TAG, 'onReachStart')
})
.onReachEnd(() => {
Logger.debug(TAG, 'onReachEnd')
this.addItems()
})
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
.width(CommonConstants.FULL_WIDTH)
// .width("100%")
.height("100%")
// .layoutWeight(1)
.padding({
top: 14,
left: 16,
... ... @@ -78,6 +110,15 @@ export struct ZhGridLayout02 {
}
.width('100%')
}
addItems() {
Logger.debug(TAG, 'addItems')
this.currentPage++
PageViewModel.getLiveReviewUrl(this.currentPage, this.pageSize).then((liveReviewDTO) => {
this.operDataList.push(...liveReviewDTO.list)
Logger.debug(TAG, 'addItems after: ' + this.operDataList.length)
})
}
}
... ...
import { CompDTO, ContentDTO, Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { HttpUrlUtils } from 'wdNetwork/Index';
import { postInteractAccentionOperateParams } from 'wdBean';
import { PageRepository } from '../repository/PageRepository';
import { CommonConstants } from 'wdConstant/Index';
/**
* 精选评论卡
* Zh_Single_Row-06
*/
const TAG = 'Zh_Single_Row-06'
@Entry
@Component
export struct ZhSingleRow06 {
@State compDTO: CompDTO = {} as CompDTO
@State list: Array<string> = ['社会', '三个字', '是四个字', '时事', '社会', '三个字', '是四个字', '时事']
@State activeIndexs: Array<number> = []
getItemWidth(index: number) {
if (index % 4 === 0 || index % 4 === 3) {
return 80
} else {
return 96
}
}
build() {
Column() {
//顶部
this.CompHeader(this.compDTO)
Grid() {
ForEach(this.list, (item: string, index: number) => {
GridItem() {
Text(item)
.fontSize(14)
.fontColor(this.activeIndexs.includes(index) ? 0x222222 : 0x666666)
.fontWeight(this.activeIndexs.includes(index) ? 600 : 400)
.textAlign(TextAlign.Center)
}
.onClick(() => {
if (this.activeIndexs.includes(index)) {
const ind = this.activeIndexs.indexOf(index);
this.activeIndexs.splice(ind, 1)
} else {
this.activeIndexs.push(index)
}
})
})
}
.height(70)
.columnsTemplate('1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr')
.margin({bottom: 10})
Text('选中标签,为您推荐更多您感兴趣的内容')
.fontSize(12)
.fontColor(0xB0B0B0)
.textAlign(TextAlign.Center)
.margin({bottom: 10})
Row() {
Text('选好了')
.fontSize(14)
.fontColor(0x000000)
.width('100%')
.textAlign(TextAlign.Center)
}
.height(40)
.backgroundColor(0xf9f9f9)
.width('100%')
.borderRadius(3)
}
.padding({
left: $r('app.float.card_comp_pagePadding_lf'),
right: $r('app.float.card_comp_pagePadding_lf'),
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.backgroundColor($r('app.color.white'))
.margin({ bottom: 8 })
}
@Builder
CompHeader(item: CompDTO) {
Row() {
Row() {
Image($r("app.media.icon_interest_ask"))
.width(24)
.height(24)
.margin({ right: 4 })
Text('以下是否有您感兴趣?')
.fontSize($r("app.float.font_size_17"))
.fontColor(0x000000)
.fontWeight(600)
}
Row() {
Image($r("app.media.close_button"))
.width(14)
.height(14)
.onClick(() => {
})
}
.padding({
right: $r('app.float.card_comp_pagePadding_lf'),
})
}
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8, bottom: 8 })
.width('100%')
}
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
@Component
struct CreatorItem {
@Prop item: ContentDTO
@State rmhIsAttention: number = 0
build() {
ListItem() {
Column() {
Flex({direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween}) {
Column() {
Row() {
Image('')
.width(20)
.height(20)
.margin({right: 4})
.border({width: 1, color: 0xcccccc, radius: 10})
Text('立志之间')
.fontColor(0x212228)
.fontSize(12)
}
}
Column() {
Row() {
Image($r('app.media.icon_like_no'))
.width(16)
.height(16)
.margin({right: 4})
Text('3835')
.fontSize(14)
.fontColor(0x999999)
}
}
}
.margin({top: 10, left: 10, right: 10, bottom: 8})
Text('就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,就业不仅是民生问题,也是发展问题,')
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({left: 10, right: 10, bottom: 8})
.fontSize(17)
.fontColor(0x212228)
.lineHeight(25)
Row() {
Image('')
.width(66)
.height(44)
.borderRadius({topLeft: 3, topRight: 0, bottomLeft: 3, bottomRight: 0})
Text('原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制原文|强化就业优先政策 健全就业促进机制')
.margin({left: 8})
.width(172)
.maxLines(2)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
.linearGradient({
direction: GradientDirection.Right,
colors: [[0xffffff, 0.0],[0xffffff, 0.8], [0xf9f9f9, 1.0]]
})
}
.width(276)
.height(150)
.margin({ right: 10 })
.borderWidth(1)
.borderColor($r('app.color.color_EDEDED'))
.borderRadius($r('app.float.image_border_radius'))
.backgroundColor(0xf9f9f9)
}
.onClick(() => {
console.log('跳转到rmh');
})
}
/**
* 关注号主 TODO 这里后面需要抽离
*/
handleAccention(item: ContentDTO, status: number) {
this.rmhIsAttention = this.rmhIsAttention ? 0 : 1
return
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
const params: postInteractAccentionOperateParams = {
attentionUserType: item.rmhInfo?.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: item.rmhInfo?.userId || '', // 被关注用户号主id
attentionCreatorId: item.rmhInfo?.rmhId || '', // 被关注用户号主id
// userType: 1,
// userId: '1', // TODO 用户id需要从本地获取
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
console.log(TAG, '关注号主==', JSON.stringify(res.data))
if (status === 1) {
this.rmhIsAttention = 0
} else {
this.rmhIsAttention = 1
}
})
}
}
... ...
... ... @@ -77,11 +77,13 @@ export struct PageComponent {
refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage,
this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight)
})
} else {
} else if (!this.pageModel.contentNeedScroll) {
NoMoreLayout()
}
}
}
// comp自己处理分页,这里设置EdgeEffect.None
.edgeEffect(this.pageModel.contentNeedScroll ? EdgeEffect.None : EdgeEffect.Spring)
.scrollBar(BarState.Off)
.cachedCount(8)
.height(CommonConstants.FULL_PARENT)
... ...
... ... @@ -4,7 +4,7 @@
@Entry
@Component
export struct detailedSkeleton {
export struct newsSkeleton {
@State quantity: Array<number> = [1, 2, 3,]
build() {
... ...
import { CommonConstants } from 'wdConstant'
import { CompDTO } from 'wdBean'
import { Action, CompDTO, ContentDTO, Params } from 'wdBean'
import { WDRouterRule } from 'wdRouter/Index'
import { Logger } from 'wdKit/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
... ... @@ -57,5 +59,23 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick(()=>{
this.gotoLive(this.compDTO?.operDataList[0])
})
}
gotoLive(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,9 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean'
import { CommonConstants } from 'wdConstant'
import { WDRouterRule } from 'wdRouter/Index'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
@Component
export struct LiveHorizontalCardComponent {
@State compDTO: CompDTO = {} as CompDTO
... ... @@ -79,6 +82,7 @@ export struct LiveHorizontalCardComponent {
.onClick(() => {
if (item.objectType != '0') {
console.log(item.objectId)
this.gotoLive(item)
}
})
})
... ... @@ -96,4 +100,19 @@ export struct LiveHorizontalCardComponent {
})
.backgroundColor($r("app.color.white"))
}
gotoLive(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
// 视频直播直播预约
import { LiveHorizontalCardForOneComponent } from './LiveHorizontalCardForOneComponent'
import { CompDTO, ContentDTO } from 'wdBean'
import { Action, CompDTO, ContentDTO, Params } from 'wdBean'
import { CommonConstants } from 'wdConstant'
import { StringUtils } from 'wdKit/Index'
import { Logger, 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'
@Component
export struct LiveHorizontalReservationComponent {
@State compDTO: CompDTO = {} as CompDTO
... ... @@ -70,6 +73,7 @@ export struct LiveHorizontalReservationComponent {
.onClick(() => {
if (item.objectType != '0') {
console.log(item.objectId)
this.gotoLive(item)
}
})
})
... ... @@ -87,4 +91,20 @@ export struct LiveHorizontalReservationComponent {
})
.backgroundColor($r("app.color.white"))
}
gotoLive(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -129,10 +129,13 @@ class EditInfoViewModel {
.then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
promptAction.showToast({ message: '修改成功' })
}else {
promptAction.showToast({ message: navResDTO.message })
}
})
.catch((error: Error) => {
Logger.info(TAG,'updateUserInfo','EditInfoViewModel')
promptAction.showToast({ message: error.message })
})
})
}
... ...
import { PageDTO, CompDTO, PageInfoDTO } from 'wdBean';
import { ViewType } from 'wdConstant/Index';
import { DateTimeUtils, Logger } from 'wdKit';
import { CompStyle, ViewType } from 'wdConstant/Index';
import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit';
import { closeRefresh } from '../utils/PullDownRefresh';
import PageModel from './PageModel';
import PageViewModel from './PageViewModel';
... ... @@ -65,39 +65,33 @@ export class PageHelper {
} else {
pageModel.hasMore = false;
}
// TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上)
// TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换
// 二次请求,批查互动数据
PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
// 刷新,替换所有数据
// pageModel.compList.replaceAll(...data)
pageModel.compList.updateItems(sizeBefore, data)
pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
})
// TODO 待优化,解决content级别的展现加载
// PageViewModel.getInteractData(pageDto.compList).then((data: CompDTO[]) => {
// // 刷新,替换所有数据
// // pageModel.compList.replaceAll(...data)
// pageModel.compList.updateItems(sizeBefore, data)
// pageModel.timestamp = DateTimeUtils.getTimeStamp().toString()
// })
// content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll
if (isLastGroup) {
closeRefresh(pageModel, true);
// // 最后一个楼层,特殊处理
// // 检测楼层最后一个组件业务数据是否需要通过访问接口获取
// let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1]
// let compSize = CollectionUtils.getListSize(comp.operDataList)
// // 直播回放,需要二次请求数据
// if (compSize <= 0 && comp.dataSourceType == 'LIVE_END') {
// let liveReviewDTO = await PageViewModel.getLiveReviewUrl(pageModel.currentPage, pageModel.pageSize)
// // content数据回来,塞给comp
// comp.operDataList.push(...liveReviewDTO.list)
// }
// 最后一个楼层,特殊处理
// 检测楼层最后一个组件业务数据是否需要通过访问接口获取
let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1]
let compSize = CollectionUtils.getListSize(comp.operDataList)
// 直播回放,需要二次请求数据
if (compSize <= 0 && comp.compStyle == CompStyle.Zh_Grid_Layout_02) {
// 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉
pageModel.contentNeedScroll = true
}
}
}
}
/**
* 获取直播回看数据
*/
private async getLiveEnd(pageModel: PageModel) {
let liveReviewDTO = await PageViewModel.getLiveReviewUrl(pageModel.currentPage, pageModel.pageSize)
Logger.debug(TAG, 'aboutToAppear, getPreviewData ' + liveReviewDTO.hasNext);
}
/**
* comp加载更多,分页加载
*/
private compLoadMore(pageModel: PageModel) {
... ... @@ -125,14 +119,6 @@ export class PageHelper {
promptAction.showToast({ message: err });
})
}
/**
* 节目数据分页加载
* TODO 待完善框架
*/
private contentLoadMore() {
}
}
... ...
... ... @@ -20,6 +20,9 @@ export default class PageModel {
// 当前请求数据的group
groupData: GroupInfoDTO = {} as GroupInfoDTO;
compList: LazyDataSource<CompDTO> = new LazyDataSource();
// 是否comp自己处理分页加载;默认是最后一个comp下的content有分页数据,需要节目内容的分页加载
// (如:首页-视频tab-直播tab,最后一个comp是直播回看列表,视频内容需要分页加载)
contentNeedScroll: boolean = false;
// 页面状态,刷新、加载更多等,1-首次、2-下拉、3上拉
loadStrategy: number = 1;
currentPage: number = 1;
... ...
... ... @@ -37,6 +37,10 @@
"value": "18fp"
},
{
"name": "font_size_18",
"value": "18fp"
},
{
"name": "font_size_24",
"value": "24fp"
},
... ... @@ -49,6 +53,10 @@
"value": "36fp"
},
{
"name": "margin_4_negative",
"value": "-4vp"
},
{
"name": "main_margin",
"value": "14vp"
},
... ... @@ -77,6 +85,46 @@
"value": "160vp"
},
{
"name": "margin_80",
"value": "80vp"
},
{
"name": "margin_2",
"value": "2vp"
},
{
"name": "margin_5",
"value": "5vp"
},
{
"name": "margin_7",
"value": "7vp"
},
{
"name": "margin_20",
"value": "20vp"
},
{
"name": "margin_24",
"value": "24vp"
},
{
"name": "margin_25",
"value": "25vp"
},
{
"name": "margin_28",
"value": "28vp"
},
{
"name": "margin_48",
"value": "48vp"
},
{
"name": "margin_60",
"value": "60vp"
},
{
"name": "single_row_03_img_height",
"value": "88vp"
},
... ... @@ -133,6 +181,10 @@
"value": "24vp"
},
{
"name": "margin_6",
"value": "6vp"
},
{
"name": "margin_16",
"value": "16vp"
},
... ... @@ -141,6 +193,14 @@
"value": "20vp"
},
{
"name": "margin_32",
"value": "32vp"
},
{
"name": "margin_36",
"value": "36vp"
},
{
"name": "vp_3",
"value": "3vp"
},
... ... @@ -167,6 +227,10 @@
{
"name": "card_comp_pagePadding_tb",
"value": "14fp"
},
{
"name": "margin_116",
"value": "116vp"
}
]
}
... ...
export { DetailPlayLivePage } from './src/main/ets/pages/DetailPlayLivePage'
\ No newline at end of file
export { DetailPlayLivePage } from './src/main/ets/pages/DetailPlayLivePage'
export { DetailPlayVLivePage } from './src/main/ets/pages/DetailPlayVLivePage'
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@
"wdKit": "file:../../commons/wdKit",
"wdBean": "file:../../features/wdBean",
"wdConstant": "file:../../commons/wdConstant",
"wdDetailPlayApi": "file:../../features/wdDetailPlayApi"
"wdDetailPlayApi": "file:../../features/wdDetailPlayApi",
"wdRouter": "file:../../commons/wdRouter"
}
}
... ...
import { BottomComponent } from '../widgets/details/BottomComponent';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
@Component
export struct DetailPlayHLivePage {
aboutToAppear(): void {
}
build() {
Column() {
TopPlayComponent()
TabComponent()
BottomComponent()
}
.height('100%')
.width('100%')
}
onPageShow(): void {
}
aboutToDisappear(): void {
}
}
\ No newline at end of file
... ...
... ... @@ -10,11 +10,12 @@ import router from '@ohos.router';
export struct DetailPlayLivePage {
TAG: string = 'DetailPlayLivePage';
liveViewModel: LiveViewModel = new LiveViewModel()
@State relId: string = '500005302448'
@State contentId: string = '20000016340'
@State relType: string = '1'
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
@State tabs: string[] = ['直播间', '大家聊']
aboutToAppear(): void {
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
... ... @@ -30,7 +31,7 @@ export struct DetailPlayLivePage {
build() {
Column() {
TopPlayComponent()
TabComponent()
TabComponent({ tabs: this.tabs })
BottomComponent()
}
.height('100%')
... ... @@ -46,6 +47,9 @@ export struct DetailPlayLivePage {
.then(
(data) => {
if (data.length > 0) {
if (data[0].liveInfo?.liveState == 'wait') {
this.tabs = ['简介', '直播间', '大家聊']
}
this.liveDetailsBean = data[0]
}
},
... ...
import { BottomComponent } from '../widgets/details/BottomComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import { TopPlayVComponent } from '../widgets/details/video/TopPlayVComponet';
@Component
export struct DetailPlayVLivePage {
aboutToAppear(): void {
}
build() {
Column() {
TopPlayVComponent()
// TabComponent()
BottomComponent()
}
.height('100%')
.width('100%')
}
onPageShow(): void {
}
aboutToDisappear(): void {
}
}
\ No newline at end of file
... ...
... ... @@ -170,10 +170,10 @@ export class LiveModel {
* @param isSubscribe
* @returns
*/
liveAppointment(relationId: string, mLiveId: string, isSubscribe: boolean) {
liveAppointment(relationId: string, liveId: string, isSubscribe: boolean) {
let params: Record<string, string> = {};
params['relationId'] = relationId
params['liveId'] = mLiveId
params['liveId'] = liveId
params['isSubscribe'] = `${isSubscribe}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO<string>>((success, fail) => {
... ...
... ... @@ -67,9 +67,9 @@ export class LiveViewModel {
}
//直播预约/取消预约
liveAppointment(relationId: string, mLiveId: string, isSubscribe: boolean) {
liveAppointment(relationId: string, liveId: string, isSubscribe: boolean) {
return new Promise<ResponseDTO<string>>((success, fail) => {
this.liveModel.liveAppointment(relationId, mLiveId, isSubscribe).then((data) => {
this.liveModel.liveAppointment(relationId, liveId, isSubscribe).then((data) => {
success(data)
}).catch((message: string) => {
fail(message)
... ...
... ... @@ -2,10 +2,12 @@ import font from '@ohos.font'
import { LiveDetailsBean } from 'wdBean/Index'
import { DateTimeUtils, StringUtils } from 'wdKit/Index'
import { LiveViewModel } from '../../viewModel/LiveViewModel'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
@Component
export struct LiveCountdownComponent {
@Consume @Watch('calculateDataStatus') liveDetailsBean: LiveDetailsBean
@State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
textTimerController: TextTimerController = new TextTimerController()
@State format: string = 'HH:mm:ss'
@State month: string = ''
... ... @@ -26,7 +28,8 @@ export struct LiveCountdownComponent {
})
setTimeout(() => {
this.textTimerController.start()
}, 2000)
}, 0)
this.updateData()
}
build() {
... ... @@ -100,7 +103,7 @@ export struct LiveCountdownComponent {
@Builder
showAppointment() {
Text('我要预约')
Text(this.isAppointmentLive ? '取消预约' : '我要预约')
.width('100%')
.height(42)
.textAlign(TextAlign.Center)
... ... @@ -113,13 +116,17 @@ export struct LiveCountdownComponent {
.border({ radius: 4 })
.backgroundColor(this.isAppointmentLive ? '#CCCCCC' : '#ED2800')
.onClick(() => {
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
if (this.liveDetailsBean && this.liveDetailsBean.liveInfo) {
this.liveAppointment()
}
})
}
calculateDataStatus() {
updateData() {
if (!this.liveDetailsBean) {
return
}
... ...
import { LiveDetailsBean } from 'wdBean/Index'
import { TabChatComponent } from './TabChatComponent'
import { TabInfoComponent } from './TabInfoComponent'
import { TabLiveComponent } from './TabLiveComponent'
... ... @@ -9,7 +8,7 @@ export struct TabComponent {
@State selectedFontColor: string = '#222222'
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
tabs: string[] = ['简介', '直播间', '大家聊']
@Prop tabs: string[] = []
aboutToAppear(): void {
... ... @@ -19,12 +18,21 @@ export struct TabComponent {
Tabs({ barPosition: BarPosition.Start, index: this.currentIndex, controller: this.controller }) {
ForEach(this.tabs, (item: string, index: number) => {
TabContent() {
if (0 == index) {
TabInfoComponent()
} else if (1 == index) {
TabLiveComponent()
} else {
TabChatComponent()
if (this.tabs.length == 3) {
if (0 == index) {
TabInfoComponent()
} else if (1 == index) {
TabLiveComponent()
} else {
TabChatComponent()
}
}
else {
if (0 == index) {
TabLiveComponent()
} else {
TabChatComponent()
}
}
}.tabBar(this.tabBuilder(index, item))
.backgroundColor('#F5F5F5')
... ...
... ... @@ -12,7 +12,7 @@ export struct TabInfoComponent {
Column() {
this.showLiveTitle()
this.showLiveDetails()
LiveCountdownComponent()
LiveCountdownComponent({liveDetailsBean:this.liveDetailsBean})
}.margin({
top: 13,
left: 16,
... ...
... ... @@ -8,12 +8,16 @@ import { TabLiveItemComponent } from './TabLiveItemComponent'
export struct TabLiveComponent {
liveViewModel: LiveViewModel = new LiveViewModel()
@State liveList: Array<LiveRoomItemBean> = []
@Consume liveDetailsBean: LiveDetailsBean
@Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean
aboutToAppear(): void {
updateDate() {
this.getLiveList()
}
aboutToAppear(): void {
}
build() {
Stack() {
if (this.liveList.length == 0) {
... ...
... ... @@ -51,14 +51,18 @@ export struct PlayUIComponent {
.margin({
right: 10
})
Text(this.liveDetailsBean.newsTitle)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('16fp')
.fontWeight(500)
.fontColor(Color.White)
.textAlign(TextAlign.Start)
.layoutWeight(1)
if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
Text(this.liveDetailsBean.newsTitle)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize('16fp')
.fontWeight(500)
.fontColor(Color.White)
.textAlign(TextAlign.Start)
.layoutWeight(1)
} else {
Blank()
}
Image($r('app.media.icon_share'))
.width(24)
.aspectRatio(1)
... ... @@ -86,8 +90,25 @@ export struct PlayUIComponent {
getLiveStatusView() {
// 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 预约
if (this.liveDetailsBean.liveInfo?.liveState == 'wait') {
Row() {
Image($r('app.media.icon_live_status_wait'))
.width(22)
.height(18)
Text('预约')
.fontSize('11fp')
.fontWeight(400)
.fontColor(Color.White)
}
.backgroundColor('#4D000000')
.padding({
top: 1,
right: 4,
bottom: 1
})
}
// 直播中
if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
else if (this.liveDetailsBean.liveInfo?.liveState == 'running') {
Row() {
Image($r('app.media.icon_live_status_running'))
.width(22)
... ...
... ... @@ -6,6 +6,8 @@ import { PlayUIComponent } from './PlayUIComponent';
export struct TopPlayComponent {
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
playerController: WDPlayerController = new WDPlayerController();
@State imgUrl: string = ''
@State isWait: boolean = false
aboutToAppear(): void {
this.playerController.onCanplay = () => {
... ... @@ -15,6 +17,10 @@ export struct TopPlayComponent {
updateData() {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) {
this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url
}
this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait'
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.liveDetailsBean.liveInfo.liveState == 'running') {
... ... @@ -35,6 +41,10 @@ export struct TopPlayComponent {
})
.height('100%')
.width('100%')
.visibility(this.isWait ? Visibility.None : Visibility.Visible)
Image(this.imgUrl)
.objectFit(ImageFit.Contain)
.visibility(this.isWait ? Visibility.Visible : Visibility.None)
PlayUIComponent({ playerController: this.playerController })
}
.height(211)
... ... @@ -43,5 +53,7 @@ export struct TopPlayComponent {
aboutToDisappear(): void {
this.playerController.pause()
this.playerController.stop()
this.playerController.release()
}
}
\ No newline at end of file
... ...
import { LiveDetailsBean } from 'wdBean/Index';
import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
@Component
export struct TopPlayVComponent {
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
playerController: WDPlayerController = new WDPlayerController();
aboutToAppear(): void {
this.playerController.onCanplay = () => {
this.playerController.play()
}
}
updateData() {
//直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) {
let playUrl = ''
if (this.liveDetailsBean.liveInfo.liveState == 'running') {
playUrl = this.liveDetailsBean.liveInfo.vlive[0].liveUrl
} else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
this.playerController.firstPlay(playUrl);
}
}
build() {
Stack() {
// https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect-0000001862607345
Image(this.liveDetailsBean.fullColumnImgUrls[0].url)
.height('100%')
.width('100%')
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
.blur(100)
WDPlayerRenderView({
playerController: this.playerController,
onLoad: async () => {
}
})// .height('100%')
.width('100%')// 扩展至所有非安全区域
.onClick(() => {
this.playerController.play()
})
// PlayUIComponent({ playerController: this.playerController })
}
// .height('100%')
.width('100%')
// 扩展至所有非安全区域
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
}
aboutToDisappear(): void {
this.playerController.pause()
}
}
\ No newline at end of file
... ...
import mediaquery from '@ohos.mediaquery';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { PlayerConstants, WDPlayerController, WDPlayerRenderView } from 'wdPlayer';
import { ContentDetailRequest, devicePLSensorManager } from 'wdDetailPlayApi';
import { PlayControlViewContainer } from '../view/PlayControlViewContainer';
import { PlayerDetailContainer } from '../view/PlayerDetailContainer';
... ... @@ -32,6 +32,19 @@ export struct DetailPlayShortVideoPage {
@Provide videoLandScape?: number = 1; // 视频朝向, 横屏视频:1;竖屏视频:2
@Provide newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@Provide followStatus: string = '0' // 关注状态
@Link @Watch('switchVideoStatusChange') switchVideoStatus: boolean
switchVideoStatusChange() {
if (this.switchVideoStatus) {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_PAUSE) {
this.playerController.play()
}
} else {
if (this.currentIndex === this.index && this.playerController.getStatus() === PlayerConstants.STATUS_START) {
this.playerController.pause()
}
}
}
currentIndexChange() {
if (this.currentIndex != this.index) {
... ... @@ -166,6 +179,7 @@ export struct DetailPlayShortVideoPage {
})
.height('100%')
.width('100%')
.margin({ top: this.contentDetailData?.videoInfo[0]?.videoLandScape === 1 ? 218 : 0 })
.onClick(() => {
console.error('WDPlayerRenderView=== onClick')
this.playerController?.switchPlayOrPause();
... ...
... ... @@ -24,6 +24,7 @@ export struct DetailVideoListPage {
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State isFullScreen: boolean = false
@State switchVideoStatus: boolean = false
async aboutToAppear(): Promise<void> {
... ... @@ -157,6 +158,7 @@ export struct DetailVideoListPage {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
Column() {
DetailPlayShortVideoPage({
switchVideoStatus: $switchVideoStatus,
contentDetailData: item,
currentIndex: this.currentIndex,
index: index,
... ...
... ... @@ -34,14 +34,15 @@ export struct VideoChannelDetail {
private channelStrategy: string = '1' // 频道策略 1-推荐;2-时间线
// private topicId?: string = '' // 专题id
// private recommend?: string = '' // 0.非推荐,1.推荐;
@State @Watch('navIndexChange') bottomNavIndex: number = 0
@State @Watch('navIndexChange') topNavIndex: number = 0
@Link @Watch('navIndexChange') bottomNavIndex: number
@Link @Watch('navIndexChange') topNavIndex: number
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
@State switchVideoStatus: boolean = false
/**
* 监听视频频道激活或失活
... ... @@ -49,30 +50,22 @@ export struct VideoChannelDetail {
navIndexChange() {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// 如果视频在暂停则播放视频
this.switchVideoStatus = true
} else {
// 如果视频在播放则暂停视频
this.switchVideoStatus = false
}
}
async aboutToAppear(): Promise<void> {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowSystemBarProperties({
statusBarContentColor: '#ffffff',
})
console.error('aboutToAppear groupId', this.groupId)
console.error('aboutToAppear pageId', this.pageId)
console.error('aboutToAppear channelId', this.channelId)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
// 根据视频频道传参查询视频楼层信息
this.getRecCompInfo()
}
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
console.error('aboutToDisappear videoChanel')
}
... ... @@ -105,8 +98,7 @@ export struct VideoChannelDetail {
}
await ContentDetailRequest.getRecCompInfo(params).then(res => {
console.log('根据视频频道传参查询视频楼层信息', res.data?.totalCount)
console.log('根据视频频道传参查询视频楼层信息', JSON.stringify(res.data?.compList))
console.log('根据视频频道传参查询视频楼层信息totalCount', res.data?.totalCount + '')
this.totalCount = res.data?.totalCount || 0
const list1: batchContentDetailParams = {
... ... @@ -136,8 +128,6 @@ export struct VideoChannelDetail {
this.batchContentDetail(list1)
this.getContentInteract(list2)
}).catch((e: BusinessError) => {
console.error('eeeeeeeeeeeeee', e)
})
}
... ... @@ -147,7 +137,7 @@ export struct VideoChannelDetail {
async batchContentDetail(list: batchContentDetailParams) {
if (list.contents.length > 0) {
await ContentDetailRequest.batchContentDetail(list).then(res => {
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
console.log('根据视频楼层信息批量查询视频列表', res.data)
this.data = this.data.concat(res.data as [])
})
}
... ... @@ -160,7 +150,7 @@ export struct VideoChannelDetail {
if (list.contentList.length > 0) {
await ContentDetailRequest.getContentInteract(list).then(res => {
this.interactDataList = res.data || []
console.log('根据视频信息批量查询点赞、收藏状态', JSON.stringify(res))
console.log('根据视频信息批量查询点赞、收藏状态', res.data)
})
}
}
... ... @@ -171,6 +161,7 @@ export struct VideoChannelDetail {
ForEach(this.data, (item: ContentDetailDTO, index: number) => {
Column() {
DetailPlayShortVideoPage({
switchVideoStatus: $switchVideoStatus,
contentDetailData: item,
currentIndex: this.currentIndex,
index: index,
... ...
... ... @@ -48,7 +48,9 @@ export struct PlayerTitleComment {
}
getName() {
return this.contentDetailData?.newsSourceName || this.contentDetailData?.editorName || ''
// console.error(this.contentDetailData?.newsSourceName + '===========' + this.contentDetailData?.editorName)
// this.contentDetailData?.newsSourceName ||
return this.contentDetailData?.editorName || ''
}
getTitle() {
... ...
... ... @@ -8,7 +8,7 @@ import { ErrorToastUtils, SPHelper } from 'wdKit'
import { WDRouterPage } from 'wdRouter/src/main/ets/router/WDRouterPage';
import { WDRouterRule } from 'wdRouter/src/main/ets/router/WDRouterRule';
import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/src/main/ets/bean/content/Params'
import {InterestsHobbiesModel} from '../../../../../../../products/phone/src/main/ets/pages/viewModel/InterestsHobbiesModel'
@Extend(Row)
function otherStyle() {
.backgroundImageSize(ImageSize.Cover)
... ... @@ -306,6 +306,10 @@ struct LoginPage {
if (this.checkCodePage) {
this.loginViewModel.appLogin(this.phoneContent, 2, this.codeContent).then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
... ... @@ -319,6 +323,11 @@ struct LoginPage {
this.loginViewModel.appLoginByPassword(this.accountContent, 0, this.passwordContent, "").then((data) => {
Logger.debug(TAG, "requestLogin: " + data.jwtToken)
promptAction.showToast({ message: '登录成功' })
///同步兴趣tag
let interestsModel = new InterestsHobbiesModel()
interestsModel.updateInterests()
router.back({
params: { userName: data.userName,
userId:data.id},
... ...
... ... @@ -41,16 +41,15 @@ class MGPlayRenderViewIns {
export struct WDPlayerRenderView {
private playerController?: WDPlayerController;
private xComponentController: XComponentController = new XComponentController();
private insId: string = "WDPlayRenderView" + insIndex;
onLoad?: ((event?: object) => void);
videoWidth: number = 0
videoHeight: number = 0
@State videoWidth: number = 0
@State videoHeight: number = 0
@State selfSize: Size = new Size('100%', '100%');
private insId: string = "WDPlayRenderView" + insIndex;
aboutToAppear() {
MGPlayRenderViewIns.add();
console.log('playerController', this.playerController)
insIndex++;
if (!this.playerController) {
return
... ... @@ -80,9 +79,7 @@ export struct WDPlayerRenderView {
})
.onLoad(async (event) => {
Logger.info(TAG, 'onLoad')
let surfaceId = this.xComponentController.getXComponentSurfaceId()
console.log('surfaceId===', surfaceId)
console.log('insId===', this.insId)
// const surfaceId = this.xComponentController.getXComponentSurfaceId()
this.xComponentController.setXComponentSurfaceSize({
surfaceWidth: 1920,
surfaceHeight: 1080
... ... @@ -94,27 +91,14 @@ export struct WDPlayerRenderView {
})
.width(this.selfSize.width)
.height(this.selfSize.height)
.margin({ top: this.getPlayerMarginTop() })
}
.id(this.insId)
.onAreaChange(() => {
// this.updateLayout()
})
.backgroundColor("#000000")
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.alignItems(this.selfSize.width === '100%' ? VerticalAlign.Top : VerticalAlign.Center)
.height('100%')
.width('100%')
}
/**
* 横屏播放器非居中展示
*/
getPlayerMarginTop() {
return this.selfSize.width === '100%' && this.videoWidth > this.videoHeight ? 218 : 0
}
updateLayout() {
let info = componentUtils.getRectangleById(this.insId);
if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) {
... ...
import {InterestsHobbiesModel, InterestsList} from '../viewModel/InterestsHobbiesModel'
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
@Entry
@Component
... ... @@ -121,6 +123,7 @@ struct LaunchInterestsHobbiesPage {
.width('662lpx')
.height('84lpx')
.onClick(()=>{
this.saveTagIds()
//跳转首页
WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage)
})
... ... @@ -149,4 +152,15 @@ struct LaunchInterestsHobbiesPage {
})
}
saveTagIds(){
let tags: string = ''
if (this.interestsArray.filter(item => item.choose).length > 0) {
let array = this.interestsArray.filter(item => item.choose)
for (let index = 0; index < array.length; index++) {
const element = array[index];
tags = tags.length === 0 ? element.id.toString() : tags + ',' + element.id.toString()
}
}
SPHelper.default.saveSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,tags)
}
}
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@ import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import data from '@ohos.telephony.data';
import { SpConstants } from 'wdConstant/Index';
export interface InterestsBean {
... ... @@ -60,9 +61,23 @@ export class InterestsHobbiesModel {
fail(error.message)
})
})
}
updateInterests(){
let tags = SPHelper.default.getSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS,'') as string
if (tags.length === 0) return
let bean: Record<string, string> = {};
bean['tagIds'] = tags
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO>((success, fail) => {
HttpRequest.post<ResponseDTO>(HttpUrlUtils.getUpdateInterestsUrl(),bean,headers).then((data: ResponseDTO) => {
if (data.code == 0) {
Logger.info('InterestsHobbiesModel','updateInterests','更新兴趣成功')
SPHelper.default.deleteSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS)
}
}, (error: Error) => {
fail(error.message)
})
})
}
}
\ No newline at end of file
... ...