yumaochao
Showing 37 changed files with 442 additions and 265 deletions
@@ -220,14 +220,26 @@ export class ProcessUtils { @@ -220,14 +220,26 @@ export class ProcessUtils {
220 } 220 }
221 221
222 public static gotoDefaultWeb(content: ContentDTO) { 222 public static gotoDefaultWeb(content: ContentDTO) {
223 - let taskAction: Action = {  
224 - type: 'JUMP_H5_BY_WEB_VIEW',  
225 - params: {  
226 - url: content.linkUrl,  
227 - } as Params,  
228 - };  
229 - WDRouterRule.jumpWithAction(taskAction)  
230 - Logger.debug(TAG, `gotoWeb, ${content.objectId}`); 223 +
  224 + // 内链
  225 + if(content.openType == '1'){
  226 + let taskAction: Action = {
  227 + type: 'JUMP_H5_BY_WEB_VIEW',
  228 + params: {
  229 + url: content.linkUrl,
  230 + } as Params,
  231 + };
  232 + WDRouterRule.jumpWithAction(taskAction)
  233 + }else if(content.openType == '2') {
  234 + // 外链
  235 + ProcessUtils.jumpExternalWebPage(content.linkUrl);
  236 + }else {
  237 + // 无需跳转
  238 +
  239 + }
  240 +
  241 +
  242 + Logger.debug(TAG, `gotoWeb, ${content.objectId}`)
231 } 243 }
232 244
233 static commentGotoWeb(content: commentInfo) { 245 static commentGotoWeb(content: commentInfo) {
@@ -15,6 +15,7 @@ export struct WdWebComponent { @@ -15,6 +15,7 @@ export struct WdWebComponent {
15 onWebPrepared: () => void = () => { 15 onWebPrepared: () => void = () => {
16 } 16 }
17 @Prop webUrl: string = '' 17 @Prop webUrl: string = ''
  18 + @Prop @Watch('onReloadStateChanged') reload: number = 0
18 @Link isPageEnd: boolean 19 @Link isPageEnd: boolean
19 20
20 build() { 21 build() {
@@ -87,5 +88,11 @@ export struct WdWebComponent { @@ -87,5 +88,11 @@ export struct WdWebComponent {
87 Logger.debug(TAG, 'onLoadIntercept return false'); 88 Logger.debug(TAG, 'onLoadIntercept return false');
88 return false 89 return false
89 } 90 }
  91 + onReloadStateChanged() {
  92 + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
  93 + if (this.reload > 0) {
  94 + this.webviewControl.refresh()
  95 + }
  96 + }
90 } 97 }
91 98
@@ -15,6 +15,7 @@ export struct WdWebLocalComponent { @@ -15,6 +15,7 @@ export struct WdWebLocalComponent {
15 } 15 }
16 @Prop backVisibility: boolean = false 16 @Prop backVisibility: boolean = false
17 @Prop webResource: Resource = {} as Resource 17 @Prop webResource: Resource = {} as Resource
  18 + @Prop @Watch('onReloadStateChanged') reload: number = 0
18 @State webHeight: string | number = '100%' 19 @State webHeight: string | number = '100%'
19 @Link isPageEnd: boolean 20 @Link isPageEnd: boolean
20 @State videoUrl: string = '' 21 @State videoUrl: string = ''
@@ -240,5 +241,11 @@ export struct WdWebLocalComponent { @@ -240,5 +241,11 @@ export struct WdWebLocalComponent {
240 Logger.debug(TAG, 'onLoadIntercept return false'); 241 Logger.debug(TAG, 'onLoadIntercept return false');
241 return false 242 return false
242 } 243 }
  244 + onReloadStateChanged() {
  245 + Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
  246 + if (this.reload > 0) {
  247 + this.webviewControl.refresh()
  248 + }
  249 + }
243 } 250 }
244 251
@@ -10,7 +10,7 @@ import { BaseDTO } from '../component/BaseDTO'; @@ -10,7 +10,7 @@ import { BaseDTO } from '../component/BaseDTO';
10 10
11 @Observed 11 @Observed
12 export class ContentDTO implements BaseDTO { 12 export class ContentDTO implements BaseDTO {
13 - shareFlag?:string='0'; 13 + shareFlag?:string='1';
14 appStyle: string = ''; 14 appStyle: string = '';
15 cityCode: string = ''; 15 cityCode: string = '';
16 coverSize: string = ''; 16 coverSize: string = '';
@@ -30,6 +30,8 @@ export struct CarderInteraction { @@ -30,6 +30,8 @@ export struct CarderInteraction {
30 this.likeBean['title'] = this.contentDetailData.newsTitle + '' 30 this.likeBean['title'] = this.contentDetailData.newsTitle + ''
31 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + '' 31 this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
32 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + '' 32 this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
  33 + this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1'
  34 + console.log('是否显示分享',this.contentDTO.shareFlag)
33 } 35 }
34 36
35 build() { 37 build() {
@@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent { @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent {
95 Column() { 95 Column() {
96 WdWebLocalComponent({ 96 WdWebLocalComponent({
97 webviewControl: this.webviewControl, 97 webviewControl: this.webviewControl,
  98 + reload:this.reload,
98 webResource: $rawfile('apph5/index.html'), 99 webResource: $rawfile('apph5/index.html'),
99 backVisibility: false, 100 backVisibility: false,
100 onWebPrepared: this.onWebPrepared.bind(this), 101 onWebPrepared: this.onWebPrepared.bind(this),
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,42 +42,44 @@ export struct InteractMComponent { @@ -41,42 +42,44 @@ export struct InteractMComponent {
41 .constraintSize({maxHeight:500}) 42 .constraintSize({maxHeight:500})
42 } 43 }
43 44
44 - Column(){  
45 - if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){  
46 - Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})  
47 - .margin({top:15,bottom:10})  
48 - .width('100%') 45 + if(this.messageModel.contentType != '211' && this.messageModel.contentType != '210'){
  46 + Column(){
  47 + if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
  48 + Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
  49 + .margin({top:15,bottom:10})
  50 + .width('100%')
49 51
50 - Divider()  
51 - .color('#EDEDED')  
52 - .backgroundColor('#EDEDED')  
53 - .width('100%')  
54 - .height(1)  
55 - }  
56 - Row(){  
57 - Image($r('app.media.MessageOriginTextIcon'))  
58 - .width('12')  
59 - .height('12')  
60 - Text(this.messageModel.InteractMsubM.contentTitle)  
61 - .fontSize('12fp')  
62 - .fontColor('#666666')  
63 - .maxLines(1)  
64 - .width('90%')  
65 - .textOverflow({overflow:TextOverflow.Ellipsis}) 52 + Divider()
  53 + .color('#EDEDED')
  54 + .backgroundColor('#EDEDED')
  55 + .width('100%')
  56 + .height(1)
  57 + }
  58 + Row(){
  59 + Image($r('app.media.MessageOriginTextIcon'))
  60 + .width('12')
  61 + .height('12')
  62 + Text(this.messageModel.InteractMsubM.contentTitle)
  63 + .fontSize('12fp')
  64 + .fontColor('#666666')
  65 + .maxLines(1)
  66 + .width('90%')
  67 + .textOverflow({overflow:TextOverflow.Ellipsis})
66 68
67 - Blank() 69 + Blank()
68 70
69 - Image($r('app.media.mine_user_edit'))  
70 - .width('12')  
71 - .height('12')  
72 - }.margin({top:10,bottom:15})  
73 - }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)  
74 - .onClick(()=>{  
75 - let contentDTO :ContentDTO = new ContentDTO();  
76 - contentDTO.objectType = this.messageModel.InteractMsubM.contentType  
77 - contentDTO.objectId = this.messageModel.InteractMsubM.contentId  
78 - ProcessUtils.processPage(contentDTO)  
79 - }) 71 + Image($r('app.media.mine_user_edit'))
  72 + .width('12')
  73 + .height('12')
  74 + }.margin({top:10,bottom:15})
  75 + }.padding({left:10,right:10}).alignItems(HorizontalAlign.Start).backgroundColor('#f5f5f5').borderRadius(5)
  76 + .onClick(()=>{
  77 + let contentDTO :ContentDTO = new ContentDTO();
  78 + contentDTO.objectType = this.messageModel.InteractMsubM.contentType
  79 + contentDTO.objectId = this.messageModel.InteractMsubM.contentId
  80 + ProcessUtils.processPage(contentDTO)
  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 }
@@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent { @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent {
20 action: Action = {} as Action 20 action: Action = {} as Action
21 @State webUrl: string = ''; 21 @State webUrl: string = '';
22 @State isPageEnd: boolean = false 22 @State isPageEnd: boolean = false
  23 + @State reload: number = 0;
23 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO 24 @Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
24 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean 25 private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
25 private webPrepared = false; 26 private webPrepared = false;
@@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent { @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent {
101 WdWebComponent({ 102 WdWebComponent({
102 webviewControl: this.webviewControl, 103 webviewControl: this.webviewControl,
103 webUrl: this.webUrl, 104 webUrl: this.webUrl,
  105 + reload: this.reload,
104 onWebPrepared: this.onWebPrepared.bind(this), 106 onWebPrepared: this.onWebPrepared.bind(this),
105 isPageEnd: $isPageEnd, 107 isPageEnd: $isPageEnd,
106 }) 108 })
@@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent { @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent {
136 if (!this.action?.params?.backVisibility) { 138 if (!this.action?.params?.backVisibility) {
137 WindowModel.shared.setWindowLayoutFullScreen(true) 139 WindowModel.shared.setWindowLayoutFullScreen(true)
138 } 140 }
  141 + this.reload++
139 } 142 }
140 143
141 aboutToAppear() { 144 aboutToAppear() {
@@ -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)
@@ -63,7 +63,7 @@ export struct Card2Component { @@ -63,7 +63,7 @@ export struct Card2Component {
63 Span(this.contentDTO.newsTitle) 63 Span(this.contentDTO.newsTitle)
64 } 64 }
65 } 65 }
66 - .fontSize($r('app.float.font_size_17')) 66 + .fontSize($r('app.float.font_size_18'))
67 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222')) 67 .fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
68 .maxLines(2) 68 .maxLines(2)
69 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 69 .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
@@ -50,7 +50,7 @@ export struct Card3Component { @@ -50,7 +50,7 @@ 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 + .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 .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 : 56 .textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
@@ -54,7 +54,7 @@ export struct Card4Component { @@ -54,7 +54,7 @@ export struct Card4Component {
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 .maxLines(3) 59 .maxLines(3)
60 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 60 .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
@@ -71,7 +71,7 @@ export struct Card5Component { @@ -71,7 +71,7 @@ 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)
@@ -70,7 +70,7 @@ export struct Card6Component { @@ -70,7 +70,7 @@ export struct Card6Component {
70 } 70 }
71 } 71 }
72 .fontColor(this.clicked ? 0x848484 : 0x222222) 72 .fontColor(this.clicked ? 0x848484 : 0x222222)
73 - .fontSize(16) 73 + .fontSize(18)
74 .lineHeight(24) 74 .lineHeight(24)
75 .fontWeight(FontWeight.Normal) 75 .fontWeight(FontWeight.Normal)
76 .maxLines(3) 76 .maxLines(3)
@@ -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 }) // 超出的部分显示省略号。
@@ -38,20 +38,19 @@ export struct QualityCommentsComponent { @@ -38,20 +38,19 @@ export struct QualityCommentsComponent {
38 38
39 39
40 aboutToDisappear(): void { 40 aboutToDisappear(): void {
41 -  
42 - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage  
43 - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口  
44 - windowClass.setWindowBackgroundColor(this.lastWindowColor)  
45 - windowClass.setWindowLayoutFullScreen(false)  
46 // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' }) 41 // windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
47 -  
48 this.dialogController = null // 将dialogController置空 42 this.dialogController = null // 将dialogController置空
  43 + }
49 44
  45 + onPageShow(): void {
  46 + WindowModel.shared.setWindowLayoutFullScreen(true)
50 } 47 }
51 48
52 - aboutToAppear(): void { 49 + onPageHide(): void {
  50 + WindowModel.shared.setWindowLayoutFullScreen(false)
  51 + }
53 52
54 - this.fullScreen(); 53 + aboutToAppear(): void {
55 this.getData(); 54 this.getData();
56 this.showAlert() 55 this.showAlert()
57 } 56 }
@@ -100,13 +99,6 @@ export struct QualityCommentsComponent { @@ -100,13 +99,6 @@ export struct QualityCommentsComponent {
100 }) 99 })
101 } 100 }
102 101
103 - fullScreen() {  
104 - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage  
105 - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口  
106 - windowClass.setWindowLayoutFullScreen(true)  
107 -  
108 - }  
109 -  
110 @Builder 102 @Builder
111 titleHeader() { 103 titleHeader() {
112 Row() { 104 Row() {
@@ -249,7 +241,7 @@ export struct QualityCommentsComponent { @@ -249,7 +241,7 @@ export struct QualityCommentsComponent {
249 } 241 }
250 // ListItem() { 242 // ListItem() {
251 // 243 //
252 - // }.height(this.bottomSafeHeight) 244 + // }.height(`${this.bottomSafeHeight}` + 'px')
253 }.onReachEnd(()=>{ 245 }.onReachEnd(()=>{
254 this.currentPage++ 246 this.currentPage++
255 this.getData() 247 this.getData()
@@ -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)
@@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent'; @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent';
7 import { ChildCommentComponent } from './ChildCommentComponent'; 7 import { ChildCommentComponent } from './ChildCommentComponent';
8 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem'; 8 import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
9 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; 9 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
  10 +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
10 11
11 const TAG = "HomePageBottomCommentComponent" 12 const TAG = "HomePageBottomCommentComponent"
12 13
@@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent { @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent {
22 @State count: number = 0; 23 @State count: number = 0;
23 @Link commentNum: number 24 @Link commentNum: number
24 @State isGetRequest: boolean = false 25 @State isGetRequest: boolean = false
  26 + private scroller: Scroller = new Scroller();
25 27
26 aboutToAppear() { 28 aboutToAppear() {
27 this.getNewPageData() 29 this.getNewPageData()
@@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent { @@ -42,39 +44,31 @@ export struct HomePageBottomCommentComponent {
42 .offset({ y: "-200lpx" }) 44 .offset({ y: "-200lpx" })
43 } 45 }
44 } else { 46 } else {
45 - List({ space: 3 }) {  
46 - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {  
47 - ListItem() {  
48 - ChildCommentComponent({  
49 - data: item,  
50 - levelHead: UserDataLocal.getUserLevelHeaderUrl(),  
51 - isLastItem: index === this.data_comment.totalCount() - 1  
52 - }) 47 + CustomPullToRefresh({
  48 + alldata:this.data_comment,
  49 + scroller:this.scroller,
  50 + customList:()=>{
  51 + this.ListLayout()
  52 + },
  53 + onRefresh:(resolve)=>{
  54 + this.curPageNum = 1;
  55 + this.hasMore = true
  56 + this.isGetRequest = false
  57 + this.data_comment.clear()
  58 +
  59 + if (!this.isLoading){
  60 + this.getNewPageData()
  61 + if(resolve) resolve('刷新成功')
53 } 62 }
54 - }, (item: CommentListItem, index: number) => index.toString())  
55 -  
56 - //没有更多数据 显示提示  
57 - if (!this.hasMore) {  
58 - ListItem() {  
59 - ListHasNoMoreDataUI() 63 + },
  64 + onLoadMore:(resolve)=> {
  65 + console.log(TAG, "触底了");
  66 + if (!this.isLoading) {
  67 + this.isLoading = true
  68 + //加载分页数据
  69 + this.getNewPageData()
60 } 70 }
61 } 71 }
62 - }  
63 - .cachedCount(15)  
64 - .layoutWeight(1)  
65 - .scrollBar(BarState.Off)  
66 - .edgeEffect(EdgeEffect.None)  
67 - .nestedScroll({  
68 - scrollForward: NestedScrollMode.PARENT_FIRST,  
69 - scrollBackward: NestedScrollMode.SELF_FIRST  
70 - })  
71 - .onReachEnd(() => {  
72 - console.log(TAG, "触底了");  
73 - if (!this.isLoading) {  
74 - this.isLoading = true  
75 - //加载分页数据  
76 - this.getNewPageData()  
77 - }  
78 }) 72 })
79 } 73 }
80 }.layoutWeight(1) 74 }.layoutWeight(1)
@@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent { @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent {
82 .width('100%') 76 .width('100%')
83 } 77 }
84 78
  79 + @Builder ListLayout(){
  80 + List({ space: 3,scroller: this.scroller }) {
  81 + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
  82 + ListItem() {
  83 + ChildCommentComponent({
  84 + data: item,
  85 + levelHead: UserDataLocal.getUserLevelHeaderUrl(),
  86 + isLastItem: index === this.data_comment.totalCount() - 1
  87 + })
  88 + }
  89 + }, (item: CommentListItem, index: number) => index.toString())
  90 +
  91 + //没有更多数据 显示提示
  92 + if (!this.hasMore) {
  93 + ListItem() {
  94 + ListHasNoMoreDataUI()
  95 + }
  96 + }
  97 + }
  98 + .cachedCount(15)
  99 + .layoutWeight(1)
  100 + .scrollBar(BarState.Off)
  101 + .edgeEffect(EdgeEffect.None)
  102 + .nestedScroll({
  103 + scrollForward: NestedScrollMode.PARENT_FIRST,
  104 + scrollBackward: NestedScrollMode.SELF_FIRST
  105 + })
  106 + }
  107 +
85 getNewPageData() { 108 getNewPageData() {
86 this.isLoading = true 109 this.isLoading = true
87 if (this.hasMore) { 110 if (this.hasMore) {
@@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
7 import { FollowChildComponent } from '../follow/FollowChildComponent'; 7 import { FollowChildComponent } from '../follow/FollowChildComponent';
8 import dataPreferences from '@ohos.data.preferences'; 8 import dataPreferences from '@ohos.data.preferences';
9 import { EmptyComponent } from '../../view/EmptyComponent'; 9 import { EmptyComponent } from '../../view/EmptyComponent';
  10 +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
10 11
11 const TAG = "HomePageBottomFollowComponent" 12 const TAG = "HomePageBottomFollowComponent"
12 /** 13 /**
@@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent" @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent"
14 */ 15 */
15 @Component 16 @Component
16 export struct HomePageBottomFollowComponent { 17 export struct HomePageBottomFollowComponent {
  18 + private scroller: Scroller = new Scroller();
17 @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); 19 @State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
18 @State isLoading: boolean = false 20 @State isLoading: boolean = false
19 @State hasMore: boolean = true 21 @State hasMore: boolean = true
@@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent { @@ -104,61 +106,30 @@ export struct HomePageBottomFollowComponent {
104 }) 106 })
105 }.layoutWeight(1) 107 }.layoutWeight(1)
106 } else { 108 } else {
107 - List({ space: 3 }) { 109 + CustomPullToRefresh({
  110 + alldata:this.data_follow,
  111 + scroller:this.scroller,
  112 + customList:()=>{
  113 + this.ListLayout()
  114 + },
  115 + onRefresh:(resolve)=>{
  116 + this.curPageNum = 1;
  117 + this.hasMore = true
  118 + this.isGetRequest = false
  119 + this.data_follow.clear()
108 120
109 - ListItem() {  
110 - Row() {  
111 - Text("关注更多人民号")  
112 - .fontWeight('400lpx')  
113 - .fontColor($r('app.color.color_222222'))  
114 - .lineHeight('38lpx')  
115 - .fontSize('27lpx')  
116 - .textAlign(TextAlign.Center)  
117 - .margin({ right: '4lpx' })  
118 - Image($r('app.media.arrow_icon_right'))  
119 - .objectFit(ImageFit.Auto)  
120 - .width('27lpx')  
121 - .height('27lpx') 121 + if (!this.isLoading){
  122 + this.getNewPageData()
  123 + if(resolve) resolve('刷新成功')
122 } 124 }
123 - .height('69lpx')  
124 - .width('659lpx')  
125 - .alignItems(VerticalAlign.Center)  
126 - .justifyContent(FlexAlign.Center)  
127 - .backgroundColor($r('app.color.color_F5F5F5'))  
128 - .margin({ top: '31lpx', bottom: '4lpx' })  
129 - }.onClick(() => {  
130 - let params = { 'index': "1" } as Record<string, string>  
131 - WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)  
132 - })  
133 -  
134 - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {  
135 - ListItem() {  
136 - FollowChildComponent({ data: item, type: 2 }) 125 + },
  126 + onLoadMore:(resolve)=> {
  127 + console.log(TAG, "触底了");
  128 + if (!this.isLoading) {
  129 + this.isLoading = true
  130 + //加载分页数据
  131 + this.getNewPageData()
137 } 132 }
138 - }, (item: FollowListDetailItem, index: number) => index.toString())  
139 -  
140 - //没有更多数据 显示提示  
141 - if (!this.hasMore) {  
142 - ListItem() {  
143 - ListHasNoMoreDataUI()  
144 - }  
145 - }  
146 - }  
147 - .cachedCount(15)  
148 - .padding({ left: '31lpx', right: '31lpx' })  
149 - .layoutWeight(1)  
150 - .scrollBar(BarState.Off)  
151 - .edgeEffect(EdgeEffect.None)  
152 - .nestedScroll({  
153 - scrollForward: NestedScrollMode.PARENT_FIRST,  
154 - scrollBackward: NestedScrollMode.SELF_FIRST  
155 - })  
156 - .onReachEnd(() => {  
157 - console.log(TAG, "触底了");  
158 - if (!this.isLoading) {  
159 - this.isLoading = true  
160 - //加载分页数据  
161 - this.getNewPageData()  
162 } 133 }
163 }) 134 })
164 } 135 }
@@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent { @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent {
167 .width('100%') 138 .width('100%')
168 } 139 }
169 140
  141 + @Builder ListLayout(){
  142 + List({ space: 3 ,scroller:this.scroller}) {
  143 + ListItem() {
  144 + Row() {
  145 + Text("关注更多人民号")
  146 + .fontWeight('400lpx')
  147 + .fontColor($r('app.color.color_222222'))
  148 + .lineHeight('38lpx')
  149 + .fontSize('27lpx')
  150 + .textAlign(TextAlign.Center)
  151 + .margin({ right: '4lpx' })
  152 + Image($r('app.media.arrow_icon_right'))
  153 + .objectFit(ImageFit.Auto)
  154 + .width('27lpx')
  155 + .height('27lpx')
  156 + }
  157 + .height('69lpx')
  158 + .width('659lpx')
  159 + .alignItems(VerticalAlign.Center)
  160 + .justifyContent(FlexAlign.Center)
  161 + .backgroundColor($r('app.color.color_F5F5F5'))
  162 + .margin({ top: '31lpx', bottom: '4lpx' })
  163 + }.onClick(() => {
  164 + let params = { 'index': "1" } as Record<string, string>
  165 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
  166 + })
  167 +
  168 + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
  169 + ListItem() {
  170 + FollowChildComponent({ data: item, type: 2 })
  171 + }
  172 + }, (item: FollowListDetailItem, index: number) => index.toString())
  173 + //没有更多数据 显示提示
  174 + if (!this.hasMore) {
  175 + ListItem() {
  176 + ListHasNoMoreDataUI()
  177 + }
  178 + }
  179 + }
  180 + .cachedCount(15)
  181 + .padding({ left: '31lpx', right: '31lpx' })
  182 + .layoutWeight(1)
  183 + .scrollBar(BarState.Off)
  184 + .edgeEffect(EdgeEffect.None)
  185 + .nestedScroll({
  186 + scrollForward: NestedScrollMode.PARENT_FIRST,
  187 + scrollBackward: NestedScrollMode.SELF_FIRST
  188 + })
  189 + }
  190 +
170 @Styles 191 @Styles
171 listStyle() { 192 listStyle() {
172 .backgroundColor(Color.White) 193 .backgroundColor(Color.White)
@@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet
7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; 7 import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
8 import { ChildCommentComponent } from './ChildCommentComponent'; 8 import { ChildCommentComponent } from './ChildCommentComponent';
9 import { EmptyComponent } from '../../view/EmptyComponent'; 9 import { EmptyComponent } from '../../view/EmptyComponent';
  10 +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
10 11
11 const TAG = "HomePageBottomComponent" 12 const TAG = "HomePageBottomComponent"
12 /** 13 /**
@@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent { @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent {
23 @Prop levelHead: string 24 @Prop levelHead: string
24 @Link commentNum: number 25 @Link commentNum: number
25 @State isGetRequest: boolean = false 26 @State isGetRequest: boolean = false
  27 + private scroller: Scroller = new Scroller();
  28 +
26 29
27 aboutToAppear() { 30 aboutToAppear() {
28 this.getNewPageData() 31 this.getNewPageData()
@@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent { @@ -41,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent {
41 .layoutWeight(1) 44 .layoutWeight(1)
42 } 45 }
43 } else { 46 } else {
44 - List({ space: 3 }) {  
45 - LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {  
46 - ListItem() {  
47 - ChildCommentComponent({  
48 - data: item,  
49 - levelHead: this.levelHead,  
50 - isLastItem: index === this.data_comment.totalCount() - 1  
51 - }) 47 + CustomPullToRefresh({
  48 + alldata:this.data_comment,
  49 + scroller:this.scroller,
  50 + customList:()=>{
  51 + this.ListLayout()
  52 + },
  53 + onRefresh:(resolve)=>{
  54 + this.curPageNum = 1;
  55 + this.hasMore = true
  56 + this.isGetRequest = false
  57 + this.data_comment.clear()
  58 +
  59 + if (!this.isLoading){
  60 + this.getNewPageData()
  61 + if(resolve) resolve('刷新成功')
52 } 62 }
53 - .onClick(() => {  
54 - })  
55 - }, (item: CommentListItem, index: number) => index.toString())  
56 -  
57 - //没有更多数据 显示提示  
58 - if (!this.hasMore) {  
59 - ListItem() {  
60 - ListHasNoMoreDataUI() 63 + },
  64 + onLoadMore:(resolve)=> {
  65 + console.log(TAG, "触底了");
  66 + if (!this.isLoading) {
  67 + this.isLoading = true
  68 + //加载分页数据
  69 + this.getNewPageData()
61 } 70 }
62 } 71 }
63 - }  
64 - .cachedCount(15)  
65 - .layoutWeight(1)  
66 - .scrollBar(BarState.Off)  
67 - .edgeEffect(EdgeEffect.None)  
68 - .nestedScroll({  
69 - scrollForward: NestedScrollMode.PARENT_FIRST,  
70 - scrollBackward: NestedScrollMode.SELF_FIRST  
71 - })  
72 - .onReachEnd(() => {  
73 - console.log(TAG, "触底了");  
74 - if (!this.isLoading) {  
75 - this.isLoading = true  
76 - //加载分页数据  
77 - this.getNewPageData()  
78 - }  
79 }) 72 })
80 } 73 }
81 } 74 }
@@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent { @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent {
84 .justifyContent(FlexAlign.Start) 77 .justifyContent(FlexAlign.Start)
85 } 78 }
86 79
  80 + @Builder ListLayout(){
  81 + List({ space: 3 ,scroller: this.scroller}) {
  82 + LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
  83 + ListItem() {
  84 + ChildCommentComponent({
  85 + data: item,
  86 + levelHead: this.levelHead,
  87 + isLastItem: index === this.data_comment.totalCount() - 1
  88 + })
  89 + }
  90 + }, (item: CommentListItem, index: number) => index.toString())
  91 +
  92 + //没有更多数据 显示提示
  93 + if (!this.hasMore) {
  94 + ListItem() {
  95 + ListHasNoMoreDataUI()
  96 + }
  97 + }
  98 + }
  99 + .cachedCount(15)
  100 + .layoutWeight(1)
  101 + .scrollBar(BarState.Off)
  102 + .edgeEffect(EdgeEffect.None)
  103 + .nestedScroll({
  104 + scrollForward: NestedScrollMode.PARENT_FIRST,
  105 + scrollBackward: NestedScrollMode.SELF_FIRST
  106 + })
  107 + }
  108 +
87 @Styles 109 @Styles
88 listStyle() { 110 listStyle() {
89 .backgroundColor(Color.White) 111 .backgroundColor(Color.White)
@@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter'; @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter';
4 import MinePageDatasModel from '../../../model/MinePageDatasModel'; 4 import MinePageDatasModel from '../../../model/MinePageDatasModel';
5 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; 5 import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
6 import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; 6 import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
  7 +import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
7 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; 8 import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
8 import { EmptyComponent } from '../../view/EmptyComponent'; 9 import { EmptyComponent } from '../../view/EmptyComponent';
9 import { FollowChildComponent } from '../follow/FollowChildComponent'; 10 import { FollowChildComponent } from '../follow/FollowChildComponent';
@@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{
22 @State count:number = 0; 23 @State count:number = 0;
23 @Prop curUserId: string 24 @Prop curUserId: string
24 @State isGetRequest:boolean = false 25 @State isGetRequest:boolean = false
25 - 26 + private scroller: Scroller = new Scroller();
26 27
27 aboutToAppear(){ 28 aboutToAppear(){
28 this.getNewPageData() 29 this.getNewPageData()
@@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{ @@ -66,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{
66 }.layoutWeight(1) 67 }.layoutWeight(1)
67 .justifyContent(FlexAlign.Start) 68 .justifyContent(FlexAlign.Start)
68 }else{ 69 }else{
69 - List({ space: 3 }) {  
70 -  
71 - ListItem() {  
72 - Row(){  
73 - Text("关注更多人民号")  
74 - .fontWeight('400lpx')  
75 - .fontColor($r('app.color.color_222222'))  
76 - .lineHeight('38lpx')  
77 - .fontSize('27lpx')  
78 - .textAlign(TextAlign.Center)  
79 - .margin({right:'4lpx'})  
80 - Image($r('app.media.arrow_icon_right'))  
81 - .objectFit(ImageFit.Auto)  
82 - .width('27lpx')  
83 - .height('27lpx')  
84 - }.height('69lpx')  
85 - .width('659lpx')  
86 - .alignItems(VerticalAlign.Center)  
87 - .justifyContent(FlexAlign.Center)  
88 - .backgroundColor($r('app.color.color_F5F5F5'))  
89 - .margin({top:'31lpx',bottom:'4lpx'})  
90 - }.onClick(()=>{  
91 - let params = {'index': "1"} as Record<string, string>;  
92 - WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)  
93 - }) 70 + CustomPullToRefresh({
  71 + alldata:this.data_follow,
  72 + scroller:this.scroller,
  73 + customList:()=>{
  74 + this.ListLayout()
  75 + },
  76 + onRefresh:(resolve)=>{
  77 + this.curPageNum = 1;
  78 + this.hasMore = true
  79 + this.isGetRequest = false
  80 + this.data_follow.clear()
94 81
95 - LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {  
96 - ListItem() {  
97 - FollowChildComponent({data: item,type:2}) 82 + if (!this.isLoading){
  83 + this.getNewPageData()
  84 + if(resolve) resolve('刷新成功')
98 } 85 }
99 - .onClick(() => {  
100 - })  
101 - }, (item: FollowListDetailItem, index: number) => index.toString())  
102 -  
103 - //没有更多数据 显示提示  
104 - if(!this.hasMore){  
105 - ListItem(){  
106 - ListHasNoMoreDataUI() 86 + },
  87 + onLoadMore:(resolve)=> {
  88 + console.log(TAG, "触底了");
  89 + if (!this.isLoading) {
  90 + this.isLoading = true
  91 + //加载分页数据
  92 + this.getNewPageData()
107 } 93 }
108 } 94 }
109 - }.cachedCount(15)  
110 - .padding({left:'31lpx',right:'31lpx'})  
111 - .layoutWeight(1)  
112 - .scrollBar(BarState.Off)  
113 - .edgeEffect(EdgeEffect.None)  
114 - .nestedScroll({  
115 - scrollForward: NestedScrollMode.PARENT_FIRST,  
116 - scrollBackward: NestedScrollMode.SELF_FIRST  
117 - })  
118 - .onReachEnd(()=>{  
119 - console.log(TAG,"触底了");  
120 - if(!this.isLoading){  
121 - this.isLoading = true  
122 - //加载分页数据  
123 - this.getNewPageData()  
124 - }  
125 }) 95 })
126 } 96 }
127 } 97 }
128 .width('100%') 98 .width('100%')
129 } 99 }
130 100
  101 + @Builder ListLayout(){
  102 + List({ space: 3 ,scroller:this.scroller}) {
  103 + ListItem() {
  104 + Row(){
  105 + Text("关注更多人民号")
  106 + .fontWeight('400lpx')
  107 + .fontColor($r('app.color.color_222222'))
  108 + .lineHeight('38lpx')
  109 + .fontSize('27lpx')
  110 + .textAlign(TextAlign.Center)
  111 + .margin({right:'4lpx'})
  112 + Image($r('app.media.arrow_icon_right'))
  113 + .objectFit(ImageFit.Auto)
  114 + .width('27lpx')
  115 + .height('27lpx')
  116 + }.height('69lpx')
  117 + .width('659lpx')
  118 + .alignItems(VerticalAlign.Center)
  119 + .justifyContent(FlexAlign.Center)
  120 + .backgroundColor($r('app.color.color_F5F5F5'))
  121 + .margin({top:'31lpx',bottom:'4lpx'})
  122 + }.onClick(()=>{
  123 + let params = {'index': "1"} as Record<string, string>;
  124 + WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
  125 + })
  126 +
  127 + LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
  128 + ListItem() {
  129 + FollowChildComponent({data: item,type:2})
  130 + }
  131 + .onClick(() => {
  132 + })
  133 + }, (item: FollowListDetailItem, index: number) => index.toString())
  134 +
  135 + //没有更多数据 显示提示
  136 + if(!this.hasMore){
  137 + ListItem(){
  138 + ListHasNoMoreDataUI()
  139 + }
  140 + }
  141 + }.cachedCount(15)
  142 + .padding({left:'31lpx',right:'31lpx'})
  143 + .layoutWeight(1)
  144 + .scrollBar(BarState.Off)
  145 + .edgeEffect(EdgeEffect.None)
  146 + .nestedScroll({
  147 + scrollForward: NestedScrollMode.PARENT_FIRST,
  148 + scrollBackward: NestedScrollMode.SELF_FIRST
  149 + })
  150 + }
131 151
132 @Styles 152 @Styles
133 listStyle() { 153 listStyle() {
@@ -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,17 +126,18 @@ struct InteractMessagePage { @@ -120,17 +126,18 @@ 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 {
133 - this.browSingModel.viewType = ViewType.EMPTY; 138 + if (this.currentPage === 1) {
  139 + this.browSingModel.viewType = ViewType.EMPTY;
  140 + }
134 } 141 }
135 }) 142 })
136 } 143 }
@@ -46,7 +46,7 @@ struct MyCollectionListPage { @@ -46,7 +46,7 @@ struct MyCollectionListPage {
46 46
47 build() { 47 build() {
48 Column(){ 48 Column(){
49 - CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{ 49 + CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{
50 this.allSelectDatas(false) 50 this.allSelectDatas(false)
51 this.isAllSelect = false 51 this.isAllSelect = false
52 this.selectDatas = [] 52 this.selectDatas = []
@@ -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) {
130 - //搜索结果  
131 - SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest}) 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{
  139 + //搜索结果
  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
@@ -329,11 +338,13 @@ export struct SearchComponent { @@ -329,11 +338,13 @@ export struct SearchComponent {
329 // } 338 // }
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
@@ -19,7 +19,7 @@ export struct BigPicCardComponent { @@ -19,7 +19,7 @@ export struct BigPicCardComponent {
19 19
20 aboutToAppear() { 20 aboutToAppear() {
21 // 取第一个数据 21 // 取第一个数据
22 - if (this.compDTO.operDataList) { 22 + if (this.compDTO.operDataList.length > 0) {
23 this.contentDTO = this.compDTO.operDataList[0]; 23 this.contentDTO = this.compDTO.operDataList[0];
24 this.contentDTO.appStyle = "2"; 24 this.contentDTO.appStyle = "2";
25 } 25 }