Showing
3 changed files
with
72 additions
and
14 deletions
| @@ -58,10 +58,9 @@ export class ProcessUtils { | @@ -58,10 +58,9 @@ export class ProcessUtils { | ||
| 58 | break; | 58 | break; |
| 59 | //动态详情页(动态图文) | 59 | //动态详情页(动态图文) |
| 60 | case ContentConstants.TYPE_FOURTEEN: | 60 | case ContentConstants.TYPE_FOURTEEN: |
| 61 | - break; | ||
| 62 | //动态详情页(动态视频) | 61 | //动态详情页(动态视频) |
| 63 | case ContentConstants.TYPE_FIFTEEN: | 62 | case ContentConstants.TYPE_FIFTEEN: |
| 64 | - ProcessUtils.gotoWeb(content); | 63 | + ProcessUtils.gotoDynamicDetailPage(content); |
| 65 | break; | 64 | break; |
| 66 | default: | 65 | default: |
| 67 | break; | 66 | break; |
| @@ -76,7 +75,7 @@ export class ProcessUtils { | @@ -76,7 +75,7 @@ export class ProcessUtils { | ||
| 76 | let taskAction: Action = { | 75 | let taskAction: Action = { |
| 77 | type: 'JUMP_DETAIL_PAGE', | 76 | type: 'JUMP_DETAIL_PAGE', |
| 78 | params: { | 77 | params: { |
| 79 | - detailPageType: 14, | 78 | + detailPageType: Number.parseInt(content.objectType), |
| 80 | contentID: content?.objectId, | 79 | contentID: content?.objectId, |
| 81 | extra: { | 80 | extra: { |
| 82 | relType: content?.relType, | 81 | relType: content?.relType, |
| 1 | -import { AccountManagerUtils, Logger } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger, DateTimeUtils } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, | 3 | import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, |
| 4 | PhotoListBean, | 4 | PhotoListBean, |
| @@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index'; | @@ -10,6 +10,8 @@ import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 10 | import { ContentConstants } from '../constants/ContentConstants'; | 10 | import { ContentConstants } from '../constants/ContentConstants'; |
| 11 | import { ProcessUtils } from 'wdRouter'; | 11 | import { ProcessUtils } from 'wdRouter'; |
| 12 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 12 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 13 | +import display from '@ohos.display'; | ||
| 14 | +import { BusinessError } from '@ohos.base'; | ||
| 13 | 15 | ||
| 14 | const TAG = 'DynamicDetailComponent' | 16 | const TAG = 'DynamicDetailComponent' |
| 15 | @Preview | 17 | @Preview |
| @@ -38,6 +40,12 @@ export struct DynamicDetailComponent { | @@ -38,6 +40,12 @@ export struct DynamicDetailComponent { | ||
| 38 | //跳转 | 40 | //跳转 |
| 39 | private mJumpInfo: ContentDTO = {} as ContentDTO; | 41 | private mJumpInfo: ContentDTO = {} as ContentDTO; |
| 40 | 42 | ||
| 43 | + // 获取当前所有的display对象 | ||
| 44 | + promise: Promise<Array<display.Display>> = display.getAllDisplays() | ||
| 45 | + | ||
| 46 | + // 屏幕宽度(单位px) | ||
| 47 | + screenWidth: number = 0; | ||
| 48 | + | ||
| 41 | async aboutToAppear() { | 49 | async aboutToAppear() { |
| 42 | await this.getContentDetailData() | 50 | await this.getContentDetailData() |
| 43 | } | 51 | } |
| @@ -120,8 +128,8 @@ export struct DynamicDetailComponent { | @@ -120,8 +128,8 @@ export struct DynamicDetailComponent { | ||
| 120 | }) | 128 | }) |
| 121 | } else { | 129 | } else { |
| 122 | Text('已关注') | 130 | Text('已关注') |
| 123 | - .width($r('app.float.margin_60')) | ||
| 124 | - .height($r('app.float.margin_48')) | 131 | + .width($r('app.float.margin_54')) |
| 132 | + .height($r('app.float.margin_24')) | ||
| 125 | .borderWidth(1) | 133 | .borderWidth(1) |
| 126 | .textAlign(TextAlign.Center) | 134 | .textAlign(TextAlign.Center) |
| 127 | .fontSize($r('app.float.font_size_12')) | 135 | .fontSize($r('app.float.font_size_12')) |
| @@ -166,7 +174,7 @@ export struct DynamicDetailComponent { | @@ -166,7 +174,7 @@ export struct DynamicDetailComponent { | ||
| 166 | }) | 174 | }) |
| 167 | } | 175 | } |
| 168 | }else{ | 176 | }else{ |
| 169 | - this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, this.contentDetailData.photoList.length, 0); | 177 | + this.buildItemCard(this.contentDetailData.videoInfo[0].firstFrameImageUri, 1, 0); |
| 170 | } | 178 | } |
| 171 | } | 179 | } |
| 172 | //特别声明 | 180 | //特别声明 |
| @@ -230,6 +238,7 @@ export struct DynamicDetailComponent { | @@ -230,6 +238,7 @@ export struct DynamicDetailComponent { | ||
| 230 | } | 238 | } |
| 231 | this.getBatchAttentionStatus | 239 | this.getBatchAttentionStatus |
| 232 | this.getInteractDataStatus | 240 | this.getInteractDataStatus |
| 241 | + this.getScreenWidth | ||
| 233 | } | 242 | } |
| 234 | 243 | ||
| 235 | // 查询当前登录用户点赞状态 | 244 | // 查询当前登录用户点赞状态 |
| @@ -276,7 +285,10 @@ export struct DynamicDetailComponent { | @@ -276,7 +285,10 @@ export struct DynamicDetailComponent { | ||
| 276 | setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){ | 285 | setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){ |
| 277 | //四角圆角 | 286 | //四角圆角 |
| 278 | Image(picPath) | 287 | Image(picPath) |
| 279 | - .width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight}) | 288 | + .width('100%') |
| 289 | + .height('100%') | ||
| 290 | + .borderRadius({topLeft: topLeft, topRight: topRight, | ||
| 291 | + bottomLeft: bottomLeft, bottomRight: bottomRight}) | ||
| 280 | } | 292 | } |
| 281 | /** | 293 | /** |
| 282 | * 组件项 | 294 | * 组件项 |
| @@ -301,7 +313,20 @@ export struct DynamicDetailComponent { | @@ -301,7 +313,20 @@ export struct DynamicDetailComponent { | ||
| 301 | .width(48) | 313 | .width(48) |
| 302 | .padding({bottom: 9}) | 314 | .padding({bottom: 9}) |
| 303 | } | 315 | } |
| 304 | - .width('100%') | 316 | + .width( |
| 317 | + //图片类型 | ||
| 318 | + this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%' | ||
| 319 | + //视频横屏 横版16:9 | ||
| 320 | + :this.contentDetailData.videoInfo[0].videoLandScape == 1?this.screenWidth-32 | ||
| 321 | + //视频竖屏 竖版3:4 | ||
| 322 | + :(this.screenWidth-32)/2) | ||
| 323 | + .height( | ||
| 324 | + //图片类型 | ||
| 325 | + this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN?'100%' | ||
| 326 | + //视频横屏 横版16:9 | ||
| 327 | + :this.contentDetailData.videoInfo[0].videoLandScape == 1?(this.screenWidth-32)*9/16 | ||
| 328 | + //视频竖屏 竖版3:4 | ||
| 329 | + :(this.screenWidth-32)/2*4/3) | ||
| 305 | .onClick((event: ClickEvent) => { | 330 | .onClick((event: ClickEvent) => { |
| 306 | if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | 331 | if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ |
| 307 | //fixme 跳转到查看图片页面(带页脚/下载按钮) | 332 | //fixme 跳转到查看图片页面(带页脚/下载按钮) |
| @@ -460,4 +485,14 @@ export struct DynamicDetailComponent { | @@ -460,4 +485,14 @@ export struct DynamicDetailComponent { | ||
| 460 | } | 485 | } |
| 461 | } | 486 | } |
| 462 | } | 487 | } |
| 488 | + | ||
| 489 | + getScreenWidth(){ | ||
| 490 | + this.promise.then((data: Array<display.Display>) => { | ||
| 491 | + console.log(`所有的屏幕信息:${JSON.stringify(data)}`) | ||
| 492 | + //单位为像素 | ||
| 493 | + this.screenWidth = data[0]["width"] | ||
| 494 | + }).catch((err: BusinessError) => { | ||
| 495 | + console.error(`Failed to obtain all the display objects. Code: ${JSON.stringify(err)}`) | ||
| 496 | + }) | ||
| 497 | + } | ||
| 463 | } | 498 | } |
| @@ -10,20 +10,44 @@ const TAG = 'PageHelper'; | @@ -10,20 +10,44 @@ const TAG = 'PageHelper'; | ||
| 10 | 10 | ||
| 11 | /** | 11 | /** |
| 12 | * 处理返回后的数据 | 12 | * 处理返回后的数据 |
| 13 | - * @deprecated | ||
| 14 | */ | 13 | */ |
| 15 | export class PageHelper { | 14 | export class PageHelper { |
| 15 | + /** | ||
| 16 | + * 刷新数据 | ||
| 17 | + */ | ||
| 16 | async refreshUI(pageModel: PageModel) { | 18 | async refreshUI(pageModel: PageModel) { |
| 17 | pageModel.loadStrategy = 2 | 19 | pageModel.loadStrategy = 2 |
| 18 | - this.parseGroup(pageModel) | 20 | + this.getPageInfo(pageModel) |
| 19 | } | 21 | } |
| 20 | 22 | ||
| 23 | + /** | ||
| 24 | + * 分页加载 | ||
| 25 | + */ | ||
| 21 | async loadMore(pageModel: PageModel) { | 26 | async loadMore(pageModel: PageModel) { |
| 22 | pageModel.loadStrategy = 3 | 27 | pageModel.loadStrategy = 3 |
| 23 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) | 28 | // 暂只支持comp分页加载,节目分页加载的得完善框架(如直播回看节目数据分页) |
| 24 | this.compLoadMore(pageModel) | 29 | this.compLoadMore(pageModel) |
| 25 | } | 30 | } |
| 26 | 31 | ||
| 32 | + /** | ||
| 33 | + * 进页面请求数据 | ||
| 34 | + */ | ||
| 35 | + async getInitData(pageModel: PageModel) { | ||
| 36 | + pageModel.loadStrategy = 1 | ||
| 37 | + this.getPageInfo(pageModel) | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + async getPageInfo(pageModel: PageModel) { | ||
| 41 | + pageModel.currentPage = 1; | ||
| 42 | + let pageInfo = await PageViewModel.getPageInfo(pageModel.pageId); | ||
| 43 | + if (pageInfo == null) { | ||
| 44 | + pageModel.viewType = ViewType.EMPTY; | ||
| 45 | + return; | ||
| 46 | + } | ||
| 47 | + pageModel.pageInfo = pageInfo; | ||
| 48 | + this.parseGroup(pageModel) | ||
| 49 | + } | ||
| 50 | + | ||
| 27 | async parseGroup(pageModel: PageModel) { | 51 | async parseGroup(pageModel: PageModel) { |
| 28 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 52 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 29 | pageModel.groupList = [] | 53 | pageModel.groupList = [] |
| @@ -66,7 +90,7 @@ export class PageHelper { | @@ -66,7 +90,7 @@ export class PageHelper { | ||
| 66 | } | 90 | } |
| 67 | 91 | ||
| 68 | //移除音频 和 活动 | 92 | //移除音频 和 活动 |
| 69 | - this.removeComp(pageModel,pageDto) | 93 | + this.removeComp(pageModel, pageDto) |
| 70 | 94 | ||
| 71 | // pageModel.compList.push(...pageDto.compList) | 95 | // pageModel.compList.push(...pageDto.compList) |
| 72 | 96 | ||
| @@ -114,7 +138,7 @@ export class PageHelper { | @@ -114,7 +138,7 @@ export class PageHelper { | ||
| 114 | let sizeBefore: number = pageModel.compList.size(); | 138 | let sizeBefore: number = pageModel.compList.size(); |
| 115 | 139 | ||
| 116 | //移除音频 和 活动 | 140 | //移除音频 和 活动 |
| 117 | - this.removeComp(pageModel,data) | 141 | + this.removeComp(pageModel, data) |
| 118 | // | 142 | // |
| 119 | // pageModel.compList.push(...data.compList) | 143 | // pageModel.compList.push(...data.compList) |
| 120 | PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | 144 | PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { |
| @@ -139,7 +163,7 @@ export class PageHelper { | @@ -139,7 +163,7 @@ export class PageHelper { | ||
| 139 | //移除音频 和 活动 | 163 | //移除音频 和 活动 |
| 140 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | 164 | if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { |
| 141 | Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | 165 | Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); |
| 142 | - }else { | 166 | + } else { |
| 143 | pageModel.compList.push(element) | 167 | pageModel.compList.push(element) |
| 144 | } | 168 | } |
| 145 | } | 169 | } |
-
Please register or login to post a comment