yuzhilin

H5稿件头部样式

1 -import { Logger, NumberFormatterUtils } from 'wdKit'; 1 +import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit';
2 import { 2 import {
3 Action, 3 Action,
4 ContentDetailDTO, 4 ContentDetailDTO,
@@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel';
14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; 14 import { ImageAndTextWebComponent } from './ImageAndTextWebComponent';
15 import router from '@ohos.router'; 15 import router from '@ohos.router';
16 import { RecommendList } from '../components/view/RecommendList' 16 import { RecommendList } from '../components/view/RecommendList'
17 -import { CommonConstants } from 'wdConstant' 17 +import { CommonConstants } from 'wdConstant';
18 import { HttpUrlUtils } from 'wdNetwork/Index'; 18 import { HttpUrlUtils } from 'wdNetwork/Index';
19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; 19 import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; 20 import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
21 import { PageRepository } from '../repository/PageRepository'; 21 import { PageRepository } from '../repository/PageRepository';
22 -import { detailedSkeleton } from './skeleton/detailSkeleton' 22 +import { detailedSkeleton } from './skeleton/detailSkeleton';
  23 +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
23 24
24 const TAG = 'ImageAndTextPageComponent' 25 const TAG = 'ImageAndTextPageComponent'
25 -  
26 @Component 26 @Component
27 export struct ImageAndTextPageComponent { 27 export struct ImageAndTextPageComponent {
28 scroller: Scroller = new Scroller(); 28 scroller: Scroller = new Scroller();
@@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent {
32 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 32 @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
33 @State interactData: InteractDataDTO = {} as InteractDataDTO 33 @State interactData: InteractDataDTO = {} as InteractDataDTO
34 @State isPageEnd: boolean = false 34 @State isPageEnd: boolean = false
35 - 35 + @State publishTime: string = ''
36 build() { 36 build() {
37 Column() { 37 Column() {
38 if (!this.isPageEnd) { 38 if (!this.isPageEnd) {
@@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent {
40 } else { 40 } else {
41 // 发布时间 41 // 发布时间
42 Row() { 42 Row() {
43 - Image($r('app.media.icon_ren_min_ri_bao'))  
44 - .width(70) 43 + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb'))
  44 + .width(80)
45 .height(28) 45 .height(28)
46 - Text(this.contentDetailData[0]?.publishTime) 46 + Text(this.publishTime)
47 .fontColor($r('app.color.color_B0B0B0')) 47 .fontColor($r('app.color.color_B0B0B0'))
48 .fontSize($r('app.float.font_size_13')) 48 .fontSize($r('app.float.font_size_13'))
49 .height('100%') 49 .height('100%')
@@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent {
151 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) 151 let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType)
152 if (detailBeans && detailBeans.length > 0) { 152 if (detailBeans && detailBeans.length > 0) {
153 this.contentDetailData = detailBeans; 153 this.contentDetailData = detailBeans;
  154 + let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
  155 + this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN)
154 if (this.contentDetailData[0]?.recommendShow === 1) { 156 if (this.contentDetailData[0]?.recommendShow === 1) {
155 this.getRecommend() 157 this.getRecommend()
156 } 158 }
1 import { CommonConstants } from 'wdConstant' 1 import { CommonConstants } from 'wdConstant'
2 -import { ContentDTO,CompDTO } from 'wdBean' 2 +import { ContentDTO, CompDTO } from 'wdBean'
  3 +import { ProcessUtils } from '../../utils/ProcessUtils';
3 4
4 @Component 5 @Component
5 export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { 6 export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
@@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent {
59 .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) 60 .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 })
60 // .offset({x:16}) 61 // .offset({x:16})
61 .onClick(() => { 62 .onClick(() => {
62 - if (item.objectType != '0') {  
63 - console.log(item.objectId)  
64 - } 63 + ProcessUtils.processPage(item)
65 }) 64 })
66 }) 65 })
67 66
68 }.listDirection(Axis.Horizontal) 67 }.listDirection(Axis.Horizontal)
  68 + .scrollBar(BarState.Off)
69 .width('100%') 69 .width('100%')
70 70
71 // .backgroundColor($r("app.color.color_FE4B05")) 71 // .backgroundColor($r("app.color.color_FE4B05"))