Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
37 changed files
with
422 additions
and
216 deletions
| @@ -2,6 +2,8 @@ | @@ -2,6 +2,8 @@ | ||
| 2 | * page接口返回的Page数据DTO | 2 | * page接口返回的Page数据DTO |
| 3 | */ | 3 | */ |
| 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; | 4 | import { AdvRuleBean, CompAdvBean } from '../adv/AdvsRuleBean'; |
| 5 | +import { ArrayList } from '@kit.ArkTS'; | ||
| 6 | +import { CompDTO } from '../component/CompDTO'; | ||
| 5 | 7 | ||
| 6 | export interface PageInfoDTO { | 8 | export interface PageInfoDTO { |
| 7 | pageId: string; // 页面id | 9 | pageId: string; // 页面id |
| @@ -27,6 +29,18 @@ export interface PageInfoDTO { | @@ -27,6 +29,18 @@ export interface PageInfoDTO { | ||
| 27 | */ | 29 | */ |
| 28 | cornersAdv2: CompAdvBean[] | 30 | cornersAdv2: CompAdvBean[] |
| 29 | 31 | ||
| 32 | + | ||
| 33 | + // 本地字段 | ||
| 34 | + /* | ||
| 35 | + 记录一次请求获取到的楼层comp数据,如 完成一次刷新到结束,获取所有楼层的稿件数据 | ||
| 36 | + */ | ||
| 37 | + oneRequestPageGroupCompList: ArrayList<CompDTO> | ||
| 38 | + | ||
| 39 | + /* | ||
| 40 | + 记录页面楼层所有的信息流广告数据 | ||
| 41 | + */ | ||
| 42 | + pageAdList:CompAdvBean[] | ||
| 43 | + | ||
| 30 | } | 44 | } |
| 31 | 45 | ||
| 32 | export interface ChannelInfoDTO { | 46 | export interface ChannelInfoDTO { |
| @@ -103,7 +103,7 @@ export struct DynamicDetailComponent { | @@ -103,7 +103,7 @@ export struct DynamicDetailComponent { | ||
| 103 | //分割线 | 103 | //分割线 |
| 104 | Image($r('app.media.ic_news_detail_division')) | 104 | Image($r('app.media.ic_news_detail_division')) |
| 105 | .width('100%') | 105 | .width('100%') |
| 106 | - .height($r('app.float.margin_7')) | 106 | + .height($r('app.float.margin_9')) |
| 107 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) | 107 | .padding({ left: $r('app.float.margin_16'), right: $r('app.float.margin_16') }) |
| 108 | Stack({ alignContent: Alignment.Bottom }) { | 108 | Stack({ alignContent: Alignment.Bottom }) { |
| 109 | if (!this.isNetConnected) { | 109 | if (!this.isNetConnected) { |
| 1 | import { ContentDTO } from 'wdBean/Index'; | 1 | import { ContentDTO } from 'wdBean/Index'; |
| 2 | import { ProcessUtils } from 'wdRouter/Index'; | 2 | import { ProcessUtils } from 'wdRouter/Index'; |
| 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' | 3 | import { InteractMessageModel } from '../../model/InteractMessageModel' |
| 4 | - | 4 | +import { DateTimeUtils} from 'wdKit/Index' |
| 5 | @Component | 5 | @Component |
| 6 | export struct InteractMComponent { | 6 | export struct InteractMComponent { |
| 7 | messageModel:InteractMessageModel = new InteractMessageModel; | 7 | messageModel:InteractMessageModel = new InteractMessageModel; |
| @@ -15,6 +15,7 @@ export struct InteractMComponent { | @@ -15,6 +15,7 @@ export struct InteractMComponent { | ||
| 15 | build() { | 15 | build() { |
| 16 | Row(){ | 16 | Row(){ |
| 17 | Image(this.messageModel.InteractMsubM.headUrl) | 17 | Image(this.messageModel.InteractMsubM.headUrl) |
| 18 | + .alt($r('app.media.default_head')) | ||
| 18 | .width(36) | 19 | .width(36) |
| 19 | .height(36) | 20 | .height(36) |
| 20 | .borderRadius(18) | 21 | .borderRadius(18) |
| @@ -29,7 +30,7 @@ export struct InteractMComponent { | @@ -29,7 +30,7 @@ export struct InteractMComponent { | ||
| 29 | .margin({left:5}) | 30 | .margin({left:5}) |
| 30 | }.width('100%') | 31 | }.width('100%') |
| 31 | 32 | ||
| 32 | - Text(this.messageModel.time) | 33 | + Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+"")) |
| 33 | .margin({top:2}) | 34 | .margin({top:2}) |
| 34 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) | 35 | .fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10}) |
| 35 | 36 | ||
| @@ -41,6 +42,7 @@ export struct InteractMComponent { | @@ -41,6 +42,7 @@ export struct InteractMComponent { | ||
| 41 | .constraintSize({maxHeight:500}) | 42 | .constraintSize({maxHeight:500}) |
| 42 | } | 43 | } |
| 43 | 44 | ||
| 45 | + if(this.messageModel.contentType != '211' && this.messageModel.contentType != '210'){ | ||
| 44 | Column(){ | 46 | Column(){ |
| 45 | if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ | 47 | if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){ |
| 46 | Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) | 48 | Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500}) |
| @@ -77,6 +79,7 @@ export struct InteractMComponent { | @@ -77,6 +79,7 @@ export struct InteractMComponent { | ||
| 77 | contentDTO.objectId = this.messageModel.InteractMsubM.contentId | 79 | contentDTO.objectId = this.messageModel.InteractMsubM.contentId |
| 78 | ProcessUtils.processPage(contentDTO) | 80 | ProcessUtils.processPage(contentDTO) |
| 79 | }) | 81 | }) |
| 82 | + } | ||
| 80 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') | 83 | }.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%') |
| 81 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) | 84 | }.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top) |
| 82 | } | 85 | } |
| @@ -102,4 +105,49 @@ export struct InteractMComponent { | @@ -102,4 +105,49 @@ export struct InteractMComponent { | ||
| 102 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; | 105 | let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply; |
| 103 | return contentString; | 106 | return contentString; |
| 104 | } | 107 | } |
| 108 | + | ||
| 109 | + getPublishTime(data:string,publishTime: string): string { | ||
| 110 | + const publishTimestamp = parseInt(publishTime) | ||
| 111 | + const currentTime = Date.now(); // 当前时间戳 | ||
| 112 | + | ||
| 113 | + // 计算差异 | ||
| 114 | + const timeDifference = currentTime - publishTimestamp; | ||
| 115 | + | ||
| 116 | + // 转换为分钟、小时和天 | ||
| 117 | + const minutes = Math.floor(timeDifference / (1000 * 60)); | ||
| 118 | + const hours = Math.floor(timeDifference / (1000 * 60 * 60)); | ||
| 119 | + const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24)); | ||
| 120 | + | ||
| 121 | + // 根据时间差返回对应的字符串 | ||
| 122 | + let result: string; | ||
| 123 | + | ||
| 124 | + if (minutes < 60) { | ||
| 125 | + result = `${minutes}分钟前`; | ||
| 126 | + if (minutes === 0) { | ||
| 127 | + result = `刚刚`; | ||
| 128 | + } | ||
| 129 | + } else if (hours < 24) { | ||
| 130 | + result = `${hours}小时前`; | ||
| 131 | + } else { | ||
| 132 | + result = `${days}天前`; | ||
| 133 | + if (days > 1) { | ||
| 134 | + let arr = data.split(" ") | ||
| 135 | + if (arr.length === 2) { | ||
| 136 | + let arr2 = arr[0].split("-") | ||
| 137 | + if (arr2.length === 3) { | ||
| 138 | + result = `${arr2[1]}-${arr2[2]}` | ||
| 139 | + } | ||
| 140 | + } else { | ||
| 141 | + //原始数据是时间戳 需要转成dateString | ||
| 142 | + let time = DateTimeUtils.formatDate(Number(publishTime)) | ||
| 143 | + let arr = time.split("-") | ||
| 144 | + if (arr.length === 3) { | ||
| 145 | + result = `${arr[1]}-${arr[2]}` | ||
| 146 | + } | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + console.log(result); | ||
| 151 | + return result | ||
| 152 | + } | ||
| 105 | } | 153 | } |
| @@ -11,19 +11,19 @@ export struct CardSourceInfo { | @@ -11,19 +11,19 @@ export struct CardSourceInfo { | ||
| 11 | Flex() { | 11 | Flex() { |
| 12 | if (this.contentDTO.corner) { | 12 | if (this.contentDTO.corner) { |
| 13 | Text(this.contentDTO.corner) | 13 | Text(this.contentDTO.corner) |
| 14 | - .fontSize($r("app.float.font_size_12")) | 14 | + .fontSize($r("app.float.font_size_11")) |
| 15 | .fontColor($r("app.color.color_ED2800")) | 15 | .fontColor($r("app.color.color_ED2800")) |
| 16 | .margin({ right: 2 }) | 16 | .margin({ right: 2 }) |
| 17 | } | 17 | } |
| 18 | if (this.contentDTO.rmhPlatform === 1) { | 18 | if (this.contentDTO.rmhPlatform === 1) { |
| 19 | Text(this.contentDTO.rmhInfo?.rmhName) | 19 | Text(this.contentDTO.rmhInfo?.rmhName) |
| 20 | - .fontSize($r("app.float.font_size_12")) | 20 | + .fontSize($r("app.float.font_size_11")) |
| 21 | .fontColor($r("app.color.color_B0B0B0")) | 21 | .fontColor($r("app.color.color_B0B0B0")) |
| 22 | .maxLines(1) | 22 | .maxLines(1) |
| 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 24 | } else if (this.contentDTO.source) { | 24 | } else if (this.contentDTO.source) { |
| 25 | Text(`${this.contentDTO.source}`) | 25 | Text(`${this.contentDTO.source}`) |
| 26 | - .fontSize($r("app.float.font_size_12")) | 26 | + .fontSize($r("app.float.font_size_11")) |
| 27 | .fontColor($r("app.color.color_B0B0B0")) | 27 | .fontColor($r("app.color.color_B0B0B0")) |
| 28 | .maxLines(1) | 28 | .maxLines(1) |
| 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 29 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -43,13 +43,13 @@ export struct CardSourceInfo { | @@ -43,13 +43,13 @@ export struct CardSourceInfo { | ||
| 43 | .height(16) | 43 | .height(16) |
| 44 | } | 44 | } |
| 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) | 45 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(this.contentDTO.publishTime))) |
| 46 | - .fontSize($r("app.float.font_size_12")) | 46 | + .fontSize($r("app.float.font_size_11")) |
| 47 | .fontColor($r("app.color.color_B0B0B0")) | 47 | .fontColor($r("app.color.color_B0B0B0")) |
| 48 | .flexShrink(0) | 48 | .flexShrink(0) |
| 49 | } | 49 | } |
| 50 | if (this.getContentDtoBean()?.interactData?.commentNum) { | 50 | if (this.getContentDtoBean()?.interactData?.commentNum) { |
| 51 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) | 51 | Text(`${this.getContentDtoBean()?.interactData?.commentNum}评`) |
| 52 | - .fontSize($r("app.float.font_size_12")) | 52 | + .fontSize($r("app.float.font_size_11")) |
| 53 | .fontColor($r("app.color.color_B0B0B0")) | 53 | .fontColor($r("app.color.color_B0B0B0")) |
| 54 | .flexShrink(0) | 54 | .flexShrink(0) |
| 55 | .margin({ left: 6 }) | 55 | .margin({ left: 6 }) |
| @@ -51,7 +51,7 @@ export struct Card10Component { | @@ -51,7 +51,7 @@ export struct Card10Component { | ||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | .width(CommonConstants.FULL_WIDTH) | 53 | .width(CommonConstants.FULL_WIDTH) |
| 54 | - .fontSize($r('app.float.font_size_17')) | 54 | + .fontSize($r('app.float.font_size_18')) |
| 55 | .fontWeight(600) | 55 | .fontWeight(600) |
| 56 | .maxLines(2) | 56 | .maxLines(2) |
| 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 57 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -52,7 +52,7 @@ export struct Card11Component { | @@ -52,7 +52,7 @@ export struct Card11Component { | ||
| 52 | Span(this.contentDTO.newsTitle) | 52 | Span(this.contentDTO.newsTitle) |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | - .fontSize($r("app.float.font_size_16")) | 55 | + .fontSize($r("app.float.font_size_18")) |
| 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 56 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 57 | .maxLines(3) | 57 | .maxLines(3) |
| 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 58 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -50,7 +50,7 @@ export struct Card12Component { | @@ -50,7 +50,7 @@ export struct Card12Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r('app.float.font_size_17')) | 53 | + .fontSize($r('app.float.font_size_18')) |
| 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| @@ -54,7 +54,7 @@ export struct Card14Component { | @@ -54,7 +54,7 @@ export struct Card14Component { | ||
| 54 | Span(this.contentDTO.newsTitle) | 54 | Span(this.contentDTO.newsTitle) |
| 55 | } | 55 | } |
| 56 | } | 56 | } |
| 57 | - .fontSize($r('app.float.font_size_17')) | 57 | + .fontSize($r('app.float.font_size_18')) |
| 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .textOverflowStyle(3) | 59 | .textOverflowStyle(3) |
| 60 | .lineHeight(25) | 60 | .lineHeight(25) |
| @@ -55,7 +55,7 @@ export struct Card15Component { | @@ -55,7 +55,7 @@ export struct Card15Component { | ||
| 55 | Span(this.contentDTO.newsTitle) | 55 | Span(this.contentDTO.newsTitle) |
| 56 | } | 56 | } |
| 57 | } | 57 | } |
| 58 | - .fontSize($r('app.float.font_size_17')) | 58 | + .fontSize($r('app.float.font_size_18')) |
| 59 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 59 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 60 | .width(CommonConstants.FULL_WIDTH) | 60 | .width(CommonConstants.FULL_WIDTH) |
| 61 | .textOverflowStyle(2) | 61 | .textOverflowStyle(2) |
| @@ -58,7 +58,7 @@ export struct Card16Component { | @@ -58,7 +58,7 @@ export struct Card16Component { | ||
| 58 | Span(this.contentDTO.newsTitle) | 58 | Span(this.contentDTO.newsTitle) |
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | - .fontSize($r('app.float.font_size_17')) | 61 | + .fontSize($r('app.float.font_size_18')) |
| 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 62 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 63 | .width(CommonConstants.FULL_WIDTH) | 63 | .width(CommonConstants.FULL_WIDTH) |
| 64 | .textOverflowStyle(2) | 64 | .textOverflowStyle(2) |
| @@ -49,7 +49,7 @@ export struct Card17Component { | @@ -49,7 +49,7 @@ export struct Card17Component { | ||
| 49 | } | 49 | } |
| 50 | } | 50 | } |
| 51 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 51 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 52 | - .fontSize($r('app.float.font_size_17')) | 52 | + .fontSize($r('app.float.font_size_18')) |
| 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 54 | .lineHeight(25) | 54 | .lineHeight(25) |
| 55 | .maxLines(3) | 55 | .maxLines(3) |
| @@ -49,12 +49,12 @@ export struct Card19Component { | @@ -49,12 +49,12 @@ export struct Card19Component { | ||
| 49 | Span(this.contentDTO.newsTitle) | 49 | Span(this.contentDTO.newsTitle) |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | - .fontSize($r('app.float.font_size_17')) | 52 | + .fontSize($r('app.float.font_size_18')) |
| 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 53 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 54 | .textOverflowStyle(3) | 54 | .textOverflowStyle(3) |
| 55 | .margin({ bottom: 8 }) | 55 | .margin({ bottom: 8 }) |
| 56 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 57 | - .lineHeight(22) | 57 | + .lineHeight(25) |
| 58 | .onClick((event: ClickEvent) => { | 58 | .onClick((event: ClickEvent) => { |
| 59 | this.clicked = true; | 59 | this.clicked = true; |
| 60 | ProcessUtils.processPage(this.contentDTO) | 60 | ProcessUtils.processPage(this.contentDTO) |
| @@ -50,7 +50,7 @@ export struct Card20Component { | @@ -50,7 +50,7 @@ export struct Card20Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r('app.float.font_size_17')) | 53 | + .fontSize($r('app.float.font_size_18')) |
| 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 54 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 55 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textOverflowStyle(3) | 56 | .textOverflowStyle(3) |
| @@ -52,7 +52,7 @@ export struct Card21Component { | @@ -52,7 +52,7 @@ export struct Card21Component { | ||
| 52 | Span(this.contentDTO.newsTitle) | 52 | Span(this.contentDTO.newsTitle) |
| 53 | } | 53 | } |
| 54 | } | 54 | } |
| 55 | - .fontSize($r('app.float.selected_text_size')) | 55 | + .fontSize(18) |
| 56 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 56 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 57 | .width(CommonConstants.FULL_WIDTH) | 57 | .width(CommonConstants.FULL_WIDTH) |
| 58 | .maxLines(4) | 58 | .maxLines(4) |
| @@ -49,7 +49,9 @@ export struct Card2Component { | @@ -49,7 +49,9 @@ export struct Card2Component { | ||
| 49 | Column() { | 49 | Column() { |
| 50 | Stack() { | 50 | Stack() { |
| 51 | //新闻标题 | 51 | //新闻标题 |
| 52 | - if (this.contentDTO.objectType == '5') { | 52 | + if (this.contentDTO.newTags) { |
| 53 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 54 | + } else if (this.contentDTO.objectType == '5') { | ||
| 53 | Notes({ objectType: this.contentDTO.objectType }) | 55 | Notes({ objectType: this.contentDTO.objectType }) |
| 54 | } | 56 | } |
| 55 | 57 | ||
| @@ -63,14 +65,18 @@ export struct Card2Component { | @@ -63,14 +65,18 @@ export struct Card2Component { | ||
| 63 | Span(this.contentDTO.newsTitle) | 65 | Span(this.contentDTO.newsTitle) |
| 64 | } | 66 | } |
| 65 | } | 67 | } |
| 66 | - .fontSize($r('app.float.font_size_17')) | 68 | + .fontSize($r('app.float.font_size_18')) |
| 67 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 69 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 68 | .maxLines(2) | 70 | .maxLines(2) |
| 69 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 | 71 | .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 70 | .align(Alignment.Start) | 72 | .align(Alignment.Start) |
| 71 | - .textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 72 | - } | ||
| 73 | - .alignContent(Alignment.TopStart) | 73 | + .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 74 | + (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | ||
| 75 | + this.contentDTO.objectType == '5' ? 30 : 0) | ||
| 76 | + }.alignContent(Alignment.TopStart) | ||
| 77 | + //.textIndent(this.contentDTO.objectType == '5' ? 35 : 0) | ||
| 78 | + // } | ||
| 79 | + // .alignContent(Alignment.TopStart) | ||
| 74 | 80 | ||
| 75 | //大图 | 81 | //大图 |
| 76 | Stack() { | 82 | Stack() { |
| @@ -50,7 +50,8 @@ export struct Card3Component { | @@ -50,7 +50,8 @@ export struct Card3Component { | ||
| 50 | Span(this.contentDTO.newsTitle) | 50 | Span(this.contentDTO.newsTitle) |
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | - .fontSize($r("app.float.font_size_16")) | 53 | + .lineHeight(27) |
| 54 | + .fontSize($r("app.float.font_size_18")) | ||
| 54 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) | 55 | .fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222")) |
| 55 | .width(CommonConstants.FULL_WIDTH) | 56 | .width(CommonConstants.FULL_WIDTH) |
| 56 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 57 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| @@ -4,7 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | @@ -4,7 +4,7 @@ import { ProcessUtils } from 'wdRouter'; | ||
| 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' | 4 | import { CardSourceInfo } from '../cardCommon/CardSourceInfo' |
| 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 5 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; | 6 | import { onlyWifiLoadImg } from '../../utils/lazyloadImg'; |
| 7 | - | 7 | +import { Notes } from './notes'; |
| 8 | const TAG: string = 'Card4Component'; | 8 | const TAG: string = 'Card4Component'; |
| 9 | 9 | ||
| 10 | /** | 10 | /** |
| @@ -44,6 +44,11 @@ export struct Card4Component { | @@ -44,6 +44,11 @@ export struct Card4Component { | ||
| 44 | //body | 44 | //body |
| 45 | Column() { | 45 | Column() { |
| 46 | //新闻标题 | 46 | //新闻标题 |
| 47 | + if (this.contentDTO.newTags) { | ||
| 48 | + Notes({ newTags: this.contentDTO.newTags }) | ||
| 49 | + } else if (this.contentDTO.objectType == '5') { | ||
| 50 | + Notes({ objectType: this.contentDTO.objectType }) | ||
| 51 | + } | ||
| 47 | Text() { | 52 | Text() { |
| 48 | if (this.titleMarked) { | 53 | if (this.titleMarked) { |
| 49 | Span(this.str01) | 54 | Span(this.str01) |
| @@ -54,10 +59,12 @@ export struct Card4Component { | @@ -54,10 +59,12 @@ export struct Card4Component { | ||
| 54 | Span(this.contentDTO.newsTitle) | 59 | Span(this.contentDTO.newsTitle) |
| 55 | } | 60 | } |
| 56 | } | 61 | } |
| 57 | - .fontSize($r('app.float.font_size_17')) | 62 | + .fontSize($r('app.float.font_size_18')) |
| 58 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 63 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 59 | .maxLines(3) | 64 | .maxLines(3) |
| 60 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 65 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| 66 | + | ||
| 67 | + | ||
| 61 | //三图 | 68 | //三图 |
| 62 | Stack(){ | 69 | Stack(){ |
| 63 | Row() { | 70 | Row() { |
| @@ -71,10 +71,11 @@ export struct Card5Component { | @@ -71,10 +71,11 @@ export struct Card5Component { | ||
| 71 | } | 71 | } |
| 72 | .width(CommonConstants.FULL_WIDTH) | 72 | .width(CommonConstants.FULL_WIDTH) |
| 73 | .fontColor(Color.White) | 73 | .fontColor(Color.White) |
| 74 | - .fontSize($r('app.float.font_size_17')) | 74 | + .fontSize($r('app.float.font_size_18')) |
| 75 | .fontWeight(FontWeight.Bold) | 75 | .fontWeight(FontWeight.Bold) |
| 76 | .maxLines(2) | 76 | .maxLines(2) |
| 77 | .align(Alignment.TopStart) | 77 | .align(Alignment.TopStart) |
| 78 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | ||
| 78 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : | 79 | .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : |
| 79 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || | 80 | (this.contentDTO.newTags?.length != 0 && this.contentDTO.newTags?.length) || |
| 80 | this.contentDTO.objectType == '5' ? 30 : 0) | 81 | this.contentDTO.objectType == '5' ? 30 : 0) |
| @@ -70,8 +70,8 @@ export struct Card6Component { | @@ -70,8 +70,8 @@ export struct Card6Component { | ||
| 70 | } | 70 | } |
| 71 | } | 71 | } |
| 72 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 72 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 73 | - .fontSize(16) | ||
| 74 | - .lineHeight(24) | 73 | + .fontSize(18) |
| 74 | + .lineHeight(27) | ||
| 75 | .fontWeight(FontWeight.Normal) | 75 | .fontWeight(FontWeight.Normal) |
| 76 | .maxLines(3) | 76 | .maxLines(3) |
| 77 | .alignSelf(ItemAlign.Start) | 77 | .alignSelf(ItemAlign.Start) |
| @@ -50,7 +50,7 @@ export struct Card9Component { | @@ -50,7 +50,7 @@ export struct Card9Component { | ||
| 50 | } | 50 | } |
| 51 | .fontColor(this.clicked ? 0x848484 : 0x222222) | 51 | .fontColor(this.clicked ? 0x848484 : 0x222222) |
| 52 | .width(CommonConstants.FULL_WIDTH) | 52 | .width(CommonConstants.FULL_WIDTH) |
| 53 | - .fontSize($r('app.float.font_size_17')) | 53 | + .fontSize($r('app.float.font_size_18')) |
| 54 | .fontWeight(600) | 54 | .fontWeight(600) |
| 55 | .maxLines(2) | 55 | .maxLines(2) |
| 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| @@ -36,7 +36,7 @@ export struct SearchContentComponent { | @@ -36,7 +36,7 @@ export struct SearchContentComponent { | ||
| 36 | Column() { | 36 | Column() { |
| 37 | //新闻标题 | 37 | //新闻标题 |
| 38 | Text(this.contentDTO.newsTitle) | 38 | Text(this.contentDTO.newsTitle) |
| 39 | - .fontSize($r('app.float.font_size_17')) | 39 | + .fontSize($r('app.float.font_size_18')) |
| 40 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) | 40 | .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) |
| 41 | .maxLines(3) | 41 | .maxLines(3) |
| 42 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 42 | .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 |
| @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | @@ -208,7 +208,7 @@ struct CarouselLayout01CardView { | ||
| 208 | Text(`${this.item.corner}${this.item.newsTitle}`) | 208 | Text(`${this.item.corner}${this.item.newsTitle}`) |
| 209 | .width(CommonConstants.FULL_PARENT) | 209 | .width(CommonConstants.FULL_PARENT) |
| 210 | .fontColor(Color.White) | 210 | .fontColor(Color.White) |
| 211 | - .fontSize($r('app.float.font_size_16')) | 211 | + .fontSize($r('app.float.font_size_18')) |
| 212 | .fontWeight(FontWeight.Medium) | 212 | .fontWeight(FontWeight.Medium) |
| 213 | .textAlign(TextAlign.Start) | 213 | .textAlign(TextAlign.Start) |
| 214 | .align(Alignment.Bottom) | 214 | .align(Alignment.Bottom) |
| @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 { | ||
| 57 | .width(12) | 57 | .width(12) |
| 58 | .margin({ left: 12, right: 8 }) | 58 | .margin({ left: 12, right: 8 }) |
| 59 | Text(item.newsTitle) | 59 | Text(item.newsTitle) |
| 60 | - .fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400) | 60 | + .fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400) |
| 61 | .maxLines(1) | 61 | .maxLines(1) |
| 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 62 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 63 | .layoutWeight(1) | 63 | .layoutWeight(1) |
| @@ -101,7 +101,7 @@ struct localCard { | @@ -101,7 +101,7 @@ struct localCard { | ||
| 101 | Text(this.operDataListItem.newsTitle) | 101 | Text(this.operDataListItem.newsTitle) |
| 102 | .width(CommonConstants.FULL_PARENT) | 102 | .width(CommonConstants.FULL_PARENT) |
| 103 | .height(CommonConstants.FULL_PARENT) | 103 | .height(CommonConstants.FULL_PARENT) |
| 104 | - .fontSize($r('app.float.font_size_16')) | 104 | + .fontSize($r('app.float.font_size_18')) |
| 105 | .fontColor('#000000') | 105 | .fontColor('#000000') |
| 106 | .align(Alignment.TopStart) | 106 | .align(Alignment.TopStart) |
| 107 | .maxLines(3) | 107 | .maxLines(3) |
| @@ -168,7 +168,7 @@ export struct ZhSingleRow06 { | @@ -168,7 +168,7 @@ export struct ZhSingleRow06 { | ||
| 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl | 168 | ? item.operDataList[0]?.commentInfo?.userHeaderUrl |
| 169 | ? item.operDataList[0].commentInfo.userHeaderUrl | 169 | ? item.operDataList[0].commentInfo.userHeaderUrl |
| 170 | : $r('app.media.default_head') | 170 | : $r('app.media.default_head') |
| 171 | - : '') | 171 | + : $r('app.media.comment_rmh_tag')) |
| 172 | .width(32) | 172 | .width(32) |
| 173 | .height(32) | 173 | .height(32) |
| 174 | .borderRadius(16) | 174 | .borderRadius(16) |
| @@ -31,21 +31,26 @@ struct InteractMessagePage { | @@ -31,21 +31,26 @@ struct InteractMessagePage { | ||
| 31 | if(this.browSingModel.viewType == ViewType.ERROR){ | 31 | if(this.browSingModel.viewType == ViewType.ERROR){ |
| 32 | EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) | 32 | EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed}) |
| 33 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ | 33 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ |
| 34 | - EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | 34 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoMessage}) |
| 35 | }else { | 35 | }else { |
| 36 | CustomPullToRefresh({ | 36 | CustomPullToRefresh({ |
| 37 | alldata:this.allDatas, | 37 | alldata:this.allDatas, |
| 38 | scroller:this.scroller, | 38 | scroller:this.scroller, |
| 39 | + hasMore:this.browSingModel.hasMore, | ||
| 39 | customList:()=>{ | 40 | customList:()=>{ |
| 40 | this.ListLayout() | 41 | this.ListLayout() |
| 41 | }, | 42 | }, |
| 42 | onRefresh:(resolve)=>{ | 43 | onRefresh:(resolve)=>{ |
| 43 | - this.browSingModel.currentPage = 0 | 44 | + this.currentPage = 1 |
| 44 | this.getData(resolve) | 45 | this.getData(resolve) |
| 45 | }, | 46 | }, |
| 46 | onLoadMore:(resolve)=> { | 47 | onLoadMore:(resolve)=> { |
| 47 | - this.browSingModel.currentPage++ | ||
| 48 | - this.getData() | 48 | + if (this.browSingModel.hasMore === false) { |
| 49 | + if(resolve) resolve('') | ||
| 50 | + return | ||
| 51 | + } | ||
| 52 | + this.currentPage++ | ||
| 53 | + this.getData(resolve) | ||
| 49 | } | 54 | } |
| 50 | }) | 55 | }) |
| 51 | } | 56 | } |
| @@ -75,6 +80,7 @@ struct InteractMessagePage { | @@ -75,6 +80,7 @@ struct InteractMessagePage { | ||
| 75 | } | 80 | } |
| 76 | } | 81 | } |
| 77 | } | 82 | } |
| 83 | + .scrollBar(BarState.Off) | ||
| 78 | .height(CommonConstants.FULL_PARENT) | 84 | .height(CommonConstants.FULL_PARENT) |
| 79 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | 85 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 |
| 80 | } | 86 | } |
| @@ -120,18 +126,19 @@ struct InteractMessagePage { | @@ -120,18 +126,19 @@ struct InteractMessagePage { | ||
| 120 | for (let index = 0; index < InteractMessageMItem.list.length; index++) { | 126 | for (let index = 0; index < InteractMessageMItem.list.length; index++) { |
| 121 | const element = InteractMessageMItem.list[index]; | 127 | const element = InteractMessageMItem.list[index]; |
| 122 | element.InteractMsubM = JSON.parse(element.remark) | 128 | element.InteractMsubM = JSON.parse(element.remark) |
| 129 | + this.allDatas.push(element) | ||
| 123 | } | 130 | } |
| 124 | 131 | ||
| 125 | - this.allDatas.push(...InteractMessageMItem.list) | ||
| 126 | - if (InteractMessageMItem.list.length === this.browSingModel.pageSize) { | ||
| 127 | - this.browSingModel.currentPage++; | ||
| 128 | - this.browSingModel.hasMore = true; | ||
| 129 | - } else { | 132 | + if (InteractMessageMItem.hasNext === 0) { |
| 130 | this.browSingModel.hasMore = false; | 133 | this.browSingModel.hasMore = false; |
| 134 | + } else { | ||
| 135 | + this.browSingModel.hasMore = true; | ||
| 131 | } | 136 | } |
| 132 | } else { | 137 | } else { |
| 138 | + if (this.currentPage === 1) { | ||
| 133 | this.browSingModel.viewType = ViewType.EMPTY; | 139 | this.browSingModel.viewType = ViewType.EMPTY; |
| 134 | } | 140 | } |
| 141 | + } | ||
| 135 | }) | 142 | }) |
| 136 | } | 143 | } |
| 137 | 144 |
| @@ -114,6 +114,7 @@ struct MyCollectionListPage { | @@ -114,6 +114,7 @@ struct MyCollectionListPage { | ||
| 114 | if (this.browSingModel.hasMore === false) NoMoreLayout() | 114 | if (this.browSingModel.hasMore === false) NoMoreLayout() |
| 115 | } | 115 | } |
| 116 | } | 116 | } |
| 117 | + .scrollBar(BarState.Off) | ||
| 117 | .height(CommonConstants.FULL_PARENT) | 118 | .height(CommonConstants.FULL_PARENT) |
| 118 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | 119 | .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 |
| 119 | } | 120 | } |
| 1 | import router from '@ohos.router' | 1 | import router from '@ohos.router' |
| 2 | -import { StringUtils, ToastUtils } from 'wdKit' | 2 | +import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit' |
| 3 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 3 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 4 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' | 4 | import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem' |
| 5 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' | 5 | import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem' |
| 6 | +import { EmptyComponent } from '../view/EmptyComponent' | ||
| 6 | import { SearchHistoryComponent } from './SearchHistoryComponent' | 7 | import { SearchHistoryComponent } from './SearchHistoryComponent' |
| 7 | import { SearchHotsComponent } from './SearchHotsComponent' | 8 | import { SearchHotsComponent } from './SearchHotsComponent' |
| 8 | import { SearchRelatedComponent } from './SearchRelatedComponent' | 9 | import { SearchRelatedComponent } from './SearchRelatedComponent' |
| @@ -30,6 +31,7 @@ export struct SearchComponent { | @@ -30,6 +31,7 @@ export struct SearchComponent { | ||
| 30 | scroller: Scroller = new Scroller() | 31 | scroller: Scroller = new Scroller() |
| 31 | @State count:string[] = [] | 32 | @State count:string[] = [] |
| 32 | @State isGetRequest:boolean = false; | 33 | @State isGetRequest:boolean = false; |
| 34 | + @State isConnectNetwork : boolean = NetworkUtil.isNetConnected() | ||
| 33 | 35 | ||
| 34 | aboutToAppear() { | 36 | aboutToAppear() { |
| 35 | //获取提示滚动 | 37 | //获取提示滚动 |
| @@ -127,8 +129,16 @@ export struct SearchComponent { | @@ -127,8 +129,16 @@ export struct SearchComponent { | ||
| 127 | .padding({ left: '31lpx', right: '31lpx' }) | 129 | .padding({ left: '31lpx', right: '31lpx' }) |
| 128 | } else { | 130 | } else { |
| 129 | if (this.hasChooseSearch) { | 131 | if (this.hasChooseSearch) { |
| 132 | + if(!this.isConnectNetwork){ | ||
| 133 | + EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => { | ||
| 134 | + this.getSearchInputResData(this.searchText) | ||
| 135 | + }}) | ||
| 136 | + .layoutWeight(1) | ||
| 137 | + .width('100%') | ||
| 138 | + }else{ | ||
| 130 | //搜索结果 | 139 | //搜索结果 |
| 131 | SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) | 140 | SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) |
| 141 | + } | ||
| 132 | } else { | 142 | } else { |
| 133 | //联想搜索 | 143 | //联想搜索 |
| 134 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) | 144 | SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText}) |
| @@ -138,7 +148,6 @@ export struct SearchComponent { | @@ -138,7 +148,6 @@ export struct SearchComponent { | ||
| 138 | .width('100%') | 148 | .width('100%') |
| 139 | } | 149 | } |
| 140 | 150 | ||
| 141 | - | ||
| 142 | /** | 151 | /** |
| 143 | * 点击搜索记录列表回调 | 152 | * 点击搜索记录列表回调 |
| 144 | * @param content | 153 | * @param content |
| @@ -330,10 +339,12 @@ export struct SearchComponent { | @@ -330,10 +339,12 @@ export struct SearchComponent { | ||
| 330 | } | 339 | } |
| 331 | this.isGetRequest = true | 340 | this.isGetRequest = true |
| 332 | this.resetSearch() | 341 | this.resetSearch() |
| 342 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 333 | }).catch((err: Error) => { | 343 | }).catch((err: Error) => { |
| 334 | console.log(TAG, JSON.stringify(err)) | 344 | console.log(TAG, JSON.stringify(err)) |
| 335 | this.isGetRequest = true | 345 | this.isGetRequest = true |
| 336 | this.resetSearch() | 346 | this.resetSearch() |
| 347 | + this.isConnectNetwork = NetworkUtil.isNetConnected() | ||
| 337 | }) | 348 | }) |
| 338 | } | 349 | } |
| 339 | 350 |
| @@ -132,6 +132,11 @@ export struct OperRowListView { | @@ -132,6 +132,11 @@ export struct OperRowListView { | ||
| 132 | build() { | 132 | build() { |
| 133 | // 视频详情页 | 133 | // 视频详情页 |
| 134 | 134 | ||
| 135 | + Column() { | ||
| 136 | + Image($r('app.media.ic_news_detail_division')) | ||
| 137 | + .width('100%') | ||
| 138 | + .height($r('app.float.margin_4')) | ||
| 139 | + | ||
| 135 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { | 140 | Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { |
| 136 | // AudioDialog() | 141 | // AudioDialog() |
| 137 | Row() { | 142 | Row() { |
| @@ -150,7 +155,7 @@ export struct OperRowListView { | @@ -150,7 +155,7 @@ export struct OperRowListView { | ||
| 150 | } | 155 | } |
| 151 | router.back(); | 156 | router.back(); |
| 152 | }) | 157 | }) |
| 153 | - .width(42) | 158 | + .width(48) |
| 154 | 159 | ||
| 155 | if (this.contentDetailData?.newsId) { | 160 | if (this.contentDetailData?.newsId) { |
| 156 | ForEach(this.operationButtonList, (item: string, index: number) => { | 161 | ForEach(this.operationButtonList, (item: string, index: number) => { |
| @@ -180,6 +185,7 @@ export struct OperRowListView { | @@ -180,6 +185,7 @@ export struct OperRowListView { | ||
| 180 | bottom: `${this.bottomSafeHeight}px` | 185 | bottom: `${this.bottomSafeHeight}px` |
| 181 | // bottom: 50 | 186 | // bottom: 50 |
| 182 | }) | 187 | }) |
| 188 | + } | ||
| 183 | 189 | ||
| 184 | } | 190 | } |
| 185 | 191 | ||
| @@ -200,7 +206,7 @@ export struct OperRowListView { | @@ -200,7 +206,7 @@ export struct OperRowListView { | ||
| 200 | } | 206 | } |
| 201 | .layoutWeight(1) | 207 | .layoutWeight(1) |
| 202 | .margin({ | 208 | .margin({ |
| 203 | - right: this.pageComponentType === 1 ? 16 : 0, | 209 | + right: this.pageComponentType === 1 ? 22 : 0, |
| 204 | }) | 210 | }) |
| 205 | 211 | ||
| 206 | if (this.showCommentIcon) { | 212 | if (this.showCommentIcon) { |
| @@ -212,7 +218,7 @@ export struct OperRowListView { | @@ -212,7 +218,7 @@ export struct OperRowListView { | ||
| 212 | }) | 218 | }) |
| 213 | } | 219 | } |
| 214 | } | 220 | } |
| 215 | - .width(46) | 221 | + .width(48) |
| 216 | } | 222 | } |
| 217 | 223 | ||
| 218 | } | 224 | } |
| @@ -233,7 +239,7 @@ export struct OperRowListView { | @@ -233,7 +239,7 @@ export struct OperRowListView { | ||
| 233 | }) | 239 | }) |
| 234 | // } | 240 | // } |
| 235 | } | 241 | } |
| 236 | - .width(42) | 242 | + .width(48) |
| 237 | .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) | 243 | .visibility(this.likesStyle !== 4 ? Visibility.Visible : Visibility.None) |
| 238 | } | 244 | } |
| 239 | 245 | ||
| @@ -261,7 +267,7 @@ export struct OperRowListView { | @@ -261,7 +267,7 @@ export struct OperRowListView { | ||
| 261 | })*/ | 267 | })*/ |
| 262 | } | 268 | } |
| 263 | .height(36) | 269 | .height(36) |
| 264 | - .width(36) | 270 | + .width(48) |
| 265 | .borderRadius(18) | 271 | .borderRadius(18) |
| 266 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | 272 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) |
| 267 | .onClick(() => { | 273 | .onClick(() => { |
| @@ -289,7 +295,7 @@ export struct OperRowListView { | @@ -289,7 +295,7 @@ export struct OperRowListView { | ||
| 289 | }) | 295 | }) |
| 290 | } | 296 | } |
| 291 | .height(36) | 297 | .height(36) |
| 292 | - .width(36) | 298 | + .width(48) |
| 293 | .justifyContent(FlexAlign.Center) | 299 | .justifyContent(FlexAlign.Center) |
| 294 | } | 300 | } |
| 295 | 301 | ||
| @@ -312,7 +318,7 @@ export struct OperRowListView { | @@ -312,7 +318,7 @@ export struct OperRowListView { | ||
| 312 | } | 318 | } |
| 313 | .justifyContent(FlexAlign.Center) | 319 | .justifyContent(FlexAlign.Center) |
| 314 | .height(36) | 320 | .height(36) |
| 315 | - .width(36) | 321 | + .width(48) |
| 316 | .borderRadius(18) | 322 | .borderRadius(18) |
| 317 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) | 323 | .backgroundColor(this.pageComponentType === 2 ? '#4D000000' : Color.Transparent) |
| 318 | } | 324 | } |
| 1 | -import { CompDTO, ContentDTO, InteractDataDTO, PageDTO, PageInfoDTO } from 'wdBean'; | 1 | +import { CompDTO, ContentDTO, InteractDataDTO, LiveReviewDTO, PageDTO, PageInfoDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; | 3 | import { CollectionUtils, DateTimeUtils, LazyDataSource, Logger, NetworkUtil, StringUtils } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| @@ -13,6 +13,7 @@ import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean | @@ -13,6 +13,7 @@ import { CompAdvMatInfoBean } from 'wdBean/src/main/ets/bean/adv/CompAdvInfoBean | ||
| 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; | 13 | import { BaseDTO } from 'wdBean/src/main/ets/bean/component/BaseDTO'; |
| 14 | import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' | 14 | import { viewBlogInsightIntentShare, ActionMode } from '../utils/InsightIntentShare' |
| 15 | import { common } from '@kit.AbilityKit'; | 15 | import { common } from '@kit.AbilityKit'; |
| 16 | + | ||
| 16 | const TAG = 'PageHelper'; | 17 | const TAG = 'PageHelper'; |
| 17 | 18 | ||
| 18 | /** | 19 | /** |
| @@ -75,7 +76,7 @@ export class PageHelper { | @@ -75,7 +76,7 @@ export class PageHelper { | ||
| 75 | return; | 76 | return; |
| 76 | } | 77 | } |
| 77 | pageModel.pageInfo = pageInfo; | 78 | pageModel.pageInfo = pageInfo; |
| 78 | - //解析广告资源 | 79 | + //解析页面挂角广告资源 |
| 79 | pageAdvModel.analysisAdvSource(pageInfo); | 80 | pageAdvModel.analysisAdvSource(pageInfo); |
| 80 | this.parseGroup(pageModel) | 81 | this.parseGroup(pageModel) |
| 81 | }).catch(() => { | 82 | }).catch(() => { |
| @@ -86,10 +87,17 @@ export class PageHelper { | @@ -86,10 +87,17 @@ export class PageHelper { | ||
| 86 | } | 87 | } |
| 87 | 88 | ||
| 88 | 89 | ||
| 90 | + /** | ||
| 91 | + * 解析信息流页面楼层数据 | ||
| 92 | + * @param pageModel | ||
| 93 | + */ | ||
| 89 | async parseGroup(pageModel: PageModel) { | 94 | async parseGroup(pageModel: PageModel) { |
| 90 | let pageInfo: PageInfoDTO = pageModel.pageInfo | 95 | let pageInfo: PageInfoDTO = pageModel.pageInfo |
| 91 | pageModel.groupList = [] | 96 | pageModel.groupList = [] |
| 97 | + pageInfo.pageAdList = [] | ||
| 98 | + pageInfo.oneRequestPageGroupCompList = new ArrayList() | ||
| 92 | pageModel.groupList.push(...pageInfo.groups) | 99 | pageModel.groupList.push(...pageInfo.groups) |
| 100 | + Logger.error("ZZZXXXXX", 'parseGroup----1-----'); | ||
| 93 | for (const group of pageInfo.groups) { | 101 | for (const group of pageInfo.groups) { |
| 94 | pageModel.isRecGroup = group.groupStrategy === 1; | 102 | pageModel.isRecGroup = group.groupStrategy === 1; |
| 95 | pageModel.groupId = group.id; | 103 | pageModel.groupId = group.id; |
| @@ -99,17 +107,40 @@ export class PageHelper { | @@ -99,17 +107,40 @@ export class PageHelper { | ||
| 99 | pageModel.pageSize = 20 | 107 | pageModel.pageSize = 20 |
| 100 | } | 108 | } |
| 101 | pageModel.groupData = group | 109 | pageModel.groupData = group |
| 110 | + | ||
| 111 | + Logger.error("ZZZXXXXX", '楼层id-start--》' + pageModel.groupId); | ||
| 102 | // await,确保groups接口顺序执行 | 112 | // await,确保groups接口顺序执行 |
| 103 | - let pageDto = await PageViewModel.getPageData(pageModel.bizCopy()) as PageDTO | 113 | + let pageDto = await PageViewModel.getPageGroupCompData(pageModel.bizCopy()) as PageDTO |
| 104 | let index = pageInfo.groups.indexOf(group) | 114 | let index = pageInfo.groups.indexOf(group) |
| 105 | if (index == 0) { | 115 | if (index == 0) { |
| 106 | // 清空comp列表 | 116 | // 清空comp列表 |
| 107 | - pageModel.compList.clearAllData() | 117 | + pageModel.compList.clear() |
| 118 | + } | ||
| 119 | + this.analysisPageGroupCompData(pageModel,pageDto, pageInfo, index == pageInfo.groups.length - 1) | ||
| 120 | + Logger.error("ZZZXXXXX", '楼层id-end--》' + pageModel.groupId + ' 楼层 comp数量=' + pageDto.compList.length); | ||
| 108 | } | 121 | } |
| 109 | - this.getGroupData(pageModel, pageDto, index == pageInfo.groups.length - 1) | ||
| 110 | 122 | ||
| 123 | + /* | ||
| 124 | + 收集页面所有楼层的组件信息,同步完成广告投放计算,异步完成稿件批查, | ||
| 125 | + */ | ||
| 126 | + pageModel.pageTotalCompSize = pageInfo.oneRequestPageGroupCompList.length + pageModel.pageTotalCompSize | ||
| 127 | + // 处理页面广告数据,投放到页面的位置 | ||
| 128 | + this.handlePageCompAdvPostion(pageInfo.oneRequestPageGroupCompList, pageModel, pageInfo.pageAdList); | ||
| 111 | 129 | ||
| 130 | + //遍历所有组件和稿件数据 push到页面 | ||
| 131 | + for (let element of pageInfo.oneRequestPageGroupCompList) { | ||
| 132 | + pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 112 | } | 133 | } |
| 134 | + | ||
| 135 | + // 批查互动数据 | ||
| 136 | + this.allCompBatchRequest(pageInfo.oneRequestPageGroupCompList.convertToArray(), pageModel) | ||
| 137 | + | ||
| 138 | + // | ||
| 139 | + pageModel.currentPage++ | ||
| 140 | + pageModel.viewType = ViewType.LOADED | ||
| 141 | + closeRefresh(pageModel, true) | ||
| 142 | + | ||
| 143 | + Logger.error("ZZZXXXXX", 'parseGroup----3----->' + pageInfo.oneRequestPageGroupCompList.length); | ||
| 113 | if (pageModel.compList.isEmpty()) { | 144 | if (pageModel.compList.isEmpty()) { |
| 114 | // 没数据,展示空页面 | 145 | // 没数据,展示空页面 |
| 115 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); | 146 | Logger.debug(TAG, 'aboutToAppear, data response page ' + pageModel.pageId + ', comp list is empty.'); |
| @@ -119,39 +150,197 @@ export class PageHelper { | @@ -119,39 +150,197 @@ export class PageHelper { | ||
| 119 | } | 150 | } |
| 120 | } | 151 | } |
| 121 | 152 | ||
| 122 | - private async getGroupData(pageModel: PageModel, pageDto: PageDTO, isLastGroup: boolean) { | 153 | + /** |
| 154 | + * 解析页面的楼层数据 | ||
| 155 | + * @param pageDto 楼层的组件信息 | ||
| 156 | + * @param pageInfo 信息流页面信息 | ||
| 157 | + * @param isLastGroup pageDto信息是不是最后一个楼层 | ||
| 158 | + */ | ||
| 159 | + private async analysisPageGroupCompData(pageModel: PageModel,pageDto: PageDTO, pageInfo: PageInfoDTO, isLastGroup: boolean) { | ||
| 160 | + | ||
| 123 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 161 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 124 | - pageModel.viewType = ViewType.LOADED; | ||
| 125 | - if (isLastGroup) { | ||
| 126 | - // 认为分页只会在最后一个group里 | ||
| 127 | - pageModel.currentPage++; | ||
| 128 | - } | ||
| 129 | - // pageModel.currentPage++; | ||
| 130 | - pageModel.hasMore = true; | ||
| 131 | 162 | ||
| 163 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集楼层组件、稿件和本地组件容器 | ||
| 164 | + // 遍历楼层的组件数据 | ||
| 165 | + pageDto.compList.forEach((element: CompDTO) => { | ||
| 166 | + let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 132 | //移除音频 和 活动 | 167 | //移除音频 和 活动 |
| 133 | - this.collectPageComp(pageModel, pageDto) | 168 | + if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { |
| 169 | + Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 170 | + } else { | ||
| 171 | + // 暂时屏蔽活动和音频详情入口 | ||
| 172 | + if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 173 | + } else { | ||
| 174 | + pageCompList.add(element) | ||
| 175 | + } | ||
| 176 | + } | ||
| 177 | + }) | ||
| 134 | 178 | ||
| 135 | - // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) | ||
| 136 | - // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 | ||
| 137 | - // 二次请求,批查互动数据 | ||
| 138 | - this.allCompBatchRequest(pageDto.compList, pageModel) | 179 | + // pageInfor 记录 |
| 180 | + pageCompList.forEach((comp: CompDTO) => { | ||
| 181 | + pageInfo.oneRequestPageGroupCompList.add(comp) | ||
| 182 | + }) | ||
| 139 | 183 | ||
| 184 | + // pageInfor 记录广告 | ||
| 185 | + if (pageDto.compAdList != null) { | ||
| 186 | + pageInfo.pageAdList.push(...pageDto.compAdList) | ||
| 187 | + } | ||
| 140 | 188 | ||
| 141 | - // content级别的展现加载丢给comp自己,这里只需要处理屏蔽分页加载,pageModel.pageScroll | 189 | + // 检测最后一个楼层是否有一行两图卡 |
| 142 | if (isLastGroup) { | 190 | if (isLastGroup) { |
| 143 | - closeRefresh(pageModel, true); | ||
| 144 | // 最后一个楼层,特殊处理 | 191 | // 最后一个楼层,特殊处理 |
| 145 | // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 | 192 | // 检测楼层最后一个组件业务数据是否需要通过访问接口获取 |
| 146 | let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] | 193 | let comp: CompDTO = pageDto.compList[pageDto.compList.length - 1] |
| 147 | - let compSize = CollectionUtils.getListSize(comp.operDataList) | ||
| 148 | // 直播回放,需要二次请求数据 | 194 | // 直播回放,需要二次请求数据 |
| 149 | - if (compSize <= 0 && comp.compStyle == CompStyle.Zh_Grid_Layout_02) { | 195 | + if ( comp.compStyle == CompStyle.Zh_Grid_Layout_02) { |
| 150 | // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 | 196 | // 这个comp,数据自己二次请求,自己分页处理,这里加flag,将page层滑动及loadmore ui去掉 |
| 151 | pageModel.contentNeedScroll = true | 197 | pageModel.contentNeedScroll = true |
| 198 | + | ||
| 199 | + //this.getLiveReviewData(pageInfo,comp) | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + | ||
| 207 | + /** | ||
| 208 | + * comp加载更多,分页加载 | ||
| 209 | + */ | ||
| 210 | + private compLoadMore(pageModel: PageModel) { | ||
| 211 | + //聚合页 | ||
| 212 | + if (pageModel.pageType == 1) { | ||
| 213 | + PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 214 | + if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 215 | + pageModel.hasMore = false; | ||
| 216 | + return; | ||
| 217 | + } else { | ||
| 218 | + //更新数据 | ||
| 219 | + pageModel.compList.addItems(liveReviewDTO.list); | ||
| 220 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 221 | + pageModel.currentPage++; | ||
| 222 | + pageModel.hasMore = true; | ||
| 223 | + pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize | ||
| 224 | + } | ||
| 225 | + }).catch((err: string | Resource) => { | ||
| 226 | + promptAction.showToast({ message: err }); | ||
| 227 | + }) | ||
| 228 | + } else { | ||
| 229 | + PageViewModel.getPageGroupCompData(pageModel.bizCopy()) | ||
| 230 | + .then((data: PageDTO) => { | ||
| 231 | + if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 232 | + pageModel.hasMore = false; | ||
| 233 | + } else { | ||
| 234 | + // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 235 | + pageModel.currentPage++; | ||
| 236 | + pageModel.hasMore = true; | ||
| 237 | + | ||
| 238 | + //移除音频 和 活动 | ||
| 239 | + this.loadMorePageComp(pageModel, data) | ||
| 240 | + // 参与批查 | ||
| 241 | + this.allCompBatchRequest(data.compList, pageModel) | ||
| 242 | + } | ||
| 243 | + }).catch((err: string | Resource) => { | ||
| 244 | + promptAction.showToast({ message: err }); | ||
| 245 | + }) | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * 加载更多页面组件和稿件信息 | ||
| 252 | + */ | ||
| 253 | + private loadMorePageComp(pageModel: PageModel, pageDto: PageDTO) { | ||
| 254 | + | ||
| 255 | + let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 256 | + | ||
| 257 | + pageDto.compList.forEach((element: CompDTO) => { | ||
| 258 | + let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 259 | + //移除音频 和 活动 | ||
| 260 | + if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 261 | + Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 262 | + } else { | ||
| 263 | + // 暂时屏蔽活动和音频详情入口 | ||
| 264 | + if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 265 | + } else { | ||
| 266 | + pageCompList.add(element) | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + }) | ||
| 271 | + | ||
| 272 | + // 记录 | ||
| 273 | + pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 274 | + // 处理页面广告数据,投放到页面的位置 | ||
| 275 | + this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto.compAdList); | ||
| 276 | + | ||
| 277 | + //遍历所有组件和稿件数据 push到页面 | ||
| 278 | + for (let element of pageCompList) { | ||
| 279 | + pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + } | ||
| 283 | + | ||
| 284 | + /** | ||
| 285 | + * 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口 | ||
| 286 | + * @param compList | ||
| 287 | + * @param pageModel | ||
| 288 | + */ | ||
| 289 | + private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | ||
| 290 | + PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | ||
| 291 | + // 刷新,替换所有数据 | ||
| 292 | + this.resetInteract(data, pageModel.compList) | ||
| 293 | + if (pageModel?.channelId === '2001' || pageModel?.channelId === '2002') { | ||
| 294 | + //早晚报意图上报 | ||
| 295 | + let context = getContext(this) as common.UIAbilityContext; | ||
| 296 | + viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED) | ||
| 297 | + } | ||
| 298 | + }) | ||
| 299 | + | ||
| 300 | + // 测试数据 | ||
| 301 | + // setTimeout(() => { | ||
| 302 | + // let index = 1 | ||
| 303 | + // let comp = pageModel.compList.getData(index) as CompDTO | ||
| 304 | + // comp.hasMore = 0 | ||
| 305 | + // //comp.operDataList[0].newsTitle = '测试111' | ||
| 306 | + // let con :InteractDataDTO = new InteractDataDTO; | ||
| 307 | + // con.commentNum=1000 | ||
| 308 | + // comp.operDataList[0].interactData = con | ||
| 309 | + // Logger.debug("ZZZXXXXX", | ||
| 310 | + // "-----setTimeout--------->" + comp.hasMore) | ||
| 311 | + // }, 4 * 1000) | ||
| 312 | + } | ||
| 313 | + | ||
| 314 | + /** | ||
| 315 | + * 刷新互动数据到compList | ||
| 316 | + * @param interact 批查互动数据结果 | ||
| 317 | + * @param compList comp list | ||
| 318 | + */ | ||
| 319 | + private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) { | ||
| 320 | + if (interact == null || interact.length == 0) { | ||
| 321 | + return | ||
| 322 | + } | ||
| 323 | + let time = DateTimeUtils.getTimeStamp().toString() | ||
| 324 | + interact.forEach((interactData) => { | ||
| 325 | + let id = interactData.contentId; | ||
| 326 | + outer: for (let i = 0; i < compList.totalCount(); i++) { | ||
| 327 | + let comp = compList.getData(i) as CompDTO; | ||
| 328 | + if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) { | ||
| 329 | + continue; | ||
| 330 | + } | ||
| 331 | + for (let j = 0; j < comp.operDataList.length; j++) { | ||
| 332 | + let content = comp.operDataList[j]; | ||
| 333 | + if (content == null) { | ||
| 334 | + continue; | ||
| 335 | + } | ||
| 336 | + if (id == content.objectId) { | ||
| 337 | + content.interactData = interactData; | ||
| 338 | + comp.timestamp = time | ||
| 339 | + break outer; | ||
| 152 | } | 340 | } |
| 153 | } | 341 | } |
| 154 | } | 342 | } |
| 343 | + }) | ||
| 155 | } | 344 | } |
| 156 | 345 | ||
| 157 | 346 | ||
| @@ -159,9 +348,9 @@ export class PageHelper { | @@ -159,9 +348,9 @@ export class PageHelper { | ||
| 159 | * 处理页面中的广告组件信息 | 348 | * 处理页面中的广告组件信息 |
| 160 | * @param pageDto | 349 | * @param pageDto |
| 161 | */ | 350 | */ |
| 162 | - private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, pageDto: PageDTO) { | 351 | + private handlePageCompAdvPostion(pageCompList: ArrayList<CompDTO>, pageModel: PageModel, compAdList: CompAdvBean[]) { |
| 163 | 352 | ||
| 164 | - let compAdvList = pageDto.compAdList | 353 | + let compAdvList = compAdList |
| 165 | 354 | ||
| 166 | let flag = true; | 355 | let flag = true; |
| 167 | if (compAdvList == null) { | 356 | if (compAdvList == null) { |
| @@ -300,142 +489,15 @@ export class PageHelper { | @@ -300,142 +489,15 @@ export class PageHelper { | ||
| 300 | 489 | ||
| 301 | 490 | ||
| 302 | /** | 491 | /** |
| 303 | - * comp加载更多,分页加载 | 492 | + * 获取直播回看数据 |
| 304 | */ | 493 | */ |
| 305 | - private compLoadMore(pageModel: PageModel) { | ||
| 306 | - //聚合页 | ||
| 307 | - if (pageModel.pageType == 1) { | ||
| 308 | - PageViewModel.postThemeList(pageModel.currentPage, pageModel.pageSize, pageModel.extra).then((liveReviewDTO) => { | ||
| 309 | - if (liveReviewDTO == null || liveReviewDTO.list == null || liveReviewDTO.list.length == 0) { | ||
| 310 | - pageModel.hasMore = false; | ||
| 311 | - return; | ||
| 312 | - } else { | ||
| 313 | - //更新数据 | ||
| 314 | - pageModel.compList.addItems(liveReviewDTO.list); | ||
| 315 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 316 | - pageModel.currentPage++; | ||
| 317 | - pageModel.hasMore = true; | ||
| 318 | - pageModel.pageTotalCompSize = liveReviewDTO.list.length + pageModel.pageTotalCompSize | ||
| 319 | - } | ||
| 320 | - }).catch((err: string | Resource) => { | ||
| 321 | - promptAction.showToast({ message: err }); | ||
| 322 | - }) | ||
| 323 | - } else { | ||
| 324 | - PageViewModel.getPageData(pageModel.bizCopy()) | ||
| 325 | - .then((data: PageDTO) => { | ||
| 326 | - if (data == null || data.compList == null || data.compList.length == 0) { | ||
| 327 | - pageModel.hasMore = false; | ||
| 328 | - } else { | ||
| 329 | - // 直接认为有分页,一直加载分页。直到没有数据,再停止 | ||
| 330 | - pageModel.currentPage++; | ||
| 331 | - pageModel.hasMore = true; | 494 | + private async getLiveReviewData(pageInfo: PageInfoDTO,comp: CompDTO) { |
| 332 | 495 | ||
| 333 | - //移除音频 和 活动 | ||
| 334 | - this.collectPageComp(pageModel, data) | ||
| 335 | - // 参与批查 | ||
| 336 | - this.allCompBatchRequest(data.compList, pageModel) | ||
| 337 | - } | ||
| 338 | - }).catch((err: string | Resource) => { | ||
| 339 | - promptAction.showToast({ message: err }); | ||
| 340 | - }) | ||
| 341 | - } | ||
| 342 | - } | ||
| 343 | - | ||
| 344 | - /** | ||
| 345 | - * 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口 | ||
| 346 | - * @param compList | ||
| 347 | - * @param pageModel | ||
| 348 | - */ | ||
| 349 | - private allCompBatchRequest(compList: CompDTO[], pageModel: PageModel) { | ||
| 350 | - PageViewModel.getInteractData(compList).then((data: InteractDataDTO[]) => { | ||
| 351 | - // 刷新,替换所有数据 | ||
| 352 | - this.resetInteract(data, pageModel.compList) | ||
| 353 | - if(pageModel?.channelId === '2001' || pageModel?.channelId === '2002'){ | ||
| 354 | - //早晚报意图上报 | ||
| 355 | - let context = getContext(this) as common.UIAbilityContext; | ||
| 356 | - viewBlogInsightIntentShare(context, pageModel?.channelId, compList, ActionMode.EXPECTED) | ||
| 357 | - } | ||
| 358 | - }) | 496 | + let currentPage = 1 |
| 497 | + let pageSize = 20 | ||
| 498 | + let listReviewDtoBean = await PageViewModel.getLiveReviewUrl(currentPage, pageSize) as LiveReviewDTO | ||
| 499 | + Logger.error("ZZZXXXXX", 'getLiveReviewData---------'+listReviewDtoBean.list.length); | ||
| 359 | 500 | ||
| 360 | - // 测试数据 | ||
| 361 | - // setTimeout(() => { | ||
| 362 | - // let index = 1 | ||
| 363 | - // let comp = pageModel.compList.getData(index) as CompDTO | ||
| 364 | - // comp.hasMore = 0 | ||
| 365 | - // //comp.operDataList[0].newsTitle = '测试111' | ||
| 366 | - // let con :InteractDataDTO = new InteractDataDTO; | ||
| 367 | - // con.commentNum=1000 | ||
| 368 | - // comp.operDataList[0].interactData = con | ||
| 369 | - // Logger.debug("ZZZXXXXX", | ||
| 370 | - // "-----setTimeout--------->" + comp.hasMore) | ||
| 371 | - // }, 4 * 1000) | ||
| 372 | - } | ||
| 373 | - | ||
| 374 | - /** | ||
| 375 | - * 移除comp | ||
| 376 | - */ | ||
| 377 | - private collectPageComp(pageModel: PageModel, pageDto: PageDTO) { | ||
| 378 | - | ||
| 379 | - let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器 | ||
| 380 | - | ||
| 381 | - pageDto.compList.forEach((element: CompDTO) => { | ||
| 382 | - let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 383 | - //移除音频 和 活动 | ||
| 384 | - if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 385 | - Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 386 | - } else { | ||
| 387 | - // 暂时屏蔽活动和音频详情入口 | ||
| 388 | - if (element.operDataList[0]?.objectType === '3' || element.operDataList[0]?.objectType === '13') { | ||
| 389 | - } else { | ||
| 390 | - pageCompList.add(element) | ||
| 391 | - } | ||
| 392 | - } | ||
| 393 | - | ||
| 394 | - }) | ||
| 395 | - | ||
| 396 | - // 记录 | ||
| 397 | - pageModel.pageTotalCompSize = pageCompList.length + pageModel.pageTotalCompSize | ||
| 398 | - | ||
| 399 | - // 处理页面广告数据,投放到页面的位置 | ||
| 400 | - this.handlePageCompAdvPostion(pageCompList, pageModel, pageDto); | ||
| 401 | - | ||
| 402 | - //遍历所有组件和稿件数据 push到页面 | ||
| 403 | - for (let element of pageCompList) { | ||
| 404 | - pageModel.compList.push(CompDTO.createNewsBean(element)) | ||
| 405 | - } | ||
| 406 | - | ||
| 407 | - } | ||
| 408 | - | ||
| 409 | - /** | ||
| 410 | - * 刷新互动数据到compList | ||
| 411 | - * @param interact 批查互动数据结果 | ||
| 412 | - * @param compList comp list | ||
| 413 | - */ | ||
| 414 | - private resetInteract(interact: InteractDataDTO[], compList: LazyDataSource<BaseDTO>) { | ||
| 415 | - if (interact == null || interact.length == 0) { | ||
| 416 | - return | ||
| 417 | - } | ||
| 418 | - let time = DateTimeUtils.getTimeStamp().toString() | ||
| 419 | - interact.forEach((interactData) => { | ||
| 420 | - let id = interactData.contentId; | ||
| 421 | - outer: for (let i = 0; i < compList.totalCount(); i++) { | ||
| 422 | - let comp = compList.getData(i) as CompDTO; | ||
| 423 | - if (comp == null || comp.operDataList == null || comp.operDataList.length == 0) { | ||
| 424 | - continue; | ||
| 425 | - } | ||
| 426 | - for (let j = 0; j < comp.operDataList.length; j++) { | ||
| 427 | - let content = comp.operDataList[j]; | ||
| 428 | - if (content == null) { | ||
| 429 | - continue; | ||
| 430 | - } | ||
| 431 | - if (id == content.objectId) { | ||
| 432 | - content.interactData = interactData; | ||
| 433 | - comp.timestamp = time | ||
| 434 | - break outer; | ||
| 435 | - } | ||
| 436 | - } | ||
| 437 | - } | ||
| 438 | - }) | ||
| 439 | } | 501 | } |
| 440 | } | 502 | } |
| 441 | 503 |
| @@ -178,7 +178,12 @@ export class PageViewModel extends BaseViewModel { | @@ -178,7 +178,12 @@ export class PageViewModel extends BaseViewModel { | ||
| 178 | return compRes.data | 178 | return compRes.data |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | - async getPageData(pageModel: PageUIReqBean): Promise<PageDTO> { | 181 | + /** |
| 182 | + * 获取页面楼层的组件信息 | ||
| 183 | + * @param pageModel | ||
| 184 | + * @returns | ||
| 185 | + */ | ||
| 186 | + async getPageGroupCompData(pageModel: PageUIReqBean): Promise<PageDTO> { | ||
| 182 | Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); | 187 | Logger.debug(TAG, 'getPageData pageId: ' + pageModel.pageId); |
| 183 | if (pageModel.isRecGroup) { | 188 | if (pageModel.isRecGroup) { |
| 184 | return this.parseComp(PageRepository.fetchRecCompData(pageModel)) | 189 | return this.parseComp(PageRepository.fetchRecCompData(pageModel)) |
| @@ -65,10 +65,18 @@ | @@ -65,10 +65,18 @@ | ||
| 65 | "value": "14vp" | 65 | "value": "14vp" |
| 66 | }, | 66 | }, |
| 67 | { | 67 | { |
| 68 | + "name": "margin_4", | ||
| 69 | + "value": "4vp" | ||
| 70 | + }, | ||
| 71 | + { | ||
| 68 | "name": "margin_8", | 72 | "name": "margin_8", |
| 69 | "value": "8vp" | 73 | "value": "8vp" |
| 70 | }, | 74 | }, |
| 71 | { | 75 | { |
| 76 | + "name": "margin_9", | ||
| 77 | + "value": "9vp" | ||
| 78 | + }, | ||
| 79 | + { | ||
| 72 | "name": "label_margin_top", | 80 | "name": "label_margin_top", |
| 73 | "value": "10vp" | 81 | "value": "10vp" |
| 74 | }, | 82 | }, |
| @@ -273,7 +273,8 @@ export struct DetailPlayShortVideoPage { | @@ -273,7 +273,8 @@ export struct DetailPlayShortVideoPage { | ||
| 273 | this.playerCoverBuilder() | 273 | this.playerCoverBuilder() |
| 274 | 274 | ||
| 275 | // 横屏-全屏观看 | 275 | // 横屏-全屏观看 |
| 276 | - if (this.videoLandScape === 1) { | 276 | + // 点击查看详情 不展示 |
| 277 | + if (this.videoLandScape === 1 && !this.isOpenDetail) { | ||
| 277 | this.playerFullscreenBuilder() | 278 | this.playerFullscreenBuilder() |
| 278 | } | 279 | } |
| 279 | } | 280 | } |
| 1 | import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; | 1 | import { Action, ContentDetailDTO, InteractDataDTO } from 'wdBean/Index'; |
| 2 | +import { NetworkUtil, Logger, NetworkType, SPHelper, WindowModel, StringUtils } from 'wdKit'; | ||
| 2 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' | 3 | import { ContentDetailRequest } from 'wdDetailPlayApi/Index' |
| 3 | import { ResponseDTO } from 'wdNetwork/Index'; | 4 | import { ResponseDTO } from 'wdNetwork/Index'; |
| 4 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' | 5 | import { DetailPlayShortVideoPage } from './DetailPlayShortVideoPage' |
| 5 | import router from '@ohos.router'; | 6 | import router from '@ohos.router'; |
| 6 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 7 | import { contentListParams } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 7 | -import { WindowModel } from 'wdKit'; | ||
| 8 | import { DisplayDirection } from 'wdConstant/Index'; | 8 | import { DisplayDirection } from 'wdConstant/Index'; |
| 9 | import { window } from '@kit.ArkUI'; | 9 | import { window } from '@kit.ArkUI'; |
| 10 | +import { EmptyComponent } from '../../../../../wdComponent/src/main/ets/components/view/EmptyComponent'; | ||
| 10 | 11 | ||
| 11 | const storage = LocalStorage.getShared(); | 12 | const storage = LocalStorage.getShared(); |
| 12 | const TAG = 'DetailVideoListPage' | 13 | const TAG = 'DetailVideoListPage' |
| @@ -29,11 +30,14 @@ export struct DetailVideoListPage { | @@ -29,11 +30,14 @@ export struct DetailVideoListPage { | ||
| 29 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | 30 | @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL |
| 30 | @State data: ContentDetailDTO[] = [] | 31 | @State data: ContentDetailDTO[] = [] |
| 31 | @State currentIndex: number = 0 | 32 | @State currentIndex: number = 0 |
| 33 | + @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | ||
| 32 | @State interactDataList: InteractDataDTO[] = [] | 34 | @State interactDataList: InteractDataDTO[] = [] |
| 33 | 35 | ||
| 34 | async aboutToAppear(): Promise<void> { | 36 | async aboutToAppear(): Promise<void> { |
| 37 | + // 注册监听网络连接 | ||
| 38 | + let netStatus = NetworkUtil.isNetConnected() | ||
| 39 | + if (netStatus) { | ||
| 35 | this.openFullScreen() | 40 | this.openFullScreen() |
| 36 | - | ||
| 37 | const action: Action = router.getParams() as Action | 41 | const action: Action = router.getParams() as Action |
| 38 | if (action) { | 42 | if (action) { |
| 39 | this.contentId = action.params?.contentID || '' | 43 | this.contentId = action.params?.contentID || '' |
| @@ -45,6 +49,12 @@ export struct DetailVideoListPage { | @@ -45,6 +49,12 @@ export struct DetailVideoListPage { | ||
| 45 | } | 49 | } |
| 46 | await this.queryVideoList() | 50 | await this.queryVideoList() |
| 47 | console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) | 51 | console.log(TAG, 'aboutToAppear', JSON.stringify(action.params)) |
| 52 | + | ||
| 53 | + } else { | ||
| 54 | + // 无网络 | ||
| 55 | + this.netStatus = 1 | ||
| 56 | + } | ||
| 57 | + | ||
| 48 | } | 58 | } |
| 49 | 59 | ||
| 50 | aboutToDisappear(): void { | 60 | aboutToDisappear(): void { |
| @@ -163,6 +173,19 @@ export struct DetailVideoListPage { | @@ -163,6 +173,19 @@ export struct DetailVideoListPage { | ||
| 163 | } | 173 | } |
| 164 | 174 | ||
| 165 | build() { | 175 | build() { |
| 176 | + if (this.netStatus !== undefined) { | ||
| 177 | + EmptyComponent({ | ||
| 178 | + emptyType: this.netStatus, emptyButton: true, retry: () => { | ||
| 179 | + this.getContentDetail(this.contentId, this.relId, this.relType) | ||
| 180 | + } | ||
| 181 | + }) | ||
| 182 | + .id('e_empty_content') | ||
| 183 | + .alignRules({ | ||
| 184 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 185 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 186 | + }) | ||
| 187 | + } else { | ||
| 188 | + | ||
| 166 | Column() { | 189 | Column() { |
| 167 | Swiper(this.swiperController) { | 190 | Swiper(this.swiperController) { |
| 168 | ForEach(this.data, (item: ContentDetailDTO, index: number) => { | 191 | ForEach(this.data, (item: ContentDetailDTO, index: number) => { |
| @@ -198,4 +221,5 @@ export struct DetailVideoListPage { | @@ -198,4 +221,5 @@ export struct DetailVideoListPage { | ||
| 198 | // bottom: this.bottomSafeHeight + 'px' | 221 | // bottom: this.bottomSafeHeight + 'px' |
| 199 | // }) | 222 | // }) |
| 200 | } | 223 | } |
| 224 | + } | ||
| 201 | } | 225 | } |
| @@ -178,7 +178,7 @@ export struct PlayerRightView { | @@ -178,7 +178,7 @@ export struct PlayerRightView { | ||
| 178 | .width(58) | 178 | .width(58) |
| 179 | .position({ x: '100%', y: '100%' }) | 179 | .position({ x: '100%', y: '100%' }) |
| 180 | .markAnchor({ x: '100%', y: '100%' }) | 180 | .markAnchor({ x: '100%', y: '100%' }) |
| 181 | - .padding({ bottom: 10, right: 10 }) | 181 | + .padding({ bottom: 7, right: 10 }) |
| 182 | .visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? | 182 | .visibility(this.isOpenDetail || this.isDragging || this.displayDirection === DisplayDirection.VIDEO_HORIZONTAL ? |
| 183 | Visibility.None : Visibility.Visible) | 183 | Visibility.None : Visibility.Visible) |
| 184 | 184 |
No preview for this file type
-
Please register or login to post a comment