wangyong_wd

contentDTO新增isSearch自定义字段,区分搜索和主页数据

... ... @@ -71,6 +71,6 @@ export interface ContentDTO {
photoNum: number;
corner: string;
rmhPlatform: number;
newTags: string
newTags: string;
isSearch?: boolean; // 是否是搜索的结果,区分搜索和主页的数据
}
\ No newline at end of file
... ...
... ... @@ -32,12 +32,19 @@ export struct CardSourceInfo {
.width(16)
.height(16)
}
// TODO 这里还有个判断需要完善,依赖外部,新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
// 新闻tab下的卡片,2天之前的不显示时间。但是如果是搜索情况下展示的卡片,显示时间
if(this.contentDTO.isSearch || !this.contentDTO.isSearch && DateTimeUtils.getCommentTime
(Number
.parseFloat(this
.contentDTO.publishTime))
.indexOf
('-') === -1) {
Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime)))
.fontSize($r("app.float.font_size_12"))
.fontColor($r("app.color.color_B0B0B0"))
.margin({ right: 6 })
.flexShrink(0)
}
if(this.contentDTO?.interactData?.commentNum) {
Text(`${this.contentDTO.interactData.commentNum}评`)
.fontSize($r("app.float.font_size_12"))
... ...
... ... @@ -111,7 +111,8 @@ export struct SearchResultContentComponent{
interactData: {} as InteractDataDTO,
corner: '',
rmhPlatform: 0,
newTags: ''
newTags: '',
isSearch: true
}
this.data.push(contentDTO)
... ...
... ... @@ -52,8 +52,7 @@ export struct BannerComponent {
.borderRadius($r('app.float.image_border_radius'))
.displayCount(this.buildDisplayCount()) // 仅展示1个图片
.cachedCount(2)
.index(1) // The default index of Swiper.
.autoPlay(true)
.index(0) // The default index of Swiper.
.indicator(Indicator.dot()
.right(5)
.itemWidth(4)
... ...