douaojie

Merge remote-tracking branch 'origin/main'

Showing 50 changed files with 1456 additions and 892 deletions
... ... @@ -16,6 +16,7 @@ interface dataObject {
operateType?: string
webViewHeight?: string
dataJson?: string
appInnerLink?: string
}
/**
* 消息Message
... ...
... ... @@ -52,7 +52,7 @@ export class WDRouterPage {
// 点播详情页
static detailPlayVodPage = new WDRouterPage("wdDetailPlayVod", "ets/pages/DetailPlayVodPage");
// 直播详情页
static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
// static detailPlayLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLivePage");
static detailPlayVLivePage = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayVLivePage");
static detailPlayLiveCommon = new WDRouterPage("wdDetailPlayLive", "ets/pages/DetailPlayLiveCommon");
// 多图(图集)详情页
... ...
... ... @@ -138,7 +138,7 @@ export class ProcessUtils {
* 动态详情页(动态视频/动态图片)
* @param content
* */
private static gotoDynamicDetailPage(content: ContentDTO) {
public static gotoDynamicDetailPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -172,7 +172,7 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoMultiPictureListPage`);
}
private static gotoSpecialTopic(content: ContentDTO) {
public static gotoSpecialTopic(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
... ... @@ -183,7 +183,7 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
}
private static gotoDefaultWeb(content: ContentDTO) {
public static gotoDefaultWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
... ... @@ -212,7 +212,7 @@ export class ProcessUtils {
Logger.debug(TAG, `commentGotoWeb, ${content.newsId}`);
}
private static gotoWeb(content: ContentDTO) {
public static gotoWeb(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
... ... @@ -231,7 +231,7 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}
private static gotoVod(content: ContentDTO) {
public static gotoVod(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -247,7 +247,7 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
}
private static async gotoLive(content: ContentDTO) {
public static async gotoLive(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -263,7 +263,7 @@ export class ProcessUtils {
Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
private static gotoAudio(content: ContentDTO) {
public static gotoAudio(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -283,7 +283,7 @@ export class ProcessUtils {
* 金刚位聚合页
* @param content
* */
private static gotoThemeListPage(content: ContentDTO) {
public static gotoThemeListPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -303,7 +303,7 @@ export class ProcessUtils {
* 图片预览页
* @param content
* */
private static gotoAtlasDetailPage(content: ContentDTO) {
public static gotoAtlasDetailPage(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
... ... @@ -351,5 +351,43 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
}
/**
* 打开早晚报
*/
public static gotoMorningEveningPaper() {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'MorningEveningPaper'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
/**
* 打开电子报
*/
public static gotoENewsPaper() {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'E_NEWSPAPER'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
/**
* 打开播报
*/
public static gotoBroadcastPage(pageId: number) {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'BroadcastPage',
id: pageId
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
}
... ...
export class H5OperateType {
/* jsCall_currentPageOperate#operateType
1、关闭页面
2、页面reload,
3、返回上一级历史,
4、允许蜂窝网络播放视频
5、邮件订阅关闭事件
6、H5进入沉浸式播放 (android)
7、H5退出沉浸式播放(andriod)
8、WebView高度更新
9、App播放视频
10、H5开始播放音频 (处理音视频互斥问题)
12、关闭 App原生默认顶部导航,并通顶显示Webview (专题页使用)
13、显示 App原生默认顶部导航,支持返回按钮和标题显示(专题页使用,默认不用设置)
14、关闭 底部评论交互BAR (专题页使用,默认不用设置)
15、显示 底部评论交互BAR(专题页使用)
16、显示 顶导分享按钮(专题页使用,针对默认顶导情况)
17、关闭 顶导分享按钮(专题页使用,针对默认顶导情况)
18、设置页面标题 (专题页使用,针对默认顶导情况)
19、设置页面状态栏颜色(专题页使用,针对默认顶导情况)
20、设置页面底部蒙层效果显示(专题页使用,针对默认顶导情况)
21、设置页面底部蒙层效果 隐藏(专题页使用,针对默认顶导情况)
22、页面加载失败后重试操作
23、开启H5自己的返回操作(默认关闭,当开启后 App返回/物理按键返回 都需要调用H5的返回方法,参见:jsCall_appNotifyEvent)
24、号主关注操作 状态更新
30、关闭当前页面左滑事件
31、打开当前页面左滑事件
32、开始弹全局弹框事件(原生代码确保Webview底部到底)
33、结束全局弹框事件(原生代码确保Webview正常恢复)
40、抽奖 阅读、评论、点赞、关注等任务--跳首页 (默认)
41、抽奖 签到任务–-跳积分中心签到
42、抽奖 意见反馈–跳意见反馈页面
43、抽奖 关注号主任务–跳关注列表页
44、抽奖 创作者认证 页面,H5 直接跳人民号申请页?
45、打开APP直接使用goBack(安卓使用,使用场景:h5页面跳转新页面,但url没有变化,不能返回上一级页面)
46、关闭APP直接使用goBack(安卓使用)
*/
// 1、关闭页面
static readonly TYPE_ONE: string = "1";
}
\ No newline at end of file
... ...
... ... @@ -2,11 +2,22 @@ import { Callback } from 'wdJsBridge';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { Logger } from 'wdKit';
import { H5CallNativeType } from './H5CallNativeType';
import { ContentDTO } from 'wdBean';
import { ProcessUtils } from 'wdRouter/src/main/ets/utils/ProcessUtils';
import { H5OperateType } from './H5OperateType';
import { ContentConstants } from 'wdConstant';
import { ProcessUtils } from 'wdRouter';
import router from '@ohos.router';
import Url from '@ohos.url'
import { ContentDTO } from 'wdBean/Index';
const TAG = 'JsBridgeBiz'
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
// TODO 完善
}
/**
* h5调用native代码
* @param data
... ... @@ -17,6 +28,7 @@ export function performJSCallNative(data: Message, call: Callback) {
switch (data.handlerName) {
case H5CallNativeType.jsCall_currentPageOperate:
handleJsCallCurrentPageOperate(data)
break;
case H5CallNativeType.jsCall_getAppPublicInfo:
// h5获取app配置信息
... ... @@ -33,27 +45,25 @@ export function performJSCallNative(data: Message, call: Callback) {
case H5CallNativeType.jsCall_appInnerLinkMethod:
handleJsCallAppInnerLinkMethod(data)
break;
case 'changeNativeMessage':
call("this is change Web Message")
break;
default:
call("this is def value")
break;
}
}
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
// TODO 完善
function handleJsCallCurrentPageOperate(data: Message) {
switch (data?.data?.operateType) {
case H5OperateType.TYPE_ONE:
router.back()
break;
default:
break;
}
}
/**
* 获取App公共信息
*/
function getAppPublicInfo(): string {
let info = new AppInfo()
info.plat = 'Phone'
// 直接用Android,后续适配再新增鸿蒙
... ... @@ -73,7 +83,6 @@ function handleJsCallReceiveH5Data(data: Message) {
}
break;
default:
break;
}
}
... ... @@ -83,5 +92,61 @@ function handleJsCallCallAppService(data: Message) {
}
function handleJsCallAppInnerLinkMethod(data: Message) {
}
let urlObject = Url.URL.parseURL(data?.data?.appInnerLink);
let urlParams = new Url.URLParams(urlObject.search);
console.log('urlObject:', `${JSON.stringify(urlParams)}`)
let content: ContentDTO = {
objectId: urlParams.get('contentId') || '',
relId: urlParams.get('relId') || '',
relType: urlParams.get('relType') || '',
pageId:urlParams.get('pageId') || '',
objectType: ''
} as ContentDTO
if (urlParams.get('skipType') === '1') {
switch (urlParams.get('type')) {
case 'video':
content.objectType = ContentConstants.TYPE_VOD
ProcessUtils.processPage(content)
break;
case 'live':
content.objectType = ContentConstants.TYPE_LIVE
ProcessUtils.processPage(content)
break;
case 'article':
content.objectType = ContentConstants.TYPE_TELETEXT
ProcessUtils.processPage(content)
break;
case 'picture':
content.objectType = ContentConstants.TYPE_NINE
ProcessUtils.processPage(content)
break;
case 'audio':
content.objectType = ContentConstants.TYPE_AUDIO
ProcessUtils.processPage(content)
break;
case 'h5':
content.objectType = ContentConstants.TYPE_LINK
ProcessUtils.processPage(content)
break;
case 'topic':
if(urlParams.get('subType') === 'h5'){
content.objectType = ContentConstants.TYPE_SPECIAL_TOPIC
ProcessUtils.processPage(content)
}
if(urlParams.get('subType') === 'moring_evening_news'){
ProcessUtils.gotoMorningEveningPaper()
}
if(urlParams.get('subType') === 'electronic_newspapers'){
ProcessUtils.gotoENewsPaper()
}
break;
case 'dynamic':
content.objectType = ContentConstants.TYPE_FOURTEEN
ProcessUtils.processPage(content)
break;
default:
break;
}
}
}
... ...
... ... @@ -18,9 +18,15 @@ export interface LiveRoomItemBean {
role: string
//ZH_TEXT_AND_IMAGE_MSG :图文,ZH_TEXT_MSG:文本,ZH_VIDEO_MSG:视频,ZH_AUDIO_MSG:音频
dataType: string
//视频封面图
transcodeImageUrl: string
//视频地址
videoUrl: string
//图片宽高
pictureResolutions: string[]
//音视频长度
duration: number
//音频地址
audioUrl: string
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,8 @@ export { CompUtils } from "./src/main/ets/utils/CompUtils"
export { EmptyComponent } from "./src/main/ets/components/view/EmptyComponent"
export { LiveEmptyComponent } from './src/main/ets/components/view/LiveEmptyComponent'
export { ErrorComponent } from "./src/main/ets/components/view/ErrorComponent"
export { LoadingComponent } from "./src/main/ets/components/view/LoadingComponent"
... ... @@ -75,3 +77,7 @@ export { LiveCommentComponent } from "./src/main/ets/components/comment/view/Liv
export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent"
export { AudioRowComponent } from "./src/main/ets/components/live/AudioRowComponent"
export { WDLiveViewDefaultType } from "./src/main/ets/components/view/LiveEmptyComponent"
... ...
... ... @@ -17,6 +17,8 @@
"wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork",
"wdJsBridge": "file:../../commons/wdJsBridge"
"wdJsBridge": "file:../../commons/wdJsBridge",
"wdDetailPlayApi":"file:../../features/wdDetailPlayApi",
"wdHwAbility": "file:../../features/wdHwAbility"
}
}
... ...
import { Logger } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO } from 'wdBean';
import media from '@ohos.multimedia.media';
... ... @@ -6,9 +5,10 @@ import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
const TAG = 'AudioDetailComponent'
interface Arr{
image:string,
title:string
interface Arr {
image: string,
title: string
}
@Component
... ... @@ -18,174 +18,176 @@ export struct AudioDetailComponent {
private relType: string = ''
private avPlayer?: media.AVPlayer;
@State playerController: WDPlayerController = new WDPlayerController();
private arr:Arr[]=[
{image:'clock',title:'定时'},
{image:'theOriginal',title:'原文'},
{image:'list',title:'列表'},
private arr: Arr[] = [
{ image: 'clock', title: '定时' },
{ image: 'theOriginal', title: '原文' },
{ image: 'list', title: '列表' },
]
@State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[]//详情
@State coverImage:string = '' //封面图
@State newsTitle:string = '' //标题
@State audioUrl:string = '' //音频路径
@State duration:number = 0 //时长
@State outSetValueOne:number = 40 //播放进度
@State contentDetailData: ContentDetailDTO[] = [] as ContentDetailDTO[] //详情
@State coverImage: string = '' //封面图
@State newsTitle: string = '' //标题
@State audioUrl: string = '' //音频路径
@State duration: number = 0 //时长
@State outSetValueOne: number = 40 //播放进度
@State isPlay: boolean = false
async aboutToAppear() {
await this.getContentDetailData()
this.playerController.firstPlay(this.audioUrl);
this.playerController.onCanplay = () => {
this.playerController.play()
this.isPlay = true
}
this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) =>{
console.log('现在时间',nowSeconds)
console.log('总时间',totalSeconds)
this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => {
console.log('现在时间', nowSeconds)
console.log('总时间', totalSeconds)
this.outSetValueOne = nowSeconds
this.duration = totalSeconds
}
}
onPageHide() {
this.playerController?.pause();
}
build() {
Row() {
Row() {
Column() {
// 封面
Row() {
Image(this.coverImage)
.width(240)
.height(160)
.borderRadius('0')
}
.justifyContent(FlexAlign.Center)
.width('100%')
.margin({ top: 64 })
// 标题
Row() {
Text(this.newsTitle)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#ffffff')
.textAlign(TextAlign.Center)
.lineHeight(28)
.fontFamily('PingFang SC, PingFang SC')
}
.padding({ left: 34, right: 34 })
.margin({ top: 32 })
// 操作矩阵
Row() {
ForEach(this.arr, (item: Arr) => {
Column() {
Image(item.image == 'clock' ? $r('app.media.clock_close') : item.image == 'theOriginal' ? $r('app.media.theOriginal_close') : item.image == 'list' ? $r('app.media.list_close') : '')
.width(28)
.height(28)
Text(item.title)
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
})
}
.width('100%')
.padding({ left: 49, right: 49 })
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 60 })
Column() {
// 封面
Row() {
Image(this.coverImage)
.width(240)
.height(160)
.borderRadius('0')
}
.justifyContent(FlexAlign.Center)
.width('100%')
.margin({ top: 64 })
// 标题
Row() {
Text(this.newsTitle)
.fontSize(20)
.fontWeight(FontWeight.Bold)
.fontColor('#ffffff')
.textAlign(TextAlign.Center)
.lineHeight(28)
.fontFamily('PingFang SC, PingFang SC')
}
.padding({ left: 34, right: 34 })
.margin({ top: 32 })
// 操作矩阵
// 进度条
Row() {
ForEach(this.arr,(item:Arr)=>{
Column() {
Image(item.image=='clock'?$r('app.media.clock_close'):item.image=='theOriginal'?$r('app.media.theOriginal_close'):item.image=='list'?$r('app.media.list_close'):'')
.width(28)
.height(28)
Text(item.title)
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
Slider({
value: this.outSetValueOne,
step: 1
})
.showTips(true)
.trackColor('rgba(0,0,0,0.5)')
.selectedColor('#ED2800')
.onChange((value: number, mode: SliderChangeMode) => {
console.log('滑块长度', value)
this.playerController?.setSeekTime(value, mode);
})
}
.width('100%')
.padding({ left: 49, right: 49 })
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 60 })
Column(){
// 进度条
Row(){
Slider({
value: this.outSetValueOne,
step: 1
})
.showTips(true)
.trackColor('rgba(0,0,0,0.5)')
.selectedColor('#ED2800')
.onChange((value: number, mode: SliderChangeMode) => {
console.log('滑块长度',value)
this.playerController?.setSeekTime(value, mode);
})
}
.width('100%')
.padding({left:24,right:24})
.margin({top:110})
// 播放按钮
Row(){
Column(){
Image($r('app.media.loop_close'))
.width(24)
.height(24)
Text('循环')
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
.padding({ left: 24, right: 24 })
.margin({ top: 110 })
Image($r('app.media.Backward_close'))
// 播放按钮
Row() {
Column() {
Image($r('app.media.loop_close'))
.width(24)
.height(24)
Stack({ alignContent: Alignment.Center }){
Image(this.isPlay?$r('app.media.suspend'):$r('app.media.playicon'))
.width(32)
.height(32)
Text('循环')
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
Image($r('app.media.Backward_close'))
.width(24)
.height(24)
Stack({ alignContent: Alignment.Center }) {
Image(this.isPlay ? $r('app.media.suspend') : $r('app.media.playicon'))
.width(32)
.height(32)
}
.padding(28)
.backgroundColor('#4D5258')
.borderRadius(50)
.onClick(() => {
if (this.isPlay) {
this.playerController.pause()
} else {
this.playerController.play()
}
.padding(28)
.backgroundColor('#4D5258')
.borderRadius(50)
.onClick(()=>{
if(this.isPlay){
this.playerController.pause()
}else{
this.playerController.play()
}
this.isPlay = !this.isPlay
})
Image($r('app.media.fastForward_close'))
this.isPlay = !this.isPlay
})
Image($r('app.media.fastForward_close'))
.width(24)
.height(24)
Column() {
Image($r('app.media.doubleSpeed_close'))
.width(24)
.height(24)
Column(){
Image($r('app.media.doubleSpeed_close'))
.width(24)
.height(24)
Text('倍速')
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
Text('倍速')
.fontColor('#4D5258')
.fontSize(12)
.lineHeight(16)
.margin(2)
}
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.margin({top:56})
.padding({left:32,right:32})
}
.layoutWeight(1)
OperRowListView()
.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 56 })
.padding({ left: 32, right: 32 })
}
.layoutWeight(1)
OperRowListView()
}
}
}
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data;
console.log('音乐详情',JSON.stringify(this.contentDetailData))
console.log('音乐详情', JSON.stringify(this.contentDetailData))
this.newsTitle = this.contentDetailData[0].newsTitle
console.log('标题',JSON.stringify(this.newsTitle))
console.log('标题', JSON.stringify(this.newsTitle))
this.coverImage = this.contentDetailData[0].fullColumnImgUrls[0].url
console.log('封面图',JSON.stringify(this.coverImage))
console.log('封面图', JSON.stringify(this.coverImage))
this.duration = this.contentDetailData[0].audioList[0].duration
console.log('音频时长',JSON.stringify(this.duration))
console.log('音频时长', JSON.stringify(this.duration))
this.audioUrl = this.contentDetailData[0].audioList[0].audioUrl
console.log('音频时长',JSON.stringify(this.audioUrl))
console.log('音频时长', JSON.stringify(this.audioUrl))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
console.log('请求失败', JSON.stringify(exception))
}
}
}
\ No newline at end of file
... ...
... ... @@ -20,9 +20,11 @@ import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { PageRepository } from '../repository/PageRepository';
import { detailedSkeleton } from './skeleton/detailSkeleton';
const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
const TAG = 'ImageAndTextPageComponent'
@Component
export struct ImageAndTextPageComponent {
scroller: Scroller = new Scroller();
... ... @@ -33,39 +35,35 @@ export struct ImageAndTextPageComponent {
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
build() {
Column() {
if (!this.isPageEnd) {
detailedSkeleton()
} else {
// 发布时间
Row() {
Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_13'))
.height('100%')
.align(Alignment.End)
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.padding({ left: 15, right: 15, })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
Row() {
Image($r('app.media.line'))
.width('100%')
.height(6)
.objectFit(ImageFit.Cover)
.margin({ top: 10 })
}
.padding({ left: 15, right: 15 })
.backgroundColor(Color.White)
// 发布时间
Row() {
Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
.width(80)
.height(28)
Text(this.publishTime)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize($r('app.float.font_size_13'))
.height('100%')
.align(Alignment.End)
}
.width(CommonConstants.FULL_WIDTH)
.height(32)
.padding({ left: 15, right: 15, })
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
Row() {
Image($r('app.media.line'))
.width('100%')
.height(6)
.objectFit(ImageFit.Cover)
.margin({ top: 10 })
}
.padding({ left: 15, right: 15 })
.backgroundColor(Color.White)
Stack({ alignContent: Alignment.Bottom }) {
Scroll(this.scroller) {
... ... @@ -88,6 +86,10 @@ export struct ImageAndTextPageComponent {
.padding({ bottom: 76 })
.scrollBar(BarState.Off)
if (!this.isPageEnd) {
detailedSkeleton()
}
//底部交互区
Row() {
Image($r('app.media.icon_arrow_left'))
... ... @@ -126,6 +128,7 @@ export struct ImageAndTextPageComponent {
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
}
}
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
... ... @@ -152,7 +155,7 @@ export struct ImageAndTextPageComponent {
if (detailBeans && detailBeans.length > 0) {
this.contentDetailData = detailBeans;
let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN)
this.publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
if (this.contentDetailData[0]?.recommendShow === 1) {
this.getRecommend()
}
... ...
... ... @@ -220,7 +220,7 @@ struct ChildCommentItem {
Span(this.item.fromUserName)
if (this.item.toUserName) {
Span(' ')
ImageSpan($r('app.media.comment_reply')).size({ width: 6, height: 9 }).offset({ y: -2.5 })
ImageSpan($r('app.media.comment_reply')).size({ width: 6, height: 9 }).offset({ y: -2.7 })
Span(' ')
Span(this.item.toUserName)
}
... ...
... ... @@ -7,6 +7,7 @@ import { CustomTitleUI } from '../../reusable/CustomTitleUI'
import { MyCommentDataSource } from '../model/MyCommentDataSource'
import { HttpUtils } from 'wdNetwork/src/main/ets/utils/HttpUtils'
import { HttpUrlUtils } from 'wdNetwork/Index'
import PageModel from '../../../viewmodel/PageModel'
const TAG = 'QualityCommentsComponent';
... ... @@ -14,12 +15,14 @@ const TAG = 'QualityCommentsComponent';
@Preview
@Component
export struct QualityCommentsComponent {
@State private browSingModel: PageModel = new PageModel()
isloading : boolean = false
@State tileOpacity: number = 0;
firstPositionY: number = 0;
bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px';
topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
// @State private browSingModel: commentListModel = new commentListModel()
isloading: boolean = false
lastWindowColor: string = '#ffffff'
currentWindowColor: string = '#FF4202'
@State allDatas: MyCommentDataSource = new MyCommentDataSource();
... ...
import { DateTimeUtils, Logger } from 'wdKit/Index';
import { WDPlayerController } from 'wdPlayer/Index';
let TAG: string = 'AudioRowComponent'
@Component
export struct AudioRowComponent {
@State playerController: WDPlayerController = new WDPlayerController();
@State audioUrl: string = '' //音频路径
@State duration: number = 0 //时长
@State outSetValueOne: number = 0 //播放进度
@State isPlaying: boolean = false
aboutToAppear(): void {
this.playerController.firstPlay(this.audioUrl)
// this.playerController.onTimeUpdate = (nowSeconds, totalSeconds) => {
// console.log('现在时间', nowSeconds)
// console.log('总时间', totalSeconds)
// this.outSetValueOne = nowSeconds
// this.duration = totalSeconds
// }
}
build() {
Row() {
Image($r('app.media.icon_voice'))
.width(20)
.aspectRatio(1)
.margin({
left: 8,
right: 6
})
.visibility(this.isPlaying ? Visibility.Visible : Visibility.Hidden)
Text(`${DateTimeUtils.getFormattedDuration(this.duration)}`)
.fontColor('#666666')
.fontWeight(400)
.fontSize('14fp')
}
.backgroundColor(Color.White)
.height(36)
.borderRadius(4)
.margin({ top: 8, right: 16 })
.width('100%')
.onClick(() => {
this.isPlaying = !this.isPlaying
this.playerController?.switchPlayOrPause()
})
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
Logger.debug(TAG, `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)
// if (isVisible && currentRatio >= 1.0) {
// Logger.debug(TAG, `播放器-播放. currentRatio:' +${currentRatio}`)
// this.playerController?.play()
// }
if (!isVisible && currentRatio <= 0.0) {
Logger.debug(TAG, `播放器-暂停. currentRatio:' +${currentRatio}`)
this.playerController?.pause()
}
})
}
aboutToDisappear(): void {
this.playerController?.release()
}
}
\ No newline at end of file
... ...
... ... @@ -10,6 +10,7 @@ import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedI
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
const TAG = "FollowListDetailUI"
... ... @@ -32,8 +33,9 @@ export struct FollowListDetailUI {
build() {
Column() {
if (this.count === 0) {
ListHasNoMoreDataUI({ style: 2 })
.height('100%')
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
} else {
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
... ...
import { ContentDTO } from 'wdBean/Index'
import { StringUtils, UserDataLocal } from 'wdKit/Index'
import { ProcessUtils } from 'wdRouter/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem'
import { CommentListItem } from '../../../viewmodel/CommentListItem'
import measure from '@ohos.measure'
@Component
export struct ChildCommentComponent {
@ObjectLink data: CommentListItem
@State levelHead: string = ""
isLastItem: boolean = false
@State isExpand: boolean = false;
@State isExpandParent: boolean = false;
@State isOverLines: boolean = false
@State isOverLinesParent: boolean = false
build() {
Column() {
Row() {
Stack({ alignContent: Alignment.Center }) {
Image(this.data.fromUserHeader)
.alt($r('app.media.default_head'))
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.borderRadius(50)
Image(this.levelHead)
.width('89lpx')
.height('89lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width('89lpx')
.height('89lpx')
.margin({ right: '15lpx' })
Column() {
Text(this.data.fromUserName)
.fontSize('25lpx')
.lineHeight('35lpx')
.fontWeight('600lpx')
.fontColor($r('app.color.color_222222'))
.margin({ bottom: '6lpx' })
.maxLines(1)
Text(`${this.data.createTime}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('31lpx')
.fontWeight('400lpx')
.maxLines(1)
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if (this.data.checkStatus === 2) {
Row() {
Text(this.data.likeNum.toString())
.fontWeight("500lpx")
.fontSize("27lpx")
.lineHeight("31lpx")
.fontColor(this.data.like_status === 0 ? $r('app.color.color_666666') : $r('app.color.color_ED2800'))
.margin({ right: '8lpx' })
Image(this.data.like_status === 0 ? $r('app.media.like_default_status') : $r('app.media.liked_status'))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
.borderRadius(50)
}.onClick(() => {
this.commentLikeOperation()
})
}
}
.margin({ bottom: '10lpx' })
.width('100%')
.height('108lpx')
.padding({ left: '31lpx', right: '31lpx' })
Row() {
if (this.isExpand) {
Text() {
Span(this.data.commentContent)
}
.textStyle()
} else {
Text() {
Span(this.clipText(this.data.commentContent, 31, 5, 630, 0))
if (this.isOverLines) {
Span('...展开')
.fontColor($r('app.color.color_999999'))
.onClick(() => {
this.isExpand = true
})
}
}.maxLines(5)
.textStyle()
}
}.padding({ left: '31lpx', right: '31lpx' })
.width('100%')
Column() {
if (StringUtils.isNotEmpty(this.data.parentCommentContent)) {
//父评论
Row() {
if (this.isExpandParent) {
Text() {
Span(`@${this.data.parentCommentUserName}:`)
.fontColor($r('app.color.color_000000'))
.fontWeight('500lpx')
.fontSize('27lpx')
.lineHeight('40lpx')
Span(this.data.parentCommentContent)
.fontColor($r('app.color.color_000000'))
.fontWeight('400lpx')
.fontSize('27lpx')
.lineHeight('40lpx')
}
.width('100%')
.textAlign(TextAlign.Start)
} else {
Text() {
Span(`@${this.data.parentCommentUserName}:`)
.fontColor($r('app.color.color_000000'))
.fontWeight('500lpx')
.fontSize('27lpx')
.lineHeight('40lpx')
Span(this.clipText(this.data.parentCommentContent, 31, 5, 630, 1))
.fontColor($r('app.color.color_000000'))
.fontWeight('400lpx')
.fontSize('27lpx')
.lineHeight('40lpx')
if (this.isOverLinesParent) {
Span('...展开')
.fontColor($r('app.color.color_999999'))
.onClick(() => {
this.isExpandParent = true
})
}
}.maxLines(5)
.textAlign(TextAlign.Start)
.width('100%')
}
}
.width('100%')
.padding({ top: '23lpx', bottom: '15lpx', right: '23lpx' })
Divider()
.width('100%')
.height('1lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.margin({ top: '4lpx', bottom: '4lpx' })
}
Column() {
Row() {
Row() {
Image($r('app.media.comment_link_icon'))
.objectFit(ImageFit.Auto)
.width('31lpx')
.height('31lpx')
.margin({ right: '10lpx' })
Column() {
Row() {
Text(`${this.data.targetTitle}`)
.fontWeight('400lpx')
.fontColor($r('app.color.color_666666'))
.lineHeight('38lpx')
.fontSize('27lpx')
.layoutWeight(1)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.width('100%')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}.layoutWeight(1)
Image($r('app.media.arrow_icon_right'))
.margin({ right: '4lpx' })
.width('23lpx')
.height('23lpx')
.margin({right:'23lpx'})
}
.width('100%')
.height('69lpx')
.justifyContent(FlexAlign.SpaceBetween)
}.height('69lpx')
.justifyContent(FlexAlign.Center)
.onClick(() => {
ProcessUtils.processPage(
{
objectId: this.data.targetId,
relType: this.data.targetRelType + "",
relId: this.data.targetRelId,
objectType: this.data.targetType + "",
} as ContentDTO)
})
}
.margin({ top: '19lpx', bottom: '31lpx', left: '31lpx', right: '31lpx' })
.padding({ left: '23lpx' })
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
if (!this.isLastItem) {
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.color($r('app.color.color_F5F5F5'))
}
}
.justifyContent(FlexAlign.Center)
}
commentLikeOperation() {
let item = new CommentLikeOperationRequestItem(this.data.targetId, this.data.id + "", this.data.targetType + "", UserDataLocal.getUserName(), UserDataLocal.getUserHeaderUrl(), this.data.like_status === 0 ? 1 : 0)
MinePageDatasModel.getCommentLikeOperation(item, getContext(this)).then((value) => {
if (value != null) {
if (value.code === 0 || value.code.toString() === "0") {
this.data.like_status = this.data.like_status === 0 ? 1 : 0
this.data.likeNum = this.data.like_status === 0 ? this.data.likeNum - 1 : this.data.likeNum + 1
}
}
})
}
/**
* 截断文本
* @author liuzhendong(猩猩G)
* @param {string} str 要截断的文本 '啊啊啊啊啊'
* @param {number} fontSize 字体大小(px)
* @param {number} maxLines 最大行数 3
* @param {number} textWidth 文本宽度(px) vp 需要转换vp2px()
* @returns {string} clipStr 截断后的文本 '啊啊'
* @param {type} 0 我的评论 1 父评论
*/
clipText(str: string, fontSize: number, maxLines: number, textWidth: number, type: number): string {
let strArr: string[] = str.split("")
let truncateContent: string = '啊啊啊啊啊' // ...比正常文字宽度更小,这里使用啊啊啊(任意三个文字)代替计算
let measureTruncateWidth: number = measure.measureText({
textContent: truncateContent,
fontSize: px2fp(fontSize),
})
if(type === 1){
measureTruncateWidth = measureTruncateWidth + measure.measureText({
textContent: `@${this.data.parentCommentUserName}:`,
fontSize: px2fp(fontSize),
})
}
let clipStr: string = ''
for (let i = 0; i < strArr.length; i++) {
if (measure.measureText({
textContent: clipStr,
fontSize: px2fp(fontSize),
}) >= textWidth * maxLines - measureTruncateWidth) {
if (type === 0) {
this.isOverLines = true
} else {
this.isOverLinesParent = true
}
break;
}
clipStr += strArr[i]
}
return clipStr
}
}
@Extend(Text)
function textStyle() {
.width('630lpx')
.fontSize('31lpx')
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('46lpx')
}
... ...
... ... @@ -8,6 +8,10 @@ import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetail
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
import { ChildCommentComponent } from './ChildCommentComponent';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
const TAG = "HomePageBottomComponent"
@Component
... ... @@ -90,6 +94,10 @@ export struct HomePageBottomComponent{
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
... ... @@ -161,7 +169,7 @@ export struct HomePageBottomComponent{
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({data: item,isLastItem:index===this.data_comment.totalCount()-1})
ChildCommentComponent({data: item,levelHead:UserDataLocal.getUserLevelHeaderUrl(),isLastItem:index===this.data_comment.totalCount()-1})
}
.onClick(() => {
})
... ... @@ -263,17 +271,7 @@ export struct HomePageBottomComponent{
if (!this.data_comment || value.list.length == 0){
this.hasMore = false
}else{
value.list.forEach((value)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType,value.targetRelId,value.targetRelObjectId,value.targetRelType,value.targetStatus))
})
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.getCommentListStatus(value)
}
this.isLoading = false
this.commentNum = value.totalCount
... ... @@ -286,102 +284,59 @@ export struct HomePageBottomComponent{
}
}
}
}
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
isLastItem: boolean = false
getCommentListStatus(value:MineCommentListDetailItem){
build() {
Column(){
Row() {
Stack({alignContent: Alignment.Center}){
Image(this.data.fromUserHeader)
.alt($r('app.media.default_head'))
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.borderRadius(50)
Image(UserDataLocal.getUserLevelHeaderUrl())
.width('89lpx')
.height('89lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width('89lpx')
.height('89lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.fromUserName)
.fontSize('25lpx')
.lineHeight('35lpx')
.fontWeight('600lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'6lpx'})
.maxLines(1)
Text(`${this.data.createTime}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('31lpx')
.fontWeight('400lpx')
.maxLines(1)
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
let status = new OtherUserCommentLikeStatusRequestItem()
let data : CommentListItem[] = []
value.list.forEach((item)=>{
if(item.checkStatus === 2){
status.commentIdList.push(item.id)
}
let commentContent = item.commentContent
if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
commentContent = item.commentContentSensitive
}
let parentCommentContent = ""
if(item.parentCommentVo!=null ){
parentCommentContent = item.parentCommentVo.commentContent
}
let parentCommentUserName = ""
if(item.parentCommentVo!=null ){
parentCommentUserName = item.parentCommentVo.fromUserName
}
.margin({bottom:'10lpx'})
.width('100%')
.height('108lpx')
.padding({left:'31lpx',right:'31lpx'})
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
Row(){
Text(this.data.commentContent)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('46lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'10lpx'})
}.padding({left:'31lpx',right:'31lpx'})
.width('100%')
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
data.forEach((list)=>{
if (item.commentId == list.id) {
list.like_status = item.status
}
})
})
Row(){
Text(this.data.targetTitle)
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
.maxLines(3)
.width('616lpx')
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}
.padding({top:'17lpx',bottom:'17lpx',left:'23lpx',right:'23lpx'})
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
.onClick(()=>{
ProcessUtils.processPage(
{objectId: this.data.targetId,
relType:this.data.targetRelType+"",
relId:this.data.targetRelId,
objectType:this.data.targetType+"",
} as ContentDTO )
data.forEach((item)=>{
let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(item.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,publishTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
if(!this.isLastItem){
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.color($r('app.color.color_F5F5F5'))
this.data_comment.notifyDataReload()
this.count = this.data_comment.totalCount()
this.commentNum = value.totalCount
if (this.data_comment.totalCount() < value.totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
}
.justifyContent(FlexAlign.Center)
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
})
}
}
\ No newline at end of file
... ...
... ... @@ -5,9 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../viewmodel/OtherUserCom
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CommentLikeOperationRequestItem } from '../../../viewmodel/CommentLikeOperationRequestItem';
import { ProcessUtils } from 'wdRouter/Index';
import { ContentDTO } from 'wdBean/Index';
import { ChildCommentComponent } from './ChildCommentComponent';
const TAG = "HomePageBottomComponent"
@Component
... ... @@ -108,8 +106,22 @@ export struct OtherHomePageBottomCommentComponent{
let status = new OtherUserCommentLikeStatusRequestItem()
let data : CommentListItem[] = []
value.list.forEach((item)=>{
status.commentIdList.push(item.id)
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus))
if(item.checkStatus === 2){
status.commentIdList.push(item.id)
}
let commentContent = item.commentContent
if(item.sensitiveShow === 0 && item.sensitiveExist === 1){
commentContent = item.commentContentSensitive
}
let parentCommentContent = ""
if(item.parentCommentVo!=null ){
parentCommentContent = item.parentCommentVo.commentContent
}
let parentCommentUserName = ""
if(item.parentCommentVo!=null ){
parentCommentUserName = item.parentCommentVo.fromUserName
}
data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,commentContent,item.likeNum,0,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,parentCommentContent,parentCommentUserName))
})
MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
... ... @@ -122,7 +134,7 @@ export struct OtherHomePageBottomCommentComponent{
})
data.forEach((item)=>{
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus))
this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType,item.targetRelId,item.targetRelObjectId,item.targetRelType,item.targetStatus,item.checkStatus,item.parentCommentContent,item.parentCommentUserName))
})
this.data_comment.notifyDataReload()
... ... @@ -141,133 +153,4 @@ export struct OtherHomePageBottomCommentComponent{
this.isLoading = false
})
}
}
@Component
struct ChildCommentComponent {
@ObjectLink data: CommentListItem
@Prop levelHead:string
isLastItem: boolean = false
build() {
Column(){
Row() {
Stack({alignContent: Alignment.Center}){
Image(this.data.fromUserHeader)
.alt($r('app.media.default_head'))
.objectFit(ImageFit.Auto)
.width('69lpx')
.height('69lpx')
.borderRadius(50)
Image(this.levelHead)
.width('89lpx')
.height('89lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}.width('89lpx')
.height('89lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.fromUserName)
.fontSize('25lpx')
.lineHeight('35lpx')
.fontWeight('600lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'6lpx'})
.maxLines(1)
Text(`${this.data.createTime}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.lineHeight('31lpx')
.fontWeight('400lpx')
.maxLines(1)
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
Row(){
Text(this.data.likeNum.toString())
.fontWeight("500lpx")
.fontSize("27lpx")
.lineHeight("31lpx")
.fontColor(this.data.like_status===0?$r('app.color.color_666666'):$r('app.color.color_ED2800'))
.margin({right:'8lpx'})
Image(this.data.like_status===0?$r('app.media.like_default_status'):$r('app.media.liked_status'))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
.borderRadius(50)
}.onClick(()=>{
this.commentLikeOperation()
})
}
.margin({bottom:'10lpx'})
.width('100%')
.height('108lpx')
.padding({left:'31lpx',right:'31lpx'})
Row(){
Text(this.data.commentContent)
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('46lpx')
.fontColor($r('app.color.color_222222'))
.margin({bottom:'10lpx'})
}.padding({left:'31lpx',right:'31lpx'})
.width('100%')
Row(){
Text(this.data.targetTitle)
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
.maxLines(3)
.width('616lpx')
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}
.padding({top:'17lpx',bottom:'17lpx',left:'23lpx',right:'23lpx'})
.width('662lpx')
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'19lpx',bottom:'31lpx'})
.onClick(()=>{
ProcessUtils.processPage(
{objectId: this.data.targetId,
relType:this.data.targetRelType+"",
relId:this.data.targetRelId,
objectType:this.data.targetType+"",
} as ContentDTO )
})
if(!this.isLastItem){
Divider().width('100%')
.height('12lpx')
.strokeWidth('12lpx')
.color($r('app.color.color_F5F5F5'))
}
}
.justifyContent(FlexAlign.Center)
}
commentLikeOperation(){
let item = new CommentLikeOperationRequestItem(this.data.targetId,this.data.id+"",this.data.targetType+"",UserDataLocal.getUserName(),UserDataLocal.getUserHeaderUrl(),this.data.like_status===0?1:0)
MinePageDatasModel.getCommentLikeOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.like_status = this.data.like_status===0?1:0
this.data.likeNum = this.data.like_status===0?this.data.likeNum-1:this.data.likeNum+1
}
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../view/EmptyComponent';
import { FollowChildComponent } from '../follow/FollowChildComponent';
const TAG = "HomePageBottomComponent"
... ... @@ -30,8 +31,37 @@ export struct OtherHomePageBottomFollowComponent{
.backgroundColor($r('app.color.color_EDEDED'))
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
.height('100%')
Column(){
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
.onClick(()=>{
let params: Params = {
pageID: "1"
}
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
EmptyComponent({emptyType:14})
.layoutWeight(1)
.width('100%')
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
List({ space: 3 }) {
... ...
... ... @@ -15,12 +15,14 @@ import { CompDTO } from 'wdBean';
import PageHelper from '../../viewmodel/PageHelper';
import { channelSkeleton } from '../skeleton/channelSkeleton'
import { ProcessUtils } from 'wdRouter/Index';
import PageAdModel from '../../viewmodel/PageAdvModel';
const TAG = 'PageComponent';
@Component
export struct PageComponent {
@State private pageModel: PageModel = new PageModel();
@State private pageAdvModel: PageAdModel = new PageAdModel();
navIndex: number = 0;
pageId: string = "";
channelId: string = "";
... ... @@ -44,7 +46,7 @@ export struct PageComponent {
.onTouch((event: TouchEvent | undefined) => {
if (event) {
if (this.pageModel.viewType === ViewType.LOADED) {
listTouchEvent(this.pageModel, event);
listTouchEvent(this.pageModel, this.pageAdvModel, event);
}
}
})
... ... @@ -120,12 +122,12 @@ export struct PageComponent {
@Builder
pageHornAd() {
if (this.pageModel.isShowAds) {
if (this.pageModel.pageCornerAdv.matInfo != null) {
if (this.pageAdvModel.isShowAds) {
if (this.pageAdvModel.pageCornerAdv.matInfo != null) {
// 页面右边挂角
this.drawPageCornerAdvView(1, 1 == this.pageModel.isRightAdv)
} else if (this.pageModel.pageCornerContentInfo.advert != null) {
this.drawPageCornerAdvView(2, 1 == this.pageModel.isRightAdv)
this.drawPageCornerAdvView(1, 1 == this.pageAdvModel.isRightAdv)
} else if (this.pageAdvModel.pageCornerContentInfo.advert != null) {
this.drawPageCornerAdvView(2, 1 == this.pageAdvModel.isRightAdv)
}
}
... ... @@ -140,8 +142,8 @@ export struct PageComponent {
@Builder
drawPageCornerAdvView(type: number, isRightCorne: boolean) {
// 页面左挂角
Image(type === 1 ? this.pageModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageModel.pageCornerContentInfo.advert.displayUrl)
Image(type === 1 ? this.pageAdvModel.pageCornerAdv.matInfo.matImageUrl[0]
: this.pageAdvModel.pageCornerContentInfo.advert.displayUrl)
.width($r('app.float.vp_80'))
.height($r('app.float.vp_80'))
.id("left_iv")
... ... @@ -159,10 +161,10 @@ export struct PageComponent {
.onClick(() => {
if (type === 1) {
// 广告业务跳转
ProcessUtils.openAdvDetail(this.pageModel.pageCornerAdv.matInfo);
ProcessUtils.openAdvDetail(this.pageAdvModel.pageCornerAdv.matInfo);
} else {
// 展现中心的业务跳转
ProcessUtils.advJumpMainPage(this.pageModel.pageCornerContentInfo.advert)
ProcessUtils.advJumpMainPage(this.pageAdvModel.pageCornerContentInfo.advert)
}
})
// 关闭按钮
... ... @@ -180,7 +182,7 @@ export struct PageComponent {
})
.onClick(() => {
// 关闭挂角广告
this.pageModel.isShowAds = false;
this.pageAdvModel.isShowAds = false;
})
... ... @@ -228,7 +230,7 @@ export struct PageComponent {
this.pageModel.groupId = this.pageId;
this.pageModel.channelId = this.channelId;
this.pageModel.currentPage = 1;
PageHelper.getInitData(this.pageModel)
PageHelper.getInitData(this.pageModel, this.pageAdvModel)
// let pageInfo = await PageViewModel.getPageInfo(this.pageModel.pageId);
// if (pageInfo == null) {
// this.pageModel.viewType = ViewType.EMPTY;
... ...
... ... @@ -5,6 +5,7 @@ import hilog from '@ohos.hilog';
import { PrivacySettingModel } from '../../model/PrivacySettingModel'
import { Params } from 'wdBean';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { HttpUrlUtils } from 'wdNetwork/Index';
const TAG = 'PrivacySettingPage';
const DiyString = '开启个性化推荐'
... ... @@ -23,6 +24,9 @@ export struct PrivacySettingPage {
}
aboutToAppear() {
if (!HttpUrlUtils.getUserId()) {
this.listData.splice(0, 1);
}
// 获取权限=
// SPHelper.default.save('sdf','sdf');
// this.initListData();
... ... @@ -60,7 +64,7 @@ export struct PrivacySettingPage {
List({ space: '23lpx' }) {
ForEach(this.listData, (item: PrivacySettingModel, index:number) => {
ListItem() {
if (index == 0) {
if (item.privacyName == DiyString) {
getTuiJianCell({ item:item, index:index });
} else {
getArrowCell({ item:item, index:index });
... ... @@ -73,6 +77,8 @@ export struct PrivacySettingPage {
PermissionUtil.reqPermissionsFromUser([item.permissionKey], this).then((res)=>{
item.permission = res;
});
}else{
PermissionUtil.openPermissionsInSystemSettings(this);
}
}
})
... ...
import { Action, CompDTO, Params, TopNavDTO } from 'wdBean';
import { LazyDataSource, Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';
import { ProcessUtils } from 'wdRouter';
import { PageComponent } from './PageComponent';
import { ChannelSubscriptionLayout } from './ChannelSubscriptionLayout';
import { FirstTabTopSearchComponent } from '../search/FirstTabTopSearchComponent';
... ... @@ -135,16 +135,6 @@ export struct TopNavigationComponent {
return item.name === '版面'
}
jumpToENewPaper() {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'E_NEWSPAPER'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
}
build() {
Column() {
// 顶部搜索、日报logo、早晚报
... ... @@ -156,7 +146,7 @@ export struct TopNavigationComponent {
.width(72)
.height(29)
.onClick(() => {
this.jumpToENewPaper()
ProcessUtils.gotoENewsPaper()
})
Stack({ alignContent: Alignment.Center }) {
Image($r('app.media.background_read_paper_home'))
... ... @@ -177,13 +167,7 @@ export struct TopNavigationComponent {
.height(30)
.width(124)
.onClick(() => {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'MorningEveningPaper'
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
ProcessUtils.gotoMorningEveningPaper()
})
}.width('100%')
.justifyContent(FlexAlign.SpaceBetween)
... ... @@ -236,18 +220,11 @@ export struct TopNavigationComponent {
}
if (this.isBroadcast(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
// 跳转到播报页面
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
pageID: 'BroadcastPage',
id: this.myChannelList[index].pageId
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
ProcessUtils.gotoBroadcastPage(this.myChannelList[index].pageId)
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}
if (this.isLayout(this._currentNavIndex === 0 ? this.myChannelList[index] : this.topNavList[index])) {
this.jumpToENewPaper()
ProcessUtils.gotoENewsPaper()
this.tabsController.changeIndex(this.currentTopNavSelectedIndex)
}
})
... ...
... ... @@ -24,7 +24,7 @@ export struct PeopleShipHomeListComponent {
// 列表
else if (this.publishCount == 0) {
// 无数据展示
EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight)
EmptyComponent({emptyType: 13}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Column() {
Column() {
... ... @@ -46,6 +46,7 @@ export struct PeopleShipHomeListComponent {
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.height('44vp')
.alignItems(HorizontalAlign.Start)
.width('100%')
... ... @@ -109,8 +110,8 @@ export struct PeopleShipHomeListComponent {
.justifyContent(FlexAlign.Center)
.constraintSize({ minWidth: 35 })
.margin({
left: '16vp',
right: '16vp'
left: index == 0 ? '16vp' : '10vp',
right: index == this.tabArr.length - 1 ? '16vp' : '10vp'
})
.height('44vp')
.onClick(() => {
... ...
... ... @@ -6,6 +6,7 @@ import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
import { HWLocationUtils } from 'wdHwAbility'
@Component
... ... @@ -29,6 +30,7 @@ export struct PeopleShipHomePageTopComponent {
@State topFixedHeight: number = 320
@State lineInNum: number = 1
@Link topHeight: number
@State provinceName: string = ''
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
... ... @@ -136,7 +138,6 @@ export struct PeopleShipHomePageTopComponent {
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
... ... @@ -151,24 +152,26 @@ export struct PeopleShipHomePageTopComponent {
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}
// IP归属地
Text(`IP归属地:${this.detailModel.region}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
})
if (this.provinceName && this.provinceName.length > 0) {
Text(`IP归属地:${this.provinceName}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
top: '10vp'
})
}
// 发布, 粉丝, 影响力
Row() {
... ... @@ -294,8 +297,9 @@ export struct PeopleShipHomePageTopComponent {
})
}
onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
async onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
... ... @@ -303,7 +307,12 @@ export struct PeopleShipHomePageTopComponent {
}
}
if (this.detailModel) {
this.topFixedHeight = 336
this.topFixedHeight = 308
if (this.detailModel.region && this.detailModel.region.length > 0) {
this.provinceName = this.detailModel.region
}else {
this.provinceName = await this.computeIPRegion(this.detailModel.province)
}
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
... ... @@ -325,6 +334,10 @@ export struct PeopleShipHomePageTopComponent {
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topHeight += 28
}
}
}
... ... @@ -335,4 +348,17 @@ export struct PeopleShipHomePageTopComponent {
return `${count}`
}
// 通过省份code获取IP问题
private async computeIPRegion(province: string) {
if (province && province.length) {
try {
let provinceName = await HWLocationUtils.getProvinceName(province) ;
return provinceName
} catch (e) {
return ''
}
}
return ''
}
}
\ No newline at end of file
... ...
... ... @@ -25,6 +25,7 @@ export struct SearchComponent {
@State relatedSearchContentsData: SearchRelatedItem[] = []
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
aboutToAppear() {
//获取提示滚动
... ... @@ -112,7 +113,7 @@ export struct SearchComponent {
} else {
if (this.hasChooseSearch) {
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isInit:true})
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
... ... @@ -287,8 +288,10 @@ export struct SearchComponent {
this.count.push("活动")
}
}
this.isGetRequest = true
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
})
}
}
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@ const TAG = "SearchResultComponent"
export struct SearchResultComponent {
@Prop count: string[]
@Prop searchText: string
@State isInit:boolean = false;
@Prop isGetRequest:boolean = false;
@State currentIndex: number = 0
private controller: TabsController = new TabsController()
fontColor: string = '#999999'
... ... @@ -28,7 +28,7 @@ export struct SearchResultComponent {
scroller: Scroller = new Scroller()
aboutToAppear(): void {
if (this.count.length === 0 && this.isInit == true) {
if (this.count.length === 0 && this.isGetRequest == true) {
this.getSuggestData()
}
}
... ... @@ -40,18 +40,7 @@ export struct SearchResultComponent {
SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => {
value.forEach((item) => {
this.data.push({
appStyle: item.appStyle,
channelId: item.channelId + "",
coverType: item.coverType,
coverUrl: item.coverUrl,
newsTitle: item.newsTitle,
objectId: item.objectId,
publishTime: item.publishTime,
relId: item.relId + "",
relType: item.relType + "",
source: item.source,
} as ContentDTO)
this.data.push(item)
})
this.data.notifyDataReload()
this.suggest_count = this.data.totalCount()
... ... @@ -61,7 +50,7 @@ export struct SearchResultComponent {
build() {
Column() {
if (this.count != null && this.count.length === 0 && this.isInit == true) {
if (this.count != null && this.count.length === 0 && this.isGetRequest == true) {
List() {
ListItem() {
//缺省图
... ...
... ... @@ -6,8 +6,8 @@ const TAG = 'LiveEmptyComponent';
/**
* WDViewDefaultType 缺省页
*/
export const enum WDViewDefaultType {
/// 1.默认
export const enum WDLiveViewDefaultType {
/// 1.默认
WDViewDefaultType_Default,
/// 16.直播结束
WDViewDefaultType_NoLiveEnd,
... ... @@ -24,7 +24,7 @@ export struct LiveEmptyComponent {
// private emptySize: SizeOptions = {};
@State emptyWidth: string | number = CommonConstants.FULL_PARENT;
@State emptyHeight: string | number = CommonConstants.FULL_PARENT;
@State emptyType: number = WDViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyType: number = WDLiveViewDefaultType.WDViewDefaultType_Default; // 缺省图类型,传枚举
@State emptyButton: boolean = false
@State timeNum: number = 10
/**
... ... @@ -46,38 +46,12 @@ export struct LiveEmptyComponent {
private timer: number = -1
retry: () => void = () => {
}
createTimer() {
if (this.emptyType === 8) {
this.timer = setInterval(() => {
this.timeNum--;
if (this.timeNum === 0) {
clearInterval(this.timer);
}
}, 1000);
}
}
destroyTimer() {
if (this.emptyType === 8) {
clearInterval(this.timer);
}
}
onPageShow(): void {
this.createTimer()
}
aboutToAppear(): void {
this.createTimer()
}
onPageHide(): void {
this.destroyTimer()
}
aboutToDisappear() {
this.destroyTimer()
}
build() {
... ... @@ -98,7 +72,7 @@ export struct LiveEmptyComponent {
// .width('this.EMPTY_IMAGE_WIDTH')
// .height(this.EMPTY_IMAGE_HEIGHT)
Text(this.emptyType !== 8 ? this.buildNoDataTip() : `${this.buildNoDataTip()}(${this.timeNum}s)`)
Text(this.buildNoDataTip())
.fontSize($r('app.float.font_size_14'))
.fontColor('#FF999999')
.fontWeight(FontWeight.Normal)
... ... @@ -107,43 +81,7 @@ export struct LiveEmptyComponent {
.onClick((event: ClickEvent) => {
Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`);
})
if (this.isShowButton()) {
if (this.emptyType !== 15) {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor('#fffffff')
.fontColor('#FF666666')
.border({ width: 1 })
.borderColor('#FFEDEDED')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
} else {
Button('点击重试')
.type(ButtonType.Normal)
.width(80)
.height(28)
.backgroundColor(Color.Black)
.fontColor('#FFCCCCCC')
.border({ width: 1 })
.borderColor('#4DFFFFFF')
.borderRadius(4)
.fontSize($r('app.float.font_size_12'))
.margin({ top: 16 })
.padding(0)
.onClick(() => {
this.retry()
})
}
}
}
}
.justifyContent(FlexAlign.Center)
.width(this.emptyWidth)
.height(this.emptyHeight)
... ... @@ -154,29 +92,22 @@ export struct LiveEmptyComponent {
buildNoDataTip(): string {
Logger.info(TAG, "buildNoDataTip");
let contentString: string = '暂无内容'
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd) {
contentString = '直播已结束' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
} else if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待
}
return contentString
}
buildNoDataTipImage(): Resource | string {
Logger.info(TAG, "buildNoDataTip");
let imageString: Resource | string = $r('app.media.icon_no_content')
if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd) {
imageString = $r('app.media.icon_no_end')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
} else if (this.emptyType === WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
imageString = $r('app.media.icon_no_liver')
}
return imageString
}
isShowButton() {
if (this.emptyType === 1 || this.emptyType === 9 || this.emptyType === 15) {
return true
} else {
return false
}
}
}
... ...
... ... @@ -323,6 +323,7 @@ class MinePageDatasModel{
Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as MineCommentListDetailItem
success(navigationBean);
// success(this.getMineCommentListDataLocal(context))
}).catch((err: Error) => {
Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
success(this.getMineCommentListDataLocal(context))
... ... @@ -338,7 +339,7 @@ class MinePageDatasModel{
async getMineCommentListDataLocal(context: Context): Promise<MineCommentListDetailItem> {
Logger.info(TAG, `getMineFollowListDataLocal start`);
let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data.json' );
let compRes: ResponseDTO<MineCommentListDetailItem> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<MineCommentListDetailItem>>(context,'mine_comment_list_data2.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
return new MineCommentListDetailItem()
... ...
... ... @@ -6,10 +6,9 @@ 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';
import { ContentDTO, contentListParams, InteractDataDTO } from 'wdBean/Index';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
import { SearchSuggestData } from '../viewmodel/SearchSuggestData';
import { SearchSuggestRequestItem } from '../viewmodel/SearchSuggestRequestItem';
const TAG = "SearcherAboutDataModel"
... ... @@ -354,17 +353,17 @@ class SearcherAboutDataModel{
/**
* 搜索推荐 展示列表
*/
getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<SearchSuggestData[]> {
return new Promise<SearchSuggestData[]>((success, error) => {
getSearchSuggestData(object:SearchSuggestRequestItem,context: Context): Promise<ContentDTO[]> {
return new Promise<ContentDTO[]>((success, error) => {
Logger.info(TAG, `getSearchSuggestData start`);
this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<SearchSuggestData[]>) => {
this.fetchSearchSuggestData(object).then((navResDTO: ResponseDTO<ContentDTO[]>) => {
if (!navResDTO || navResDTO.code != 0 /*|| navResDTO.data == null*/) {
// success(this.getSearchSuggestDataLocal(context))
success([])
return
}
Logger.info(TAG, "getSearchSuggestData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as SearchSuggestData[]
let navigationBean = navResDTO.data as ContentDTO[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getSearchSuggestData catch, error.name : ${err.name}, error.message:${err.message}`);
... ... @@ -377,12 +376,12 @@ class SearcherAboutDataModel{
fetchSearchSuggestData(object:SearchSuggestRequestItem) {
let url = HttpUrlUtils.getSearchSuggestDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<SearchSuggestData[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers)
};
async getSearchSuggestDataLocal(context: Context): Promise<SearchSuggestData[]> {
async getSearchSuggestDataLocal(context: Context): Promise<ContentDTO[]> {
Logger.info(TAG, `getInteractListDataLocal start`);
let compRes: ResponseDTO<SearchSuggestData[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<SearchSuggestData[]>>(context,'search_suggest_data.json' );
let compRes: ResponseDTO<ContentDTO[]> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<ContentDTO[]>>(context,'search_suggest_data.json' );
if (!compRes || !compRes.data) {
Logger.info(TAG, `getInteractListDataLocal compRes is empty`);
return []
... ...
... ... @@ -6,8 +6,9 @@ import PageModel from '../viewmodel/PageModel';
import PageViewModel from '../viewmodel/PageViewModel';
import { DateTimeUtils } from 'wdKit';
import PageHelper from '../viewmodel/PageHelper';
import PageAdModel from '../viewmodel/PageAdvModel';
export function listTouchEvent(pageModel: PageModel, event: TouchEvent) {
export function listTouchEvent(pageModel: PageModel,pageAdvModel:PageAdModel, event: TouchEvent) {
switch (event.type) {
case TouchType.Down:
pageModel.downY = event.touches[0].y;
... ... @@ -35,7 +36,7 @@ export function listTouchEvent(pageModel: PageModel, event: TouchEvent) {
}
if ((pageModel.isPullRefreshOperation === true)) {
// Lift your finger and pull down to refresh.
touchUpPullRefresh(pageModel);
touchUpPullRefresh(pageModel,pageAdvModel);
} else {
// Fingers up, handle loading more.
touchUpLoadMore(pageModel);
... ... @@ -65,14 +66,15 @@ export function touchMovePullRefresh(pageModel: PageModel, event: TouchEvent) {
}
}
export function touchUpPullRefresh(pageModel: PageModel) {
export function touchUpPullRefresh(pageModel: PageModel,pageAdvModel:PageAdModel) {
if (pageModel.isCanRefresh === true) {
pageModel.offsetY = vp2px(pageModel.pullDownRefreshHeight);
pullRefreshState(pageModel, RefreshState.Refreshing);
pageModel.currentPage = 1;
setTimeout(() => {
let self: PageModel = pageModel;
PageHelper.refreshUI(self)
let advSelf: PageAdModel = pageAdvModel;
PageHelper.refreshUI(self,advSelf)
// PageViewModel.getPageData(self.bizCopy(2))
// .then((data: PageDTO) => {
// self.timestamp = DateTimeUtils.getTimeStamp().toString()
... ...
... ... @@ -24,7 +24,7 @@ export class CommentListItem{
keyArticle: number = -1
likeNum: number = 0
// pageId: null
// parentCommentVo: null
parentCommentVo: ParentCommentVo = new ParentCommentVo()
parentId: number = -1
rootCommentId: number = -1
sensitiveExist: number = -1
... ... @@ -39,9 +39,12 @@ export class CommentListItem{
targetTitle: string = ""
// topicType: null
uuid: string = ""
parentCommentContent = ""
parentCommentUserName = ""
isShowAll:boolean = false
constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number,targetRelId: string,targetRelObjectId: string,targetRelType: number,targetStatus: number,) {
constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number,targetRelId: string,targetRelObjectId: string,targetRelType: number,targetStatus: number,checkStatus:number,parentCommentContent:string,parentCommentUserName:string) {
this.fromUserHeader = fromUserHeader
this.fromUserName = fromUserName
this.commentContent = commentContent
... ... @@ -56,5 +59,18 @@ export class CommentListItem{
this.targetRelObjectId = targetRelObjectId
this.targetRelType = targetRelType
this.targetStatus = targetStatus
this.checkStatus = checkStatus
this.parentCommentContent = parentCommentContent
this.parentCommentUserName = parentCommentUserName
}
}
class ParentCommentVo{
avatarFrame: string = ""
checkStatus: number = -1
commentContent: string = ""
commentPics: string = ""
commentType: string = ""
fromUserName: string = ""
id: number = -1
}
... ...
import { PageInfoDTO } from 'wdBean/Index';
import { AdvRuleBean, CompAdvBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
/**
* @Description: 处理页面的广告业务
* @Author: lyb
* @Email: liyubing@wondertek.com.cn
* @CreateDate:
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
export default class PageAdModel {
//左右挂角广告对象
pageCornerAdv: CompAdvBean = {} as CompAdvBean
// 挂角广告
isShowAds: boolean = false;
isRightAdv: number = 1;
// 1:右边;2:左边 -> 默认右边
pageCornerContentInfo: AdvRuleBean = {} as AdvRuleBean
// 展现中心业务信息
/**
* 解析广告资源
* @param pageInfo
*/
analysisAdvSource(pageInfo: PageInfoDTO): void {
if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {
// 优先展示展现中心广告
let cornersAdv = pageInfo.cornersAdv
if (cornersAdv == null) {
return
}
if (cornersAdv.advert == null) {
return
}
if ("left_down" == cornersAdv.pos) {
// 左边挂角广告
this.isRightAdv = 2
} else {
// 右边挂角广告
this.isRightAdv = 1
}
this.pageCornerContentInfo = cornersAdv;
this.isShowAds = true
} else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
// 广告中心-挂角广告信息
let cornersAdv2 = pageInfo.cornersAdv2
// 获取
let showCompAdvBean = cornersAdv2[0]
if (showCompAdvBean.matInfo == null) {
return
}
//
let slotInfo = showCompAdvBean.slotInfo;
let postion = slotInfo.position
if (postion == 0) {
//左边挂角
this.isRightAdv = 2
} else {
// 右边挂角
this.isRightAdv = 1
}
this.pageCornerAdv = showCompAdvBean
this.isShowAds = true
}
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import PageModel from './PageModel';
import PageViewModel from './PageViewModel';
import { promptAction } from '@kit.ArkUI';
import { AdvRuleBean } from 'wdBean/src/main/ets/bean/adv/AdvsRuleBean';
import PageAdModel from './PageAdvModel';
const TAG = 'PageHelper';
... ... @@ -13,12 +14,14 @@ const TAG = 'PageHelper';
* 处理返回后的数据
*/
export class PageHelper {
/**
* 刷新数据
*/
async refreshUI(pageModel: PageModel) {
async refreshUI(pageModel: PageModel,pageAdvModel:PageAdModel) {
pageModel.loadStrategy = 2
this.getPageInfo(pageModel)
this.getPageInfo(pageModel,pageAdvModel)
}
/**
... ... @@ -33,12 +36,12 @@ export class PageHelper {
/**
* 进页面请求数据
*/
async getInitData(pageModel: PageModel) {
async getInitData(pageModel: PageModel,pageAdvModel:PageAdModel) {
pageModel.loadStrategy = 1
this.getPageInfo(pageModel)
this.getPageInfo(pageModel,pageAdvModel)
}
async getPageInfo(pageModel: PageModel) {
async getPageInfo(pageModel: PageModel,pageAdvModel:PageAdModel) {
pageModel.currentPage = 1;
let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId);
if (pageInfo == null) {
... ... @@ -47,67 +50,12 @@ export class PageHelper {
}
pageModel.pageInfo = pageInfo;
//解析广告资源
this.analysisAdvSource(pageModel);
pageAdvModel.analysisAdvSource(pageInfo)
this.parseGroup(pageModel)
}
/**
* 解析广告资源
* @param pageInfo
*/
analysisAdvSource(pageModel: PageModel) {
let pageInfo = pageModel.pageInfo
if (pageInfo.hasAdInfo === 1 && pageInfo.cornersAdv != null) {
// 优先展示展现中心广告
let cornersAdv = pageInfo.cornersAdv
if (cornersAdv == null) {
return
}
if (cornersAdv.advert == null) {
return
}
if ("left_down" == cornersAdv.pos) {
// 左边挂角广告
pageModel.isRightAdv = 2
} else {
// 右边挂角广告
pageModel.isRightAdv = 1
}
pageModel.pageCornerContentInfo = cornersAdv;
pageModel.isShowAds = true
} else if (pageInfo.cornersAdv2 != null && pageInfo.cornersAdv2.length > 0) {
// 广告中心-挂角广告信息
let cornersAdv2 = pageInfo.cornersAdv2
// 获取
let showCompAdvBean = cornersAdv2[0]
if (showCompAdvBean.matInfo == null) {
return
}
//
let slotInfo = showCompAdvBean.slotInfo;
let postion = slotInfo.position
if (postion == 0) {
//左边挂角
pageModel.isRightAdv = 2
} else {
// 右边挂角
pageModel.isRightAdv = 1
}
pageModel.pageCornerAdv = showCompAdvBean
pageModel.isShowAds = true
}
}
async parseGroup(pageModel: PageModel) {
... ...
... ... @@ -51,11 +51,11 @@ export default class PageModel {
// keyGenerator相关字符串,用于刷新list布局
timestamp: String = '1';
//左右挂角广告对象
pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告
isShowAds : boolean = false;
isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边
pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息
// //左右挂角广告对象
// pageCornerAdv:CompAdvBean = {} as CompAdvBean // 挂角广告
// isShowAds : boolean = false;
// isRightAdv : number = 1;// 1:右边;2:左边 -> 默认右边
// pageCornerContentInfo:AdvRuleBean = {} as AdvRuleBean // 展现中心业务信息
/**
... ...
@Observed
export class SearchSuggestData{
// activityExt: null
appStyle: string = ""
// askInfo: null
axisColor: string = ""
// bestNoticer: null
// bottomNavId: null
cardItemId: string = ""
channelId: number = -1
// commentInfo: null
corner: string = ""
coverSize: string = ""
coverType: number = -1
coverUrl: string = ""
expIds: string = ""
extra: string = ""
fullColumnImgUrls: Array<FullColumnImgUrls> = []
// hasMore: null
itemId: string = ""
itemType: string = ""
itemTypeCode: string = ""
keyArticle: number = -1
// landscape: null
// likeStyle: null
linkUrl: string = ""
// liveInfo: null
menuShow: number = -1
newTags: string = ""
newsAuthor: string = ""
newsSubTitle: string = ""
newsSummary: string = ""
newsTitle: string = ""
newsTitleColor: string = ""
objectId: string = ""
objectLevel: string = ""
objectType: string = ""
// openComment: null
// openLikes: null
pageId: string = ""
// photoNum: null
// position: null
// productNum: null
publishTime: string = ""
// pushTime: null
// pushUnqueId: null
readFlag: number = -1
recommend: number = -1
relId: number = -1
relObjectId: string = ""
relType: number = -1
// rmhInfo: null
rmhPlatform: number = -1
sceneId: string = ""
// shareInfo: null
// slideShows: Array< unknown >
// sortValue: null
source: string = ""
subObjectType: string = ""
subSceneId: string = ""
// tagIds: Array< unknown >
// tagWord: null
// titleShow: null
// titleShowPolicy: null
// topicTemplate: null
traceId: string = ""
traceInfo: string = ""
// userInfo: null
videoInfo: VideoInfo = new VideoInfo()
visitorComment: number = -1
// voiceInfo: null
}
class FullColumnImgUrls{
// format: null
fullUrl: string = ""
height: number = -1
landscape: number = -1
size: number = -1
url: string = ""
weight: number = -1
}
class VideoInfo{
firstFrameImageUri: string = ""
videoDuration: number = -1
videoLandscape: number = -1
videoUrl: string = ""
}
... ... @@ -52,6 +52,10 @@
{
"name": "comp_advertisement",
"value": "广告"
},
{
"name": "location_reason",
"value": " "
}
]
}
\ No newline at end of file
... ...
... ... @@ -11,6 +11,6 @@
"wdKit": "file:../../commons/wdKit",
"wdBean": "file:../../features/wdBean",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork"
"wdNetwork": "file:../../commons/wdNetwork",
}
}
... ...
... ... @@ -2,15 +2,15 @@ import { Action, LiveDetailsBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import router from '@ohos.router';
import { DetailPlayLivePage } from './DetailPlayLivePage'
import { DetailPlayVLivePage } from './DetailPlayVLivePage'
import { DetailPlayLivePage } from './DetailPlayLivePage';
import { DetailPlayVLivePage } from './DetailPlayVLivePage';
import { Logger } from 'wdKit/Index';
const TAG = 'DetailPlayLiveCommon'
@Entry()
@Entry
@Component
export struct DetailPlayLiveCommon {
TAG: string = 'DetailPlayLiveCommon';
private liveViewModel: LiveViewModel = new LiveViewModel()
@State liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@State liveState: string = ''
... ... @@ -18,8 +18,12 @@ export struct DetailPlayLiveCommon {
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@Provide pageShow: number = -1
@Provide pageHide: number = -1
@Provide pageBackPress: number = -1
aboutToAppear(): void {
Logger.debug(TAG, 'aboutToAppear')
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
const par: Action = router.getParams() as Action;
const params = par?.params;
... ... @@ -56,5 +60,21 @@ export struct DetailPlayLiveCommon {
})
}
onPageShow() {
this.pageShow = 0
Logger.debug(TAG, 'onPageShow')
}
onPageHide() {
this.pageHide = 0
Logger.debug(TAG, 'onPageHide')
}
onBackPress(): boolean | void {
this.pageBackPress = 0
Logger.debug(TAG, 'onBackPress')
return true
}
}
... ...
import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import router from '@ohos.router';
import { DisplayDirection } from 'wdConstant/Index';
import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import { window } from '@kit.ArkUI';
import { router, window } from '@kit.ArkUI';
import { devicePLSensorManager } from 'wdDetailPlayApi/Index';
import { LiveCommentComponent } from 'wdComponent/Index';
import { WDPlayerController } from 'wdPlayer/Index';
@Entry
let TAG: string = 'DetailPlayLivePage';
@Component
export struct DetailPlayLivePage {
//横竖屏,默认竖屏
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
playerController: WDPlayerController = new WDPlayerController();
TAG: string = 'DetailPlayLivePage';
liveViewModel: LiveViewModel = new LiveViewModel()
@State relId: string = ''
@State contentId: string = ''
... ... @@ -27,11 +26,14 @@ export struct DetailPlayLivePage {
@State tabs: string[] = []
//监听屏幕横竖屏变化
listener = mediaquery.matchMediaSync('(orientation: landscape)');
@Consume @Watch('onPageShowCus') pageShow: number
@Consume @Watch('onPageHideCus') pageHide: number
@Consume @Watch('onBackPressCus') pageBackPress: number
aboutToAppear(): void {
Logger.info(this.TAG, `wyj-aboutToAppear`)
Logger.info(TAG, `wyj-aboutToAppear`)
this.listener?.on("change", (mediaQueryResult) => {
Logger.info(this.TAG, `change;${mediaQueryResult.matches}`)
Logger.info(TAG, `change;${mediaQueryResult.matches}`)
if (mediaQueryResult?.matches) {
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
} else {
... ... @@ -39,11 +41,6 @@ export struct DetailPlayLivePage {
}
WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
})
let par: Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
this.getLiveDetails()
this.getLiveRoomData()
}
... ... @@ -62,18 +59,39 @@ export struct DetailPlayLivePage {
.width('100%')
}
onPageShow(): void {
Logger.info(this.TAG, `wyj-onPageShow`)
aboutToDisappear(): void {
Logger.info(TAG, `wyj-aboutToDisappear`)
this.playerController?.stop()
this.playerController?.release()
}
onPageShowCus(): void {
Logger.info(TAG, `wyj-onPageShowCus`)
// WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
}
onPageHide(): void {
Logger.info(this.TAG, `wyj-onPageHide`)
onPageHideCus(): void {
Logger.info(TAG, `wyj-onPageHideCus`)
devicePLSensorManager.devicePLSensorOff();
// WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
this.playerController?.pause()
}
onBackPressCus(): boolean | void {
if (this.displayDirection == DisplayDirection.VERTICAL) {
router.back()
} else {
this.displayDirection = DisplayDirection.VERTICAL
}
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
return true
}
getLiveDetails() {
this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
.then(
... ... @@ -102,23 +120,4 @@ export struct DetailPlayLivePage {
})
}
aboutToDisappear(): void {
Logger.info(this.TAG, `wyj-aboutToDisappear`)
}
onBackPress(): boolean | void {
if (this.displayDirection == DisplayDirection.VERTICAL) {
router.back()
} else {
this.displayDirection = DisplayDirection.VERTICAL
}
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
return true
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
import { WDPlayerController } from 'wdPlayer/Index';
import { DisplayDirection } from 'wdConstant/Index';
import { LiveEmptyComponent, WDLiveViewDefaultType } from 'wdComponent/Index';
const storage = LocalStorage.getShared();
const TAG = 'DetailPlayVLivePage'
... ... @@ -22,6 +23,7 @@ export struct DetailPlayVLivePage {
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
@Provide isShowControl: boolean = false
@Provide liveState: string = ''
@Provide playUrl: string = ''
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏
@State relId: string = ''
@State contentId: string = ''
... ... @@ -50,30 +52,45 @@ export struct DetailPlayVLivePage {
build() {
Column() {
Stack() {
PlayerComponent({
playerController: this.playerController
})
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
// 直播结束且无回看
if (this.liveState === 'end' || !this.playUrl) {
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveEnd
})
} else {
Stack() {
// 直播暂停,仍然可以评论
if (this.liveState === 'pause') {
LiveEmptyComponent({
emptyType: WDLiveViewDefaultType.WDViewDefaultType_NoLiveSuspend
})
} else {
PlayerComponent({
playerController: this.playerController
})
}
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
.position({ x: '100%', y: '100%' })
.markAnchor({ x: 56, y: 56 })
.onClick(() => {
this.swiperController.showNext()
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
})
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
.position({ x: '100%', y: '100%' })
.markAnchor({ x: 56, y: 56 })
.onClick(() => {
this.swiperController.showNext()
})
}
.height('100%')
.width('100%')
}
.height('100%')
.width('100%')
}
.height('100%')
... ... @@ -86,7 +103,10 @@ export struct DetailPlayVLivePage {
(data) => {
if (data.length > 0) {
this.liveDetailsBean = data[0]
this.liveState = this.liveDetailsBean.liveInfo?.liveState
this.liveState = this.liveDetailsBean.liveInfo?.liveState //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停
if (this.liveDetailsBean.liveInfo.liveState == 'end') {
this.playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
console.log(TAG, 'getLiveDetails', JSON.stringify((this.liveDetailsBean)))
}
},
... ...
import { LiveRoomItemBean } from 'wdBean/Index'
import { StringUtils } from 'wdKit/Index'
@Component
export struct TabChatItemComponent {
... ... @@ -9,7 +10,7 @@ export struct TabChatItemComponent {
build() {
Row() {
Image(this.item.senderUserAvatarUrl)
Image(StringUtils.isEmpty(this.item.senderUserAvatarUrl) ? $r('app.media.default_head') : this.item.senderUserAvatarUrl)
.borderRadius(90)
.width(24)
.height(24)
... ...
import { Action, LiveRoomItemBean, Params, PhotoListBean } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { AudioRowComponent } from 'wdComponent/Index'
import { DateTimeUtils, StringUtils } from 'wdKit/Index'
import { WDRouterRule } from 'wdRouter/Index'
... ... @@ -111,24 +112,10 @@ export struct TabLiveItemComponent {
}
//音频
else if (this.item.dataType === 'ZH_AUDIO_MSG') {
Row() {
Image($r('app.media.icon_voice'))
.width(20)
.aspectRatio(1)
.margin({
left: 8,
right: 6
})
Text(DateTimeUtils.getFormattedDuration(this.item.duration))
.fontColor('#666666')
.fontWeight(400)
.fontSize('14fp')
}
.backgroundColor(Color.White)
.height(36)
.borderRadius(4)
.margin({ top: 8, right: 16 })
.width('100%')
AudioRowComponent({
audioUrl: this.item.audioUrl,
duration: this.item.duration
})
}
//视频
else if (this.item.dataType === 'ZH_VIDEO_MSG') {
... ...
import { LiveDetailsBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { WDPlayerController, WDPlayerRenderLiveView } from 'wdPlayer/Index';
import { PlayUIComponent } from './PlayUIComponent';
... ... @@ -7,13 +6,15 @@ import { PlayUIComponent } from './PlayUIComponent';
export struct TopPlayComponent {
TAG: string = 'TopPlayComponent'
@Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean
playerController: WDPlayerController = new WDPlayerController();
playerController?: WDPlayerController
@State imgUrl: string = ''
@State isWait: boolean = false
aboutToAppear(): void {
this.playerController.onCanplay = () => {
this.playerController.play()
if (this.playerController) {
this.playerController.onCanplay = () => {
this.playerController?.play()
}
}
}
... ... @@ -30,7 +31,7 @@ export struct TopPlayComponent {
} else if (this.liveDetailsBean.liveInfo.liveState == 'end') {
playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri
}
this.playerController.firstPlay(playUrl);
this.playerController?.firstPlay(playUrl);
}
}
... ... @@ -44,18 +45,6 @@ export struct TopPlayComponent {
.height('100%')
.width('100%')
.visibility(this.isWait ? Visibility.None : Visibility.Visible)
.onVisibleAreaChange([0.0, 1.0], (isVisible: boolean, currentRatio: number) => {
Logger.debug(this.TAG, `当前屏幕可见区域大小: currentRatio:' +${currentRatio}`)
if (isVisible && currentRatio >= 1.0) {
Logger.debug(this.TAG, `播放器-暂停. currentRatio:' +${currentRatio}`)
this.playerController.play()
}
if (!isVisible && currentRatio <= 0.0) {
Logger.debug(this.TAG, `播放器-播放. currentRatio:' +${currentRatio}`)
this.playerController.pause()
}
})
Image(this.imgUrl)
.objectFit(ImageFit.Contain)
.visibility(this.isWait ? Visibility.Visible : Visibility.None)
... ... @@ -65,8 +54,5 @@ export struct TopPlayComponent {
}
aboutToDisappear(): void {
this.playerController.pause()
this.playerController.stop()
this.playerController.release()
}
}
\ No newline at end of file
... ...
... ... @@ -35,6 +35,10 @@
{
"name": "reason_read_write_media",
"value": "user_grant"
},
{
"name": "location_reason",
"value": " "
}
]
}
\ No newline at end of file
... ...
{
"src": [
"pages/DetailPlayLivePage",
"pages/DetailPlayVLivePage",
"pages/DetailPlayLiveCommon"
]
... ...
... ... @@ -152,6 +152,22 @@ export class HWLocationUtils {
}
return ''
}
// 通过省份code获取省份名称
static async getProvinceName(provinceCode: string) {
let bean = await ResourcesUtils.getResourcesJson<ResponseDTO<Array<LocalData>>>(getContext(), 'areaList_data.json');
if (bean) {
if (bean.code == 0 && bean.data) {
for (let i = 0; i < bean.data.length; i++) {
if (bean.data[i].code == provinceCode) {
return bean.data[i].label
}
}
}
}
return ''
}
}
interface LocalData {
... ...
... ... @@ -15,6 +15,7 @@
"wdDetailPlayShortVideo": "file:../../features/wdDetailPlayShortVideo",
"wdRouter": "file:../../commons/wdRouter",
"wdNetwork": "file:../../commons/wdNetwork",
"wdHwAbility": "file:../../features/wdHwAbility"
"wdHwAbility": "file:../../features/wdHwAbility",
"wdJsBridge": "file:../../commons/wdJsBridge"
}
}
... ...
import router from '@ohos.router';
import { Action } from 'wdBean';
import { Logger } from 'wdKit';
import { WdWebComponent } from 'wdWebComponent';
const TAG = 'DefaultWebPage';
import router from '@ohos.router';
import { CommonConstants } from 'wdConstant'
import { BridgeWebViewControl } from 'wdJsBridge';
import { detailedSkeleton } from 'wdComponent/src/main/ets/components/skeleton/detailSkeleton'
const TAG = 'DefaultWebPage'
@Entry
@Component
struct DefaultWebPage {
private url?: string;
@State reload: number = 0;
@State isPageEnd : boolean = false
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
this.url = action.params?.url
}
}
onPageShow() {
Logger.info(TAG, `DefaultWebPage# onPageShow:::refresh`);
this.reload = ++this.reload
}
onPageHide() {
this.reload = 0
}
webviewControl: BridgeWebViewControl = new BridgeWebViewControl()
scroller: Scroller = new Scroller();
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
build() {
Column() {
WdWebComponent({
webUrl: this.url,
backVisibility: false,
// reload: this.reload,
isPageEnd:$isPageEnd
})
if (!this.isPageEnd) {
detailedSkeleton()
}
Stack({ alignContent: Alignment.Bottom }) {
Column() {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
backVisibility: false,
isPageEnd: $isPageEnd
})
}
.padding({ bottom: 56 })
.width(CommonConstants.FULL_WIDTH)
.height(CommonConstants.FULL_HEIGHT)
}
}.width(CommonConstants.FULL_WIDTH).height(CommonConstants.FULL_HEIGHT)
}
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
this.webUrl = action.params?.url || ''
}
}
}
}
\ No newline at end of file
... ...
{
"code": "0",
"data": {
"hasNext": 0,
"list": [
{
"avatarFrame": "",
"checkStatus": 0,
"commentContent": "说得很好啊你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突",
"commentContentSensitive": "",
"commentLevel": 2,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"createTime": "2024-04-24 10:22:37",
"fromCreatorId": "",
"fromDeviceId": "",
"fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "559509019499205",
"fromUserName": "人民wH38q",
"fromUserType": 1,
"h5Url": "",
"id": 58110548,
"keyArticle": 0,
"likeNum": 0,
"pageId": null,
"parentCommentVo": {
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "1,因为读书的人\n是低着头向上看的人\n身处一隅,却能放眼世界\n2,因为读书的人\n总是比不读书的人\n活得有趣一点\n3,因为读书的人\n即使平凡,绝不平庸",
"commentPics": "",
"commentType": "1",
"fromUserName": "胡德清",
"id": 58109773
},
"parentId": 58109773,
"rootCommentId": 58109773,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "读书,就是一个让生命变得更加辽阔的过程",
"shareTitle": "读书,就是低着头向上看",
"shareUrl": "https://people.pdnews.cn/column/30044549051-500005339313"
},
"targetId": "30044549051",
"targetRelId": "500005339313",
"targetRelObjectId": "2002",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "读书,就是低着头向上看",
"targetType": 13,
"topicType": null,
"uuid": "6425f699-d762-4d33-b73c-64c780fc9693"
},
{
"avatarFrame": "",
"checkStatus": 0,
"commentContent": "你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突你牛魔突突突突兔兔突突突",
"commentContentSensitive": "",
"commentLevel": 2,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"createTime": "2024-04-24 10:21:42",
"fromCreatorId": "",
"fromDeviceId": "",
"fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "559509019499205",
"fromUserName": "人民wH38q",
"fromUserType": 1,
"h5Url": "",
"id": 58092145,
"keyArticle": 0,
"likeNum": 0,
"pageId": null,
"parentCommentVo": {
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "这是继续把自己塑造成受害者角色,其实不过是历史原因造成,这也改不了以色列这半年来对加沙人民的种族灭绝行为!",
"commentPics": "",
"commentType": "1",
"fromUserName": "人民pn5SI",
"id": 58063914
},
"parentId": 58063914,
"rootCommentId": 58063914,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
"shareTitle": "以色列媒体:以军中央司令部司令请辞",
"shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
},
"targetId": "30044533884",
"targetRelId": "500005335271",
"targetRelObjectId": "2002",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "以色列媒体:以军中央司令部司令请辞",
"targetType": 8,
"topicType": null,
"uuid": "0950adb8-542c-4c11-bc0c-708b1b41554d"
},
{
"avatarFrame": "",
"checkStatus": 3,
"commentContent": "【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。【华为】您报名的“鸿蒙生态学堂·线上培训 第二期”直播于今晚19:00开始。本次主题:HarmonyOS NEXT 界面开发,点击观看https://url.cloud.huawei.com/q56YcuTFvO。回放观看https://url.cloud.huawei.com/q5Upzl3GOA。",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"createTime": "2024-04-24 10:19:22",
"fromCreatorId": "",
"fromDeviceId": "",
"fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "559509019499205",
"fromUserName": "人民wH38q",
"fromUserType": 1,
"h5Url": "",
"id": 58091980,
"keyArticle": 0,
"likeNum": 0,
"pageId": null,
"parentCommentVo": null,
"parentId": -1,
"rootCommentId": 58091980,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
"shareTitle": "以色列媒体:以军中央司令部司令请辞",
"shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
},
"targetId": "30044533884",
"targetRelId": "500005335271",
"targetRelObjectId": "2002",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "以色列媒体:以军中央司令部司令请辞",
"targetType": 8,
"topicType": null,
"uuid": "320ac584-4ad9-4c38-822d-82dcbf366063"
},
{
"avatarFrame": "",
"checkStatus": 0,
"commentContent": "说得好",
"commentContentSensitive": "",
"commentLevel": 2,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"createTime": "2024-04-24 10:17:30",
"fromCreatorId": "",
"fromDeviceId": "",
"fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "559509019499205",
"fromUserName": "人民wH38q",
"fromUserType": 1,
"h5Url": "",
"id": 58091767,
"keyArticle": 0,
"likeNum": 0,
"pageId": null,
"parentCommentVo": {
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "一级战犯!",
"commentPics": "",
"commentType": "1",
"fromUserName": "一把火",
"id": 57995700
},
"parentId": 57995700,
"rootCommentId": 57995700,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "",
"shareSummary": "报道说,福克斯请辞与以国防军军事情报局局长哈利瓦的辞职没有关联。",
"shareTitle": "以色列媒体:以军中央司令部司令请辞",
"shareUrl": "https://people.pdnews.cn/column/30044533884-500005335271"
},
"targetId": "30044533884",
"targetRelId": "500005335271",
"targetRelObjectId": "2002",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "以色列媒体:以军中央司令部司令请辞",
"targetType": 8,
"topicType": null,
"uuid": "a8f009c7-6fa1-44c9-bc99-107d14acbac7"
},
{
"avatarFrame": "",
"checkStatus": 2,
"commentContent": "你好",
"commentContentSensitive": "",
"commentLevel": 1,
"commentPics": "",
"commentSensitive": "",
"commentType": "2",
"createTime": "2024-04-19 16:19:02",
"fromCreatorId": "",
"fromDeviceId": "",
"fromUserHeader": "https://rmrbcmsonline.peopleapp.com/upload/default.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
"fromUserId": "559509019499205",
"fromUserName": "人民wH38q",
"fromUserType": 1,
"h5Url": "",
"id": 57870182,
"keyArticle": 1,
"likeNum": 0,
"pageId": null,
"parentCommentVo": null,
"parentId": -1,
"rootCommentId": 57870182,
"sensitiveExist": 0,
"sensitiveShow": 1,
"shareInfo": {
"shareCoverUrl": "https://rmrbcmsonline.peopleapp.com/upload/ueditor/image/20240419/a_965759026988052480.jpeg",
"shareSummary": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
"shareTitle": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
"shareUrl": "https://people.pdnews.cn/rmharticle/30044466109"
},
"targetId": "30044466109",
"targetRelId": "500005326186",
"targetRelObjectId": "2058",
"targetRelType": 1,
"targetStatus": 0,
"targetTitle": "中央宣传部直属单位2024年度公开招聘工作人员面试公告",
"targetType": 8,
"topicType": null,
"uuid": "849612f9-3880-4e7a-a8c3-d7281706ec0e"
}
],
"pageNum": 1,
"pageSize": 20,
"totalCommentNum": 5,
"totalCount": 5
},
"message": "Success",
"meta": null,
"requestId": "",
"success": true,
"timestamp": 1713925942006
}
\ No newline at end of file
... ...