王士厅

图集bug修复

@@ -3,12 +3,12 @@ import { Logger } from 'wdKit'; @@ -3,12 +3,12 @@ import { Logger } from 'wdKit';
3 3
4 const TAG = 'MultiPictureDetailPageComponent'; 4 const TAG = 'MultiPictureDetailPageComponent';
5 5
  6 +@Reusable
6 @Component 7 @Component
7 export struct MultiPictureDetailItemComponent { 8 export struct MultiPictureDetailItemComponent {
8 private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean 9 private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean
9 //alt app.media.picture_loading 设计稿尺寸 10 //alt app.media.picture_loading 设计稿尺寸
10 @State imageWidth:string | number = 167 11 @State imageWidth:string | number = 167
11 - @State ratio:number = 167/60  
12 12
13 13
14 async aboutToAppear() { 14 async aboutToAppear() {
@@ -20,12 +20,10 @@ export struct MultiPictureDetailItemComponent { @@ -20,12 +20,10 @@ export struct MultiPictureDetailItemComponent {
20 Image(this.MultiPictureDetailItem.picPath) 20 Image(this.MultiPictureDetailItem.picPath)
21 .alt($r('app.media.picture_loading')) 21 .alt($r('app.media.picture_loading'))
22 .width(this.imageWidth) 22 .width(this.imageWidth)
23 - .aspectRatio(this.ratio)  
24 .objectFit(ImageFit.Contain) 23 .objectFit(ImageFit.Contain)
25 .interpolation(ImageInterpolation.High) 24 .interpolation(ImageInterpolation.High)
26 .onComplete(event => { 25 .onComplete(event => {
27 this.imageWidth = '100%' 26 this.imageWidth = '100%'
28 - this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height  
29 }) 27 })
30 } 28 }
31 .height('100%') 29 .height('100%')
@@ -46,6 +46,9 @@ export struct MultiPictureDetailPageComponent { @@ -46,6 +46,9 @@ export struct MultiPictureDetailPageComponent {
46 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏 46 @State showDownload: Boolean = false // 控制是否显示下载默认隐藏
47 @State publishCommentModel: publishCommentModel = new publishCommentModel() 47 @State publishCommentModel: publishCommentModel = new publishCommentModel()
48 @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] 48 @State operationButtonList: string[] = ['comment', 'like', 'collect', 'share']
  49 + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
  50 + @State windowHeight: number = AppStorage.get<number>('windowHeight') as number;
  51 + @State currentOffset:number = 0
49 52
50 //watch监听页码回调 53 //watch监听页码回调
51 onCurrentPageNumUpdated(): void { 54 onCurrentPageNumUpdated(): void {
@@ -90,9 +93,6 @@ export struct MultiPictureDetailPageComponent { @@ -90,9 +93,6 @@ export struct MultiPictureDetailPageComponent {
90 .height('100%') 93 .height('100%')
91 .backgroundColor(Color.Black) 94 .backgroundColor(Color.Black)
92 .id('e_picture_container') 95 .id('e_picture_container')
93 - // 设置顶部绘制延伸到状态栏  
94 - // 设置底部绘制延伸到导航条  
95 - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])  
96 } 96 }
97 97
98 @Builder 98 @Builder
@@ -104,7 +104,7 @@ export struct MultiPictureDetailPageComponent { @@ -104,7 +104,7 @@ export struct MultiPictureDetailPageComponent {
104 Row() { 104 Row() {
105 Stack() { 105 Stack() {
106 Image(this.getImgUrl()) 106 Image(this.getImgUrl())
107 - .borderRadius(24) 107 + .borderRadius(18)
108 .aspectRatio(1) 108 .aspectRatio(1)
109 .border({ width: 1, color: Color.White, style: BorderStyle.Solid }) 109 .border({ width: 1, color: Color.White, style: BorderStyle.Solid })
110 .width(36) 110 .width(36)
@@ -157,7 +157,7 @@ export struct MultiPictureDetailPageComponent { @@ -157,7 +157,7 @@ export struct MultiPictureDetailPageComponent {
157 .margin(0) 157 .margin(0)
158 .height(17) 158 .height(17)
159 Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`) 159 Text(`${this.contentDetailData?.rmhInfo?.rmhDesc}`)
160 - .fontColor('#676767') 160 + .fontColor(Color.White)
161 .fontSize(12) 161 .fontSize(12)
162 .fontFamily('PingFang SC-Regular') 162 .fontFamily('PingFang SC-Regular')
163 .fontWeight(400) 163 .fontWeight(400)
@@ -201,8 +201,8 @@ export struct MultiPictureDetailPageComponent { @@ -201,8 +201,8 @@ export struct MultiPictureDetailPageComponent {
201 }.alignItems(VerticalAlign.Center) 201 }.alignItems(VerticalAlign.Center)
202 } 202 }
203 .borderRadius(4) 203 .borderRadius(4)
204 - .backgroundColor('#B0B0B0')  
205 - .width(48) 204 + .backgroundColor('#333333')
  205 + .width(54)
206 .height(24) 206 .height(24)
207 } 207 }
208 208
@@ -215,6 +215,7 @@ export struct MultiPictureDetailPageComponent { @@ -215,6 +215,7 @@ export struct MultiPictureDetailPageComponent {
215 .width('100%') 215 .width('100%')
216 .height(44) 216 .height(44)
217 .zIndex(10) 217 .zIndex(10)
  218 + .margin({top:`${this.topSafeHeight + 12}px`})
218 .alignRules({ 219 .alignRules({
219 top: { anchor: "__container__", align: VerticalAlign.Top }, 220 top: { anchor: "__container__", align: VerticalAlign.Top },
220 middle: { anchor: "__container__", align: HorizontalAlign.Center } 221 middle: { anchor: "__container__", align: HorizontalAlign.Center }
@@ -235,8 +236,17 @@ export struct MultiPictureDetailPageComponent { @@ -235,8 +236,17 @@ export struct MultiPictureDetailPageComponent {
235 .cachedCount(1) 236 .cachedCount(1)
236 .indicator(false) 237 .indicator(false)
237 .displayCount(1) 238 .displayCount(1)
238 - .onAnimationEnd(event => { 239 + .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => {
  240 + console.info("onGestureSwipe current offset: " + extraInfo.currentOffset)
  241 + this.currentOffset = Math.abs(extraInfo.currentOffset)
  242 + })
  243 + .onTouch((event: TouchEvent) => {
  244 + if(event.type === 1) {
  245 + // if(this.currentOffset > px2vp((this.windowHeight - item.height)/2 - 100)) {
  246 + if(this.currentOffset > 160) {
239 router.back() 247 router.back()
  248 + }
  249 + }
240 }) 250 })
241 }) 251 })
242 } 252 }
@@ -283,6 +293,7 @@ export struct MultiPictureDetailPageComponent { @@ -283,6 +293,7 @@ export struct MultiPictureDetailPageComponent {
283 direction: FlexDirection.Column, 293 direction: FlexDirection.Column,
284 justifyContent: FlexAlign.Start 294 justifyContent: FlexAlign.Start
285 }) { 295 }) {
  296 + if(this.contentDetailData?.photoList?.length) {
286 Text() { 297 Text() {
287 Span(`${this.swiperIndex + 1}`) 298 Span(`${this.swiperIndex + 1}`)
288 .fontSize(24) 299 .fontSize(24)
@@ -297,7 +308,8 @@ export struct MultiPictureDetailPageComponent { @@ -297,7 +308,8 @@ export struct MultiPictureDetailPageComponent {
297 } 308 }
298 .fontColor(Color.White) 309 .fontColor(Color.White)
299 .margin(4) 310 .margin(4)
300 - 311 + }
  312 + if(this.contentDetailData.newsTitle) {
301 Text(`${this.contentDetailData.newsTitle}`) 313 Text(`${this.contentDetailData.newsTitle}`)
302 .fontColor(Color.White) 314 .fontColor(Color.White)
303 .fontSize(16) 315 .fontSize(16)
@@ -310,6 +322,8 @@ export struct MultiPictureDetailPageComponent { @@ -310,6 +322,8 @@ export struct MultiPictureDetailPageComponent {
310 bottom: 4, 322 bottom: 4,
311 right: 0 323 right: 0
312 }) 324 })
  325 + }
  326 + if(this.contentDetailData.photoList?.[this.swiperIndex].picDesc) {
313 Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`) 327 Text(`${this.contentDetailData.photoList?.[this.swiperIndex].picDesc}`)
314 .fontColor(Color.White) 328 .fontColor(Color.White)
315 .fontSize(14) 329 .fontSize(14)
@@ -323,7 +337,8 @@ export struct MultiPictureDetailPageComponent { @@ -323,7 +337,8 @@ export struct MultiPictureDetailPageComponent {
323 bottom: 4, 337 bottom: 4,
324 right: 18 338 right: 18
325 }) 339 })
326 - .maxLines(16) 340 + .maxLines(32)
  341 + }
327 } 342 }
328 } 343 }
329 .width('100%') 344 .width('100%')
@@ -346,6 +361,7 @@ export struct MultiPictureDetailPageComponent { @@ -346,6 +361,7 @@ export struct MultiPictureDetailPageComponent {
346 direction: FlexDirection.Row, 361 direction: FlexDirection.Row,
347 justifyContent: FlexAlign.SpaceBetween 362 justifyContent: FlexAlign.SpaceBetween
348 }) { 363 }) {
  364 + if(this.contentDetailData?.photoList?.length) {
349 Text() { 365 Text() {
350 Span(`${this.swiperIndex + 1}`) 366 Span(`${this.swiperIndex + 1}`)
351 .fontSize(24) 367 .fontSize(24)
@@ -360,7 +376,9 @@ export struct MultiPictureDetailPageComponent { @@ -360,7 +376,9 @@ export struct MultiPictureDetailPageComponent {
360 } 376 }
361 .fontColor(Color.White) 377 .fontColor(Color.White)
362 .margin(4) 378 .margin(4)
  379 + }
363 380
  381 + if(this.contentDetailData.photoList?.[this.swiperIndex].picPath) {
364 ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath }) 382 ImageDownloadComponent({ url: this.contentDetailData.photoList?.[this.swiperIndex].picPath })
365 .margin({ 383 .margin({
366 top: 8, 384 top: 8,
@@ -370,6 +388,7 @@ export struct MultiPictureDetailPageComponent { @@ -370,6 +388,7 @@ export struct MultiPictureDetailPageComponent {
370 }) 388 })
371 } 389 }
372 } 390 }
  391 + }
373 .width('100%') 392 .width('100%')
374 } 393 }
375 .visibility(this.showDownload ? Visibility.Visible : Visibility.None) 394 .visibility(this.showDownload ? Visibility.Visible : Visibility.None)
@@ -26,7 +26,6 @@ struct MultiPictureDetailPage { @@ -26,7 +26,6 @@ struct MultiPictureDetailPage {
26 }) 26 })
27 } 27 }
28 } 28 }
29 - .padding({top:44})  
30 .backgroundColor(Color.Black) 29 .backgroundColor(Color.Black)
31 } 30 }
32 31
@@ -57,6 +56,12 @@ struct MultiPictureDetailPage { @@ -57,6 +56,12 @@ struct MultiPictureDetailPage {
57 Logger.info(TAG, 'onBackPress'); 56 Logger.info(TAG, 'onBackPress');
58 } 57 }
59 58
  59 +
  60 + aboutToDisappear(): void {
  61 + console.log(TAG, 'aboutToDisappear')
  62 + this.closeFullScreen()
  63 + }
  64 +
60 /** 65 /**
61 * 开启沉浸式 66 * 开启沉浸式
62 * TODO:颜色待根据业务接口修改 67 * TODO:颜色待根据业务接口修改
@@ -67,11 +72,6 @@ struct MultiPictureDetailPage { @@ -67,11 +72,6 @@ struct MultiPictureDetailPage {
67 // WindowModel.shared.setWindowSystemBarEnable([]) 72 // WindowModel.shared.setWindowSystemBarEnable([])
68 } 73 }
69 74
70 - aboutToDisappear(): void {  
71 - console.log(TAG, 'aboutToDisappear')  
72 - this.closeFullScreen()  
73 - }  
74 -  
75 /** 75 /**
76 * 关闭沉浸式 76 * 关闭沉浸式
77 * TODO:颜色待根据业务接口修改 77 * TODO:颜色待根据业务接口修改