王士厅

多图(图集)详情页 底部titles代码手机端适配

@@ -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,7 +169,8 @@ export struct MultiPictureDetailPageComponent { @@ -166,7 +169,8 @@ export struct MultiPictureDetailPageComponent {
166 }) 169 })
167 .id('e_attention') 170 .id('e_attention')
168 } 171 }
169 - 172 + Row(){
  173 + Scroll(this.scroller) {
170 Row() { 174 Row() {
171 Flex({ 175 Flex({
172 direction: FlexDirection.Column, 176 direction: FlexDirection.Column,
@@ -194,22 +198,27 @@ export struct MultiPictureDetailPageComponent { @@ -194,22 +198,27 @@ export struct MultiPictureDetailPageComponent {
194 bottom: 4, 198 bottom: 4,
195 right: 18 199 right: 18
196 }) 200 })
197 - .maxLines(3) 201 + .maxLines(16)
198 } 202 }
199 } 203 }
200 .width('100%') 204 .width('100%')
201 - .height(178)  
202 .margin ({ 205 .margin ({
203 top: 8, 206 top: 8,
204 left: 18, 207 left: 18,
205 - bottom: 8, 208 + bottom: 24,
206 right: 18 209 right: 18
207 }) 210 })
  211 + }
  212 + .scrollable(ScrollDirection.Vertical)
  213 + .scrollBarWidth(0)
  214 + .height(px2vp(this.titleHeight))
  215 + }
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 }