zhaojunkai
... ... @@ -15,6 +15,7 @@ export struct WdWebComponent {
onWebPrepared: () => void = () => {
}
@Prop webUrl: string = ''
@Prop @Watch('onReloadStateChanged') reload: number = 0
@Link isPageEnd: boolean
build() {
... ... @@ -87,5 +88,11 @@ export struct WdWebComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -15,6 +15,7 @@ export struct WdWebLocalComponent {
}
@Prop backVisibility: boolean = false
@Prop webResource: Resource = {} as Resource
@Prop @Watch('onReloadStateChanged') reload: number = 0
@State webHeight: string | number = '100%'
@Link isPageEnd: boolean
@State videoUrl: string = ''
... ... @@ -240,5 +241,11 @@ export struct WdWebLocalComponent {
Logger.debug(TAG, 'onLoadIntercept return false');
return false
}
onReloadStateChanged() {
Logger.info(TAG, `onReloadStateChanged:::refresh, this.reload: ${this.reload}`);
if (this.reload > 0) {
this.webviewControl.refresh()
}
}
}
... ...
... ... @@ -95,6 +95,7 @@ export struct ImageAndTextWebComponent {
Column() {
WdWebLocalComponent({
webviewControl: this.webviewControl,
reload:this.reload,
webResource: $rawfile('apph5/index.html'),
backVisibility: false,
onWebPrepared: this.onWebPrepared.bind(this),
... ...
... ... @@ -20,6 +20,7 @@ export struct SpacialTopicPageComponent {
action: Action = {} as Action
@State webUrl: string = '';
@State isPageEnd: boolean = false
@State reload: number = 0;
@Provide contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
private h5ReceiveAppData: H5ReceiveDetailBean = { dataSource: '2' } as H5ReceiveDetailBean
private webPrepared = false;
... ... @@ -101,6 +102,7 @@ export struct SpacialTopicPageComponent {
WdWebComponent({
webviewControl: this.webviewControl,
webUrl: this.webUrl,
reload: this.reload,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd: $isPageEnd,
})
... ... @@ -136,6 +138,7 @@ export struct SpacialTopicPageComponent {
if (!this.action?.params?.backVisibility) {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
this.reload++
}
aboutToAppear() {
... ...
... ... @@ -7,6 +7,7 @@ import { EmptyComponent } from '../../view/EmptyComponent';
import { ChildCommentComponent } from './ChildCommentComponent';
import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDetailItem';
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomCommentComponent"
... ... @@ -22,6 +23,7 @@ export struct HomePageBottomCommentComponent {
@State count: number = 0;
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -42,7 +44,40 @@ export struct HomePageBottomCommentComponent {
.offset({ y: "-200lpx" })
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3,scroller: this.scroller }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -68,18 +103,6 @@ export struct HomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
getNewPageData() {
... ...
... ... @@ -7,6 +7,7 @@ import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../follow/FollowChildComponent';
import dataPreferences from '@ohos.data.preferences';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomFollowComponent"
/**
... ... @@ -14,6 +15,7 @@ const TAG = "HomePageBottomFollowComponent"
*/
@Component
export struct HomePageBottomFollowComponent {
private scroller: Scroller = new Scroller();
@State data_follow: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State isLoading: boolean = false
@State hasMore: boolean = true
... ... @@ -104,8 +106,40 @@ export struct HomePageBottomFollowComponent {
})
}.layoutWeight(1)
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row() {
Text("关注更多人民号")
... ... @@ -136,7 +170,6 @@ export struct HomePageBottomFollowComponent {
FollowChildComponent({ data: item, type: 2 })
}
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
... ... @@ -153,18 +186,6 @@ export struct HomePageBottomFollowComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
.width('100%')
}
@Styles
... ...
... ... @@ -7,6 +7,7 @@ import { MineCommentListDetailItem } from '../../../viewmodel/MineCommentListDet
import { OtherUserCommentLikeStatusRequestItem } from '../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
import { ChildCommentComponent } from './ChildCommentComponent';
import { EmptyComponent } from '../../view/EmptyComponent';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
const TAG = "HomePageBottomComponent"
/**
... ... @@ -23,6 +24,8 @@ export struct OtherHomePageBottomCommentComponent {
@Prop levelHead: string
@Link commentNum: number
@State isGetRequest: boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear() {
this.getNewPageData()
... ... @@ -41,7 +44,41 @@ export struct OtherHomePageBottomCommentComponent {
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_comment,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Builder ListLayout(){
List({ space: 3 ,scroller: this.scroller}) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
... ... @@ -50,8 +87,6 @@ export struct OtherHomePageBottomCommentComponent {
isLastItem: index === this.data_comment.totalCount() - 1
})
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
... ... @@ -69,19 +104,6 @@ export struct OtherHomePageBottomCommentComponent {
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}
@Styles
... ...
... ... @@ -4,6 +4,7 @@ import { WDRouterRule, WDRouterPage } from 'wdRouter';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem';
import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem';
import { CustomPullToRefresh } from '../../reusable/CustomPullToRefresh';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { EmptyComponent } from '../../view/EmptyComponent';
import { FollowChildComponent } from '../follow/FollowChildComponent';
... ... @@ -22,7 +23,7 @@ export struct OtherHomePageBottomFollowComponent{
@State count:number = 0;
@Prop curUserId: string
@State isGetRequest:boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear(){
this.getNewPageData()
... ... @@ -66,8 +67,39 @@ export struct OtherHomePageBottomFollowComponent{
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
List({ space: 3 }) {
CustomPullToRefresh({
alldata:this.data_follow,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_follow.clear()
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
})
}
}
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row(){
Text("关注更多人民号")
... ... @@ -115,19 +147,7 @@ export struct OtherHomePageBottomFollowComponent{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
}
@Styles
listStyle() {
... ...
... ... @@ -46,7 +46,7 @@ struct MyCollectionListPage {
build() {
Column(){
CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:true,editCallback:()=>{
CustomTitleAndEditUI({titleName:'我的收藏',isDisplayButton:this.browSingModel.viewType == ViewType.ERROR || this.browSingModel.viewType == ViewType.EMPTY?false:true,editCallback:()=>{
this.allSelectDatas(false)
this.isAllSelect = false
this.selectDatas = []
... ...
... ... @@ -19,7 +19,7 @@ export struct BigPicCardComponent {
aboutToAppear() {
// 取第一个数据
if (this.compDTO.operDataList) {
if (this.compDTO.operDataList.length > 0) {
this.contentDTO = this.compDTO.operDataList[0];
this.contentDTO.appStyle = "2";
}
... ...