zhaojunkai
@@ -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
@@ -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),
@@ -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() {
@@ -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,7 +44,40 @@ export struct HomePageBottomCommentComponent { @@ -42,7 +44,40 @@ export struct HomePageBottomCommentComponent {
42 .offset({ y: "-200lpx" }) 44 .offset({ y: "-200lpx" })
43 } 45 }
44 } else { 46 } else {
45 - List({ space: 3 }) { 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('刷新成功')
  62 + }
  63 + },
  64 + onLoadMore:(resolve)=> {
  65 + console.log(TAG, "触底了");
  66 + if (!this.isLoading) {
  67 + this.isLoading = true
  68 + //加载分页数据
  69 + this.getNewPageData()
  70 + }
  71 + }
  72 + })
  73 + }
  74 + }.layoutWeight(1)
  75 + .justifyContent(FlexAlign.Start)
  76 + .width('100%')
  77 + }
  78 +
  79 + @Builder ListLayout(){
  80 + List({ space: 3,scroller: this.scroller }) {
46 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 81 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
47 ListItem() { 82 ListItem() {
48 ChildCommentComponent({ 83 ChildCommentComponent({
@@ -68,18 +103,6 @@ export struct HomePageBottomCommentComponent { @@ -68,18 +103,6 @@ export struct HomePageBottomCommentComponent {
68 scrollForward: NestedScrollMode.PARENT_FIRST, 103 scrollForward: NestedScrollMode.PARENT_FIRST,
69 scrollBackward: NestedScrollMode.SELF_FIRST 104 scrollBackward: NestedScrollMode.SELF_FIRST
70 }) 105 })
71 - .onReachEnd(() => {  
72 - console.log(TAG, "触底了");  
73 - if (!this.isLoading) {  
74 - this.isLoading = true  
75 - //加载分页数据  
76 - this.getNewPageData()  
77 - }  
78 - })  
79 - }  
80 - }.layoutWeight(1)  
81 - .justifyContent(FlexAlign.Start)  
82 - .width('100%')  
83 } 106 }
84 107
85 getNewPageData() { 108 getNewPageData() {
@@ -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,8 +106,40 @@ export struct HomePageBottomFollowComponent { @@ -104,8 +106,40 @@ 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()
  120 +
  121 + if (!this.isLoading){
  122 + this.getNewPageData()
  123 + if(resolve) resolve('刷新成功')
  124 + }
  125 + },
  126 + onLoadMore:(resolve)=> {
  127 + console.log(TAG, "触底了");
  128 + if (!this.isLoading) {
  129 + this.isLoading = true
  130 + //加载分页数据
  131 + this.getNewPageData()
  132 + }
  133 + }
  134 + })
  135 + }
  136 + }.layoutWeight(1)
  137 + .justifyContent(FlexAlign.Start)
  138 + .width('100%')
  139 + }
