陈剑华

Merge remote-tracking branch 'origin/main'

... ... @@ -6,9 +6,12 @@ import router from '@ohos.router'
@Reusable
@Component
export struct CardSourceInfo {
@State contentDTO: ContentDTO = new ContentDTO();
@State @Watch('checkData') contentDTO: ContentDTO = new ContentDTO();
@ObjectLink compDTO: CompDTO
// 特殊稿件内部item展示的来源信息
isCompInnerSource: boolean = false
// 是否有展示的信息,如来源,标签、时间、评论
@State viewShowData: boolean = true
aboutToAppear(): void {
}
... ... @@ -89,18 +92,20 @@ export struct CardSourceInfo {
build() {
Flex({ alignItems: ItemAlign.Center }) {
// 标签
if (this.contentDTO.corner) {
Text(this.contentDTO.corner)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
.margin({ right: 6 })
}
if (this.contentDTO.cornerMark) {
Text(this.contentDTO.cornerMark)
.fontSize($r("app.float.font_size_11"))
.fontColor($r("app.color.color_ED2800"))
.margin({ right: 2 })
.margin({ right: 6 })
}
// 来源信息
if (this.contentDTO.rmhPlatform === 1) {
Text(this.contentDTO.rmhInfo?.rmhName)
.fontSize($r("app.float.font_size_11"))
... ... @@ -115,6 +120,7 @@ export struct CardSourceInfo {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
// 点
if (((this.contentDTO.rmhPlatform === 1 && this.contentDTO.rmhInfo?.rmhName &&
this.contentDTO.rmhInfo?.rmhName != '') || (this.contentDTO.source && this.contentDTO.source != '')) &&
(this.getContentDtoBean()?.interactData?.commentNum
... ... @@ -143,6 +149,7 @@ export struct CardSourceInfo {
.margin({ right: 4 })
}
// 评论数
if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
Text(`${this.handlerNum(this.getContentDtoBean()?.interactData?.commentNum.toString())}评`)
... ... @@ -162,7 +169,7 @@ export struct CardSourceInfo {
}
.width(CommonConstants.FULL_WIDTH)
.margin({ top: 8 })
.margin({ top: this.viewShowData ? 8 : 0 })
}
/**
... ... @@ -178,4 +185,45 @@ export struct CardSourceInfo {
}
return this.compDTO.operDataList[0]
}
/**
* 检测是否有展示的数据
*/
checkData() {
let have = false
if (this.contentDTO.corner) {
have = true
}
if (this.contentDTO.cornerMark) {
have = true
}
if (this.contentDTO.rmhPlatform === 1) {
have = true
} else if (this.contentDTO.source) {
have = true
}
// 发布日期
if (this.showTime()) {
have = true
}
// 评论数
if (!this.isCompInnerSource && Number(this.getContentDtoBean()?.interactData?.commentNum) > 0 &&
this.showCommentNum()) {
have = true
} else {
if (this.isCompInnerSource && this.contentDTO.interactData && this.contentDTO.interactData?.commentNum > 0) {
have = true
}
}
if (have) {
} else {
this.viewShowData = false
}
}
}
\ No newline at end of file
... ...
... ... @@ -28,9 +28,8 @@ export struct Card10Component {
@State textArr: textItem[] = []
@State hideDetail: boolean = false;
basePageHelp: BasePageHelp = new BasePageHelp
// 稿件参与批查,需要对列表信息单独重绘
@State isBatchData : boolean= false
@State isBatchData: boolean = false
async aboutToAppear(): Promise<void> {
this.titleInit();
... ... @@ -126,11 +125,10 @@ export struct Card10Component {
// 专题列表--后端返回三个,
if (!this.hideDetail) {
if(this.isBatchData){
if (this.isBatchData) {
this.drawCompList()
} else {
this.drawCompList()
}else {
this.drawCompList()
}
}
... ... @@ -170,7 +168,7 @@ export struct Card10Component {
}
@Builder
drawCompList(){
drawCompList() {
Column() {
ForEach(this.contentDTO.slideShows, (item: slideShows, index: number) => {
... ... @@ -187,36 +185,37 @@ export struct Card10Component {
@Builder
timelineItem(item: slideShows, index: number) {
Row() {
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
// 有图片资源的
if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Blank()
//bottom 评论等信息
CardSourceInfo(
{
isCompInnerSource:true,
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.height(78)
.alignItems(HorizontalAlign.Start)
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
Blank()
//bottom 评论等信息
CardSourceInfo(
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.height(78)
.alignItems(HorizontalAlign.Start)
// 右侧图片
if (item.fullColumnImgUrls && item.fullColumnImgUrls[0] && item.fullColumnImgUrls[0].url) {
Stack() {
Image(this.loadImg ? item.fullColumnImgUrls[0].url : '')
.backgroundColor(0xf5f5f5)
... ... @@ -231,6 +230,33 @@ export struct Card10Component {
}
.alignContent(Alignment.BottomEnd)
.height(78)
}else{
Column() {
Stack() {
if (item.objectType == '5') {
Notes({ objectType: 5 })
}
Text(item.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontWeight(400)
.fontColor($r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.textIndent(item.objectType == '5' ? 38 : 0)
}.alignContent(Alignment.TopStart)
//bottom 评论等信息
CardSourceInfo(
{
isCompInnerSource: true,
compDTO: this.compDTO,
contentDTO: this.createContent(item)
}
)
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}
}
.padding({ top: 10, bottom: 10 })
... ... @@ -260,6 +286,4 @@ export struct Card10Component {
contentDTO.voiceInfo = { voiceDuration: Number(item.voiceDuration) as number };
return contentDTO;
}
}
\ No newline at end of file
... ...