wangliang_wd

Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main

* 'main' of http://192.168.1.42/developOne/harmonyPool:
  fix:bug[17178] 无网络-触发搜索,页面空白
  人民号-分享显示状态优化
  fix:17496 话题专题/投票专题详情页,点击投票,触发登录,登录成功后,点击投票,循环触发登录
  fix:bug[17410] 我的关注无法下拉刷新
  fix:bug[17409 ]我的评论无法刷新
... ... @@ -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()
}
}
}
... ...
... ... @@ -10,7 +10,7 @@ import { BaseDTO } from '../component/BaseDTO';
@Observed
export class ContentDTO implements BaseDTO {
shareFlag?:string='0';
shareFlag?:string='1';
appStyle: string = '';
cityCode: string = '';
coverSize: string = '';
... ...
... ... @@ -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,39 +44,31 @@ export struct HomePageBottomCommentComponent {
.offset({ y: "-200lpx" })
}
} else {
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
data: item,
levelHead: UserDataLocal.getUserLevelHeaderUrl(),
isLastItem: index === this.data_comment.totalCount() - 1
})
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('刷新成功')
}
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
... ... @@ -82,6 +76,35 @@ export struct HomePageBottomCommentComponent {
.width('100%')
}
@Builder ListLayout(){
List({ space: 3,scroller: this.scroller }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
data: item,
levelHead: UserDataLocal.getUserLevelHeaderUrl(),
isLastItem: index === this.data_comment.totalCount() - 1
})
}
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
... ...
... ... @@ -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,61 +106,30 @@ 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()
ListItem() {
Row() {
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({ right: '4lpx' })
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({ top: '31lpx', bottom: '4lpx' })
}.onClick(() => {
let params = { 'index': "1" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({ data: item, type: 2 })
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}
.cachedCount(15)
.padding({ left: '31lpx', right: '31lpx' })
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
... ... @@ -167,6 +138,56 @@ export struct HomePageBottomFollowComponent {
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row() {
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({ right: '4lpx' })
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}
.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({ top: '31lpx', bottom: '4lpx' })
}.onClick(() => {
let params = { 'index': "1" } as Record<string, string>
WDRouterRule.jumpWithPage(WDRouterPage.followListPage, params)
})
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({ data: item, type: 2 })
}
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}
.cachedCount(15)
.padding({ left: '31lpx', right: '31lpx' })
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
@Styles
listStyle() {
.backgroundColor(Color.White)
... ...
... ... @@ -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,41 +44,31 @@ export struct OtherHomePageBottomCommentComponent {
.layoutWeight(1)
}
} else {
List({ space: 3 }) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
data: item,
levelHead: this.levelHead,
isLastItem: index === this.data_comment.totalCount() - 1
})
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('刷新成功')
}
.onClick(() => {
})
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
... ... @@ -84,6 +77,35 @@ export struct OtherHomePageBottomCommentComponent {
.justifyContent(FlexAlign.Start)
}
@Builder ListLayout(){
List({ space: 3 ,scroller: this.scroller}) {
LazyForEach(this.data_comment, (item: CommentListItem, index: number = 0) => {
ListItem() {
ChildCommentComponent({
data: item,
levelHead: this.levelHead,
isLastItem: index === this.data_comment.totalCount() - 1
})
}
}, (item: CommentListItem, index: number) => index.toString())
//没有更多数据 显示提示
if (!this.hasMore) {
ListItem() {
ListHasNoMoreDataUI()
}
}
}
.cachedCount(15)
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
@Styles
listStyle() {
.backgroundColor(Color.White)
... ...
... ... @@ -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,68 +67,87 @@ export struct OtherHomePageBottomFollowComponent{
}.layoutWeight(1)
.justifyContent(FlexAlign.Start)
}else{
List({ space: 3 }) {
ListItem() {
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
}.onClick(()=>{
let params = {'index': "1"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
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()
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:2})
if (!this.isLoading){
this.getNewPageData()
if(resolve) resolve('刷新成功')
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
},
onLoadMore:(resolve)=> {
console.log(TAG, "触底了");
if (!this.isLoading) {
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
}
}.cachedCount(15)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}
.width('100%')
}
@Builder ListLayout(){
List({ space: 3 ,scroller:this.scroller}) {
ListItem() {
Row(){
Text("关注更多人民号")
.fontWeight('400lpx')
.fontColor($r('app.color.color_222222'))
.lineHeight('38lpx')
.fontSize('27lpx')
.textAlign(TextAlign.Center)
.margin({right:'4lpx'})
Image($r('app.media.arrow_icon_right'))
.objectFit(ImageFit.Auto)
.width('27lpx')
.height('27lpx')
}.height('69lpx')
.width('659lpx')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.Center)
.backgroundColor($r('app.color.color_F5F5F5'))
.margin({top:'31lpx',bottom:'4lpx'})
}.onClick(()=>{
let params = {'index': "1"} as Record<string, string>;
WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params)
})
LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:2})
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
}
}
}.cachedCount(15)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.edgeEffect(EdgeEffect.None)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
}
@Styles
listStyle() {
... ...
import router from '@ohos.router'
import { StringUtils, ToastUtils } from 'wdKit'
import { NetworkUtil, StringUtils, ToastUtils } from 'wdKit'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { SearchHistoryItem } from '../../viewmodel/SearchHistoryItem'
import { SearchRelatedItem } from '../../viewmodel/SearchRelatedItem'
import { EmptyComponent } from '../view/EmptyComponent'
import { SearchHistoryComponent } from './SearchHistoryComponent'
import { SearchHotsComponent } from './SearchHotsComponent'
import { SearchRelatedComponent } from './SearchRelatedComponent'
... ... @@ -30,6 +31,7 @@ export struct SearchComponent {
scroller: Scroller = new Scroller()
@State count:string[] = []
@State isGetRequest:boolean = false;
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
aboutToAppear() {
//获取提示滚动
... ... @@ -127,8 +129,16 @@ export struct SearchComponent {
.padding({ left: '31lpx', right: '31lpx' })
} else {
if (this.hasChooseSearch) {
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"100%" ,retry: () => {
this.getSearchInputResData(this.searchText)
}})
.layoutWeight(1)
.width('100%')
}else{
//搜索结果
SearchResultComponent({count:this.count,searchText:this.searchText,isGetRequest:this.isGetRequest})
}
} else {
//联想搜索
SearchRelatedComponent({relatedSearchContentData:$relatedSearchContentsData,onGetSearchRes: (item): void => this.getSearchRelatedResData(item),searchText:this.searchText})
... ... @@ -138,7 +148,6 @@ export struct SearchComponent {
.width('100%')
}
/**
* 点击搜索记录列表回调
* @param content
... ... @@ -329,11 +338,13 @@ export struct SearchComponent {
// }
}
this.isGetRequest = true
this.resetSearch()
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
})
}
... ...