108 140
  141 + @Builder ListLayout(){
  142 + List({ space: 3 ,scroller:this.scroller}) {
109 ListItem() { 143 ListItem() {
110 Row() { 144 Row() {
111 Text("关注更多人民号") 145 Text("关注更多人民号")
@@ -136,7 +170,6 @@ export struct HomePageBottomFollowComponent { @@ -136,7 +170,6 @@ export struct HomePageBottomFollowComponent {
136 FollowChildComponent({ data: item, type: 2 }) 170 FollowChildComponent({ data: item, type: 2 })
137 } 171 }
138 }, (item: FollowListDetailItem, index: number) => index.toString()) 172 }, (item: FollowListDetailItem, index: number) => index.toString())
139 -  
140 //没有更多数据 显示提示 173 //没有更多数据 显示提示
141 if (!this.hasMore) { 174 if (!this.hasMore) {
142 ListItem() { 175 ListItem() {
@@ -153,18 +186,6 @@ export struct HomePageBottomFollowComponent { @@ -153,18 +186,6 @@ export struct HomePageBottomFollowComponent {
153 scrollForward: NestedScrollMode.PARENT_FIRST, 186 scrollForward: NestedScrollMode.PARENT_FIRST,
154 scrollBackward: NestedScrollMode.SELF_FIRST 187 scrollBackward: NestedScrollMode.SELF_FIRST
155 }) 188 })
156 - .onReachEnd(() => {  
157 - console.log(TAG, "触底了");  
158 - if (!this.isLoading) {  
159 - this.isLoading = true  
160 - //加载分页数据  
161 - this.getNewPageData()  
162 - }  
163 - })  
164 - }  
165 - }.layoutWeight(1)  
166 - .justifyContent(FlexAlign.Start)  
167 - .width('100%')  
168 } 189 }
169 190
170 @Styles 191 @Styles
@@ -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,7 +44,41 @@ export struct OtherHomePageBottomCommentComponent { @@ -41,7 +44,41 @@ export struct OtherHomePageBottomCommentComponent {
41 .layoutWeight(1) 44 .layoutWeight(1)
42 } 45 }
43 } else { 46 } else {
44 - List({ space: 3 }) { 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('刷新成功')
  62 + }
  63 + },
  64 + onLoadMore:(resolve)=> {
  65 + console.log(TAG, "触底了");
  66 + if (!this.isLoading) {
  67 + this.isLoading = true
  68 + //加载分页数据
  69 + this.getNewPageData()
  70 + }
  71 + }
  72 + })
  73 + }
  74 + }
  75 + .width('100%')
  76 + .layoutWeight(1)
  77 + .justifyContent(FlexAlign.Start)
  78 + }
  79 +
  80 + @Builder ListLayout(){
  81 + List({ space: 3 ,scroller: this.scroller}) {
45 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => { 82 LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
46 ListItem() { 83 ListItem() {
47 ChildCommentComponent({ 84 ChildCommentComponent({
@@ -50,8 +87,6 @@ export struct OtherHomePageBottomCommentComponent { @@ -50,8 +87,6 @@ export struct OtherHomePageBottomCommentComponent {
50 isLastItem: index === this.data_comment.totalCount() - 1 87 isLastItem: index === this.data_comment.totalCount() - 1
51 }) 88 })
52 } 89 }
53 - .onClick(() => {  
54 - })  
55 }, (item: CommentListItem, index: number) => index.toString()) 90 }, (item: CommentListItem, index: number) => index.toString())
56 91
57 //没有更多数据 显示提示 92 //没有更多数据 显示提示
@@ -69,19 +104,6 @@ export struct OtherHomePageBottomCommentComponent { @@ -69,19 +104,6 @@ export struct OtherHomePageBottomCommentComponent {
69 scrollForward: NestedScrollMode.PARENT_FIRST, 104 scrollForward: NestedScrollMode.PARENT_FIRST,
70 scrollBackward: NestedScrollMode.SELF_FIRST 105 scrollBackward: NestedScrollMode.SELF_FIRST
71 }) 106 })
72 - .onReachEnd(() => {  
73 - console.log(TAG, "触底了");  
74 - if (!this.isLoading) {  
75 - this.isLoading = true  
76 - //加载分页数据  
77 - this.getNewPageData()  
78 - }  
79 - })  
80 - }  
81 - }  
82 - .width('100%')  
83 - .layoutWeight(1)  
84 - .justifyContent(FlexAlign.Start)  
85 } 107 }
86 108
87 @Styles 109 @Styles
@@ -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,8 +67,39 @@ export struct OtherHomePageBottomFollowComponent{ @@ -66,8 +67,39 @@ 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 + 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()
70 81
  82 + if (!this.isLoading){
  83 + this.getNewPageData()
  84 + if(resolve) resolve('刷新成功')
  85 + }
  86 + },
  87 + onLoadMore:(resolve)=> {
  88 + console.log(TAG, "触底了");
  89 + if (!this.isLoading) {
  90 + this.isLoading = true
  91 + //加载分页数据
  92 + this.getNewPageData()
  93 + }
  94 + }
  95 + })
  96 + }
  97 + }
  98 + .width('100%')
  99 + }
  100 +
  101 + @Builder ListLayout(){
  102 + List({ space: 3 ,scroller:this.scroller}) {
71 ListItem() { 103 ListItem() {
72 Row(){ 104 Row(){
73 Text("关注更多人民号") 105 Text("关注更多人民号")
@@ -115,19 +147,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -115,19 +147,7 @@ export struct OtherHomePageBottomFollowComponent{
115 scrollForward: NestedScrollMode.PARENT_FIRST, 147 scrollForward: NestedScrollMode.PARENT_FIRST,
116 scrollBackward: NestedScrollMode.SELF_FIRST 148 scrollBackward: NestedScrollMode.SELF_FIRST
117 }) 149 })
118 - .onReachEnd(()=>{  
119 - console.log(TAG,"触底了");  
120 - if(!this.isLoading){  
121 - this.isLoading = true  
122 - //加载分页数据  
123 - this.getNewPageData()  
124 } 150 }
125 - })  
126 - }  
127 - }  
128 - .width('100%')  
129 - }  
130 -  
131 151
132 @Styles 152 @Styles
133 listStyle() { 153 listStyle() {
@@ -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 = []
@@ -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 }