王士厅

图集代码优化

... ... @@ -36,6 +36,7 @@ export struct MultiPictureDetailPageComponent {
private contentId: string = ''
private relType: string = ''
private displayTool = display.getDefaultDisplaySync()
@State nShowDownloadTitleHeight: number = 0
@State titleHeight: number = 0
@State index: number = 0
@State currentIndex: number = 0
... ... @@ -50,6 +51,7 @@ export struct MultiPictureDetailPageComponent {
@State swiperIndex: number = 0;
@Provide followStatus: string | undefined = undefined // 关注状态
@Provide showCommentList: boolean = false
private subScroller: Scroller = new Scroller()
private scroller: Scroller = new Scroller()
@State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图
@State isOffLine: boolean = false // 存储视频下线状态用来展示缺省图
... ... @@ -63,6 +65,7 @@ export struct MultiPictureDetailPageComponent {
followUserId: string = ''
followUserName: string = ''
@State isEnableSwipe: boolean = true;
@State isScrollerTop: boolean = false;
//watch监听页码回调
onCurrentPageNumUpdated(): void {
... ... @@ -74,7 +77,8 @@ export struct MultiPictureDetailPageComponent {
async aboutToAppear() {
//获取宽高尺寸
this.titleHeight = this.displayTool.width * 178 / 375
this.titleHeight = this.displayTool.width * 227 / 375
this.nShowDownloadTitleHeight = this.displayTool.width * 311 / 375
//注册字体
// font.registerFont({
// familyName: 'BebasNeueBold',
... ... @@ -353,34 +357,34 @@ export struct MultiPictureDetailPageComponent {
@Builder
NShowDownload() {
Column() {
Row() {
Scroll(this.scroller) {
Row() {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
if (this.contentDetailData?.photoList?.length) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData?.photoList?.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}
.fontColor(Color.White)
.margin({
top: 4,
left: 18,
bottom: 4,
right: 4
})
}
Scroll(this.scroller) {
Flex({
direction: FlexDirection.Column,
justifyContent: FlexAlign.Start
}) {
if (this.contentDetailData?.photoList?.length) {
Text() {
Span(`${this.swiperIndex + 1}`)
.fontSize(24)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(28)
Span(`/${this.contentDetailData?.photoList?.length}`)
.fontSize(14)
.fontFamily('PingFang SC-Medium')
.fontWeight(500)
.lineHeight(19)
}
.fontColor(Color.White)
.margin({
top: 4,
left: 18,
bottom: 4,
right: 4
})
}
List() {
ListItem(){
if (this.contentDetailData.newsTitle) {
Text(`${this.contentDetailData.newsTitle}`)
.fontColor(Color.White)
... ... @@ -396,6 +400,8 @@ export struct MultiPictureDetailPageComponent {
})
.width('92%')
}
}
ListItem(){
if (this.contentDetailData.photoList?.[this.swiperIndex].picDesc) {
Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
.fontColor(Color.White)
... ... @@ -415,15 +421,30 @@ export struct MultiPictureDetailPageComponent {
}
}
}
.width('100%')
.nestedScroll(
{
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
}
)
.constraintSize (
{
maxHeight: px2vp(this.titleHeight)
}
)
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.constraintSize({
maxHeight: px2vp(this.titleHeight)
})
.align(Alignment.Bottom)
.width('100%')
}
.scrollable(ScrollDirection.Vertical)
.scrollBarWidth(0)
.constraintSize (
{
maxHeight: px2vp(this.nShowDownloadTitleHeight)
}
)
// .initialOffset({
// yOffset: px2vp(this.titleHeight)/2
// })
OperRowListView({
contentDetailData: this.contentDetailData,
... ...