Showing
4 changed files
with
18 additions
and
11 deletions
| @@ -71,6 +71,6 @@ export interface ContentDTO { | @@ -71,6 +71,6 @@ export interface ContentDTO { | ||
| 71 | photoNum: number; | 71 | photoNum: number; |
| 72 | corner: string; | 72 | corner: string; |
| 73 | rmhPlatform: number; | 73 | rmhPlatform: number; |
| 74 | - newTags: string | ||
| 75 | - | 74 | + newTags: string; |
| 75 | + isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据 | ||
| 76 | } | 76 | } |
| @@ -32,12 +32,19 @@ export struct CardSourceInfo { | @@ -32,12 +32,19 @@ export struct CardSourceInfo { | ||
| 32 | .width(16) | 32 | .width(16) |
| 33 | .height(16) | 33 | .height(16) |
| 34 | } | 34 | } |
| 35 | - // TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 | ||
| 36 | - Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 37 | - .fontSize($r("app.float.font_size_12")) | ||
| 38 | - .fontColor($r("app.color.color_B0B0B0")) | ||
| 39 | - .margin({ right: 6 }) | ||
| 40 | - .flexShrink(0) | 35 | + // 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间 |
| 36 | + if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime | ||
| 37 | + (Number | ||
| 38 | + .parseFloat(this | ||
| 39 | + .contentDTO.publishTime)) | ||
| 40 | + .indexOf | ||
| 41 | + ('-') === -1) { | ||
| 42 | + Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | ||
| 43 | + .fontSize($r("app.float.font_size_12")) | ||
| 44 | + .fontColor($r("app.color.color_B0B0B0")) | ||
| 45 | + .margin({ right: 6 }) | ||
| 46 | + .flexShrink(0) | ||
| 47 | + } | ||
| 41 | if(this.contentDTO?.interactData?.commentNum) { | 48 | if(this.contentDTO?.interactData?.commentNum) { |
| 42 | Text(`${this.contentDTO.interactData.commentNum}评`) | 49 | Text(`${this.contentDTO.interactData.commentNum}评`) |
| 43 | .fontSize($r("app.float.font_size_12")) | 50 | .fontSize($r("app.float.font_size_12")) |
| @@ -111,7 +111,8 @@ export struct SearchResultContentComponent{ | @@ -111,7 +111,8 @@ export struct SearchResultContentComponent{ | ||
| 111 | interactData: {} as InteractDataDTO, | 111 | interactData: {} as InteractDataDTO, |
| 112 | corner: '', | 112 | corner: '', |
| 113 | rmhPlatform: 0, | 113 | rmhPlatform: 0, |
| 114 | - newTags: '' | 114 | + newTags: '', |
| 115 | + isSearch: true | ||
| 115 | } | 116 | } |
| 116 | 117 | ||
| 117 | this.data.push(contentDTO) | 118 | this.data.push(contentDTO) |
| @@ -52,8 +52,7 @@ export struct BannerComponent { | @@ -52,8 +52,7 @@ export struct BannerComponent { | ||
| 52 | .borderRadius($r('app.float.image_border_radius')) | 52 | .borderRadius($r('app.float.image_border_radius')) |
| 53 | .displayCount(this.buildDisplayCount()) // 仅展示1个图片 | 53 | .displayCount(this.buildDisplayCount()) // 仅展示1个图片 |
| 54 | .cachedCount(2) | 54 | .cachedCount(2) |
| 55 | - .index(1) // The default index of Swiper. | ||
| 56 | - .autoPlay(true) | 55 | + .index(0) // The default index of Swiper. |
| 57 | .indicator(Indicator.dot() | 56 | .indicator(Indicator.dot() |
| 58 | .right(5) | 57 | .right(5) |
| 59 | .itemWidth(4) | 58 | .itemWidth(4) |
-
Please register or login to post a comment