yuzhilin

fix:动态详情页样式

@@ -29,7 +29,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel'; @@ -29,7 +29,8 @@ import { publishCommentModel } from './comment/model/PublishCommentModel';
29 import { CommentComponent } from './comment/view/CommentComponent'; 29 import { CommentComponent } from './comment/view/CommentComponent';
30 30
31 const TAG = 'DynamicDetailComponent' 31 const TAG = 'DynamicDetailComponent'
32 -@Preview 32 +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm';
  33 +// @Preview
33 @Component 34 @Component
34 export struct DynamicDetailComponent { 35 export struct DynamicDetailComponent {
35 //入参 36 //入参
@@ -53,6 +54,7 @@ export struct DynamicDetailComponent { @@ -53,6 +54,7 @@ export struct DynamicDetailComponent {
53 //跳转 54 //跳转
54 private mJumpInfo: ContentDTO = {} as ContentDTO; 55 private mJumpInfo: ContentDTO = {} as ContentDTO;
55 56
  57 + @State publishTime: string = ''
56 58
57 59
58 async aboutToAppear() { 60 async aboutToAppear() {
@@ -71,7 +73,7 @@ export struct DynamicDetailComponent { @@ -71,7 +73,7 @@ export struct DynamicDetailComponent {
71 .height($r('app.float.margin_28')) 73 .height($r('app.float.margin_28'))
72 .margin({ left: $r('app.float.margin_16') }) 74 .margin({ left: $r('app.float.margin_16') })
73 Blank() 75 Blank()
74 - Text(StringUtils.isEmpty(this.contentDetailData.publishTime)?"":this.contentDetailData.publishTime.replace('-','年').replace('-','月').replace(' ','日 ').substring(0,this.contentDetailData.publishTime.length-2)) 76 + Text(this.publishTime)
75 .fontColor($r('app.color.color_B0B0B0')) 77 .fontColor($r('app.color.color_B0B0B0'))
76 .fontSize($r('app.float.font_size_12')) 78 .fontSize($r('app.float.font_size_12'))
77 .lineHeight($r('app.float.margin_28')) 79 .lineHeight($r('app.float.margin_28'))
@@ -79,6 +81,8 @@ export struct DynamicDetailComponent { @@ -79,6 +81,8 @@ export struct DynamicDetailComponent {
79 } 81 }
80 .height($r('app.float.margin_48')) 82 .height($r('app.float.margin_48'))
81 .width('100%') 83 .width('100%')
  84 + .alignItems(VerticalAlign.Bottom)
  85 + .padding({bottom:5})
82 //分割线 86 //分割线
83 Image($r('app.media.ic_news_detail_division')) 87 Image($r('app.media.ic_news_detail_division'))
84 .width('100%') 88 .width('100%')
@@ -338,23 +342,23 @@ export struct DynamicDetailComponent { @@ -338,23 +342,23 @@ export struct DynamicDetailComponent {
338 ,left: $r('app.float.vp_12') 342 ,left: $r('app.float.vp_12')
339 ,right: $r('app.float.vp_12') }) 343 ,right: $r('app.float.vp_12') })
340 //微信/朋友圈/微博 344 //微信/朋友圈/微博
341 - Row(){  
342 - Image($r('app.media.xxhdpi_pic_wechat'))  
343 - .width($r('app.float.margin_116'))  
344 - .height($r('app.float.margin_36'))  
345 - .objectFit(ImageFit.Cover)  
346 - Image($r('app.media.xxhdpi_pic_pyq'))  
347 - .width($r('app.float.margin_116'))  
348 - .height($r('app.float.margin_36'))  
349 - .margin({ left: $r('app.float.margin_4_negative')})  
350 - .objectFit(ImageFit.Cover)  
351 - Image($r('app.media.xxhdpi_pic_wb'))  
352 - .width($r('app.float.margin_116'))  
353 - .height($r('app.float.margin_36'))  
354 - .margin({ left: $r('app.float.margin_4_negative')})  
355 - .objectFit(ImageFit.Cover)  
356 - }  
357 - .margin({ top: $r('app.float.margin_24')}) 345 + // Row(){
  346 + // Image($r('app.media.xxhdpi_pic_wechat'))
  347 + // .width($r('app.float.margin_116'))
  348 + // .height($r('app.float.margin_36'))
  349 + // .objectFit(ImageFit.Cover)
  350 + // Image($r('app.media.xxhdpi_pic_pyq'))
  351 + // .width($r('app.float.margin_116'))
  352 + // .height($r('app.float.margin_36'))
  353 + // .margin({ left: $r('app.float.margin_4_negative')})
  354 + // .objectFit(ImageFit.Cover)
  355 + // Image($r('app.media.xxhdpi_pic_wb'))
  356 + // .width($r('app.float.margin_116'))
  357 + // .height($r('app.float.margin_36'))
  358 + // .margin({ left: $r('app.float.margin_4_negative')})
  359 + // .objectFit(ImageFit.Cover)
  360 + // }
  361 + // .margin({ top: $r('app.float.margin_24')})
358 //点赞 362 //点赞
359 Row(){ 363 Row(){
360 Blank().layoutWeight(1) 364 Blank().layoutWeight(1)
@@ -435,6 +439,10 @@ export struct DynamicDetailComponent { @@ -435,6 +439,10 @@ export struct DynamicDetailComponent {
435 try { 439 try {
436 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) 440 let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
437 this.contentDetailData = data[0]; 441 this.contentDetailData = data[0];
  442 + let dateTime =
  443 + DateTimeUtils.parseDate(this.contentDetailData?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN);
  444 + let _publishTime = DateTimeUtils.formatDate(dateTime, PATTERN_DATE_CN_RN)
  445 + this.publishTime = DateTimeUtils.removeTrailingZeros(_publishTime)
438 console.log('动态详情',JSON.stringify(this.contentDetailData)) 446 console.log('动态详情',JSON.stringify(this.contentDetailData))
439 } catch (exception) { 447 } catch (exception) {
440 console.log('请求失败',JSON.stringify(exception)) 448 console.log('请求失败',JSON.stringify(exception))