yumaochao
Showing 37 changed files with 288 additions and 111 deletions
... ... @@ -220,6 +220,9 @@ export class ProcessUtils {
}
public static gotoDefaultWeb(content: ContentDTO) {
// 内链
if(content.openType == '1'){
let taskAction: Action = {
type: 'JUMP_H5_BY_WEB_VIEW',
params: {
... ... @@ -227,7 +230,16 @@ export class ProcessUtils {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoWeb, ${content.objectId}`);
}else if(content.openType == '2') {
// 外链
ProcessUtils.jumpExternalWebPage(content.linkUrl);
}else {
// 无需跳转
}
Logger.debug(TAG, `gotoWeb, ${content.objectId}`)
}
static commentGotoWeb(content: commentInfo) {
... ...
... ... @@ -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 = '';
... ...
... ... @@ -30,6 +30,8 @@ export struct CarderInteraction {
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
this.contentDTO.shareFlag = this.contentDTO.shareFlag?this.contentDTO.shareFlag:'1'
console.log('是否显示分享',this.contentDTO.shareFlag)
}
build() {
... ...
... ... @@ -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),
... ...
import { ContentDTO } from 'wdBean/Index';
import { ProcessUtils } from 'wdRouter/Index';
import { InteractMessageModel } from '../../model/InteractMessageModel'
import { DateTimeUtils} from 'wdKit/Index'
@Component
export struct InteractMComponent {
messageModel:InteractMessageModel = new InteractMessageModel;
... ... @@ -15,6 +15,7 @@ export struct InteractMComponent {
build() {
Row(){
Image(this.messageModel.InteractMsubM.headUrl)
.alt($r('app.media.default_head'))
.width(36)
.height(36)
.borderRadius(18)
... ... @@ -29,7 +30,7 @@ export struct InteractMComponent {
.margin({left:5})
}.width('100%')
Text(this.messageModel.time)
Text(this.getPublishTime(this.messageModel.time,DateTimeUtils.getDateTimestamp(this.messageModel.time)+""))
.margin({top:2})
.fontSize('12fp').fontColor('#B0B0B0').margin({top:10,bottom:10})
... ... @@ -41,6 +42,7 @@ export struct InteractMComponent {
.constraintSize({maxHeight:500})
}
if(this.messageModel.contentType != '211' && this.messageModel.contentType != '210'){
Column(){
if (this.messageModel.contentType === '207' || this.messageModel.contentType === '209'){
Text('[你的评论]'+this.buildCommentContent()).fontSize('14fp').fontColor('#666666').constraintSize({maxHeight:500})
... ... @@ -77,6 +79,7 @@ export struct InteractMComponent {
contentDTO.objectId = this.messageModel.InteractMsubM.contentId
ProcessUtils.processPage(contentDTO)
})
}
}.padding({left:5,right:5}).alignItems(HorizontalAlign.Start).width('90%')
}.padding({top:10,left:16,right:16}).width('100%').alignItems(VerticalAlign.Top)
}
... ... @@ -102,4 +105,49 @@ export struct InteractMComponent {
let contentString : string = this.messageModel.contentType === '207'?this.messageModel.message:this.messageModel.InteractMsubM.beReply;
return contentString;
}
getPublishTime(data:string,publishTime: string): string {
const publishTimestamp = parseInt(publishTime)
const currentTime = Date.now(); // 当前时间戳
// 计算差异
const timeDifference = currentTime - publishTimestamp;
// 转换为分钟、小时和天
const minutes = Math.floor(timeDifference / (1000 * 60));
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
// 根据时间差返回对应的字符串
let result: string;
if (minutes < 60) {
result = `${minutes}分钟前`;
if (minutes === 0) {
result = `刚刚`;
}
} else if (hours < 24) {
result = `${hours}小时前`;
} else {
result = `${days}天前`;
if (days > 1) {
let arr = data.split(" ")
if (arr.length === 2) {
let arr2 = arr[0].split("-")
if (arr2.length === 3) {
result = `${arr2[1]}-${arr2[2]}`
}
} else {
//原始数据是时间戳 需要转成dateString
let time = DateTimeUtils.formatDate(Number(publishTime))
let arr = time.split("-")
if (arr.length === 3) {
result = `${arr[1]}-${arr[2]}`
}
}
}
}
console.log(result);
return result
}
}
\ No newline at end of file
... ...
... ... @@ -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() {
... ...
... ... @@ -51,7 +51,7 @@ export struct Card10Component {
}
}
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -52,7 +52,7 @@ export struct Card11Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r("app.float.font_size_16"))
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -50,7 +50,7 @@ export struct Card12Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
... ...
... ... @@ -54,7 +54,7 @@ export struct Card14Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.lineHeight(25)
... ...
... ... @@ -55,7 +55,7 @@ export struct Card15Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
... ... @@ -58,7 +58,7 @@ export struct Card16Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(2)
... ...
... ... @@ -49,7 +49,7 @@ export struct Card17Component {
}
}
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.lineHeight(25)
.maxLines(3)
... ...
... ... @@ -49,12 +49,12 @@ export struct Card19Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.textOverflowStyle(3)
.margin({ bottom: 8 })
.width(CommonConstants.FULL_WIDTH)
.lineHeight(22)
.lineHeight(25)
.onClick((event: ClickEvent) => {
this.clicked = true;
ProcessUtils.processPage(this.contentDTO)
... ...
... ... @@ -50,7 +50,7 @@ export struct Card20Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.textOverflowStyle(3)
... ...
... ... @@ -52,7 +52,7 @@ export struct Card21Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.selected_text_size'))
.fontSize(18)
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.width(CommonConstants.FULL_WIDTH)
.maxLines(4)
... ...
... ... @@ -63,7 +63,7 @@ export struct Card2Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
... ...
... ... @@ -50,7 +50,7 @@ export struct Card3Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r("app.float.font_size_16"))
.fontSize($r("app.float.font_size_18"))
.fontColor(this.clicked ? 0x848484 : $r("app.color.color_222222"))
.width(CommonConstants.FULL_WIDTH)
.textIndent(this.contentDTO.newTags?.length < 5 && this.contentDTO.newTags?.length > 2 ? 58 :
... ...
... ... @@ -54,7 +54,7 @@ export struct Card4Component {
Span(this.contentDTO.newsTitle)
}
}
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
... ...
... ... @@ -71,7 +71,7 @@ export struct Card5Component {
}
.width(CommonConstants.FULL_WIDTH)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Bold)
.maxLines(2)
.align(Alignment.TopStart)
... ...
... ... @@ -70,7 +70,7 @@ export struct Card6Component {
}
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.fontSize(16)
.fontSize(18)
.lineHeight(24)
.fontWeight(FontWeight.Normal)
.maxLines(3)
... ...
... ... @@ -50,7 +50,7 @@ export struct Card9Component {
}
.fontColor(this.clicked ? 0x848484 : 0x222222)
.width(CommonConstants.FULL_WIDTH)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(600)
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -36,7 +36,7 @@ export struct SearchContentComponent {
Column() {
//新闻标题
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
.fontSize($r('app.float.font_size_18'))
.fontColor(this.clicked ? 0x848484 : $r('app.color.color_222222'))
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
... ...
... ... @@ -38,20 +38,19 @@ export struct QualityCommentsComponent {
aboutToDisappear(): void {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowBackgroundColor(this.lastWindowColor)
windowClass.setWindowLayoutFullScreen(false)
// windowClass.setWindowSystemBarProperties({ statusBarColor: '#000' })
this.dialogController = null // 将dialogController置空
}
onPageShow(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
}
aboutToAppear(): void {
onPageHide(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
}
this.fullScreen();
aboutToAppear(): void {
this.getData();
this.showAlert()
}
... ... @@ -100,13 +99,6 @@ export struct QualityCommentsComponent {
})
}
fullScreen() {
const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage
const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口
windowClass.setWindowLayoutFullScreen(true)
}
@Builder
titleHeader() {
Row() {
... ... @@ -249,7 +241,7 @@ export struct QualityCommentsComponent {
}
// ListItem() {
//
// }.height(this.bottomSafeHeight)
// }.height(`${this.bottomSafeHeight}` + 'px')
}.onReachEnd(()=>{
this.currentPage++
this.getData()
... ...
... ... @@ -208,7 +208,7 @@ struct CarouselLayout01CardView {
Text(`${this.item.corner}${this.item.newsTitle}`)
.width(CommonConstants.FULL_PARENT)
.fontColor(Color.White)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontWeight(FontWeight.Medium)
.textAlign(TextAlign.Start)
.align(Alignment.Bottom)
... ...
... ... @@ -57,7 +57,7 @@ export struct ZhSingleColumn04 {
.width(12)
.margin({ left: 12, right: 8 })
Text(item.newsTitle)
.fontSizeColorWeight($r('app.float.font_size_17'), $r('app.color.color_222222'), 400)
.fontSizeColorWeight($r('app.float.font_size_18'), $r('app.color.color_222222'), 400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)
... ...
... ... @@ -101,7 +101,7 @@ struct localCard {
Text(this.operDataListItem.newsTitle)
.width(CommonConstants.FULL_PARENT)
.height(CommonConstants.FULL_PARENT)
.fontSize($r('app.float.font_size_16'))
.fontSize($r('app.float.font_size_18'))
.fontColor('#000000')
.align(Alignment.TopStart)
.maxLines(3)
... ...
... ... @@ -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() {
... ...
... ... @@ -31,21 +31,26 @@ struct InteractMessagePage {
if(this.browSingModel.viewType == ViewType.ERROR){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NetworkFailed})
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory})
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoMessage})
}else {
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
hasMore:this.browSingModel.hasMore,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.currentPage = 1
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
if (this.browSingModel.hasMore === false) {
if(resolve) resolve('')
return
}
this.currentPage++
this.getData(resolve)
}
})
}
... ... @@ -75,6 +80,7 @@ struct InteractMessagePage {
}
}
}
.scrollBar(BarState.Off)
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
... ... @@ -120,18 +126,19 @@ struct InteractMessagePage {
for (let index = 0; index < InteractMessageMItem.list.length; index++) {
const element = InteractMessageMItem.list[index];
element.InteractMsubM = JSON.parse(element.remark)
this.allDatas.push(element)
}
this.allDatas.push(...InteractMessageMItem.list)
if (InteractMessageMItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
if (InteractMessageMItem.hasNext === 0) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
if (this.currentPage === 1) {
this.browSingModel.viewType = ViewType.EMPTY;
}
}
})
}
... ...
... ... @@ -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 = []
... ... @@ -114,6 +114,7 @@ struct MyCollectionListPage {
if (this.browSingModel.hasMore === false) NoMoreLayout()
}
}
.scrollBar(BarState.Off)
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
... ...
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) {
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
... ... @@ -330,10 +339,12 @@ export struct SearchComponent {
}
this.isGetRequest = true
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
}).catch((err: Error) => {
console.log(TAG, JSON.stringify(err))
this.isGetRequest = true
this.resetSearch()
this.isConnectNetwork = NetworkUtil.isNetConnected()
})
}
... ...
... ... @@ -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";
}
... ...