Showing
3 changed files
with
48 additions
and
22 deletions
| 1 | import { PhotoListBean } from 'wdBean'; | 1 | import { PhotoListBean } from 'wdBean'; |
| 2 | import { Logger } from 'wdKit'; | 2 | import { Logger } from 'wdKit'; |
| 3 | +import router from '@ohos.router'; | ||
| 4 | +import display from '@ohos.display'; | ||
| 3 | 5 | ||
| 4 | const TAG = 'MultiPictureDetailPageComponent'; | 6 | const TAG = 'MultiPictureDetailPageComponent'; |
| 5 | 7 | ||
| 6 | @Component | 8 | @Component |
| 7 | export struct MultiPictureDetailItemComponent { | 9 | export struct MultiPictureDetailItemComponent { |
| 8 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | 10 | private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean |
| 11 | + //alt app.media.picture_loading 设计稿尺寸 | ||
| 12 | + @State imageWidth:string | number = 167 | ||
| 13 | + @State ratio:number = 167/60 | ||
| 14 | + private scroller: Scroller = new Scroller() | ||
| 15 | + private displayTool = display.getDefaultDisplaySync() | ||
| 16 | + @State picHeight: number = 0 | ||
| 9 | 17 | ||
| 10 | 18 | ||
| 11 | async aboutToAppear() { | 19 | async aboutToAppear() { |
| 12 | Logger.info(TAG, 'pictures preview') | 20 | Logger.info(TAG, 'pictures preview') |
| 21 | + this.picHeight = this.displayTool.width * 578 / 375 | ||
| 13 | } | 22 | } |
| 14 | 23 | ||
| 15 | build() { | 24 | build() { |
| 16 | - Stack({ alignContent: Alignment.BottomStart }) { | ||
| 17 | - Row() { | ||
| 18 | - Image(this.MultiPictureDetailItem.picPath) | ||
| 19 | - .alt($r('app.media.picture_loading')) | ||
| 20 | - .width('100%') | ||
| 21 | - .aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height) | ||
| 22 | - .objectFit(ImageFit.Fill) | ||
| 23 | - .interpolation(ImageInterpolation.High) | ||
| 24 | - } | ||
| 25 | - .height('100%') | ||
| 26 | - .width('100%') | 25 | + Row() { |
| 26 | + Image(this.MultiPictureDetailItem.picPath) | ||
| 27 | + .alt($r('app.media.picture_loading')) | ||
| 28 | + .width(this.imageWidth) | ||
| 29 | + .aspectRatio(this.ratio) | ||
| 30 | + .objectFit(ImageFit.Fill) | ||
| 31 | + .interpolation(ImageInterpolation.High) | ||
| 32 | + .onComplete(event => { | ||
| 33 | + this.imageWidth = '100%' | ||
| 34 | + this.ratio = this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height | ||
| 35 | + }) | ||
| 36 | + /*.onDrop(event => { | ||
| 37 | + router.back(); | ||
| 38 | + }) | ||
| 39 | + .draggable(true)*/ | ||
| 40 | + /*Scroll(this.scroller) { | ||
| 27 | 41 | ||
| 42 | + } | ||
| 43 | + .scrollable(ScrollDirection.Vertical) | ||
| 44 | + .scrollBarWidth(0) | ||
| 45 | + .height(px2vp(this.picHeight))*/ | ||
| 28 | } | 46 | } |
| 29 | - .backgroundColor(Color.Black) | 47 | + .height('100%') |
| 30 | .width('100%') | 48 | .width('100%') |
| 49 | + .backgroundColor(Color.Black) | ||
| 50 | + .justifyContent(FlexAlign.Center) | ||
| 31 | } | 51 | } |
| 32 | } | 52 | } |
| 1 | -import { Logger } from 'wdKit'; | 1 | +import { Logger, SPHelper } from 'wdKit'; |
| 2 | import { ResponseDTO } from 'wdNetwork'; | 2 | import { ResponseDTO } from 'wdNetwork'; |
| 3 | import { | 3 | import { |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -17,6 +17,7 @@ import { DateTimeUtils } from 'wdKit/Index'; | @@ -17,6 +17,7 @@ import { DateTimeUtils } from 'wdKit/Index'; | ||
| 17 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 17 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 19 | import { PageRepository } from '../repository/PageRepository'; | 19 | import { PageRepository } from '../repository/PageRepository'; |
| 20 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 20 | 21 | ||
| 21 | const TAG = 'MultiPictureDetailPageComponent'; | 22 | const TAG = 'MultiPictureDetailPageComponent'; |
| 22 | 23 | ||
| @@ -350,9 +351,10 @@ export struct MultiPictureDetailPageComponent { | @@ -350,9 +351,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 350 | /** | 351 | /** |
| 351 | * 关注号主 | 352 | * 关注号主 |
| 352 | */ | 353 | */ |
| 353 | - handleAccention() { | 354 | + async handleAccention() { |
| 354 | // 未登录,跳转登录 | 355 | // 未登录,跳转登录 |
| 355 | - if (!HttpUrlUtils.getUserId()) { | 356 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 357 | + if (!user_id) { | ||
| 356 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 358 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 357 | return | 359 | return |
| 358 | } | 360 | } |
| 1 | -import { ToastUtils, Logger, NumberFormatterUtils } from 'wdKit'; | 1 | +import { ToastUtils, Logger, NumberFormatterUtils, SPHelper } from 'wdKit'; |
| 2 | import { | 2 | import { |
| 3 | InputMethodProperty, | 3 | InputMethodProperty, |
| 4 | batchLikeAndCollectResult, | 4 | batchLikeAndCollectResult, |
| @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV | @@ -15,6 +15,7 @@ import { MultiPictureDetailViewModel } from '../../viewmodel/MultiPictureDetailV | ||
| 15 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 15 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 17 | import { PageRepository } from '../../repository/PageRepository'; | 17 | import { PageRepository } from '../../repository/PageRepository'; |
| 18 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 18 | 19 | ||
| 19 | export interface OperationItem { | 20 | export interface OperationItem { |
| 20 | icon: Resource; | 21 | icon: Resource; |
| @@ -53,8 +54,9 @@ export struct OperRowListView { | @@ -53,8 +54,9 @@ export struct OperRowListView { | ||
| 53 | } | 54 | } |
| 54 | ] | 55 | ] |
| 55 | 56 | ||
| 56 | - aboutToAppear() { | ||
| 57 | - if (HttpUrlUtils.getUserId()) { | 57 | + async aboutToAppear() { |
| 58 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') | ||
| 59 | + if (user_id) { | ||
| 58 | this.getInteractDataStatus() | 60 | this.getInteractDataStatus() |
| 59 | } | 61 | } |
| 60 | this.queryContentInteractCount() | 62 | this.queryContentInteractCount() |
| @@ -338,9 +340,10 @@ export struct OperRowListView { | @@ -338,9 +340,10 @@ export struct OperRowListView { | ||
| 338 | /** | 340 | /** |
| 339 | * 点赞、取消点赞 | 341 | * 点赞、取消点赞 |
| 340 | */ | 342 | */ |
| 341 | - toggleLikeStatus() { | 343 | + async toggleLikeStatus() { |
| 342 | // 未登录,跳转登录 | 344 | // 未登录,跳转登录 |
| 343 | - if (!HttpUrlUtils.getUserId()) { | 345 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 346 | + if (!user_id) { | ||
| 344 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 347 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 345 | return | 348 | return |
| 346 | } | 349 | } |
| @@ -361,9 +364,10 @@ export struct OperRowListView { | @@ -361,9 +364,10 @@ export struct OperRowListView { | ||
| 361 | /** | 364 | /** |
| 362 | * 收藏、取消收藏 | 365 | * 收藏、取消收藏 |
| 363 | */ | 366 | */ |
| 364 | - toggleCollectStatus() { | 367 | + async toggleCollectStatus() { |
| 365 | // 未登录,跳转登录 | 368 | // 未登录,跳转登录 |
| 366 | - if (!HttpUrlUtils.getUserId()) { | 369 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 370 | + if (!user_id) { | ||
| 367 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 371 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 368 | return | 372 | return |
| 369 | } | 373 | } |
-
Please register or login to post a comment