liyubing

Merge remote-tracking branch 'origin/main'

... ... @@ -58,10 +58,9 @@ export class ProcessUtils {
break;
//动态详情页(动态图文)
case ContentConstants.TYPE_FOURTEEN:
break;
//动态详情页(动态视频)
case ContentConstants.TYPE_FIFTEEN:
ProcessUtils.gotoWeb(content);
ProcessUtils.gotoDynamicDetailPage(content);
break;
default:
break;
... ... @@ -76,7 +75,7 @@ export class ProcessUtils {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 14,
detailPageType: Number.parseInt(content.objectType),
contentID: content?.objectId,
extra: {
relType: content?.relType,
... ...
import { AccountManagerUtils, Logger } from 'wdKit';
import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
... ... @@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from 'wdRouter';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import display from '@ohos.display';
import { BusinessError } from '@ohos.base';
const TAG = 'DynamicDetailComponent'
@Preview
... ... @@ -38,6 +40,12 @@ export struct DynamicDetailComponent {
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
// 获取当前所有的display对象
promise: Promise<Array<display.Display>> = display.getAllDisplays()
// 屏幕宽度(单位px)
screenWidth: number = 0;
async aboutToAppear() {
await this.getContentDetailData()
}
... ... @@ -120,8 +128,8 @@ export struct DynamicDetailComponent {
})
} else {
Text('已关注')
.width($r('app.float.margin_60'))
.height($r('app.float.margin_48'))
.width($r('app.float.margin_54'))
.height($r('app.float.margin_24'))
.borderWidth(1)
.textAlign(TextAlign.Center)
.fontSize($r('app.float.font_size_12'))
... ... @@ -166,7 +174,7 @@ export struct DynamicDetailComponent {
})
}
}else{
this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, this.contentDetailData.photoList.length, 0);
this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, 1, 0);
}
}
//特别声明
... ... @@ -230,6 +238,7 @@ export struct DynamicDetailComponent {
}
this.getBatchAttentionStatus
this.getInteractDataStatus
this.getScreenWidth
}
// 查询当前登录用户点赞状态
... ... @@ -276,7 +285,10 @@ export struct DynamicDetailComponent {
setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
//四角圆角
Image(picPath)
.width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight})
.width('100%')
.height('100%')
.borderRadius({topLeft: topLeft, topRight: topRight,
bottomLeft: bottomLeft, bottomRight: bottomRight})
}
/**
* 组件项
... ... @@ -301,7 +313,20 @@ export struct DynamicDetailComponent {
.width(48)
.padding({bottom: 9})
}
.width('100%')
.width(
//图片类型
this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
//视频横屏 横版16:9
:this.contentDetailData.videoInfo[0].videoLandScape == 1?this.screenWidth-32
//视频竖屏 竖版3:4
:(this.screenWidth-32)/2)
.height(
//图片类型
this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%'
//视频横屏 横版16:9
:this.contentDetailData.videoInfo[0].videoLandScape == 1?(this.screenWidth-32)*9/16
//视频竖屏 竖版3:4
:(this.screenWidth-32)/2*4/3)
.onClick((event: ClickEvent) => {
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//fixme 跳转到查看图片页面(带页脚/下载按钮)
... ... @@ -460,4 +485,14 @@ export struct DynamicDetailComponent {
}
}
}
getScreenWidth(){
this.promise.then((data: Array<display.Display>) => {
console.log(`所有的屏幕信息:${JSON.stringify(data)}`)
//单位为像素
this.screenWidth = data[0]["width"]
}).catch((err: BusinessError) => {
console.error(`Failed to obtain all the display objects. Code: ${JSON.stringify(err)}`)
})
}
}
\ No newline at end of file
... ...
... ... @@ -10,20 +10,44 @@ const TAG = 'PageHelper';
/**
* 处理返回后的数据
* @deprecated
*/
export class PageHelper {
/**
* 刷新数据
*/
async refreshUI(pageModel: PageModel) {
pageModel.loadStrategy = 2
this.parseGroup(pageModel)
this.getPageInfo(pageModel)
}
/**
* 分页加载
*/
async loadMore(pageModel: PageModel) {
pageModel.loadStrategy = 3
// 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页)
this.compLoadMore(pageModel)
}
/**
* 进页面请求数据
*/
async getInitData(pageModel: PageModel) {
pageModel.loadStrategy = 1
this.getPageInfo(pageModel)
}
async getPageInfo(pageModel: PageModel) {
pageModel.currentPage = 1;
let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId);
if (pageInfo == null) {
pageModel.viewType = ViewType.EMPTY;
return;
}
pageModel.pageInfo = pageInfo;
this.parseGroup(pageModel)
}
async parseGroup(pageModel: PageModel) {
let pageInfo: PageInfoDTO = pageModel.pageInfo
pageModel.groupList = []
... ... @@ -66,7 +90,7 @@ export class PageHelper {
}
//移除音频 和 活动
this.removeComp(pageModel,pageDto)
this.removeComp(pageModel, pageDto)
// pageModel.compList.push(...pageDto.compList)
... ... @@ -114,7 +138,7 @@ export class PageHelper {
let sizeBefore: number = pageModel.compList.size();
//移除音频 和 活动
this.removeComp(pageModel,data)
this.removeComp(pageModel, data)
//
// pageModel.compList.push(...data.compList)
PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => {
... ... @@ -132,14 +156,14 @@ export class PageHelper {
* 移除comp
*/
private removeComp(pageModel: PageModel, pageDto: PageDTO) {
let datas = pageDto.compList
let datas = pageDto.compList
for (let index = 0; index < datas.length; index++) {
const element = datas[index];
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
Logger.debug(TAG, 'getGroupData 移除音频 和 活动');
}else {
} else {
pageModel.compList.push(element)
}
}
... ...