Showing
1 changed file
with
56 additions
and
42 deletions
| @@ -27,11 +27,13 @@ export struct MultiPictureDetailPageComponent { | @@ -27,11 +27,13 @@ export struct MultiPictureDetailPageComponent { | ||
| 27 | private screenWidth: number = 0 | 27 | private screenWidth: number = 0 |
| 28 | private picWidth: number = 0 | 28 | private picWidth: number = 0 |
| 29 | @State picHeight: number = 0 | 29 | @State picHeight: number = 0 |
| 30 | + @State titleHeight: number = 0 | ||
| 30 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO | 31 | @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO |
| 31 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' | 32 | @Provide @Watch('onCurrentPageNumUpdated') currentPageNum: string = '01' |
| 32 | private swiperController: SwiperController = new SwiperController() | 33 | private swiperController: SwiperController = new SwiperController() |
| 33 | @State swiperIndex: number = 0; | 34 | @State swiperIndex: number = 0; |
| 34 | @Provide followStatus: string = '0' // 关注状态 | 35 | @Provide followStatus: string = '0' // 关注状态 |
| 36 | + private scroller: Scroller = new Scroller() | ||
| 35 | 37 | ||
| 36 | //watch监听页码回调 | 38 | //watch监听页码回调 |
| 37 | onCurrentPageNumUpdated(): void { | 39 | onCurrentPageNumUpdated(): void { |
| @@ -47,7 +49,8 @@ export struct MultiPictureDetailPageComponent { | @@ -47,7 +49,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 47 | this.screenWidth = this.displayTool.width | 49 | this.screenWidth = this.displayTool.width |
| 48 | // this.picWidth = this.screenWidth - vp2px(52) | 50 | // this.picWidth = this.screenWidth - vp2px(52) |
| 49 | this.picWidth = this.screenWidth | 51 | this.picWidth = this.screenWidth |
| 50 | - this.picHeight = this.picWidth * 566 / 378 | 52 | + this.picHeight = this.picWidth * 578 / 375 |
| 53 | + this.titleHeight = this.screenWidth * 178 / 375 | ||
| 51 | //注册字体 | 54 | //注册字体 |
| 52 | font.registerFont({ | 55 | font.registerFont({ |
| 53 | familyName: 'BebasNeue_Regular', | 56 | familyName: 'BebasNeue_Regular', |
| @@ -74,7 +77,7 @@ export struct MultiPictureDetailPageComponent { | @@ -74,7 +77,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 74 | } | 77 | } |
| 75 | .index(this.swiperIndex) | 78 | .index(this.swiperIndex) |
| 76 | .width('100%') | 79 | .width('100%') |
| 77 | - .height(px2vp(this.picHeight)) | 80 | + .height(px2vp(this.picHeight) + 32) |
| 78 | .vertical(false) | 81 | .vertical(false) |
| 79 | .autoPlay(false) | 82 | .autoPlay(false) |
| 80 | .cachedCount(3) | 83 | .cachedCount(3) |
| @@ -82,7 +85,7 @@ export struct MultiPictureDetailPageComponent { | @@ -82,7 +85,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 82 | .displayCount(1) | 85 | .displayCount(1) |
| 83 | .id('e_swiper_content') | 86 | .id('e_swiper_content') |
| 84 | .alignRules({ | 87 | .alignRules({ |
| 85 | - top: { anchor: "__container__", align: VerticalAlign.Top }, | 88 | + center: { anchor: "__container__", align: VerticalAlign.Center }, |
| 86 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 89 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 87 | }) | 90 | }) |
| 88 | .onChange((index: number) => { | 91 | .onChange((index: number) => { |
| @@ -166,50 +169,56 @@ export struct MultiPictureDetailPageComponent { | @@ -166,50 +169,56 @@ export struct MultiPictureDetailPageComponent { | ||
| 166 | }) | 169 | }) |
| 167 | .id('e_attention') | 170 | .id('e_attention') |
| 168 | } | 171 | } |
| 172 | + Row(){ | ||
| 173 | + Scroll(this.scroller) { | ||
| 174 | + Row() { | ||
| 175 | + Flex({ | ||
| 176 | + direction: FlexDirection.Column, | ||
| 177 | + justifyContent: FlexAlign.Start | ||
| 178 | + }) { | ||
| 179 | + Text() { | ||
| 180 | + Span(`${this.swiperIndex + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28) | ||
| 181 | + Span(`/${this.contentDetailData.photoList.length}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19) | ||
| 182 | + }.fontColor(Color.White).margin(4) | ||
| 169 | 183 | ||
| 170 | - Row() { | ||
| 171 | - Flex({ | ||
| 172 | - direction: FlexDirection.Column, | ||
| 173 | - justifyContent: FlexAlign.Start | ||
| 174 | - }) { | ||
| 175 | - Text() { | ||
| 176 | - Span(`${this.swiperIndex + 1}`).fontSize(24).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(28) | ||
| 177 | - Span(`/${this.contentDetailData.photoList.length}`).fontSize(14).fontFamily('PingFang SC-Medium').fontWeight(500).lineHeight(19) | ||
| 178 | - }.fontColor(Color.White).margin(4) | ||
| 179 | - | ||
| 180 | - Text(`${this.contentDetailData.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold') | ||
| 181 | - .fontWeight(600).lineHeight(24) | ||
| 182 | - .margin ({ | ||
| 183 | - top: 4, | ||
| 184 | - left: 0, | ||
| 185 | - bottom: 4, | ||
| 186 | - right: 0 | ||
| 187 | - }) | ||
| 188 | - Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`).fontColor(Color.White) | ||
| 189 | - .fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22) | ||
| 190 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 191 | - .margin ({ | ||
| 192 | - top: 4, | ||
| 193 | - left: 0, | ||
| 194 | - bottom: 4, | ||
| 195 | - right: 18 | ||
| 196 | - }) | ||
| 197 | - .maxLines(3) | 184 | + Text(`${this.contentDetailData.newsTitle}`).fontColor(Color.White).fontSize(16).fontFamily('PingFang SC-Semibold') |
| 185 | + .fontWeight(600).lineHeight(24) | ||
| 186 | + .margin ({ | ||
| 187 | + top: 4, | ||
| 188 | + left: 0, | ||
| 189 | + bottom: 4, | ||
| 190 | + right: 0 | ||
| 191 | + }) | ||
| 192 | + Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`).fontColor(Color.White) | ||
| 193 | + .fontSize(14).fontFamily('PingFang SC-Regular').fontWeight(400).lineHeight(22) | ||
| 194 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 195 | + .margin ({ | ||
| 196 | + top: 4, | ||
| 197 | + left: 0, | ||
| 198 | + bottom: 4, | ||
| 199 | + right: 18 | ||
| 200 | + }) | ||
| 201 | + .maxLines(16) | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + .width('100%') | ||
| 205 | + .margin ({ | ||
| 206 | + top: 8, | ||
| 207 | + left: 18, | ||
| 208 | + bottom: 24, | ||
| 209 | + right: 18 | ||
| 210 | + }) | ||
| 198 | } | 211 | } |
| 212 | + .scrollable(ScrollDirection.Vertical) | ||
| 213 | + .scrollBarWidth(0) | ||
| 214 | + .height(px2vp(this.titleHeight)) | ||
| 199 | } | 215 | } |
| 200 | - .width('100%') | ||
| 201 | - .height(178) | ||
| 202 | - .margin ({ | ||
| 203 | - top: 8, | ||
| 204 | - left: 18, | ||
| 205 | - bottom: 8, | ||
| 206 | - right: 18 | ||
| 207 | - }) | ||
| 208 | .id('e_swiper_titles') | 216 | .id('e_swiper_titles') |
| 209 | .alignRules({ | 217 | .alignRules({ |
| 210 | - bottom: { anchor: "e_swiper_content", align: VerticalAlign.Bottom }, | ||
| 211 | - middle: { anchor: "e_swiper_content", align: HorizontalAlign.Center } | 218 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 219 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 212 | }) | 220 | }) |
| 221 | + .height(px2vp(this.titleHeight) + 64) | ||
| 213 | 222 | ||
| 214 | OperRowListView({ | 223 | OperRowListView({ |
| 215 | contentDetailData: this.contentDetailData, | 224 | contentDetailData: this.contentDetailData, |
| @@ -218,7 +227,12 @@ export struct MultiPictureDetailPageComponent { | @@ -218,7 +227,12 @@ export struct MultiPictureDetailPageComponent { | ||
| 218 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | 227 | bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, |
| 219 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 228 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 220 | }) | 229 | }) |
| 221 | - .width('100%').height(56).margin(16) | 230 | + .width('100%').height(56).margin({ |
| 231 | + top: 16, | ||
| 232 | + left: 16, | ||
| 233 | + right:16, | ||
| 234 | + bottom: 0 | ||
| 235 | + }) | ||
| 222 | .border({ width: {top: 0.5}, color: '#FFFFFF' }) | 236 | .border({ width: {top: 0.5}, color: '#FFFFFF' }) |
| 223 | .id('e_oper_row') | 237 | .id('e_oper_row') |
| 224 | } | 238 | } |
-
Please register or login to post a comment