wangliang_wd

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

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  长图提示png图片
  视频频道入口修改与接口调用
  卡片样式更新
  人民号三图卡,动态横长图和竖长图
  contentDTO新增isSearch自定义字段,区分搜索和主页数据
  desc:搜索结果展示
  关于页面整改
  卡片样式优化
  卡片样式优化
Showing 39 changed files with 1080 additions and 189 deletions
... ... @@ -11,8 +11,8 @@ export class SpConstants{
static USER_TEMP_TOKEN="tempToken"
static USER_PHONE = "user_phone"
//协议相关
static USER_PROTOCOL = "user_protocol" //用户协议
static PRIVATE_PROTOCOL = "private_protocol" //隐私协议
static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
static LOGOUT_PROTOCOL = "logout_protocol" //人民日报客户端app注销协议
static MESSAGE_BOARD_USER_PROTOCOL = "message_board_user_protocol" //"留言板-用户协议"
static MESSAGE_BOARD_NOTICE_PROTOCOL = "message_board_notice_protocol" //留言板-留言须知
... ...
import window from '@ohos.window';
import { BusinessError } from '@ohos.base';
import { AsyncCallback, BusinessError } from '@ohos.base';
import deviceInfo from '@ohos.deviceInfo'
import display from '@ohos.display';
interface SystemBarProperties {
statusBarColor?: string;
isStatusBarLightIcon?: boolean;
statusBarContentColor?: string;
navigationBarColor?: string;
isNavigationBarLightIcon?: boolean;
navigationBarContentColor?: string;
}
export class Size {
width: number = 0
height: number = 0
... ... @@ -15,17 +25,23 @@ export class Size {
export class WindowModel {
private windowStage?: window.WindowStage;
private windowClass?: window.Window;
static shared: WindowModel = new WindowModel()
static TAG = "WindowModel";
setWindowStage(windowStage: window.WindowStage) {
this.windowStage = windowStage;
this.windowClass = windowStage.getMainWindowSync();
}
getWindowStage(): window.WindowStage {
return this.windowStage as window.WindowStage
}
getWindowClass(): window.Window {
return this.windowClass as window.Window
}
setMainWindowFullScreen(fullScreen: boolean) {
if (deviceInfo.deviceType != "phone") {
return
... ... @@ -103,5 +119,17 @@ export class WindowModel {
});
})
}
/**
* 设置窗口全屏模式时窗口内导航栏、状态栏的属性,使用callback异步回调。
* @param systemBarProperties
* @param callback
*/
setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback?: AsyncCallback<void>): void {
this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
callback && callback(err)
})
}
}
... ...
... ... @@ -46,6 +46,10 @@ export class HttpUrlUtils {
* 批查接口,查询互动相关数据,如收藏数、评论数等
*/
static readonly INTERACT_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/content/interactData";
/**
* 查询视频频道推荐楼层
*/
static readonly DISPLAY_REC_COMPINFO: string = "/api/rmrb-bff-display-zh/display/zh/c/rec/compInfo";
// 多图(图集)详情页
/**
* 批量查询内容当前用户点赞、收藏状态
... ... @@ -196,7 +200,6 @@ export class HttpUrlUtils {
* 搜索联想词
*/
static readonly RELATED_SEARCH_CONTENT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/suggestions/";
/**
* 直播详情
*/
... ... @@ -205,7 +208,6 @@ export class HttpUrlUtils {
* 直播详情-直播间列表
*/
static readonly LIVE_LIST_PATH: string = "/api/live-center-message/zh/a/live/message/video/list";
/**
* 直播详情-大家聊列表
*/
... ... @@ -215,7 +217,6 @@ export class HttpUrlUtils {
* 搜索结果 显示tab 数
*/
static readonly SEARCH_RESULT_COUNT_DATA_PATH: string = "/api/rmrb-search-api/zh/c/count?keyword=";
/**
* 搜索结果 显示list 详情
*/
... ... @@ -662,6 +663,11 @@ export class HttpUrlUtils {
return url
}
static getInteractListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.INTERACT_DATA_PATH
return url
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
... ...
... ... @@ -71,6 +71,6 @@ export interface ContentDTO {
photoNum: number;
corner: string;
rmhPlatform: number;
newTags: string
newTags: string;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
}
\ No newline at end of file
... ...
... ... @@ -10,56 +10,60 @@ import { DateTimeUtils } from 'wdKit/Index'
@Component
export struct CardMediaInfo {
@State contentDTO: ContentDTO = {} as ContentDTO // 如果有duraion,代表点播,显示时长;如果不传或者传0,显示直播中
// objectType 0:不跳转 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,
// 14动态图文,15动态视频16问政;100人民号,101标签
build() {
Row() {
if(this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15' ) {
if (this.contentDTO.objectType === '1' || this.contentDTO.objectType === '15') {
// 点播、动态视频
Row(){
Image($r('app.media.videoTypeIcon'))
Row() {
Image($r('app.media.card_play'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.videoInfo.videoDuration * 1000))
.mediaText()
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '2') {
} else if (this.contentDTO.objectType === '2') {
// liveInfo.liveState 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
// 显示直播信息
Row(){
if(this.contentDTO.liveInfo.liveState === 'running') {
Image($r('app.media.icon_live'))
Row() {
if(this.contentDTO.liveInfo.liveState === 'wait') {
Image($r('app.media.card_wait'))
.mediaLogo()
Text('预约')
.mediaText()
} else if (this.contentDTO.liveInfo.liveState === 'running') {
Image($r('app.media.card_live'))
.mediaLogo()
Text('直播中')
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end'){
Image($r('app.media.videoTypeIcon'))
} else if (this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo.replayUri) {
Image($r('app.media.card_play'))
.mediaLogo()
Text('回看')
.mediaText()
} else if(this.contentDTO.liveInfo.liveState === 'end' && this.contentDTO.liveInfo
.replayUri) {
// Image($r('app.media.card_live'))
// .mediaLogo()
Text('直播结束')
.mediaText()
}
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '9') {
} else if (this.contentDTO.objectType === '9') {
// 显示组图;图片数量
Row(){
Image($r('app.media.album_card_shape'))
Row() {
Image($r('app.media.card_image'))
.mediaLogo()
Text(`${this.contentDTO.photoNum}`)
.mediaText()
.width(20)
}
.backgroundColor('#4d000000')
.borderRadius($r('app.float.button_border_radius'))
} else if(this.contentDTO.objectType === '13') {
} else if (this.contentDTO.objectType === '13') {
// 显示音频信息
Row(){
Image($r('app.media.broadcast_listen'))
.height(14)
.borderRadius($r('app.float.button_border_radius'))
Row() {
Image($r('app.media.card_audio'))
.mediaLogo()
Text(DateTimeUtils.getFormattedDuration(this.contentDTO.voiceInfo.voiceDuration * 1000))
.mediaText()
}
... ... @@ -68,18 +72,27 @@ export struct CardMediaInfo {
.margin(6)
}
@Styles mediaLogo() {
.width(22)
.height(18)
.borderRadius($r('app.float.button_border_radius'))
@Styles
mediaLogo() {
.width(14)
.height(14)
.margin({ right: 3 })
.shadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
}
}
@Extend(Text) function mediaText() {
@Extend(Text)
function mediaText() {
.fontColor($r('app.color.color_fff'))
.fontSize($r('app.float.font_size_12'))
.width(40)
.height(18)
.textAlign(TextAlign.Center)
.margin({ left: -3 })
.fontSize($r('app.float.font_size_14'))
.lineHeight(18)
.textShadow({
radius: 2,
color: 'rgba(0,0,0,0.3)',
offsetY: 2
})
}
\ No newline at end of file
... ...
... ... @@ -28,16 +28,23 @@ export struct CardSourceInfo {
.fontColor($r("app.color.color_B0B0B0"))
.maxLines(1)
.textOverflow({overflow: TextOverflow.Ellipsis})
}
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1) {
Image($r("app.media.point"))
.width(16)
.height(16)
}
// TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ right: 6 })
.flexShrink(0)
}
if(this.contentDTO?.interactData?.commentNum) {
Text(`${this.contentDTO.interactData.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
... ...
... ... @@ -3,46 +3,45 @@ import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card12Component';
const TAG = 'Card14Component';
/**
* 人民号-动态---12:人民号无图卡;
* 人民号-动态---14:人民号单图卡;
*/
@Entry
@Component
export struct Card12Component {
export struct Card14Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
// appStyle: '20',
// coverType: 1,
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// fullColumnImgUrls: [
// {
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// weight: 1600
// }
// ],
// newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhInfo: {
// authIcon:
// 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
// authTitle: '10后音乐人王烁然个人人民号',
// authTitle2: '10后音乐人王烁然个人人民号',
// banControl: 0,
// cnIsAttention: 1,
// rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhName: '王烁然',
// userId: '522435359667845',
// userType: '2'
// },
// objectType: '1',
// videoInfo: {
// firstFrameImageUri: '',
// videoDuration: 37,
// videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
// }
} as ContentDTO;
aboutToAppear(): void {
... ...
import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
const TAG = 'Card16Component';
/**
* 人民号-动态---16:人民号三图卡;
*/
@Component
export struct Card16Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
} as ContentDTO;
aboutToAppear(): void {
}
build() {
Column() {
// rmh信息
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontColor($r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
.margin({ bottom: 8 })
.lineHeight(25)
}
if (this.contentDTO.coverUrl) {
Flex() {
ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => {
Image(item).flexBasis(113).height(75).margin({right: 2})
})
}
}
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.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')
})
}
}
interface radiusType {
topLeft: number | Resource;
topRight: number | Resource;
bottomLeft: number | Resource;
bottomRight: number | Resource;
}
@Component
struct createImg {
@Prop contentDTO: ContentDTO
build() {
GridRow() {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
// 横屏
GridCol({
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
}
}
}
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
\ No newline at end of file
... ...
... ... @@ -13,7 +13,7 @@ export struct Card19Component {
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
// fullColumnImgUrls: [
// {
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994160362418176.png?x-oss-process=image/quality,q_90/auto-orient,1',
// fullUrl: 'https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240323/a_955994155727712256.png?x-oss-process=image/quality,q_90/auto-orient,1',
// height: 1500,
// landscape: 1,
// size: 1,
... ... @@ -107,6 +107,8 @@ interface radiusType {
@Component
struct createImg {
@Prop fullColumnImgUrls: FullColumnImgUrlDTO[]
@State picWidth: number = 0;
@State picHeight: number = 0;
aboutToAppear(): void {
if(this.fullColumnImgUrls.length === 4) { // 为了使用栅格布局以便于占用三分之二的宽度,加一个占位
this.fullColumnImgUrls.splice(2,0, {
... ... @@ -137,18 +139,77 @@ struct createImg {
return radius
}
getPicType(){
if (this.picWidth && this.picWidth) {
if (this.picWidth / this.picHeight > 343/172) {
return 1; //横长图
} else if (this.picHeight / this.picWidth > 305/228) {
return 2; //竖长图
} else {
return 3
}
} else {
return 3; //普通图
}
}
build() {
GridRow({
gutter: { x: 2, y: 2 }
}) {
ForEach(this.fullColumnImgUrls, (item: FullColumnImgUrlDTO, index: number) => {
if (this.fullColumnImgUrls.length === 1) {
if (this.getPicType() !== 3) {
GridCol({
span: this.getPicType() === 1 ? 12 : 8
}){
Stack({
alignContent: Alignment.BottomEnd
}) {
if (this.getPicType() === 1) {
Image(item.fullUrl)
.width('100%')
.height(172)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
} else if (this.getPicType() === 2) {
Image(item.fullUrl)
.width('100%')
.height(305)
.autoResize(true)
.borderRadius(this.caclImageRadius(index))
}
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
}
} else {
GridCol({
span: { xs: 8 }
}) {
Image(item.fullUrl)
.width('100%')
.borderRadius(this.caclImageRadius(index))
.autoResize(true)
.opacity(!this.picWidth && !this.picHeight ? 0 : 1)
.onComplete(callback => {
this.picWidth = callback?.width || 0;
this.picHeight = callback?.height || 0;
})
}
}
} else if (this.fullColumnImgUrls.length === 4) {
GridCol({
... ...
... ... @@ -104,7 +104,7 @@ export struct Card9Component {
Column() {
Row() {
// 标题
Image($r("app.media.point_icon"))
Image($r("app.media.timeline_rect"))
.width(9)
.height(9)
.margin({ right: 5 })
... ...
... ... @@ -157,11 +157,11 @@ struct CreatorItem {
.width(44)
.height(44)
if (this.isSelected) {
Image($r('app.media.MyCollection_selected_icon'))
Image($r('app.media.rmh_selected'))
.width(16)
.height(16)
} else {
Image($r('app.media.ic_succeed_refresh'))
Image($r('app.media.rmh_unselected'))
.width(16)
.height(16)
}
... ...
... ... @@ -90,6 +90,7 @@ export struct OtherHomePageBottomCommentComponent{
MinePageDatasModel.getOtherCommentListData(object,getContext(this)).then((value)=>{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
this.getCommentListStatus(value)
}
... ...
... ... @@ -60,6 +60,7 @@ export struct BottomNavigationComponent {
MinePageComponent()
} else {
TopNavigationComponent({
groupId: navItem.id,
topNavList: navItem.topNavChannelList,
_currentNavIndex: this.currentNavIndex,
changeBarBackgroundColor: (color: Color) => {
... ...
... ... @@ -12,7 +12,6 @@ import LoadMoreLayout from './LoadMoreLayout';
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CompParser } from '../CompParser';
import { GroupInfoDTO } from 'wdBean/src/main/ets/bean/navigation/PageInfoDTO';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
import { CompDTO, LiveReviewDTO, PageDTO, PageInfoBean } from 'wdBean';
... ... @@ -40,7 +39,6 @@ export struct PageComponent {
totalCount: 0,
list: []
};
name: string = "";
@Link @Watch('onChange') currentTopNavSelectedIndex: number
build() {
... ... @@ -71,7 +69,7 @@ export struct PageComponent {
@Builder
ListLayout() {
List() {
if (this.name !== '视频') {
// 下拉刷新
ListItem() {
RefreshLayout({
... ... @@ -79,11 +77,7 @@ export struct PageComponent {
this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight)
})
}
}
if (this.name === '视频') {
VideoChannelDetail()
} else {
LazyForEach(this.pageModel.compList, (compDTO: CompDTO, compIndex: number) => {
ListItem() {
Column() {
... ... @@ -93,9 +87,7 @@ export struct PageComponent {
},
(compDTO: CompDTO, compIndex: number) => compDTO.id + compIndex.toString() + this.pageModel.timestamp
)
}
if (this.name !== '视频') {
// 加载更多
ListItem() {
if (this.pageModel.hasMore) {
... ... @@ -107,7 +99,6 @@ export struct PageComponent {
NoMoreLayout()
}
}
}
}
.scrollBar(BarState.Off)
... ...
... ... @@ -6,6 +6,7 @@ import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
import window from '@ohos.window';
import { WindowModel } from 'wdKit';
import { VideoChannelDetail } from 'wdDetailPlayShortVideo/Index';
const TAG = 'TopNavigationComponent';
... ... @@ -20,6 +21,7 @@ const storage = LocalStorage.getShared();
@Entry(storage)
@Component
export struct TopNavigationComponent {
private groupId: number = 0
private tabsController: TabsController = new TabsController()
private changeBarBackgroundColor: (color: Color) => void = () => {
}
... ... @@ -236,13 +238,21 @@ export struct TopNavigationComponent {
Tabs({ index: this.currentTopNavSelectedIndex, controller: this.tabsController }) {
ForEach(this._currentNavIndex === 0 ? this.myChannelList : this.topNavList, (navItem: TopNavDTO, index: number) => {
TabContent() {
if (this._currentNavIndex === 2 && navItem.name === '视频') {
VideoChannelDetail({
bottomNavIndex: this._currentNavIndex,
topNavIndex: this.currentTopNavSelectedIndex,
groupId: this.groupId + '',
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
})
} else
if (!this.isBroadcast(navItem) && !this.isLayout(navItem)) {
PageComponent({
currentTopNavSelectedIndex: $currentTopNavSelectedIndex,
navIndex: index,
pageId: navItem.pageId + '',
channelId: navItem.channelId + '',
name: navItem.name
})
}
}
... ...
import { ContentDTO, FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils } from 'wdKit/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
... ... @@ -13,6 +17,7 @@ export struct SearchResultContentComponent{
@State keywords:string = ""
@State searchType:string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = 0;
@State isLoading:boolean = false
@State hasMore:boolean = true
... ... @@ -42,9 +47,51 @@ export struct SearchResultContentComponent{
SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keywords,getContext(this)).then((value)=>{
if (!this.data || value.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
value.list.forEach((value)=>{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
//TODO 查询创作者详情接口
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
})
}
}
getInteractData(resultData:SearchResultContentData){
if(resultData.list[0].dataList!=null){
resultData.list.splice(0,1)
}
let data : contentListParams = {
contentList: []
}
resultData.list.forEach((item)=>{
data.contentList.push({
contentId: item.data.id + '',
contentType: Number.parseInt(item.data.type)
})
})
SearcherAboutDataModel.getInteractListData(data,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
resultData.list.forEach((data)=>{
if (item.contentId == data.data.id) {
data.data.collectNum = item.collectNum+""
data.data.commentNum = item.commentNum+""
data.data.likeNum = item.likeNum+""
data.data.readNum = item.readNum+""
data.data.shareNum = item.shareNum+""
}
})
})
resultData.list.forEach((value)=>{
let photos:FullColumnImgUrlDTO[] = []
if(value.data.appStyle === 4){
value.data.appStyleImages.split("&&").forEach((value)=>{
... ... @@ -111,37 +158,78 @@ export struct SearchResultContentComponent{
interactData: {} as InteractDataDTO,
corner: '',
rmhPlatform: 0,
newTags: ''
newTags: '',
isSearch: true
}
this.data.push(contentDTO)
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < value.totalCount) {
if (this.data.totalCount() < resultData.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
console.log(TAG,"请求失败")
this.isLoading = false
})
}
build() {
Column() {
if(this.count == 0){
ListHasNoMoreDataUI({style:2})
}else{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List() {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image($r('app.media.default_head'))
.width('84lpx')
.height('84lpx')
.margin({bottom:'15lpx'})
Text(item.creatorName)
.fontSize('20lpx')
}.alignItems(HorizontalAlign.Center)
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('150lpx')
.onReachEnd(()=>{
if(!this.isLoading){
//进入更多关注页
}
})
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
CardParser({contentDTO:item})
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
}
}
}
.onClick(()=>{
//TODO 跳转
... ... @@ -154,7 +242,8 @@ export struct SearchResultContentComponent{
ListHasNoMoreDataUI()
}
}
}.cachedCount(4)
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.layoutWeight(1)
... ... @@ -167,6 +256,7 @@ export struct SearchResultContentComponent{
})
}
}
}
.backgroundColor($r('app.color.white'))
.height('100%')
.width('100%')
... ...
... ... @@ -67,10 +67,10 @@ export struct AboutPageUI {
this.getArrowCell(item, index)
}.onClick(() => {
if (index == 0) {
let bean = { contentId: "1", pageID: "" } as Params
let bean = { contentID: "2", pageID: "" } as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
} else {
let bean = { contentId: "2", pageID: "" } as Params
let bean = { contentID: "1", pageID: "" } as Params
WDRouterRule.jumpWithPage(WDRouterPage.loginProtocolPage, bean)
}
})
... ...
... ... @@ -52,8 +52,7 @@ export struct BannerComponent {
.borderRadius($r('app.float.image_border_radius'))
.displayCount(this.buildDisplayCount()) // 仅展示1个图片
.cachedCount(2)
.index(1) // The default index of Swiper.
.autoPlay(true)
.index(0) // The default index of Swiper.
.indicator(Indicator.dot()
.right(5)
.itemWidth(4)
... ...
... ... @@ -6,6 +6,7 @@ import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
import { contentListParams, InteractDataDTO } from 'wdBean/Index';
const TAG = "SearcherAboutDataModel"
... ... @@ -82,6 +83,8 @@ class SearcherAboutDataModel{
if(this.searchHistoryData.length>10){
this.searchHistoryData.splice(10,this.searchHistoryData.length - 10)
}
// this.putSearchHistoryData("大家")
// this.putSearchHistoryData("人民")
return this.searchHistoryData
}
... ... @@ -278,6 +281,44 @@ class SearcherAboutDataModel{
return compRes.data
}
/**
* 搜索结果 展示列表(交互详情 评论收藏点赞分享数量)
*/
getInteractListData(data : contentListParams,context: Context): Promise<InteractDataDTO[]> {
return new Promise<InteractDataDTO[]>((success, error) => {
Logger.info(TAG, `getInteractListData start`);
this.fetchInteractListData(data).then((navResDTO: ResponseDTO<InteractDataDTO[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success(this.getInteractListDataLocal(context))
return
}
Logger.info(TAG, "getInteractListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as InteractDataDTO[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getInteractListData catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getInteractListDataLocal(context))
})
})
}
fetchInteractListData(data : contentListParams) {
let url = HttpUrlUtils.getInteractListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers)
};
async getInteractListDataLocal(context: Context): Promise<InteractDataDTO[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<InteractDataDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<InteractDataDTO[]>>(context,'search_result_interact_list_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
}
Logger.info(TAG, `getInteractListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
return compRes.data
}
}
... ...
... ... @@ -4,6 +4,7 @@ import { SearchResultContentItem } from './SearchResultContentItem'
export class SearchResultContentData{
list:SearchResultContentItem[] = []
keyword:string = ""
pageNum: number = 0
pageSize: number = 20
... ...
export class SearchResultContentItem{
data:SearchDescription = new SearchDescription()
dataList:SearchRmhDescription[] = []
resultType:string = ""
}
... ... @@ -172,6 +173,180 @@ class SearchDescription{
sourceName: string = ""
shareImageBucket: string = ""
landscape: string = ""
collectNum: string = ""
commentNum: string = ""
likeNum: string= ""
readNum: string= ""
shareNum: string= ""
}
export class SearchRmhDescription{
likeEnable: string= ""
previewUri: string= ""
firstFrameImageBucket: string= ""
appImg: string= ""
onlineStatus: string= ""
createUserName: string= ""
contentCheck: string= ""
type: string= ""
titleOsst: string= ""
coverHImageBucket: string= ""
shareImageUri: string= ""
searchTypeInt: string= ""
authIcon: string= ""
id: string= ""
newOld: string= ""
seoTags: string= ""
publishTime: string= ""
feedControl: string= ""
saveType: string= ""
userTypeInt: string= ""
userOrigin: string= ""
creatorType: string= ""
planStartTime: string= ""
waresSwitch: string= ""
introductionLiteral: string= ""
topicType: string= ""
hotFlag: string= ""
coverUrl: string= ""
itemId: string= ""
titleEn: string= ""
matrixId: string= ""
tplId: string= ""
joinActivity: string= ""
status: string= ""
headerPhotoUrl: string= ""
zhSearch: string= ""
activityControl: string= ""
city: string= ""
showTitleIng: string= ""
shareFlag: string= ""
creatorName: string= ""
className: string= ""
showTitleNo: string= ""
liveSwitch: string= ""
likesStyle: string= ""
dataKey: string= ""
search: string= ""
puserId: string= ""
top: string= ""
titleLiteral: string= ""
countryCode: string= ""
startTime: string= ""
shareDescription: string= ""
channelId: string= ""
openComment: string= ""
creatorClassify: string= ""
previewBucket: string= ""
picCount: string= ""
recommendControl: string= ""
creatorNameLiteral: string= ""
subjects: string= ""
updateUser: string= ""
i: string= ""
updateTime: string= ""
userId: string= ""
showTitleEd: string= ""
authTo: string= ""
rmhPlatformInt: string= ""
giftEnable: string= ""
titleEnosst: string= ""
shareCoverUrl: string= ""
deleted: string= ""
zhOperateFlag: string= ""
shareTitle: string= ""
scrollUpdated: string= ""
createTime: string= ""
creatorBan: string= ""
publishTimeInt: string= ""
organization: string= ""
channelName: string= ""
createUser: string= ""
currentPoliticsFlag: string= ""
endTime: string= ""
sourceId: string= ""
country: string= ""
secondClassify: string= ""
createUserId: string= ""
firstFrameImageUri: string= ""
pubTime: string= ""
openLikes: string= ""
contentText: string= ""
relType: string= ""
authImg: string= ""
roomId: string= ""
nameLiteral: string= ""
mainControl: string= ""
coverVImageBucket: string= ""
linkUrl: string= ""
openDownload: string= ""
zhChannelPageImg: string= ""
appStandImg: string= ""
shareSummary: string= ""
firstPublishTimeInt: string= ""
rmhPlatform: string= ""
creatorNameOsst: string= ""
searchType: string= ""
author: string= ""
askAnswerFlag: string= ""
seoTagName: string= ""
weight: string= ""
pageId: string= ""
firstPublishTime: string= ""
coverVImageUri: string= ""
publishType: string= ""
isVr: string= ""
name: string= ""
shareUrl: string= ""
userType: string= ""
firstProcessTime: string= ""
hasRecord: string= ""
shareTitleOsst: string= ""
classify: string= ""
itemType: string= ""
nameOsst: string= ""
districtCode: string= ""
hidden: string= ""
cityCode: string= ""
liveType: string= ""
appStyleImages: string= ""
titleShow: string= ""
cornerMark: string= ""
creatorId: string= ""
levelScore: string= ""
description: string= ""
liveStartTime: string= ""
likeStyle: string= ""
title: string= ""
content: string= ""
platform: string= ""
duration: string= ""
shareDescriptionLiteral: string= ""
createTimeInt: string= ""
liveEndTime: string= ""
topicTemplate: string= ""
barrageEnable: string= ""
introduction: string= ""
notice: string= ""
shareTitleLiteral: string= ""
coverHImageUri: string= ""
relId: string= ""
classCode: string= ""
grayScale: string= ""
appStyle: string= ""
authTitle: string= ""
provinceCode: string= ""
tenancy: string= ""
platformId: string= ""
classSubName: string= ""
recommended: string= ""
descriptionLiteral: string= ""
banControl: string= ""
auditingStatus: string= ""
planEndTime: string= ""
speakControl: string= ""
sourceName: string= ""
shareImageBucket: string= ""
landscape: string= ""
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@ import { Logger, ResourcesUtils } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import HashMap from '@ohos.util.HashMap';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
const TAG = 'ContentDetailRequest';
... ... @@ -13,6 +14,18 @@ export interface ContentDetailRequestParams {
relType: string
}
export interface contentsItem {
contentId: string;
contentRelId: string;
contentType: number;
relId: string;
relType: string;
}
export interface batchContentDetailParams {
contents: contentsItem[]
}
export interface recommentVideoListParams {
pageSize: number;
refreshCnt: number;
... ... @@ -27,6 +40,47 @@ export interface contentListParams {
contentList: contentListItem[];
}
export interface getRecCompInfoParams {
groupId: string;
pageId: string;
channelId: string;
loadStrategy: string;
channelStrategy: string;
pageNum: number;
pageSize: number;
refreshTime: number;
}
// 为空的值不声明,需要时再加
export interface operDataListItem {
objectId: string;
objectType: string;
relId: string;
relType: string;
channelId: string;
}
export interface compListItem {
compStyle: string;
compType: string;
hasMore: number;
recommend: number;
operDataList: operDataListItem[];
}
export interface getRecCompInfoResult {
blockDesc: string;
id: number;
name: string;
pageId: string;
pageNum: number;
pageSize: number;
recommend: number;
totalCount: number;
compList: compListItem[]
}
export interface IStatusContentList {
contentId: string;
... ... @@ -159,7 +213,33 @@ export class ContentDetailRequest {
}
/**
*
* 查询沉浸式视频频道推荐楼层数据
* @returns
*/
static getRecCompInfo(params: getRecCompInfoParams): Promise<ResponseDTO<getRecCompInfoResult>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DISPLAY_REC_COMPINFO
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.request({ url, method: 'GET', params, headers: HttpRequest.buildHeaderWithGlobalHeader(headers) })
}
/**
* 批量查询沉浸式视频详情
* @returns
*/
static batchContentDetail(params: batchContentDetailParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.request({
url,
method: 'POST',
data: params,
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
})
}
/**
* 批量查询作品点赞、收藏、分享、阅读、评论数量
* @returns
*/
static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
... ...
... ... @@ -5,104 +5,164 @@ import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage'
import { Test } from './Test'
import router from '@ohos.router';
import window from '@ohos.window';
import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import {
batchContentDetailParams,
compListItem,
contentListParams,
contentsItem,
getRecCompInfoParams
} from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest';
import { WindowModel } from 'wdKit/Index';
import { BusinessError } from '@kit.BasicServicesKit';
interface loadMoreData {
pageNum: number;
refreshTime: number;
loadStrategy: string;
}
@Entry
@Component
export struct VideoChannelDetail {
private contentId: string = ''
private relId: string = ''
private relType: string = ''
private groupId: string = '' // 楼层id
private pageId: string = '' //页面id
private pageNum: number = 1
private pageSize: number = 10
private loadStrategy: string = 'first_load' // 首次加载: first_load, 上推刷新: push_up, 下拉刷新: pull_down
private refreshTime: number = new Date().getTime() // 第一页刷新时间,用于频道分页排序时过滤,查询时携带【首刷、下拉取当前最新时间;其他的都使用首刷的时间】
private channelId: string = '' // 频道id
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
private swiperController: SwiperController = new SwiperController()
@Provide showComment: boolean = false
@State data: ContentDetailDTO[] = []
@State currentIndex: number = 0
@State interactDataList: InteractDataDTO[] = []
@State totalCount: number = 0
async aboutToAppear(): Promise<void> {
// let data: ContentDetailDTO[] = []
// let action: Action = router.getParams() as Action
// if (action) {
// this.contentId = action.params?.contentID || ''
// if (action.params && action.params.extra) {
// this.relId = action.params.extra.relId || ''
// this.relType = action.params.extra.relType || ''
// }
// await ContentDetailRequest.getContentDetail({
// contentId: this.contentId,
// relId: this.relId,
// relType: this.relType
// }).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => {
// console.error('resDTO==', JSON.stringify(resDTO.data))
// if (resDTO.data) {
// this.data.push(resDTO.data[0])
// }
//
// })
// }
await this.queryVideoList()
// await ContentDetailRequest.postRecommendVideoList({
// pageSize: 5,
// refreshCnt: 1
// }).then(res => {
// if (res.data) {
// data = data.concat(res.data)
// }
// console.log('res1===', JSON.stringify(res))
// console.log('res==' + this.data)
// })
if (this.data.length > 0) {
const params: contentListParams = {
contentList: []
/**
* 监听视频频道激活或失活
*/
navIndexChange() {
if (this.bottomNavIndex === 2 && this.topNavIndex === 0) {
// 如果视频在暂停则播放视频
} else {
// 如果视频在播放则暂停视频
}
this.data.map(item => {
params.contentList.push({
contentId: item.newsId + '',
contentType: item.newsType
})
})
// 批量查询内容当前用户点赞、收藏状态
await ContentDetailRequest.getContentInteract(params).then(res => {
if (res.data) {
this.interactDataList = res.data || []
}
console.log('获取互动点赞等数据===', JSON.stringify(res))
})
// 查询各类型内容动态数据接口V2
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)
// 根据视频频道传参查询视频楼层信息
this.getRecCompInfo()
}
// this.data = data
console.error('aboutToAppear===', this.data.length)
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync();
windowClass.setWindowSystemBarProperties({
statusBarContentColor: '#000000',
})
console.error('aboutToDisappear videoChanel')
}
onPageHide(): void {
console.error('onPageHide videoChanel')
}
onPageShow(): void {
console.error('onPageShow videoChanel')
}
/**
* 查询视频列表用于翻页
* 根据视频频道传参查询视频楼层信息
*/
async queryVideoList() {
await ContentDetailRequest.postRecommendVideoList({
pageSize: 5,
refreshCnt: 1
}).then(res => {
if (res.data) {
this.data = this.data.concat(res.data)
}
console.log('queryVideoList===', JSON.stringify(this.data))
async getRecCompInfo() {
if (this.data.length > 0 && this.data.length === this.totalCount) {
AlertDialog.show({ message: '没有更多视频了~' })
return
}
const params: getRecCompInfoParams = {
groupId: this.groupId,
pageId: this.pageId,
channelId: this.channelId,
loadStrategy: this.loadStrategy,
channelStrategy: this.channelStrategy,
pageNum: this.pageNum,
pageSize: this.pageSize,
refreshTime: this.refreshTime,
}
await ContentDetailRequest.getRecCompInfo(params).then(res => {
console.log('根据视频频道传参查询视频楼层信息', res.data?.totalCount)
console.log('根据视频频道传参查询视频楼层信息', JSON.stringify(res.data?.compList))
this.totalCount = res.data?.totalCount || 0
const list1: batchContentDetailParams = {
contents: []
}
const list2: contentListParams = {
contentList: []
}
if (res.data?.compList.length) {
res.data?.compList.map((item: compListItem) => {
list1.contents.push({
contentId: item.operDataList[0].objectId,
contentRelId: item.operDataList[0].relId,
contentType: Number(item.operDataList[0].objectType),
relId: item.operDataList[0].relId,
relType: item.operDataList[0].relType,
})
list2.contentList.push({
contentId: item.operDataList[0].objectId,
contentType: Number(item.operDataList[0].objectType),
})
})
}
aboutToDisappear(): void {
this.batchContentDetail(list1)
this.getContentInteract(list2)
}).catch((e: BusinessError) => {
console.error('eeeeeeeeeeeeee', e)
})
}
onPageHide(): void {
/**
* 根据视频楼层信息批量查询视频列表
*/
async batchContentDetail(list: batchContentDetailParams) {
if (list.contents.length > 0) {
await ContentDetailRequest.batchContentDetail(list).then(res => {
console.log('根据视频楼层信息批量查询视频列表', JSON.stringify(res.data))
this.data = this.data.concat(res.data as [])
})
}
}
/**
* 根据视频信息批量查询点赞、收藏状态
*/
async getContentInteract(list: contentListParams) {
if (list.contentList.length > 0) {
await ContentDetailRequest.getContentInteract(list).then(res => {
this.interactDataList = res.data || []
console.log('根据视频信息批量查询点赞、收藏状态', JSON.stringify(res))
})
}
}
build() {
... ... @@ -133,7 +193,10 @@ export struct VideoChannelDetail {
console.info('onChange==', index.toString())
if (this.currentIndex === this.data.length - 1) {
this.queryVideoList()
this.pageNum++
this.refreshTime = new Date().getTime()
this.loadStrategy = 'push_up'
this.getRecCompInfo()
}
})
... ...
... ... @@ -144,7 +144,7 @@ export struct PlayerTitleComment {
Column() {
Slider({
value: this.progressVal,
step: 1,
step: 0.01,
// style: SliderStyle.OutSet
})
.blockColor(this.status === PlayerConstants.STATUS_START ? Color.Transparent : $r('app.color.play_block_color'))
... ... @@ -159,7 +159,7 @@ export struct PlayerTitleComment {
.width('100%')
.height(19)
.onChange((value: number, mode: SliderChangeMode) => {
this.playerController?.setSeekTime(value, mode);
this.playerController?.setSeekTime(Math.floor(value), mode);
})
if (this.showComment) {
... ...
... ... @@ -20,11 +20,11 @@ struct LoginProtocolWebview {
if (router.getParams()) {
let params = router.getParams() as Params
Logger.info(TAG, 'params.contentID:' + params.contentID);
if (params.contentID == "1") { //用户协议
this.webUrl = await SPHelper.default.get(SpConstants.USER_PROTOCOL, this.userProtocol) as string
if (params.contentID == "1") { //"人民日报客户端网络服务使用协议"
this.webUrl = await SPHelper.default.get(SpConstants.NET_SERVICE_PROTOCOL, this.userProtocol) as string
this.webviewController.loadUrl(this.webUrl)
} else if(params.contentID == "2"){ //隐私协议
} else if(params.contentID == "2"){ //"人民日报客户端用户隐私协议"
this.webUrl = await SPHelper.default.get(SpConstants.PRIVATE_PROTOCOL, this.privateProtocol) as string
this.webviewController.loadUrl(this.webUrl)
}else if(params.contentID == "3"){ //注销协议
... ...
... ... @@ -120,6 +120,9 @@ export class WDPlayerController {
this.avPlayer?.on(Events.ERROR, (error) => {
this.playError(error.message);
})
this.avPlayer?.on('seekDone', (time: number) => {
this.initProgress(time);
})
this.avPlayer?.on(Events.VIDEO_SIZE_CHANGE, (width: number, height: number) => {
if (this.onVideoSizeChange) {
this.onVideoSizeChange(width, height);
... ... @@ -248,8 +251,8 @@ export class WDPlayerController {
// 100 / 1000));
}
if (mode === SliderChangeMode.End) {
this.seekTime = value * this.duration;
this.avPlayer?.seek(this.seekTime, media.SeekMode.SEEK_PREV_SYNC);
this.seekTime = Math.floor(value * this.duration / 100);
this.avPlayer?.seek(this.seekTime);
}
}
... ... @@ -269,7 +272,7 @@ export class WDPlayerController {
let nowSeconds = Math.floor(time / 1000);
let totalSeconds = Math.floor(this.duration / 1000);
if (this.onTimeUpdate) {
this.onTimeUpdate(nowSeconds, totalSeconds);
this.onTimeUpdate(time, this.duration);
}
}
... ...
... ... @@ -23,7 +23,7 @@ export class LaunchModel {
//保存数据
for (let i = 0; i < data.data.length; i++) {
if (data.data[i].type == 1) {
SPHelper.default.save(SpConstants.USER_PROTOCOL, data.data[i].linkUrl)
SPHelper.default.save(SpConstants.NET_SERVICE_PROTOCOL, data.data[i].linkUrl)
} else if (data.data[i].type == 2) {
SPHelper.default.save(SpConstants.PRIVATE_PROTOCOL, data.data[i].linkUrl)
}else if (data.data[i].type == 4) {
... ...
{
"code": "0",
"data": [
{
"collectNum": 1,
"commentNum": 1,
"contentId": "30044118767",
"contentType": 8,
"likeNum": 20,
"readNum": 7839,
"shareNum": 1
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30043914123",
"contentType": 8,
"likeNum": 20,
"readNum": 4986,
"shareNum": 2
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044329241",
"contentType": 8,
"likeNum": 0,
"readNum": 416,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 2,
"contentId": "30044323528",
"contentType": 8,
"likeNum": 3,
"readNum": 1139,
"shareNum": 4
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044318896",
"contentType": 8,
"likeNum": 0,
"readNum": 1266,
"shareNum": 1
},
{
"collectNum": 11,
"commentNum": 13,
"contentId": "30044318735",
"contentType": 8,
"likeNum": 12,
"readNum": 3842,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044303875",
"contentType": 8,
"likeNum": 0,
"readNum": 2689,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044210715",
"contentType": 8,
"likeNum": 0,
"readNum": 173,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30002401426",
"contentType": 8,
"likeNum": 0,
"readNum": 9002,
"shareNum": 1
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044297214",
"contentType": 8,
"likeNum": 20,
"readNum": 3079,
"shareNum": 6
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30002735426",
"contentType": 8,
"likeNum": 0,
"readNum": 3816,
"shareNum": 0
},
{
"collectNum": 5,
"commentNum": 1,
"contentId": "30002891779",
"contentType": 8,
"likeNum": 2,
"readNum": 30474,
"shareNum": 4
},
{
"collectNum": 0,
"commentNum": 4,
"contentId": "30044242849",
"contentType": 8,
"likeNum": 4,
"readNum": 1099,
"shareNum": 4
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044064967",
"contentType": 8,
"likeNum": 9,
"readNum": 63139,
"shareNum": 5
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044214313",
"contentType": 8,
"likeNum": 1,
"readNum": 5966,
"shareNum": 1
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044174144",
"contentType": 8,
"likeNum": 20,
"readNum": 5150,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044036728",
"contentType": 8,
"likeNum": 20,
"readNum": 4217,
"shareNum": 0
},
{
"collectNum": 3,
"commentNum": 0,
"contentId": "30044123091",
"contentType": 8,
"likeNum": 20,
"readNum": 16697,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30044055254",
"contentType": 8,
"likeNum": 20,
"readNum": 11551,
"shareNum": 0
},
{
"collectNum": 0,
"commentNum": 0,
"contentId": "30043994115",
"contentType": 8,
"likeNum": 0,
"readNum": 2370,
"shareNum": 3
}
],
"message": "Success",
"meta": null,
"requestId": "",
"success": true,
"timestamp": 1712889166521
}
\ No newline at end of file
... ...