wangliang_wd

feat:优化他人主页,优化无网状态下UI展示

... ... @@ -57,7 +57,6 @@ export struct OtherHomePageBottomCommentComponent {
this.curPageNum = 1;
this.hasMore = true
this.isGetRequest = false
this.data_comment.clear()
if (!this.isLoading){
this.getNewPageData()
... ... @@ -134,6 +133,8 @@ export struct OtherHomePageBottomCommentComponent {
let object = new OtherUserCommentListRequestItem("", 20, this.curPageNum, time, "1", this.curUserId)
MinePageDatasModel.getOtherCommentListData(object, getContext(this)).then((value) => {
if (this.curPageNum === 1) this.data_comment.clear()
if (!this.data_comment || value.list.length == 0) {
this.hasMore = false
this.isLoading = false
... ...
... ... @@ -16,10 +16,10 @@ const TAG = "OtherNormalUserHomePage"
struct OtherNormalUserHomePage {
@State params:Record<string, string> = router.getParams() as Record<string, string>;
@Watch('change') @State curUserId: string = '-1';
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
pageShowTime:number = 0;
pageHideTime:number = 0;
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
onPageShow() {
this.curUserId = this.params?.['userId'];
... ... @@ -68,7 +68,7 @@ struct OtherNormalUserHomePage {
Stack({ alignContent: Alignment.Top }){
Image($r('app.media.title_bg'))
.width('100%')
.height('355lpx')
.height(`calc(${295 + this.topSafeHeight + 'lpx'})`)
.objectFit(ImageFit.Cover)
Row()
... ... @@ -83,7 +83,7 @@ struct OtherNormalUserHomePage {
Stack({ alignContent: Alignment.Top }){
this.MineHomeTitleTransparent()
this.MineHomeTitleWhite()
}
}.margin({top:px2vp(this.topSafeHeight)})
Scroll() {
Column() {
... ... @@ -175,7 +175,7 @@ struct OtherNormalUserHomePage {
this.tileOpacity = persent
}
})
.backgroundColor($r('app.color.color_transparent'))
// .backgroundColor($r('app.color.color_transparent'))
.height('184lpx')
.width('100%')
.padding({ left: '6lpx' })
... ... @@ -184,7 +184,7 @@ struct OtherNormalUserHomePage {
if(StringUtils.isNotEmpty(this.desc)){
Column() {
Row() {
Text(this.desc)
Text('简介:'+this.desc)
.fontSize('27lpx')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
... ...
... ... @@ -2,12 +2,12 @@ import { CommentListItem } from './CommentListItem'
export class MineCommentListDetailItem{
list:CommentListItem[] = []
hasNext: number = 1
pageNum: number = 0
pageSize: number = 20
totalCount: number = 0
constructor(list?:CommentListItem[],pageNum?: number,pageSize?: number,totalCount?: number) {
constructor(list?:CommentListItem[],hasNext?: number,pageNum?: number,pageSize?: number,totalCount?: number) {
}
}
\ No newline at end of file
... ...
... ... @@ -59,9 +59,12 @@ struct LoginProtocolWebview {
.width(24)
.aspectRatio(1)
.onClick(() => {
if(this.webviewController.accessBackward()){
this.webviewController.backward()
return
if (this.isConnectNetwork){
///无网络状态下 执行webviewController.accessBackward方法 会crash
if(this.webviewController.accessBackward()){
this.webviewController.backward()
return
}
}
router.back();
}).margin({ left: 16 })
... ...
import {InterestsHobbiesModel, InterestsList} from '../viewModel/InterestsHobbiesModel'
import { WDRouterRule } from 'wdRouter';
import { WDRouterPage } from 'wdRouter';
import { SPHelper } from 'wdKit/Index';
import { SpConstants } from 'wdConstant/Index';
import { NetworkUtil, SPHelper } from 'wdKit/Index';
import { SpConstants, ViewType } from 'wdConstant/Index';
import { CustomToast} from 'wdKit'
import { ButtonOptions, promptAction, window } from '@kit.ArkUI';
import { ParamType, TrackConstants, TrackingContent } from 'wdTracking/Index';
import { ImageKnifeComponent,ScaleType } from '@ohos/imageknife';
import { EmptyComponent, WDViewDefaultType } from 'wdComponent/Index';
@Entry
@Component
... ... @@ -16,7 +17,7 @@ struct LaunchInterestsHobbiesPage {
@State interestsArray: InterestsList[] = []
@State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@State isConnectNetwork : boolean = NetworkUtil.isNetConnected()
dialogToast: CustomDialogController = new CustomDialogController({
builder: CustomToast({
msg: '请先选择您感兴趣的内容哦',
... ... @@ -72,71 +73,81 @@ struct LaunchInterestsHobbiesPage {
.height('35lpx')
.margin({top:'12lpx'})
Grid( ){
ForEach(this.interestsArray,(item:InterestsList,index:number)=>{
GridItem(){
Stack({alignContent:Alignment.TopStart}){
ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic?item.pic:'',mainScaleType:ScaleType.FIT_XY}})
.width('100%')
.height('100%')
.backgroundColor(Color.White)
.borderRadius(5)
// Image(item.pic)
// .width('100%')
// .height('100%')
// .backgroundColor(Color.White)
// .borderRadius(5)
Stack(){
Image('')
if(!this.isConnectNetwork){
EmptyComponent({ emptyType: 1,emptyHeight:"60%" ,retry: () => {
this.isConnectNetwork = NetworkUtil.isNetConnected()
}})
.layoutWeight(1)
.width('100%')
}else{
Grid( ){
ForEach(this.interestsArray,(item:InterestsList,index:number)=>{
GridItem(){
Stack({alignContent:Alignment.TopStart}){
ImageKnifeComponent({imageKnifeOption:{loadSrc:item.pic?item.pic:'',mainScaleType:ScaleType.FIT_XY}})
.width('100%')
.height('100%')
.backgroundColor(Color.Black)
.opacity(item.choose?0.5:0)
.backgroundColor(Color.White)
.borderRadius(5)
}
Stack(){
Column({}){
Text(item.name)
.fontSize(18)
.fontColor('#FFFFFF')
.margin({top:'21lpx',left:'19lpx'})
.width('100%')
.height('46lpx')
.fontWeight(FontWeight.Bold)
Text(item.title)
.fontSize('23lpx')
.fontColor('#FFFFFF')
.margin({top:'2lpx',left:'19lpx'})
// Image(item.pic)
// .width('100%')
// .height('100%')
// .backgroundColor(Color.White)
// .borderRadius(5)
Stack(){
Image('')
.width('100%')
.height('31lpx')
Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot'))
.height('32lpx')
.width('32lpx')
.margin({top:'80lpx',left:'120lpx'})
.height('100%')
.backgroundColor(Color.Black)
.opacity(item.choose?0.5:0)
.borderRadius(5)
}
Stack(){
Column({}){
Text(item.name)
.fontSize(18)
.fontColor('#FFFFFF')
.margin({top:'21lpx',left:'19lpx'})
.width('100%')
.height('46lpx')
.fontWeight(FontWeight.Bold)
Text(item.title)
.fontSize('23lpx')
.fontColor('#FFFFFF')
.margin({top:'2lpx',left:'19lpx'})
.width('100%')
.height('31lpx')
Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot'))
.height('32lpx')
.width('32lpx')
.margin({top:'80lpx',left:'120lpx'})
}.justifyContent(FlexAlign.Start)
}
}.justifyContent(FlexAlign.Start)
}
}
}
.width('192lpx')
.height('230lpx')
.borderRadius('8lpx')
.onClick(()=>{
//选择后改变已选择属性
item.choose = !item.choose
this.interestsArray.splice(index,1,item)
this.selectCount = this.interestsArray.filter(item => item.choose).length
})
.width('192lpx')
.height('230lpx')
.borderRadius('8lpx')
.onClick(()=>{
//选择后改变已选择属性
item.choose = !item.choose
this.interestsArray.splice(index,1,item)
this.selectCount = this.interestsArray.filter(item => item.choose).length
})
})
})
}
.width('90%')
.margin({top:'61lpx',bottom:'300lpx'})
.columnsTemplate('1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
}
.width('90%')
.margin({top:'61lpx',bottom:'300lpx'})
.columnsTemplate('1fr 1fr 1fr')
.columnsGap('23lpx')
.rowsGap('23lpx')
.scrollBar(BarState.Off)
}
.width('100%')
.height('100%')
... ...
... ... @@ -110,7 +110,7 @@ export default struct CustomDialogComponent {
.margin({top: 1})
}
.width('528lpx')
.borderRadius('15')
.borderRadius('10')
.backgroundColor(Color.White)
.clip(true)
... ...