Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: desc:fix bug 图集替换缺省图为通用组件 屏蔽音频详情和活动入口 jdesc:getXToken没有不返回 feat:启动引导页和兴趣选择页问题修复 图片缩放及下载 屏蔽活动和音频组件 图集swiperItem细节优化
Showing
32 changed files
with
513 additions
and
159 deletions
| @@ -3,15 +3,15 @@ | @@ -3,15 +3,15 @@ | ||
| 3 | { | 3 | { |
| 4 | "name": "shared_desc", | 4 | "name": "shared_desc", |
| 5 | "value": "全局工具包" | 5 | "value": "全局工具包" |
| 6 | - } , | 6 | + }, |
| 7 | { | 7 | { |
| 8 | "name": "net_core_no_network", | 8 | "name": "net_core_no_network", |
| 9 | "value": "当前无网络,请重试" | 9 | "value": "当前无网络,请重试" |
| 10 | - } , | 10 | + }, |
| 11 | { | 11 | { |
| 12 | "name": "net_core_weak_network", | 12 | "name": "net_core_weak_network", |
| 13 | "value": "当前无网络,请重试" | 13 | "value": "当前无网络,请重试" |
| 14 | - } , | 14 | + }, |
| 15 | { | 15 | { |
| 16 | "name": "net_core_page_error_network", | 16 | "name": "net_core_page_error_network", |
| 17 | "value": "网络出小差了,请检查下网络" | 17 | "value": "网络出小差了,请检查下网络" |
| @@ -47,6 +47,10 @@ | @@ -47,6 +47,10 @@ | ||
| 47 | { | 47 | { |
| 48 | "name": "auditing_core_error", | 48 | "name": "auditing_core_error", |
| 49 | "value": "内容已下线" | 49 | "value": "内容已下线" |
| 50 | + }, | ||
| 51 | + { | ||
| 52 | + "name": "image_request_fail", | ||
| 53 | + "value": "图片加载失败,请检查网络" | ||
| 50 | } | 54 | } |
| 51 | ] | 55 | ] |
| 52 | } | 56 | } |
| @@ -397,7 +397,8 @@ export class HttpUrlUtils { | @@ -397,7 +397,8 @@ export class HttpUrlUtils { | ||
| 397 | if (StringUtils.isNotEmpty(HttpUrlUtils.token)) { | 397 | if (StringUtils.isNotEmpty(HttpUrlUtils.token)) { |
| 398 | return HttpUrlUtils.token | 398 | return HttpUrlUtils.token |
| 399 | } | 399 | } |
| 400 | - return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; | 400 | + // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; |
| 401 | + return '' | ||
| 401 | } | 402 | } |
| 402 | 403 | ||
| 403 | static getRefreshToken() { | 404 | static getRefreshToken() { |
| @@ -19,7 +19,7 @@ export interface CompDTO { | @@ -19,7 +19,7 @@ export interface CompDTO { | ||
| 19 | name: string; | 19 | name: string; |
| 20 | objectId: string; // 跳转页面id? | 20 | objectId: string; // 跳转页面id? |
| 21 | objectTitle: string; // comp标题 | 21 | objectTitle: string; // comp标题 |
| 22 | - // objectType?: any; // 跳转类型,枚举: | 22 | + objectType?: string; // 跳转类型,枚举: |
| 23 | operDataList: ContentDTO[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 | 23 | operDataList: ContentDTO[]; // 运营数据列表【正常运营配置的强运营数据,部分推荐场景的配置(自动源兜底数据)】 |
| 24 | // pageId?: any; | 24 | // pageId?: any; |
| 25 | posterSize: string; | 25 | posterSize: string; |
| @@ -31,14 +31,14 @@ export struct CompParser { | @@ -31,14 +31,14 @@ export struct CompParser { | ||
| 31 | compIndex: number = 0; | 31 | compIndex: number = 0; |
| 32 | 32 | ||
| 33 | build() { | 33 | build() { |
| 34 | - Column(){ | 34 | + Column() { |
| 35 | this.componentBuilder(this.compDTO, this.compIndex); | 35 | this.componentBuilder(this.compDTO, this.compIndex); |
| 36 | - Divider().strokeWidth(1).color('#f5f5f5').padding({left:16,right:16}) | ||
| 37 | } | 36 | } |
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | @Builder | 39 | @Builder |
| 41 | componentBuilder(compDTO: CompDTO, compIndex: number) { | 40 | componentBuilder(compDTO: CompDTO, compIndex: number) { |
| 41 | + if (compDTO.objectType !== '3' && compDTO.objectType !== '13') { //暂时屏蔽活动和音频详情入口 | ||
| 42 | if (compDTO.compStyle === CompStyle.Label_03) { | 42 | if (compDTO.compStyle === CompStyle.Label_03) { |
| 43 | LabelComponent({ compDTO: compDTO }) | 43 | LabelComponent({ compDTO: compDTO }) |
| 44 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { | 44 | } else if (compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) { |
| @@ -76,15 +76,13 @@ export struct CompParser { | @@ -76,15 +76,13 @@ export struct CompParser { | ||
| 76 | Text(compDTO.compStyle) | 76 | Text(compDTO.compStyle) |
| 77 | .width(CommonConstants.FULL_PARENT) | 77 | .width(CommonConstants.FULL_PARENT) |
| 78 | .padding(10) | 78 | .padding(10) |
| 79 | - .onClick(()=>{ | ||
| 80 | - if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) {//精选评论 | 79 | + .onClick(() => { |
| 80 | + if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { //精选评论 | ||
| 81 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) | 81 | WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage) |
| 82 | } | 82 | } |
| 83 | }) | 83 | }) |
| 84 | - // Text(compDTO.compStyle) | ||
| 85 | - // .width(CommonConstants.FULL_PARENT) | ||
| 86 | - // .padding(10) | ||
| 87 | - // .backgroundColor(Color.Brown) // 展示本页未实现的compStyle | 84 | + } |
| 85 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 88 | } | 86 | } |
| 89 | } | 87 | } |
| 90 | } | 88 | } |
| 1 | import { PhotoListBean } from 'wdBean/Index'; | 1 | import { PhotoListBean } from 'wdBean/Index'; |
| 2 | import { Logger } from 'wdKit/Index'; | 2 | import { Logger } from 'wdKit/Index'; |
| 3 | -import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | ||
| 4 | import { display, router } from '@kit.ArkUI'; | 3 | import { display, router } from '@kit.ArkUI'; |
| 5 | import { ImageDownloadComponent } from './ImageDownloadComponent'; | 4 | import { ImageDownloadComponent } from './ImageDownloadComponent'; |
| 5 | +import { ImageItemView } from './view/ImageItemView'; | ||
| 6 | 6 | ||
| 7 | const TAG = 'ImageSwiperComponent'; | 7 | const TAG = 'ImageSwiperComponent'; |
| 8 | 8 | ||
| @@ -17,6 +17,9 @@ export struct ImageSwiperComponent { | @@ -17,6 +17,9 @@ export struct ImageSwiperComponent { | ||
| 17 | private screenWidth: number = 0 | 17 | private screenWidth: number = 0 |
| 18 | private picWidth: number = 0 | 18 | private picWidth: number = 0 |
| 19 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 20 | + @State isEnableSwipe: boolean = true; | ||
| 21 | + | ||
| 22 | + // @Provide bgc: Color = Color.White; | ||
| 20 | 23 | ||
| 21 | //watch监听页码回调 | 24 | //watch监听页码回调 |
| 22 | onCurrentPageNumUpdated(): void { | 25 | onCurrentPageNumUpdated(): void { |
| @@ -53,7 +56,8 @@ export struct ImageSwiperComponent { | @@ -53,7 +56,8 @@ export struct ImageSwiperComponent { | ||
| 53 | if (this.photoList && this.photoList?.length > 0) { | 56 | if (this.photoList && this.photoList?.length > 0) { |
| 54 | Swiper(this.swiperController) { | 57 | Swiper(this.swiperController) { |
| 55 | ForEach(this.photoList, (item: PhotoListBean) => { | 58 | ForEach(this.photoList, (item: PhotoListBean) => { |
| 56 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 59 | + // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 60 | + ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) | ||
| 57 | }) | 61 | }) |
| 58 | } | 62 | } |
| 59 | .index(this.swiperIndex) | 63 | .index(this.swiperIndex) |
| 1 | -import { CommonConstants } from 'wdConstant'; | ||
| 2 | -import { Logger } from 'wdKit'; | ||
| 3 | - | ||
| 4 | -const TAG = 'EmptyComponent'; | ||
| 5 | - | ||
| 6 | -/** | ||
| 7 | - * WDViewDefaultType 缺省页 | ||
| 8 | - */ | ||
| 9 | -export const enum WDViewDefaultType { | ||
| 10 | - ///无网 | ||
| 11 | - WDViewDefaultType_NoNetwork, | ||
| 12 | - ///网络失败 请稍后重试-倒计时 | ||
| 13 | - WDViewDefaultType_NetworkFailed, | ||
| 14 | - ///内容获取失败 | ||
| 15 | - WDViewDefaultType_ContentFailed, | ||
| 16 | -} | ||
| 17 | - | ||
| 18 | -/** | ||
| 19 | - * 空数据/无数据 | ||
| 20 | - */ | ||
| 21 | -@Preview | ||
| 22 | -@Component | ||
| 23 | -export struct MultiPictureDetailEmptyComponent { | ||
| 24 | - // private emptySize: SizeOptions = {}; | ||
| 25 | - @State emptyWidth: string | number = CommonConstants.FULL_PARENT; | ||
| 26 | - @State emptyHeight: string | number = CommonConstants.FULL_PARENT; | ||
| 27 | - @State emptyType: number = WDViewDefaultType.WDViewDefaultType_ContentFailed | ||
| 28 | - /** | ||
| 29 | - * The empty image width percentage setting. | ||
| 30 | - */ | ||
| 31 | - readonly EMPTY_IMAGE_WIDTH: string = '15%'; | ||
| 32 | - /** | ||
| 33 | - * The empty image height percentage setting. | ||
| 34 | - */ | ||
| 35 | - readonly EMPTY_IMAGE_HEIGHT: string = '15%'; | ||
| 36 | - /** | ||
| 37 | - * The empty data text component margin top. | ||
| 38 | - */ | ||
| 39 | - readonly EMPTY_TIP_TEXT_MARGIN_TOP: string = '10'; | ||
| 40 | - /** | ||
| 41 | - * The empty data text opacity. | ||
| 42 | - */ | ||
| 43 | - readonly TEXT_OPACITY: number = 1; | ||
| 44 | - | ||
| 45 | - build() { | ||
| 46 | - this.noProgrammeData(); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - /** | ||
| 50 | - * 无数据,空白view组件 | ||
| 51 | - */ | ||
| 52 | - @Builder | ||
| 53 | - noProgrammeData() { | ||
| 54 | - Column() { | ||
| 55 | - Image(this.buildNoDataTipImage()) | ||
| 56 | - .width('this.EMPTY_IMAGE_WIDTH') | ||
| 57 | - .height(this.EMPTY_IMAGE_HEIGHT) | ||
| 58 | - .objectFit(ImageFit.Contain) | ||
| 59 | - // .border({ width: 1, color: Color.Red, radius: 6 }) | ||
| 60 | - | ||
| 61 | - Text(this.buildNoDataTip()) | ||
| 62 | - .fontSize($r('app.float.font_size_14')) | ||
| 63 | - .fontColor('#999999') | ||
| 64 | - .fontWeight(FontWeight.Normal) | ||
| 65 | - .opacity(this.TEXT_OPACITY) | ||
| 66 | - .margin({ top: this.EMPTY_TIP_TEXT_MARGIN_TOP }) | ||
| 67 | - .onClick((event: ClickEvent) => { | ||
| 68 | - Logger.info(TAG, `noProgrammeData onClick event?.source: ${event.source}`); | ||
| 69 | - }) | ||
| 70 | - Button('点击重试', { type: ButtonType.Normal, stateEffect: true }) | ||
| 71 | - .borderRadius(4) | ||
| 72 | - .margin(16) | ||
| 73 | - .height(28) | ||
| 74 | - .fontSize(12) | ||
| 75 | - .fontColor('#CCCCCC') | ||
| 76 | - .fontFamily('PingFang SC-Medium') | ||
| 77 | - .border({ width: 1, color: '#545454' }) | ||
| 78 | - .backgroundColor(Color.Black) | ||
| 79 | - } | ||
| 80 | - .justifyContent(FlexAlign.Center) | ||
| 81 | - .width(this.emptyWidth) | ||
| 82 | - .height(this.emptyHeight) | ||
| 83 | - .backgroundColor(Color.Black) | ||
| 84 | - } | ||
| 85 | - | ||
| 86 | - buildNoDataTip(): string { | ||
| 87 | - Logger.info(TAG, "buildNoDataTip"); | ||
| 88 | - let contentString: string = '获取内容失败请重试' | ||
| 89 | - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | ||
| 90 | - contentString = '网络出小差了,请检查网络后重试' | ||
| 91 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { | ||
| 92 | - contentString = '获取内容失败请重试' | ||
| 93 | - } | ||
| 94 | - | ||
| 95 | - return contentString | ||
| 96 | - } | ||
| 97 | - | ||
| 98 | - buildNoDataTipImage(): Resource | string { | ||
| 99 | - Logger.info(TAG, "buildNoDataTip"); | ||
| 100 | - let imageString: Resource | string = $r('app.media.icon_no_content') | ||
| 101 | - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoNetwork) { | ||
| 102 | - imageString = $r('app.media.icon_no_net') | ||
| 103 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_ContentFailed) { | ||
| 104 | - imageString = $r('app.media.icon_no_content') | ||
| 105 | - } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NetworkFailed) { | ||
| 106 | - imageString = $r('app.media.icon_no_net') | ||
| 107 | - } | ||
| 108 | - return imageString | ||
| 109 | - } | ||
| 110 | -} |
| 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() { | 25 | Row() { |
| 18 | Image(this.MultiPictureDetailItem.picPath) | 26 | Image(this.MultiPictureDetailItem.picPath) |
| 19 | .alt($r('app.media.picture_loading')) | 27 | .alt($r('app.media.picture_loading')) |
| 20 | - .width('100%') | ||
| 21 | - .aspectRatio(this.MultiPictureDetailItem.width / this.MultiPictureDetailItem.height) | 28 | + .width(this.imageWidth) |
| 29 | + .aspectRatio(this.ratio) | ||
| 22 | .objectFit(ImageFit.Fill) | 30 | .objectFit(ImageFit.Fill) |
| 23 | .interpolation(ImageInterpolation.High) | 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) { | ||
| 41 | + | ||
| 42 | + } | ||
| 43 | + .scrollable(ScrollDirection.Vertical) | ||
| 44 | + .scrollBarWidth(0) | ||
| 45 | + .height(px2vp(this.picHeight))*/ | ||
| 24 | } | 46 | } |
| 25 | .height('100%') | 47 | .height('100%') |
| 26 | .width('100%') | 48 | .width('100%') |
| 27 | - | ||
| 28 | - } | ||
| 29 | .backgroundColor(Color.Black) | 49 | .backgroundColor(Color.Black) |
| 30 | - .width('100%') | 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, |
| @@ -12,11 +12,12 @@ import display from '@ohos.display'; | @@ -12,11 +12,12 @@ import display from '@ohos.display'; | ||
| 12 | import font from '@ohos.font'; | 12 | import font from '@ohos.font'; |
| 13 | import { OperRowListView } from './view/OperRowListView'; | 13 | import { OperRowListView } from './view/OperRowListView'; |
| 14 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | 14 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; |
| 15 | -import { MultiPictureDetailEmptyComponent } from './MultiPictureDetailEmptyComponent'; | 15 | +import { EmptyComponent } from './view/EmptyComponent'; |
| 16 | import { DateTimeUtils } from 'wdKit/Index'; | 16 | 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 | ||
| @@ -36,7 +37,7 @@ export struct MultiPictureDetailPageComponent { | @@ -36,7 +37,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 36 | @State swiperIndex: number = 0; | 37 | @State swiperIndex: number = 0; |
| 37 | @Provide followStatus: string = '0' // 关注状态 | 38 | @Provide followStatus: string = '0' // 关注状态 |
| 38 | private scroller: Scroller = new Scroller() | 39 | private scroller: Scroller = new Scroller() |
| 39 | - @State netStatus: number = 0 // 存储网络状态用来展示缺省图 | 40 | + @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 |
| 40 | 41 | ||
| 41 | //watch监听页码回调 | 42 | //watch监听页码回调 |
| 42 | onCurrentPageNumUpdated(): void { | 43 | onCurrentPageNumUpdated(): void { |
| @@ -238,8 +239,8 @@ export struct MultiPictureDetailPageComponent { | @@ -238,8 +239,8 @@ export struct MultiPictureDetailPageComponent { | ||
| 238 | .height(px2vp(this.titleHeight) + 64) | 239 | .height(px2vp(this.titleHeight) + 64) |
| 239 | 240 | ||
| 240 | } else { | 241 | } else { |
| 241 | - if (this.netStatus === 1) { | ||
| 242 | - MultiPictureDetailEmptyComponent({ emptyType: 2}) | 242 | + if(this.netStatus !== undefined) { |
| 243 | + EmptyComponent({ emptyType: this.netStatus}) | ||
| 243 | .id('e_empty_content') | 244 | .id('e_empty_content') |
| 244 | .alignRules({ | 245 | .alignRules({ |
| 245 | center: { anchor: "__container__", align: VerticalAlign.Center }, | 246 | center: { anchor: "__container__", align: VerticalAlign.Center }, |
| @@ -289,6 +290,9 @@ export struct MultiPictureDetailPageComponent { | @@ -289,6 +290,9 @@ export struct MultiPictureDetailPageComponent { | ||
| 289 | return | 290 | return |
| 290 | } | 291 | } |
| 291 | this.contentDetailData = resDTO.data?.[0]; | 292 | this.contentDetailData = resDTO.data?.[0]; |
| 293 | + if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 294 | + this.netStatus = 0 | ||
| 295 | + } | ||
| 292 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 296 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| 293 | if (HttpUrlUtils.getUserId()) { | 297 | if (HttpUrlUtils.getUserId()) { |
| 294 | this.getInteractBrowsOperate() | 298 | this.getInteractBrowsOperate() |
| @@ -350,9 +354,10 @@ export struct MultiPictureDetailPageComponent { | @@ -350,9 +354,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 350 | /** | 354 | /** |
| 351 | * 关注号主 | 355 | * 关注号主 |
| 352 | */ | 356 | */ |
| 353 | - handleAccention() { | 357 | + async handleAccention() { |
| 354 | // 未登录,跳转登录 | 358 | // 未登录,跳转登录 |
| 355 | - if (!HttpUrlUtils.getUserId()) { | 359 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 360 | + if (!user_id) { | ||
| 356 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 361 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 357 | return | 362 | return |
| 358 | } | 363 | } |
| @@ -19,7 +19,6 @@ export default struct MinePagePersonFunctionUI { | @@ -19,7 +19,6 @@ export default struct MinePagePersonFunctionUI { | ||
| 19 | .interpolation(ImageInterpolation.High) | 19 | .interpolation(ImageInterpolation.High) |
| 20 | Text(`${item.msg}`) | 20 | Text(`${item.msg}`) |
| 21 | .margin({top:'8lpx'}) | 21 | .margin({top:'8lpx'}) |
| 22 | - .width('50lpx') | ||
| 23 | .height('23lpx') | 22 | .height('23lpx') |
| 24 | .fontColor($r('app.color.color_222222')) | 23 | .fontColor($r('app.color.color_222222')) |
| 25 | .fontSize('23lpx') | 24 | .fontSize('23lpx') |
| 1 | import { Params } from 'wdBean'; | 1 | import { Params } from 'wdBean'; |
| 2 | -import { DateTimeUtils, LazyDataSource, StringUtils, UserDataLocal } from 'wdKit'; | ||
| 3 | -import { HttpUrlUtils } from 'wdNetwork'; | 2 | +import { DateTimeUtils, LazyDataSource,UserDataLocal } from 'wdKit'; |
| 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 3 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 6 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; | 5 | import { CommentListItem } from '../../../viewmodel/CommentListItem'; |
| 7 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 8 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 9 | -import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'; | ||
| 10 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 11 | import { FollowChildComponent } from '../follow/FollowChildComponent'; | 9 | import { FollowChildComponent } from '../follow/FollowChildComponent'; |
| 12 | 10 | ||
| @@ -22,6 +20,7 @@ export struct HomePageBottomComponent{ | @@ -22,6 +20,7 @@ export struct HomePageBottomComponent{ | ||
| 22 | @State count:number = 0; | 20 | @State count:number = 0; |
| 23 | @State isMineAccount:boolean = true; | 21 | @State isMineAccount:boolean = true; |
| 24 | @State userId:string = ""; | 22 | @State userId:string = ""; |
| 23 | + @Link commentNum:number | ||
| 25 | 24 | ||
| 26 | aboutToAppear(){ | 25 | aboutToAppear(){ |
| 27 | this.getNewPageData() | 26 | this.getNewPageData() |
| @@ -36,6 +35,7 @@ export struct HomePageBottomComponent{ | @@ -36,6 +35,7 @@ export struct HomePageBottomComponent{ | ||
| 36 | 35 | ||
| 37 | if(this.count === 0){ | 36 | if(this.count === 0){ |
| 38 | if(this.style === 1){ | 37 | if(this.style === 1){ |
| 38 | + Column(){ | ||
| 39 | Row(){ | 39 | Row(){ |
| 40 | Text("关注更多人民号") | 40 | Text("关注更多人民号") |
| 41 | .fontWeight('400lpx') | 41 | .fontWeight('400lpx') |
| @@ -60,6 +60,8 @@ export struct HomePageBottomComponent{ | @@ -60,6 +60,8 @@ export struct HomePageBottomComponent{ | ||
| 60 | } | 60 | } |
| 61 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 61 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 62 | }) | 62 | }) |
| 63 | + }.layoutWeight(1) | ||
| 64 | + .justifyContent(FlexAlign.Start) | ||
| 63 | }else{ | 65 | }else{ |
| 64 | ListHasNoMoreDataUI({style:2}) | 66 | ListHasNoMoreDataUI({style:2}) |
| 65 | .layoutWeight(1) | 67 | .layoutWeight(1) |
| @@ -211,7 +213,8 @@ export struct HomePageBottomComponent{ | @@ -211,7 +213,8 @@ export struct HomePageBottomComponent{ | ||
| 211 | this.hasMore = false | 213 | this.hasMore = false |
| 212 | }else{ | 214 | }else{ |
| 213 | value.list.forEach((value)=>{ | 215 | value.list.forEach((value)=>{ |
| 214 | - this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType)) | 216 | + let publishTime = DateTimeUtils.getCommentTime(DateTimeUtils.parseDate(value.createTime,DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)) |
| 217 | + this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,publishTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType)) | ||
| 215 | }) | 218 | }) |
| 216 | this.data_comment.notifyDataReload() | 219 | this.data_comment.notifyDataReload() |
| 217 | this.count = this.data_comment.totalCount() | 220 | this.count = this.data_comment.totalCount() |
| @@ -222,6 +225,7 @@ export struct HomePageBottomComponent{ | @@ -222,6 +225,7 @@ export struct HomePageBottomComponent{ | ||
| 222 | } | 225 | } |
| 223 | } | 226 | } |
| 224 | this.isLoading = false | 227 | this.isLoading = false |
| 228 | + this.commentNum = value.totalCount | ||
| 225 | }).catch((err:Error)=>{ | 229 | }).catch((err:Error)=>{ |
| 226 | console.log(TAG,"请求失败") | 230 | console.log(TAG,"请求失败") |
| 227 | this.isLoading = false | 231 | this.isLoading = false |
| 1 | +import { image } from '@kit.ImageKit'; | ||
| 2 | +import { matrix4, promptAction, window } from '@kit.ArkUI'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | +import { ScaleModel } from '../../model/ScaleModel'; | ||
| 5 | +import { OffsetModel } from '../../model/OffsetModel'; | ||
| 6 | +import { windowSizeManager } from '../../utils/Managers'; | ||
| 7 | +import { runWithAnimation } from '../../utils/FuncUtils'; | ||
| 8 | +import { PhotoListBean } from 'wdBean/Index'; | ||
| 9 | +import { http } from '@kit.NetworkKit'; | ||
| 10 | + | ||
| 11 | +// TODO:知识点:组件复用 | ||
| 12 | +@Reusable | ||
| 13 | +@Component | ||
| 14 | +export struct ImageItemView { | ||
| 15 | + @Consume private bgc: Color; | ||
| 16 | + @Link isEnableSwipe: boolean; // TODO:需求:多图切换 | ||
| 17 | + @State isEnableOffset: boolean = false; | ||
| 18 | + @State imageScaleInfo: ScaleModel = new ScaleModel(1.0, 1.0, 1.5, 0.3); | ||
| 19 | + @State imageOffsetInfo: OffsetModel = new OffsetModel(0, 0); | ||
| 20 | + @State matrix: matrix4.Matrix4Transit = matrix4.identity().copy(); | ||
| 21 | + @State imagePixelMap: image.PixelMap | null = null; // 当前图片pixelMap,用于Image组件显示 | ||
| 22 | + @State fitWH: "width" | "height" | undefined = undefined; // 表示当前图片是根据宽度适配还是高度适配 | ||
| 23 | + @State imageDefaultSize: image.Size = { width: 0, height: 0 }; // 图片默认大小,即,与屏幕大小最适配的显示大小 | ||
| 24 | + imageUri: string = ""; // 当前图片uri | ||
| 25 | + imageWHRatio: number = 0; // 图片原始宽高比 | ||
| 26 | + private MultiPictureDetailItem: PhotoListBean = {} as PhotoListBean | ||
| 27 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 28 | + | ||
| 29 | + aboutToAppear(): void { | ||
| 30 | + this.imageUri = this.MultiPictureDetailItem.picPath | ||
| 31 | + this.getPicture() | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + /** | ||
| 35 | + * 通过http的request方法从网络下载图片资源 | ||
| 36 | + */ | ||
| 37 | + async getPicture() { | ||
| 38 | + console.info(`cj2024 getPicture`) | ||
| 39 | + http.createHttp() | ||
| 40 | + .request(this.imageUri, | ||
| 41 | + (error: BusinessError, data: http.HttpResponse) => { | ||
| 42 | + if (error) { | ||
| 43 | + // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 44 | + promptAction.showToast({ | ||
| 45 | + message: $r('app.string.image_request_fail'), | ||
| 46 | + duration: 2000 | ||
| 47 | + }) | ||
| 48 | + return; | ||
| 49 | + } | ||
| 50 | + this.transcodePixelMap(data); | ||
| 51 | + // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 52 | + console.info(`cj2024 getPicture ${data.result}`) | ||
| 53 | + if (data.result instanceof ArrayBuffer) { | ||
| 54 | + console.info(`cj2024 getPicture 222`) | ||
| 55 | + this.imageBuffer = data.result as ArrayBuffer; | ||
| 56 | + } | ||
| 57 | + } | ||
| 58 | + ) | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 63 | + * @param data:网络获取到的资源 | ||
| 64 | + */ | ||
| 65 | + transcodePixelMap(data: http.HttpResponse) { | ||
| 66 | + console.info(`cj2024 transcodePixelMap ${data.responseCode}`) | ||
| 67 | + if (http.ResponseCode.OK === data.responseCode) { | ||
| 68 | + const imageData: ArrayBuffer = data.result as ArrayBuffer; | ||
| 69 | + // 通过ArrayBuffer创建图片源实例。 | ||
| 70 | + const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 71 | + this.initCurrentImageInfo(imageSource); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 根据图片宽高比及窗口大小计算图片的默认宽高,即,图片最适配屏幕的大小 | ||
| 77 | + * @param imageWHRatio:图片原始宽高比 | ||
| 78 | + * @param size:窗口大小{with:number,height:number} | ||
| 79 | + * @returns image.Size | ||
| 80 | + */ | ||
| 81 | + calcImageDefaultSize(imageWHRatio: number, size: window.Size): image.Size { | ||
| 82 | + let width = 0 | ||
| 83 | + let height = 0; | ||
| 84 | + if (imageWHRatio > size.width / size.height) { | ||
| 85 | + // 图片宽高比大于屏幕宽高比,图片默认以屏幕宽度进行显示 | ||
| 86 | + width = size.width; | ||
| 87 | + height = size.width / imageWHRatio; | ||
| 88 | + } else { | ||
| 89 | + height = size.height; | ||
| 90 | + width = size.height * imageWHRatio; | ||
| 91 | + } | ||
| 92 | + return { width: width, height: height }; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + /** | ||
| 96 | + * TODO:知识点:根据图片大小(宽高<=屏幕宽高)和屏幕大小计算图片放大适配屏幕进行显示的缩放倍率 | ||
| 97 | + * @param imageSize:图片当前大小 | ||
| 98 | + * @param windowSize:窗口大小 | ||
| 99 | + * @returns:缩放倍率 | ||
| 100 | + */ | ||
| 101 | + calcFitScaleRatio(imageSize: image.Size, windowSize: window.Size): number { | ||
| 102 | + let ratio: number = 1.0; | ||
| 103 | + if (windowSize.width > imageSize.width) { | ||
| 104 | + ratio = windowSize.width / imageSize.width; | ||
| 105 | + } else { | ||
| 106 | + ratio = windowSize.height / imageSize.height; | ||
| 107 | + } | ||
| 108 | + return ratio; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + /** | ||
| 112 | + * 设置当前图片的相关信息:uri、whRatio、pixelMap、fitWH、defaultSize、maxScaleValue | ||
| 113 | + * TODO:知识点:提前获取图片的信息,以进行Image组件的尺寸设置及后续的相关计算 | ||
| 114 | + */ | ||
| 115 | + initCurrentImageInfo(imageSource: image.ImageSource): void { | ||
| 116 | + this.matrix = matrix4.identity().copy(); | ||
| 117 | + // const imageSource: image.ImageSource = image.createImageSource(this.imageUri); | ||
| 118 | + imageSource.getImageInfo(0).then((data: image.ImageInfo) => { | ||
| 119 | + this.imageWHRatio = data.size.width / data.size.height; | ||
| 120 | + this.imageDefaultSize = this.calcImageDefaultSize(this.imageWHRatio, windowSizeManager.get()); | ||
| 121 | + if (this.imageDefaultSize.width === windowSizeManager.get().width) { | ||
| 122 | + this.fitWH = "width"; | ||
| 123 | + } else { | ||
| 124 | + this.fitWH = "height"; | ||
| 125 | + } | ||
| 126 | + this.imageScaleInfo.maxScaleValue += this.fitWH === "width" ? | ||
| 127 | + (windowSizeManager.get().height / this.imageDefaultSize.height) : | ||
| 128 | + (windowSizeManager.get().width / this.imageDefaultSize.width); | ||
| 129 | + }).catch((err: BusinessError) => { | ||
| 130 | + console.error(`[error][getImageInfo]${err.message}`); | ||
| 131 | + }); | ||
| 132 | + imageSource.createPixelMap().then((data: image.PixelMap) => { | ||
| 133 | + this.imagePixelMap = data; | ||
| 134 | + }).catch((err: BusinessError) => { | ||
| 135 | + console.error(`[error][createPixelMap]${err.message}`); | ||
| 136 | + }); | ||
| 137 | + this.isEnableOffset = false; | ||
| 138 | + this.imageScaleInfo.reset(); | ||
| 139 | + this.imageOffsetInfo.reset(); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * 在图片消失时,将当前图片的信息设置为默认值 | ||
| 144 | + */ | ||
| 145 | + resetCurrentImageInfo(): void { | ||
| 146 | + this.imageScaleInfo.reset(); | ||
| 147 | + this.imageOffsetInfo.reset(); | ||
| 148 | + this.matrix = matrix4.identity().copy(); | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + /** | ||
| 152 | + * TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 | ||
| 153 | + * @returns:长度为4的boolean数组,表示上下左右是否到达边界 | ||
| 154 | + */ | ||
| 155 | + evaluateBound(): boolean[] { | ||
| 156 | + return [false, false, false, false]; | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + build() { | ||
| 160 | + Stack() { | ||
| 161 | + Image(this.imagePixelMap)// TODO:知识点:宽高只根据其尺寸设置一个,通过保持宽高比来设置另一个属性 | ||
| 162 | + .width(this.fitWH === "width" ? "100%" : undefined) | ||
| 163 | + .height(this.fitWH === "height" ? "100%" : undefined) | ||
| 164 | + .aspectRatio(this.imageWHRatio) | ||
| 165 | + .objectFit(ImageFit.Cover)// TODO:知识点:保持宽高比进行缩放,可以超出父组件,以便实现多图切换的增强功能 | ||
| 166 | + .autoResize(false) | ||
| 167 | + .transform(this.matrix)// TODO:知识点:通过matrix控制图片的缩放 | ||
| 168 | + .defaultFocus(true) | ||
| 169 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 170 | + .offset({ | ||
| 171 | + // TODO:知识点:通过offset控制图片的偏移 | ||
| 172 | + x: this.imageOffsetInfo.currentX, | ||
| 173 | + y: this.imageOffsetInfo.currentY | ||
| 174 | + }) | ||
| 175 | + } | ||
| 176 | + .onBlur(() => { | ||
| 177 | + this.resetCurrentImageInfo(); | ||
| 178 | + }) | ||
| 179 | + // .backgroundColor(this.bgc) | ||
| 180 | + .alignContent(Alignment.Center) | ||
| 181 | + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 182 | + .width("100%") | ||
| 183 | + .height("100%") | ||
| 184 | + .gesture( | ||
| 185 | + GestureGroup( | ||
| 186 | + GestureMode.Exclusive, | ||
| 187 | + // TODO:知识点:双击切换图片大小 | ||
| 188 | + TapGesture({ count: 2 }) | ||
| 189 | + .onAction(() => { | ||
| 190 | + let fn: Function; | ||
| 191 | + // 已经是放大状态下,双击缩小 | ||
| 192 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.defaultScaleValue) { | ||
| 193 | + fn = () => { | ||
| 194 | + this.isEnableSwipe = true; | ||
| 195 | + this.imageScaleInfo.reset(); | ||
| 196 | + this.imageOffsetInfo.reset(); | ||
| 197 | + this.matrix = matrix4.identity().copy(); | ||
| 198 | + }; | ||
| 199 | + } else { | ||
| 200 | + // 已经是缩小状态,双击放大 | ||
| 201 | + fn = () => { | ||
| 202 | + this.isEnableSwipe = false; | ||
| 203 | + const ratio: number = this.calcFitScaleRatio(this.imageDefaultSize, windowSizeManager.get()); | ||
| 204 | + this.imageScaleInfo.scaleValue = ratio; | ||
| 205 | + this.imageOffsetInfo.reset(); | ||
| 206 | + this.matrix = matrix4.identity().scale({ | ||
| 207 | + x: ratio, | ||
| 208 | + y: ratio, | ||
| 209 | + }).copy(); | ||
| 210 | + this.imageScaleInfo.stash(); | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + runWithAnimation(fn); | ||
| 214 | + }), | ||
| 215 | + // 单击切换背景色 | ||
| 216 | + // TapGesture({ count: 1 }).onAction(() => { | ||
| 217 | + // runWithAnimation(() => { | ||
| 218 | + // this.bgc = this.bgc === Color.White ? Color.Black : Color.White; | ||
| 219 | + // }); | ||
| 220 | + // }), | ||
| 221 | + // TODO:知识点:双指捏合缩放图片 | ||
| 222 | + PinchGesture({ fingers: 2, distance: 1 }) | ||
| 223 | + .onActionUpdate((event: GestureEvent) => { | ||
| 224 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.lastValue * event.scale; | ||
| 225 | + // TODO:知识点:缩放时不允许大于最大缩放因子+额外缩放因子,不允许小于默认大小-额外缩放因子,额外缩放因子用于提升用户体验 | ||
| 226 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue * | ||
| 227 | + (1 + this.imageScaleInfo.extraScaleValue) | ||
| 228 | + ) { | ||
| 229 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue * | ||
| 230 | + (1 + this.imageScaleInfo.extraScaleValue); | ||
| 231 | + } | ||
| 232 | + if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue * | ||
| 233 | + (1 - this.imageScaleInfo.extraScaleValue)) { | ||
| 234 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.defaultScaleValue * | ||
| 235 | + (1 - this.imageScaleInfo.extraScaleValue); | ||
| 236 | + } | ||
| 237 | + // TODO:知识点:matrix默认缩放中心为组件中心 | ||
| 238 | + this.matrix = matrix4.identity().scale({ | ||
| 239 | + x: this.imageScaleInfo.scaleValue, | ||
| 240 | + y: this.imageScaleInfo.scaleValue, | ||
| 241 | + }).copy(); | ||
| 242 | + console.debug(this.imageScaleInfo.toString()); | ||
| 243 | + }) | ||
| 244 | + .onActionEnd((event: GestureEvent) => { | ||
| 245 | + /** | ||
| 246 | + * TODO:知识点:当小于默认大小时,恢复为默认大小 | ||
| 247 | + */ | ||
| 248 | + if (this.imageScaleInfo.scaleValue < this.imageScaleInfo.defaultScaleValue) { | ||
| 249 | + runWithAnimation(() => { | ||
| 250 | + this.imageScaleInfo.reset(); | ||
| 251 | + this.imageOffsetInfo.reset(); | ||
| 252 | + this.matrix = matrix4.identity().copy(); | ||
| 253 | + }) | ||
| 254 | + } | ||
| 255 | + // TODO:知识点:当大于最大缩放因子时,恢复到最大 | ||
| 256 | + if (this.imageScaleInfo.scaleValue > this.imageScaleInfo.maxScaleValue) { | ||
| 257 | + runWithAnimation(() => { | ||
| 258 | + this.imageScaleInfo.scaleValue = this.imageScaleInfo.maxScaleValue; | ||
| 259 | + this.matrix = matrix4.identity() | ||
| 260 | + .scale({ | ||
| 261 | + x: this.imageScaleInfo.maxScaleValue, | ||
| 262 | + y: this.imageScaleInfo.maxScaleValue | ||
| 263 | + }); | ||
| 264 | + }) | ||
| 265 | + } | ||
| 266 | + this.imageScaleInfo.stash(); | ||
| 267 | + }), | ||
| 268 | + // // TODO:知识点:滑动图片 | ||
| 269 | + // PanGesture({ fingers: 1 })// TODO:需求:默认大小下左右滑动应当是切换图片 | ||
| 270 | + // .onActionUpdate((event: GestureEvent) => { | ||
| 271 | + // if (this.imageScaleInfo.scaleValue === this.imageScaleInfo.defaultScaleValue) { | ||
| 272 | + // // 默认大小下不允许移动 | ||
| 273 | + // return; | ||
| 274 | + // } | ||
| 275 | + // this.imageOffsetInfo.currentX = this.imageOffsetInfo.lastX + event.offsetX; | ||
| 276 | + // this.imageOffsetInfo.currentY = this.imageOffsetInfo.lastY + event.offsetY; | ||
| 277 | + // }) | ||
| 278 | + // .onActionEnd((event: GestureEvent) => { | ||
| 279 | + // this.imageOffsetInfo.stash(); | ||
| 280 | + // }) | ||
| 281 | + ), | ||
| 282 | + ) | ||
| 283 | + } | ||
| 284 | +} |
| 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 | } |
| @@ -60,7 +60,7 @@ class MinePageDatasModel{ | @@ -60,7 +60,7 @@ class MinePageDatasModel{ | ||
| 60 | return this.personalData | 60 | return this.personalData |
| 61 | } | 61 | } |
| 62 | this.personalData.push(new MinePagePersonalFunctionsItem("评论",$r('app.media.mine_comment_icon'))) | 62 | this.personalData.push(new MinePagePersonalFunctionsItem("评论",$r('app.media.mine_comment_icon'))) |
| 63 | - this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_order_icon'))) | 63 | + this.personalData.push(new MinePagePersonalFunctionsItem("关注",$r('app.media.mine_follow_icon'))) |
| 64 | this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) | 64 | this.personalData.push(new MinePagePersonalFunctionsItem("收藏",$r('app.media.mine_collect_icon'))) |
| 65 | this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) | 65 | this.personalData.push(new MinePagePersonalFunctionsItem("历史",$r('app.media.mine_history_icon'))) |
| 66 | this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) | 66 | this.personalData.push(new MinePagePersonalFunctionsItem("消息",$r('app.media.mine_msg_icon'))) |
| 1 | +@Observed | ||
| 2 | +export class OffsetModel { | ||
| 3 | + public currentX: number; | ||
| 4 | + public currentY: number; | ||
| 5 | + public lastX: number = 0; | ||
| 6 | + public lastY: number = 0; | ||
| 7 | + | ||
| 8 | + constructor(currentX: number = 0, currentY: number = 0) { | ||
| 9 | + this.currentX = currentX; | ||
| 10 | + this.currentY = currentY; | ||
| 11 | + } | ||
| 12 | + | ||
| 13 | + reset(): void { | ||
| 14 | + this.currentX = 0; | ||
| 15 | + this.currentY = 0; | ||
| 16 | + this.lastX = 0; | ||
| 17 | + this.lastY = 0; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + stash(): void { | ||
| 21 | + this.lastX = this.currentX; | ||
| 22 | + this.lastY = this.currentY; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + toString(): string { | ||
| 26 | + return `[currentX: ${this.currentX} currentY: ${this.currentY} lastX: ${this.lastX} lastY: ${this.lastY}]`; | ||
| 27 | + } | ||
| 28 | +} |
| 1 | +@Observed | ||
| 2 | +export class ScaleModel { | ||
| 3 | + /** | ||
| 4 | + * scaleValue: 本次缩放因子,用于控制图片的大小显示 | ||
| 5 | + * lastValue:记录上次缩放完后的缩放因子 | ||
| 6 | + * defaultMaxScaleValue:默认的最大放大值 | ||
| 7 | + * defaultScaleValue:默认缩放值,1 | ||
| 8 | + */ | ||
| 9 | + public scaleValue: number; | ||
| 10 | + public lastValue: number; | ||
| 11 | + public maxScaleValue: number; | ||
| 12 | + public extraScaleValue: number; | ||
| 13 | + public readonly defaultScaleValue: number = 1; | ||
| 14 | + | ||
| 15 | + constructor(scaleValue: number = 1.0, lastValue: number = 1.0, | ||
| 16 | + maxScaleValue: number = 1.5, extraScaleValue: number = 0.2) { | ||
| 17 | + this.scaleValue = scaleValue; | ||
| 18 | + this.lastValue = lastValue; | ||
| 19 | + this.maxScaleValue = maxScaleValue; | ||
| 20 | + this.extraScaleValue = extraScaleValue; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + reset(): void { | ||
| 24 | + this.scaleValue = this.defaultScaleValue; | ||
| 25 | + this.lastValue = this.scaleValue; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + stash(): void { | ||
| 29 | + this.lastValue = this.scaleValue; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + toString(): string { | ||
| 33 | + return `[scaleValue: ${this.scaleValue} lastValue: ${this.lastValue}]`; | ||
| 34 | + } | ||
| 35 | +} |
| @@ -185,10 +185,10 @@ struct MineHomePage { | @@ -185,10 +185,10 @@ struct MineHomePage { | ||
| 185 | //tab 页面 | 185 | //tab 页面 |
| 186 | Tabs({controller: this.controller}) { | 186 | Tabs({controller: this.controller}) { |
| 187 | TabContent() { | 187 | TabContent() { |
| 188 | - HomePageBottomComponent({style:0}) | 188 | + HomePageBottomComponent({style:0,commentNum:$commentNum}) |
| 189 | }.tabBar(this.TabBuilder(0,"评论")) | 189 | }.tabBar(this.TabBuilder(0,"评论")) |
| 190 | TabContent() { | 190 | TabContent() { |
| 191 | - HomePageBottomComponent({style:1}) | 191 | + HomePageBottomComponent({style:1,commentNum:$commentNum}) |
| 192 | }.tabBar(this.TabBuilder(1,"关注")) | 192 | }.tabBar(this.TabBuilder(1,"关注")) |
| 193 | } | 193 | } |
| 194 | .backgroundColor($r('app.color.white')) | 194 | .backgroundColor($r('app.color.white')) |
| 1 | +/** | ||
| 2 | + * 给函数的执行加上动画 | ||
| 3 | + * @param fn:要在动画内执行的回调函数,通常fn里面会改变状态变量 | ||
| 4 | + * @param duration:动画持续时长 | ||
| 5 | + * @param curve:动画区线 | ||
| 6 | + */ | ||
| 7 | +import { ImageViewerConstants } from '../constants/ImageViewerConstants'; | ||
| 8 | + | ||
| 9 | +export function runWithAnimation( | ||
| 10 | + fn: Function, | ||
| 11 | + duration: number = ImageViewerConstants.ANIMATE_DURATION, | ||
| 12 | + curve: Curve = Curve.Smooth): void { | ||
| 13 | + animateTo({ duration: duration, curve: curve }, () => { | ||
| 14 | + fn(); | ||
| 15 | + }) | ||
| 16 | +} |
| 1 | +import { window } from '@kit.ArkUI'; | ||
| 2 | + | ||
| 3 | +class WindowSizeManager { | ||
| 4 | + private size: window.Size = { width: 0, height: 0 }; | ||
| 5 | + | ||
| 6 | + constructor() { | ||
| 7 | + window.getLastWindow(getContext()).then((value: window.Window) => { | ||
| 8 | + const rect: window.Rect = value.getWindowProperties().windowRect; | ||
| 9 | + this.size.width = px2vp(rect.width); | ||
| 10 | + this.size.height = px2vp(rect.height); | ||
| 11 | + console.log(`[windowWidth]${this.size.width} [windowHeight]${this.size.height}`); | ||
| 12 | + }) | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + get(): window.Size { | ||
| 16 | + return this.size; | ||
| 17 | + } | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +export const windowSizeManager: WindowSizeManager = new WindowSizeManager(); |
| @@ -39,6 +39,14 @@ | @@ -39,6 +39,14 @@ | ||
| 39 | { | 39 | { |
| 40 | "name": "image_request_fail", | 40 | "name": "image_request_fail", |
| 41 | "value": "图片加载失败,请检查网络" | 41 | "value": "图片加载失败,请检查网络" |
| 42 | + }, | ||
| 43 | + { | ||
| 44 | + "name": "EntryAbility_desc", | ||
| 45 | + "value": "$string:app_desc" | ||
| 46 | + }, | ||
| 47 | + { | ||
| 48 | + "name": "reason_read_write_media", | ||
| 49 | + "value": "user_grant" | ||
| 42 | } | 50 | } |
| 43 | ] | 51 | ] |
| 44 | } | 52 | } |
| @@ -4,9 +4,9 @@ import { WDRouterPage } from 'wdRouter'; | @@ -4,9 +4,9 @@ import { WDRouterPage } from 'wdRouter'; | ||
| 4 | @Entry | 4 | @Entry |
| 5 | @Component | 5 | @Component |
| 6 | struct GuidePages { | 6 | struct GuidePages { |
| 7 | - guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4')] | ||
| 8 | - guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4')] | ||
| 9 | - guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'), $r('app.media.guide_button')] | 7 | + guideImage = [$r('app.media.guide_static1'), $r('app.media.guide_static2'), $r('app.media.guide_static3'), $r('app.media.guide_static4'),$r('app.media.guide_static5')] |
| 8 | + guideTitle = [$r('app.media.guide_title1'), $r('app.media.guide_title2'), $r('app.media.guide_title3'), $r('app.media.guide_title4'),$r('app.media.guide_title5')] | ||
| 9 | + guideIndex = [$r('app.media.guide_index1'), $r('app.media.guide_index2'), $r('app.media.guide_index3'),$r('app.media.guide_index4'), $r('app.media.guide_button')] | ||
| 10 | 10 | ||
| 11 | build() { | 11 | build() { |
| 12 | Column() { | 12 | Column() { |
| @@ -57,7 +57,7 @@ struct GuidePages { | @@ -57,7 +57,7 @@ struct GuidePages { | ||
| 57 | .margin({ bottom: 85 }) | 57 | .margin({ bottom: 85 }) |
| 58 | .height(40) | 58 | .height(40) |
| 59 | .onClick(() => { | 59 | .onClick(() => { |
| 60 | - if (index == 3) { | 60 | + if (index == 4) { |
| 61 | // 跳转到首页 | 61 | // 跳转到首页 |
| 62 | //WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | 62 | //WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) |
| 63 | //跳转到兴趣偏好选择页 | 63 | //跳转到兴趣偏好选择页 |
No preview for this file type
No preview for this file type
| @@ -3,6 +3,7 @@ import { WDRouterRule } from 'wdRouter'; | @@ -3,6 +3,7 @@ import { WDRouterRule } from 'wdRouter'; | ||
| 3 | import { WDRouterPage } from 'wdRouter'; | 3 | import { WDRouterPage } from 'wdRouter'; |
| 4 | import { SPHelper } from 'wdKit/Index'; | 4 | import { SPHelper } from 'wdKit/Index'; |
| 5 | import { SpConstants } from 'wdConstant/Index'; | 5 | import { SpConstants } from 'wdConstant/Index'; |
| 6 | +import { ButtonOptions, promptAction } from '@kit.ArkUI'; | ||
| 6 | 7 | ||
| 7 | @Entry | 8 | @Entry |
| 8 | @Component | 9 | @Component |
| @@ -79,6 +80,11 @@ struct LaunchInterestsHobbiesPage { | @@ -79,6 +80,11 @@ struct LaunchInterestsHobbiesPage { | ||
| 79 | .margin({top:'2lpx',left:'19lpx'}) | 80 | .margin({top:'2lpx',left:'19lpx'}) |
| 80 | .width('100%') | 81 | .width('100%') |
| 81 | .height('31lpx') | 82 | .height('31lpx') |
| 83 | + Image(item.choose ? $r('app.media.interestsSelected') : $r('app.media.interestsSelectNot')) | ||
| 84 | + .height('32lpx') | ||
| 85 | + .width('32lpx') | ||
| 86 | + .margin({top:'80lpx',left:'110lpx'}) | ||
| 87 | + | ||
| 82 | }.justifyContent(FlexAlign.Start) | 88 | }.justifyContent(FlexAlign.Start) |
| 83 | } | 89 | } |
| 84 | 90 | ||
| @@ -87,7 +93,7 @@ struct LaunchInterestsHobbiesPage { | @@ -87,7 +93,7 @@ struct LaunchInterestsHobbiesPage { | ||
| 87 | .width('100%') | 93 | .width('100%') |
| 88 | .height('100%') | 94 | .height('100%') |
| 89 | .backgroundColor(Color.White) | 95 | .backgroundColor(Color.White) |
| 90 | - .opacity(item.choose?0:0.7) | 96 | + .opacity(item.choose?0:0.6) |
| 91 | .borderRadius(5) | 97 | .borderRadius(5) |
| 92 | } | 98 | } |
| 93 | } | 99 | } |
| @@ -122,7 +128,21 @@ struct LaunchInterestsHobbiesPage { | @@ -122,7 +128,21 @@ struct LaunchInterestsHobbiesPage { | ||
| 122 | .borderRadius('10lpx') | 128 | .borderRadius('10lpx') |
| 123 | .width('662lpx') | 129 | .width('662lpx') |
| 124 | .height('84lpx') | 130 | .height('84lpx') |
| 131 | + Image('') | ||
| 132 | + .width('662lpx') | ||
| 133 | + .height('84lpx') | ||
| 134 | + .backgroundColor(Color.White) | ||
| 135 | + .opacity(this.selectCount == 0 ? 0.6 : 0) | ||
| 136 | + .borderRadius('10lpx') | ||
| 125 | .onClick(()=>{ | 137 | .onClick(()=>{ |
| 138 | + if (this.selectCount == 0) { | ||
| 139 | + promptAction.showToast({ | ||
| 140 | + message : '请先选择您感兴趣的内容哦', | ||
| 141 | + duration: 2000, | ||
| 142 | + bottom: 50 | ||
| 143 | + }) | ||
| 144 | + return | ||
| 145 | + } | ||
| 126 | this.saveTagIds() | 146 | this.saveTagIds() |
| 127 | //跳转首页 | 147 | //跳转首页 |
| 128 | WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) | 148 | WDRouterRule.jumpWithReplacePage(WDRouterPage.mainPage) |
1.73 KB
-
Please register or login to post a comment