yanlu

fix:17009 UI还原问题--人民号号主信息页简介为空的时候鸿蒙版未能隐藏简介

... ... @@ -35,7 +35,7 @@ struct PeopleShipHomePage {
@Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
//关注显示
@Prop attentionOpacity: boolean = false
@Provide topHeight: number = 400
@Provide @Watch('handleChangeTopHeight') topHeight: number = 400
build() {
... ... @@ -62,7 +62,6 @@ struct PeopleShipHomePage {
})
.width("100%")
.height(this.topHeight)
.backgroundColor(Color.White)
// 列表
PeopleShipHomeListComponent({
... ... @@ -81,7 +80,7 @@ struct PeopleShipHomePage {
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.onScroll(() => {
.onDidScroll(() => {
// this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
this.topOpacity = this.scroller.currentOffset().yOffset / 100
if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
... ... @@ -89,8 +88,7 @@ struct PeopleShipHomePage {
} else {
this.attentionOpacity = false
}
console.log(`全局请求失败拦截,message:${this.topOpacity}`)
// System.out.println("输出高度:"+ AttrHelper.vp2px(height,this));
Logger.debug('PeopleShipHomePage',`透明度:${this.topOpacity}`)
})
}
... ... @@ -108,13 +106,13 @@ struct PeopleShipHomePage {
try {
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`)
Logger.debug('PeopleShipHomePage', '获取页面信息' + `${JSON.stringify(this.detailModel)}`)
// 获取关注
// 登录后获取,是否关注
if (HttpUtils.getUserId()) {
let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`)
Logger.debug('PeopleShipHomePage', '获取关注信息' + `${JSON.stringify(followList)}`)
this.findFollowStata(followList)
}
... ... @@ -126,7 +124,7 @@ struct PeopleShipHomePage {
findFollowStata(followList: QueryListIsFollowedItem[]) {
if (followList.length > 0) {
let item: QueryListIsFollowedItem = followList[0]
Logger.debug('PeopleShipHomePage', '关注', `${JSON.stringify(item.status)}`)
Logger.debug('PeopleShipHomePage', '关注' + `${JSON.stringify(item.status)}`)
this.isAttention = item.status
}
}
... ... @@ -169,5 +167,9 @@ struct PeopleShipHomePage {
this.isLoadingAttention = false
})
}
handleChangeTopHeight() {
Logger.debug('PeopleShipHomePage', 'topHeight' + this.topHeight)
}
}
... ...
... ... @@ -155,8 +155,13 @@ export struct TopNavigationComponent {
this.channelIds = _channelIds
this.myChannelList = _myChannelList
this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
// 崩溃
// this.currentTopNavName = this._currentNavIndex === 0 ? this.myChannelList[0].name : this.topNavList[0].name
if (this._currentNavIndex === 0 && this.myChannelList && this.myChannelList.length > 0 && this.myChannelList[0].name) {
this.currentTopNavName = this.myChannelList[0].name
}else if(this._currentNavIndex != 0 && this.topNavList && this.topNavList.length > 0 && this.topNavList[0].name){
this.currentTopNavName = this.topNavList[0].name
}
//缓存首页频道
let index = this.myChannelList.findIndex(_item => _item.channelId === this.indexSettingChannelId)
... ...
... ... @@ -114,62 +114,64 @@ export struct PeopleShipHomePageTopComponent {
}
// 简介
if (this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) {
if (this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(() => {
if (this.isCollapse) {
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
} else {
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
this.topHeight = this.topFixedHeight + 21 * 3
}
})
.fontColor($r('app.color.color_B0B0B0'))
Span(this.collapseTxt)
.onClick(() => {
if (this.isCollapse) {
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}
.backgroundColor(Color.Transparent)
.lineHeight('21vp')
.width('100%')
.maxLines(this.maxLines)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.vp_14'))
.padding({
left: '16vp',
right: '16vp',
})
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
} else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
} else {
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
this.topHeight = this.topFixedHeight + 21 * 3
}
})
.fontColor($r('app.color.color_B0B0B0'))
}
.backgroundColor(Color.Transparent)
.lineHeight('21vp')
.width('100%')
.maxLines(3)
.maxLines(this.maxLines)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.fontSize($r('app.float.vp_14'))
.padding({
left: '16vp',
right: '16vp',
})
.backgroundColor(Color.Transparent)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
} else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.width('100%')
.maxLines(3)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.padding({
left: '16vp',
right: '16vp',
})
.backgroundColor(Color.Transparent)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}.width('100%')
.backgroundColor(Color.Transparent)
.alignItems(VerticalAlign.Top)
}
}
// IP归属地
... ... @@ -261,8 +263,8 @@ export struct PeopleShipHomePageTopComponent {
.height('6vp')
}
.width('100%')
.backgroundColor(Color.White)
// .height('100%')
}
async aboutToAppear() {
... ... @@ -312,7 +314,7 @@ export struct PeopleShipHomePageTopComponent {
async onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction) {
if (this.content.length == 0 && this.detailModel.introduction && this.detailModel.introduction.length > 0) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
... ... @@ -344,18 +346,24 @@ export struct PeopleShipHomePageTopComponent {
this.topFixedHeight += 12
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
} else {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
}
// IP归属地
if (this.provinceName && this.provinceName.length > 0) {
this.topFixedHeight += 28
this.topHeight += 28
this.topHeight = this.topFixedHeight
}
// 简介
if (this.detailModel.introduction && this.detailModel.introduction.length > 0 ) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topHeight = this.topFixedHeight + (21 * this.lineInNum)
} else {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}` + '收起', DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21 * 3 : 21 * this.lineInNum)
}
}
}
}
... ...