Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
wangliang_wd
2024-07-12 10:01:00 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ead842540a78e4231048231c52f1dcef544ac762
ead84254
1 parent
518253d2
feat:优化专题卡跳转问题,增加已读状态
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
16 deletions
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card10Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/cardview/Card10Component.ets
View file @
ead8425
...
...
@@ -10,6 +10,7 @@ import { SearchShowRed, titleInitRes, textItem } from '../../utils/searchShowRed
import router from '@ohos.router'
import { BasePageHelp } from '../page/template/BasePageHelp';
import { Logger } from 'wdKit/Index';
import { hasClicked, persistentStorage } from '../../utils/persistentStorage';
/**
* 大专题卡--CompStyle: 10
...
...
@@ -182,27 +183,44 @@ export struct Card10Component {
}
})
}
}
@Builder
timelineItem(item: slideShows, index: number) {
Card10ComponentTimelineItem({
compDTO:this.compDTO,
slideItem:item,
contentDTO:this.contentDTO,
loadImg:this.loadImg
})
}
}
@Component
export struct Card10ComponentTimelineItem {
slideItem: slideShows = new slideShows;
@State contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
@State loadImg: boolean = false;
@State isRead: boolean = false;//已读状态
build() {
Row() {
// 有图片资源的
if (
item.fullColumnImgUrls && item.fullColumnImgUrls[0] && i
tem.fullColumnImgUrls[0].url) {
if (
this.slideItem.fullColumnImgUrls && this.slideItem.fullColumnImgUrls[0] && this.slideI
tem.fullColumnImgUrls[0].url) {
Column() {
Stack() {
if (
i
tem.objectType == '5') {
if (
this.slideI
tem.objectType == '5') {
Notes({ objectType: 5 })
}
Text(
i
tem.newsTitle)
Text(
this.slideI
tem.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor(
$r('app.color.color_222222')
)
.fontColor(
this.isRead ? 0x848484 : '#222222'
)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(
i
tem.objectType == '5' ? 38 : 0)
.textIndent(
this.slideI
tem.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
Blank()
...
...
@@ -211,7 +229,7 @@ export struct Card10Component {
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(
i
tem)
contentDTO: this.createContent(
this.slideI
tem)
}
)
}
...
...
@@ -220,7 +238,7 @@ export struct Card10Component {
.alignItems(HorizontalAlign.Start)
Stack() {
Image(this.loadImg ?
i
tem.fullColumnImgUrls[0].url : '')
Image(this.loadImg ?
this.slideI
tem.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
.width(117)
.height(78)
...
...
@@ -228,7 +246,7 @@ export struct Card10Component {
.borderRadius($r('app.float.image_border_radius'))
.margin({ left: 12 })
CardMediaInfo({
contentDTO: this.createMediaInfoContent(
i
tem)
contentDTO: this.createMediaInfoContent(
this.slideI
tem)
})
}
.alignContent(Alignment.BottomEnd)
...
...
@@ -236,16 +254,16 @@ export struct Card10Component {
}else{
Column() {
Stack() {
if (
i
tem.objectType == '5') {
if (
this.slideI
tem.objectType == '5') {
Notes({ objectType: 5 })
}
Text(
i
tem.newsTitle)
Text(
this.slideI
tem.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(
i
tem.objectType == '5' ? 38 : 0)
.textIndent(
this.slideI
tem.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
//bottom 评论等信息
...
...
@@ -253,7 +271,7 @@ export struct Card10Component {
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(
i
tem)
contentDTO: this.createContent(
this.slideI
tem)
}
)
}
...
...
@@ -264,15 +282,24 @@ export struct Card10Component {
}
.padding({ top: 10, bottom: 10 })
.onClick((event: ClickEvent) => {
this.isRead = true
persistentStorage(this.slideItem.newsId);
const str: string = JSON.stringify(this.contentDTO);
const data: ContentDTO = JSON.parse(str)
data.objectId = item.newsId
data.relId = item.relId
data.objectType = String(item.objectType)
data.objectId = this.slideItem.newsId
data.relId = this.slideItem.relId
data.linkUrl = this.slideItem.linkUrl
data.objectType = String(this.slideItem.objectType)
ProcessUtils.processPage(data)
})
}
aboutToAppear(): void {
this.isRead = hasClicked(this.slideItem.newsId, '')
}
private createContent(item: slideShows): ContentDTO {
let contentDTO = new ContentDTO()
contentDTO.publishTime = item.publishTime?.toString() || '';
...
...
Please
register
or
login
to post a comment