Merge remote-tracking branch 'origin/main'
# Conflicts: # sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
Showing
89 changed files
with
2163 additions
and
866 deletions
Too many changes to show.
To preserve performance only 89 of 89+ files are displayed.
| @@ -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() { |
| @@ -556,6 +557,24 @@ export class HttpUrlUtils { | @@ -556,6 +557,24 @@ export class HttpUrlUtils { | ||
| 556 | return url | 557 | return url |
| 557 | } | 558 | } |
| 558 | 559 | ||
| 560 | + /*评论状态*/ | ||
| 561 | + static getBatchCommentStatusUrl() { | ||
| 562 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-comment/comment/zh/c/batchCommentStatus" | ||
| 563 | + return url | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + /*levleIcon*/ | ||
| 567 | + static getBatchUserUrl() { | ||
| 568 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-user-point/auth/level/zh/c/batchUser" | ||
| 569 | + return url | ||
| 570 | + } | ||
| 571 | + | ||
| 572 | + /*authIcon 20个一次上限*/ | ||
| 573 | + static getDetailListUrl() { | ||
| 574 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-contact/contact/zh/c/master/detailList" | ||
| 575 | + return url | ||
| 576 | + } | ||
| 577 | + | ||
| 559 | 578 | ||
| 560 | //账户注销 | 579 | //账户注销 |
| 561 | static accountLogoutUrl() { | 580 | static accountLogoutUrl() { |
| @@ -756,6 +775,12 @@ export class HttpUrlUtils { | @@ -756,6 +775,12 @@ export class HttpUrlUtils { | ||
| 756 | return url | 775 | return url |
| 757 | } | 776 | } |
| 758 | 777 | ||
| 778 | + //点赞 | ||
| 779 | + static executeLike() { | ||
| 780 | + let url = HttpUrlUtils._hostUrl + "/api/rmrb-interact/interact/zh/c/like/executeLike"; | ||
| 781 | + return url; | ||
| 782 | + } | ||
| 783 | + | ||
| 759 | // static getYcgCommonHeaders(): HashMap<string, string> { | 784 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 760 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 785 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| 761 | // | 786 | // |
| @@ -83,6 +83,8 @@ export class WDRouterPage { | @@ -83,6 +83,8 @@ export class WDRouterPage { | ||
| 83 | static privacySettingPage = new WDRouterPage("wdComponent", "ets/components/page/PrivacySettingPage"); | 83 | static privacySettingPage = new WDRouterPage("wdComponent", "ets/components/page/PrivacySettingPage"); |
| 84 | // 关于页 | 84 | // 关于页 |
| 85 | static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage"); | 85 | static aboutPage = new WDRouterPage("wdComponent", "ets/components/page/SettingAboutPage"); |
| 86 | + // 精选评论页 | ||
| 87 | + static QualityCommentsPage = new WDRouterPage("wdComponent", "ets/components/page/QualityCommentsPage"); | ||
| 86 | // 设置页 | 88 | // 设置页 |
| 87 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); | 89 | static settingPage = new WDRouterPage("wdComponent", "ets/components/page/SettingPage"); |
| 88 | // 设置页 | 90 | // 设置页 |
| @@ -82,7 +82,6 @@ export struct WdWebLocalComponent { | @@ -82,7 +82,6 @@ export struct WdWebLocalComponent { | ||
| 82 | 82 | ||
| 83 | //webview 高度设置 | 83 | //webview 高度设置 |
| 84 | private setCurrentPageOperate: (data: Message) => void = (data) => { | 84 | private setCurrentPageOperate: (data: Message) => void = (data) => { |
| 85 | - console.log("setCurrentPageOperate", JSON.stringify(data)) | ||
| 86 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') { | 85 | if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') { |
| 87 | if (typeof this.webHeight === 'number') { | 86 | if (typeof this.webHeight === 'number') { |
| 88 | if (Number(data?.data?.webViewHeight) > this.webHeight) { | 87 | if (Number(data?.data?.webViewHeight) > this.webHeight) { |
| @@ -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; |
| @@ -20,4 +20,5 @@ export interface Params { | @@ -20,4 +20,5 @@ export interface Params { | ||
| 20 | // 17.多图(图集)详情页 | 20 | // 17.多图(图集)详情页 |
| 21 | detailPageType?: number; // 详情页类型 | 21 | detailPageType?: number; // 详情页类型 |
| 22 | liveStyle?: number; // 直播类型:0横屏,1竖屏 | 22 | liveStyle?: number; // 直播类型:0横屏,1竖屏 |
| 23 | + creatorId?: string; //号主id | ||
| 23 | } | 24 | } |
| @@ -69,3 +69,5 @@ export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" | @@ -69,3 +69,5 @@ export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" | ||
| 69 | 69 | ||
| 70 | export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" | 70 | export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" |
| 71 | 71 | ||
| 72 | +export { WDViewDefaultType } from "./src/main/ets/components/view/EmptyComponent" | ||
| 73 | + |
| @@ -20,6 +20,7 @@ import { CardParser } from './CardParser'; | @@ -20,6 +20,7 @@ import { CardParser } from './CardParser'; | ||
| 20 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; | 20 | import { LiveHorizontalReservationComponent } from './view/LiveHorizontalReservationComponent'; |
| 21 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; | 21 | import { ZhGridLayout02 } from './compview/ZhGridLayout02'; |
| 22 | import { Card5Component } from './cardview/Card5Component' | 22 | import { Card5Component } from './cardview/Card5Component' |
| 23 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | ||
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * comp适配器. | 26 | * comp适配器. |
| @@ -32,8 +33,10 @@ export struct CompParser { | @@ -32,8 +33,10 @@ export struct CompParser { | ||
| 32 | compIndex: number = 0; | 33 | compIndex: number = 0; |
| 33 | 34 | ||
| 34 | build() { | 35 | build() { |
| 36 | + Column() { | ||
| 35 | this.componentBuilder(this.compDTO, this.compIndex); | 37 | this.componentBuilder(this.compDTO, this.compIndex); |
| 36 | } | 38 | } |
| 39 | + } | ||
| 37 | 40 | ||
| 38 | @Builder | 41 | @Builder |
| 39 | componentBuilder(compDTO: CompDTO, compIndex: number) { | 42 | componentBuilder(compDTO: CompDTO, compIndex: number) { |
| @@ -53,8 +56,6 @@ export struct CompParser { | @@ -53,8 +56,6 @@ export struct CompParser { | ||
| 53 | ZhSingleRow02({ compDTO }) | 56 | ZhSingleRow02({ compDTO }) |
| 54 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 57 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 55 | LiveHorizontalReservationComponent({ compDTO: compDTO }) | 58 | LiveHorizontalReservationComponent({ compDTO: compDTO }) |
| 56 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_06) { | ||
| 57 | - ZhSingleRow06({ compDTO }) | ||
| 58 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | 59 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { |
| 59 | ZhGridLayout02({ compDTO: compDTO }) | 60 | ZhGridLayout02({ compDTO: compDTO }) |
| 60 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { | 61 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) { |
| @@ -68,8 +69,6 @@ export struct CompParser { | @@ -68,8 +69,6 @@ export struct CompParser { | ||
| 68 | ZhSingleColumn04({ compDTO: compDTO }) | 69 | ZhSingleColumn04({ compDTO: compDTO }) |
| 69 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { | 70 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_05) { |
| 70 | ZhSingleColumn05({ compDTO: compDTO }) | 71 | ZhSingleColumn05({ compDTO: compDTO }) |
| 71 | - } else if (compDTO.compStyle === CompStyle.Zh_Single_Column_09) { | ||
| 72 | - ZhSingleColumn09({ compDTO: compDTO }) | ||
| 73 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { | 72 | } else if (!Number.isNaN(Number(compDTO.compStyle))) { |
| 74 | CardParser({ contentDTO: compDTO.operDataList[0] }); | 73 | CardParser({ contentDTO: compDTO.operDataList[0] }); |
| 75 | } | 74 | } |
| @@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog'; | @@ -8,6 +8,7 @@ import { ENewspaperCalendarDialog } from '../dialog/ENewspaperCalendarDialog'; | ||
| 8 | import font from '@ohos.font'; | 8 | import font from '@ohos.font'; |
| 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; | 9 | import { ENewspaperPageDialog } from '../dialog/ENewspaperPageDialog'; |
| 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; | 10 | import { RMCalendarBean } from './calendar/RMCalendarBean'; |
| 11 | +import { newsSkeleton } from './skeleton/newsSkeleton'; | ||
| 11 | 12 | ||
| 12 | @Component | 13 | @Component |
| 13 | export struct ENewspaperPageComponent { | 14 | export struct ENewspaperPageComponent { |
| @@ -63,13 +64,15 @@ export struct ENewspaperPageComponent { | @@ -63,13 +64,15 @@ export struct ENewspaperPageComponent { | ||
| 63 | customStyle: true, | 64 | customStyle: true, |
| 64 | }) | 65 | }) |
| 65 | //文字报纸弹框 | 66 | //文字报纸弹框 |
| 66 | - listDialogController: CustomDialogController = new CustomDialogController({ | ||
| 67 | - builder: ENewspaperListDialog({ | ||
| 68 | - newspaperListBean: this.newspaperListBean | ||
| 69 | - }), | ||
| 70 | - alignment: DialogAlignment.Bottom, | ||
| 71 | - offset: { dx: 0, dy: 0 } | ||
| 72 | - }) | 67 | + @State isOpenListDialog: boolean = false |
| 68 | + | ||
| 69 | + // listDialogController: CustomDialogController = new CustomDialogController({ | ||
| 70 | + // builder: ENewspaperListDialog({ | ||
| 71 | + // newspaperListBean: this.newspaperListBean | ||
| 72 | + // }), | ||
| 73 | + // alignment: DialogAlignment.Bottom, | ||
| 74 | + // offset: { dx: 0, dy: 0 } | ||
| 75 | + // }) | ||
| 73 | 76 | ||
| 74 | async aboutToAppear() { | 77 | async aboutToAppear() { |
| 75 | //获取宽高尺寸 | 78 | //获取宽高尺寸 |
| @@ -95,6 +98,7 @@ export struct ENewspaperPageComponent { | @@ -95,6 +98,7 @@ export struct ENewspaperPageComponent { | ||
| 95 | } | 98 | } |
| 96 | 99 | ||
| 97 | build() { | 100 | build() { |
| 101 | + Stack() { | ||
| 98 | RelativeContainer() { | 102 | RelativeContainer() { |
| 99 | RelativeContainer() { | 103 | RelativeContainer() { |
| 100 | Image($r('app.media.icon_arrow_down')) | 104 | Image($r('app.media.icon_arrow_down')) |
| @@ -154,6 +158,18 @@ export struct ENewspaperPageComponent { | @@ -154,6 +158,18 @@ export struct ENewspaperPageComponent { | ||
| 154 | }) | 158 | }) |
| 155 | .id('e_newspaper_top') | 159 | .id('e_newspaper_top') |
| 156 | 160 | ||
| 161 | + if (!this.newspaperListBean || !this.newspaperListBean.list || this.newspaperListBean.list.length == 0) { | ||
| 162 | + newsSkeleton() | ||
| 163 | + .alignRules({ | ||
| 164 | + top: { anchor: "e_newspaper_top", align: VerticalAlign.Bottom }, | ||
| 165 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 166 | + }) | ||
| 167 | + .id('news_skeleton_id') | ||
| 168 | + .width('100%') | ||
| 169 | + .height(px2vp(this.picHeight) + 32) | ||
| 170 | + .margin({ top: 35, left: 10, right: 10 }) | ||
| 171 | + } | ||
| 172 | + | ||
| 157 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { | 173 | if (this.newspaperListBean && this.newspaperListBean.list && this.newspaperListBean.list.length > 0) { |
| 158 | Swiper(this.swiperController) { | 174 | Swiper(this.swiperController) { |
| 159 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { | 175 | ForEach(this.newspaperListBean?.list, (item: NewspaperListItemBean, index: number) => { |
| @@ -266,13 +282,23 @@ export struct ENewspaperPageComponent { | @@ -266,13 +282,23 @@ export struct ENewspaperPageComponent { | ||
| 266 | }) | 282 | }) |
| 267 | .id('e_newspaper_read') | 283 | .id('e_newspaper_read') |
| 268 | .onClick((event: ClickEvent) => { | 284 | .onClick((event: ClickEvent) => { |
| 269 | - this.listDialogController.open() | 285 | + this.isOpenListDialog = true |
| 270 | }) | 286 | }) |
| 271 | } | 287 | } |
| 272 | .width('100%') | 288 | .width('100%') |
| 273 | .height('100%') | 289 | .height('100%') |
| 274 | .backgroundColor($r('app.color.color_80000000')) | 290 | .backgroundColor($r('app.color.color_80000000')) |
| 275 | .id('e_newspaper_container') | 291 | .id('e_newspaper_container') |
| 292 | + | ||
| 293 | + ENewspaperListDialog({ | ||
| 294 | + newspaperListBean: this.newspaperListBean, | ||
| 295 | + closeDialog: () => { | ||
| 296 | + this.isOpenListDialog = false | ||
| 297 | + } | ||
| 298 | + }) | ||
| 299 | + .visibility(this.isOpenListDialog ? Visibility.Visible : Visibility.None) | ||
| 300 | + } | ||
| 301 | + | ||
| 276 | } | 302 | } |
| 277 | 303 | ||
| 278 | private async getNewspaperTime() { | 304 | private async getNewspaperTime() { |
| 1 | -import { Logger, NumberFormatterUtils } from 'wdKit'; | 1 | +import { Logger, NumberFormatterUtils, DateTimeUtils } from 'wdKit'; |
| 2 | import { | 2 | import { |
| 3 | Action, | 3 | Action, |
| 4 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | @@ -14,15 +14,15 @@ import DetailViewModel from '../viewmodel/DetailViewModel'; | ||
| 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | 14 | import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; |
| 15 | import router from '@ohos.router'; | 15 | import router from '@ohos.router'; |
| 16 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 17 | -import { CommonConstants } from 'wdConstant' | 17 | +import { CommonConstants } from 'wdConstant'; |
| 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 18 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 21 | import { PageRepository } from '../repository/PageRepository'; |
| 22 | -import { detailedSkeleton } from './skeleton/detailSkeleton' | 22 | +import { detailedSkeleton } from './skeleton/detailSkeleton'; |
| 23 | +const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | ||
| 23 | 24 | ||
| 24 | const TAG = 'ImageAndTextPageComponent' | 25 | const TAG = 'ImageAndTextPageComponent' |
| 25 | - | ||
| 26 | @Component | 26 | @Component |
| 27 | export struct ImageAndTextPageComponent { | 27 | export struct ImageAndTextPageComponent { |
| 28 | scroller: Scroller = new Scroller(); | 28 | scroller: Scroller = new Scroller(); |
| @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { | @@ -32,7 +32,7 @@ export struct ImageAndTextPageComponent { | ||
| 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | 32 | @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 |
| 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO | 33 | @State interactData: InteractDataDTO = {} as InteractDataDTO |
| 34 | @State isPageEnd: boolean = false | 34 | @State isPageEnd: boolean = false |
| 35 | - | 35 | + @State publishTime: string = '' |
| 36 | build() { | 36 | build() { |
| 37 | Column() { | 37 | Column() { |
| 38 | if (!this.isPageEnd) { | 38 | if (!this.isPageEnd) { |
| @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { | @@ -40,10 +40,10 @@ export struct ImageAndTextPageComponent { | ||
| 40 | } else { | 40 | } else { |
| 41 | // 发布时间 | 41 | // 发布时间 |
| 42 | Row() { | 42 | Row() { |
| 43 | - Image($r('app.media.icon_ren_min_ri_bao')) | ||
| 44 | - .width(70) | 43 | + Image(this.contentDetailData[0]?.rmhInfo ? $r('app.media.logo_rmh') : $r('app.media.logo_rmrb')) |
| 44 | + .width(80) | ||
| 45 | .height(28) | 45 | .height(28) |
| 46 | - Text(this.contentDetailData[0]?.publishTime) | 46 | + Text(this.publishTime) |
| 47 | .fontColor($r('app.color.color_B0B0B0')) | 47 | .fontColor($r('app.color.color_B0B0B0')) |
| 48 | .fontSize($r('app.float.font_size_13')) | 48 | .fontSize($r('app.float.font_size_13')) |
| 49 | .height('100%') | 49 | .height('100%') |
| @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { | @@ -151,6 +151,8 @@ export struct ImageAndTextPageComponent { | ||
| 151 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) | 151 | let detailBeans = await DetailViewModel.getDetailPageData(relId, contentId, relType) |
| 152 | if (detailBeans && detailBeans.length > 0) { | 152 | if (detailBeans && detailBeans.length > 0) { |
| 153 | this.contentDetailData = detailBeans; | 153 | this.contentDetailData = detailBeans; |
| 154 | + let dateTime = DateTimeUtils.parseDate(this.contentDetailData[0]?.publishTime, DateTimeUtils.PATTERN_DATE_TIME_HYPHEN); | ||
| 155 | + this.publishTime = DateTimeUtils.formatDate(dateTime,PATTERN_DATE_CN_RN) | ||
| 154 | if (this.contentDetailData[0]?.recommendShow === 1) { | 156 | if (this.contentDetailData[0]?.recommendShow === 1) { |
| 155 | this.getRecommend() | 157 | this.getRecommend() |
| 156 | } | 158 | } |
| 1 | +import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit'; | ||
| 2 | +import { http } from '@kit.NetworkKit'; | ||
| 3 | +import { BusinessError } from '@kit.BasicServicesKit'; | ||
| 4 | +import { promptAction } from '@kit.ArkUI'; | ||
| 5 | +import { image } from '@kit.ImageKit'; | ||
| 6 | +import { photoAccessHelper } from '@kit.MediaLibraryKit'; | ||
| 7 | +import fs from '@ohos.file.fs'; | ||
| 8 | + | ||
| 9 | +const PERMISSIONS: Array<Permissions> = [ | ||
| 10 | + 'ohos.permission.READ_IMAGEVIDEO', | ||
| 11 | + 'ohos.permission.WRITE_IMAGEVIDEO' | ||
| 12 | +]; | ||
| 13 | + | ||
| 14 | +/* | ||
| 15 | + * saveButton参考文档 | ||
| 16 | + * https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/savebutton-0000001820999677 | ||
| 17 | + * */ | ||
| 18 | +@Component | ||
| 19 | +export struct ImageDownloadComponent { | ||
| 20 | + @State image: PixelMap | undefined = undefined; | ||
| 21 | + @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 | ||
| 22 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 23 | + url: string = '' | ||
| 24 | + | ||
| 25 | + build() { | ||
| 26 | + Column() { | ||
| 27 | + SaveButton({ icon: SaveIconStyle.LINES }) | ||
| 28 | + .iconColor(Color.White) | ||
| 29 | + .onClick(async () => { | ||
| 30 | + console.info(`cj2024 onClick ${this.imageBuffer}`) | ||
| 31 | + if (this.imageBuffer !== undefined) { | ||
| 32 | + await this.saveImage(this.imageBuffer); | ||
| 33 | + promptAction.showToast({ | ||
| 34 | + message: $r('app.string.image_request_success'), | ||
| 35 | + duration: 2000 | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + }) | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + async aboutToAppear(): Promise<void> { | ||
| 44 | + console.info(`cj2024 图片下载 ${this.url}`) | ||
| 45 | + const context = getContext(this) as common.UIAbilityContext; | ||
| 46 | + const atManager = abilityAccessCtrl.createAtManager(); | ||
| 47 | + await atManager.requestPermissionsFromUser(context, PERMISSIONS); | ||
| 48 | + this.getPicture(); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 通过http的request方法从网络下载图片资源 | ||
| 53 | + */ | ||
| 54 | + async getPicture() { | ||
| 55 | + console.info(`cj2024 getPicture`) | ||
| 56 | + http.createHttp() | ||
| 57 | + .request(this.url, | ||
| 58 | + (error: BusinessError, data: http.HttpResponse) => { | ||
| 59 | + if (error) { | ||
| 60 | + // 下载失败时弹窗提示检查网络,不执行后续逻辑 | ||
| 61 | + promptAction.showToast({ | ||
| 62 | + message: $r('app.string.image_request_fail'), | ||
| 63 | + duration: 2000 | ||
| 64 | + }) | ||
| 65 | + return; | ||
| 66 | + } | ||
| 67 | + this.transcodePixelMap(data); | ||
| 68 | + // 判断网络获取到的资源是否为ArrayBuffer类型 | ||
| 69 | + console.info(`cj2024 getPicture ${data.result}`) | ||
| 70 | + if (data.result instanceof ArrayBuffer) { | ||
| 71 | + console.info(`cj2024 getPicture 222`) | ||
| 72 | + this.imageBuffer = data.result as ArrayBuffer; | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + ) | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + /** | ||
| 79 | + * 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型 | ||
| 80 | + * @param data:网络获取到的资源 | ||
| 81 | + */ | ||
| 82 | + transcodePixelMap(data: http.HttpResponse) { | ||
| 83 | + console.info(`cj2024 transcodePixelMap ${data.responseCode}`) | ||
| 84 | + if (http.ResponseCode.OK === data.responseCode) { | ||
| 85 | + const imageData: ArrayBuffer = data.result as ArrayBuffer; | ||
| 86 | + // 通过ArrayBuffer创建图片源实例。 | ||
| 87 | + const imageSource: image.ImageSource = image.createImageSource(imageData); | ||
| 88 | + const options: image.InitializationOptions = { | ||
| 89 | + 'alphaType': 0, // 透明度 | ||
| 90 | + 'editable': false, // 是否可编辑 | ||
| 91 | + 'pixelFormat': 3, // 像素格式 | ||
| 92 | + 'scaleMode': 1, // 缩略值 | ||
| 93 | + 'size': { height: 100, width: 100 } | ||
| 94 | + }; // 创建图片大小 | ||
| 95 | + | ||
| 96 | + // 通过属性创建PixelMap | ||
| 97 | + imageSource.createPixelMap(options).then((pixelMap: PixelMap) => { | ||
| 98 | + this.image = pixelMap; | ||
| 99 | + }); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + /** | ||
| 104 | + * 保存ArrayBuffer到图库 | ||
| 105 | + * @param buffer:图片ArrayBuffer | ||
| 106 | + * @returns | ||
| 107 | + */ | ||
| 108 | + async saveImage(buffer: ArrayBuffer | string): Promise<void> { | ||
| 109 | + console.info(`cj2024 saveImage buffer ${buffer}`) | ||
| 110 | + const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context | ||
| 111 | + const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例 | ||
| 112 | + const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源 | ||
| 113 | + console.info(`cj2024 saveImage uri ${uri}`) | ||
| 114 | + const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); | ||
| 115 | + await fs.write(file.fd, buffer); | ||
| 116 | + await fs.close(file.fd); | ||
| 117 | + } | ||
| 118 | +} |
| 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 } from '@kit.ArkUI'; | 3 | +import { display, router } from '@kit.ArkUI'; |
| 4 | +import { ImageDownloadComponent } from './ImageDownloadComponent'; | ||
| 5 | +import { ImageItemView } from './view/ImageItemView'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'ImageSwiperComponent'; | 7 | const TAG = 'ImageSwiperComponent'; |
| 7 | 8 | ||
| @@ -16,6 +17,9 @@ export struct ImageSwiperComponent { | @@ -16,6 +17,9 @@ export struct ImageSwiperComponent { | ||
| 16 | private screenWidth: number = 0 | 17 | private screenWidth: number = 0 |
| 17 | private picWidth: number = 0 | 18 | private picWidth: number = 0 |
| 18 | @State picHeight: number = 0 | 19 | @State picHeight: number = 0 |
| 20 | + @State isEnableSwipe: boolean = true; | ||
| 21 | + | ||
| 22 | + // @Provide bgc: Color = Color.White; | ||
| 19 | 23 | ||
| 20 | //watch监听页码回调 | 24 | //watch监听页码回调 |
| 21 | onCurrentPageNumUpdated(): void { | 25 | onCurrentPageNumUpdated(): void { |
| @@ -35,10 +39,25 @@ export struct ImageSwiperComponent { | @@ -35,10 +39,25 @@ export struct ImageSwiperComponent { | ||
| 35 | 39 | ||
| 36 | build() { | 40 | build() { |
| 37 | RelativeContainer() { | 41 | RelativeContainer() { |
| 42 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 43 | + .width(24) | ||
| 44 | + .height(24) | ||
| 45 | + .aspectRatio(1) | ||
| 46 | + .interpolation(ImageInterpolation.High) | ||
| 47 | + .alignRules({ | ||
| 48 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 49 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 50 | + }) | ||
| 51 | + .onClick(() => { | ||
| 52 | + router.back(); | ||
| 53 | + }) | ||
| 54 | + .id("backImg") | ||
| 55 | + | ||
| 38 | if (this.photoList && this.photoList?.length > 0) { | 56 | if (this.photoList && this.photoList?.length > 0) { |
| 39 | Swiper(this.swiperController) { | 57 | Swiper(this.swiperController) { |
| 40 | ForEach(this.photoList, (item: PhotoListBean) => { | 58 | ForEach(this.photoList, (item: PhotoListBean) => { |
| 41 | - MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) | 59 | + // MultiPictureDetailItemComponent({ MultiPictureDetailItem: item }) |
| 60 | + ImageItemView({ MultiPictureDetailItem: item, isEnableSwipe: this.isEnableSwipe }) | ||
| 42 | }) | 61 | }) |
| 43 | } | 62 | } |
| 44 | .index(this.swiperIndex) | 63 | .index(this.swiperIndex) |
| @@ -96,6 +115,19 @@ export struct ImageSwiperComponent { | @@ -96,6 +115,19 @@ export struct ImageSwiperComponent { | ||
| 96 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 115 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 97 | }) | 116 | }) |
| 98 | } | 117 | } |
| 118 | + | ||
| 119 | + ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | ||
| 120 | + .alignRules({ | ||
| 121 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 122 | + right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 123 | + }) | ||
| 124 | + .margin({ | ||
| 125 | + top: 8, | ||
| 126 | + left: 18, | ||
| 127 | + bottom: 24, | ||
| 128 | + right: 18 | ||
| 129 | + }) | ||
| 130 | + .id("downloadImg") | ||
| 99 | } | 131 | } |
| 100 | .width('100%') | 132 | .width('100%') |
| 101 | .height('100%') | 133 | .height('100%') |
| 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 { | 3 | import { |
| 3 | ContentDetailDTO, | 4 | ContentDetailDTO, |
| 4 | PhotoListBean, | 5 | PhotoListBean, |
| @@ -11,10 +12,12 @@ import display from '@ohos.display'; | @@ -11,10 +12,12 @@ import display from '@ohos.display'; | ||
| 11 | import font from '@ohos.font'; | 12 | import font from '@ohos.font'; |
| 12 | import { OperRowListView } from './view/OperRowListView'; | 13 | import { OperRowListView } from './view/OperRowListView'; |
| 13 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; | 14 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; |
| 15 | +import { EmptyComponent } from './view/EmptyComponent'; | ||
| 14 | import { DateTimeUtils } from 'wdKit/Index'; | 16 | import { DateTimeUtils } from 'wdKit/Index'; |
| 15 | import { HttpUrlUtils } from 'wdNetwork/Index'; | 17 | import { HttpUrlUtils } from 'wdNetwork/Index'; |
| 16 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 17 | import { PageRepository } from '../repository/PageRepository'; | 19 | import { PageRepository } from '../repository/PageRepository'; |
| 20 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 18 | 21 | ||
| 19 | const TAG = 'MultiPictureDetailPageComponent'; | 22 | const TAG = 'MultiPictureDetailPageComponent'; |
| 20 | 23 | ||
| @@ -34,6 +37,7 @@ export struct MultiPictureDetailPageComponent { | @@ -34,6 +37,7 @@ export struct MultiPictureDetailPageComponent { | ||
| 34 | @State swiperIndex: number = 0; | 37 | @State swiperIndex: number = 0; |
| 35 | @Provide followStatus: string = '0' // 关注状态 | 38 | @Provide followStatus: string = '0' // 关注状态 |
| 36 | private scroller: Scroller = new Scroller() | 39 | private scroller: Scroller = new Scroller() |
| 40 | + @State netStatus: number | undefined = undefined // 存储网络状态用来展示缺省图 | ||
| 37 | 41 | ||
| 38 | //watch监听页码回调 | 42 | //watch监听页码回调 |
| 39 | onCurrentPageNumUpdated(): void { | 43 | onCurrentPageNumUpdated(): void { |
| @@ -56,10 +60,6 @@ export struct MultiPictureDetailPageComponent { | @@ -56,10 +60,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 56 | familySrc: $rawfile('font/BebasNeue_Regular.otf') | 60 | familySrc: $rawfile('font/BebasNeue_Regular.otf') |
| 57 | }) | 61 | }) |
| 58 | this.getContentDetailData() | 62 | this.getContentDetailData() |
| 59 | - if (HttpUrlUtils.getUserId()) { | ||
| 60 | - this.getInteractBrowsOperate() | ||
| 61 | - this.getBatchAttentionStatus() | ||
| 62 | - } | ||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | aboutToDisappear() { | 65 | aboutToDisappear() { |
| @@ -238,6 +238,16 @@ export struct MultiPictureDetailPageComponent { | @@ -238,6 +238,16 @@ export struct MultiPictureDetailPageComponent { | ||
| 238 | }) | 238 | }) |
| 239 | .height(px2vp(this.titleHeight) + 64) | 239 | .height(px2vp(this.titleHeight) + 64) |
| 240 | 240 | ||
| 241 | + } else { | ||
| 242 | + if(this.netStatus !== undefined) { | ||
| 243 | + EmptyComponent({ emptyType: this.netStatus}) | ||
| 244 | + .id('e_empty_content') | ||
| 245 | + .alignRules({ | ||
| 246 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 247 | + middle: { anchor: "__container__", align: HorizontalAlign.Center } | ||
| 248 | + }) | ||
| 249 | + } | ||
| 250 | + } | ||
| 241 | OperRowListView({ | 251 | OperRowListView({ |
| 242 | contentDetailData: this.contentDetailData, | 252 | contentDetailData: this.contentDetailData, |
| 243 | }) | 253 | }) |
| @@ -256,7 +266,6 @@ export struct MultiPictureDetailPageComponent { | @@ -256,7 +266,6 @@ export struct MultiPictureDetailPageComponent { | ||
| 256 | .border({ width: { top: 0.5 }, color: '#FFFFFF' }) | 266 | .border({ width: { top: 0.5 }, color: '#FFFFFF' }) |
| 257 | .id('e_oper_row') | 267 | .id('e_oper_row') |
| 258 | } | 268 | } |
| 259 | - } | ||
| 260 | .width('100%') | 269 | .width('100%') |
| 261 | .height('100%') | 270 | .height('100%') |
| 262 | .backgroundColor(Color.Black) | 271 | .backgroundColor(Color.Black) |
| @@ -266,11 +275,44 @@ export struct MultiPictureDetailPageComponent { | @@ -266,11 +275,44 @@ export struct MultiPictureDetailPageComponent { | ||
| 266 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 275 | .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) |
| 267 | } | 276 | } |
| 268 | 277 | ||
| 269 | - private async getContentDetailData() { | 278 | + private getContentDetailData() { |
| 270 | try { | 279 | try { |
| 271 | - let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | ||
| 272 | - this.contentDetailData = data?.[0]; | 280 | + PageRepository.fetchDetailData(this.relId, this.contentId, this.relType).then((resDTO: ResponseDTO<ContentDetailDTO[]>) => { |
| 281 | + // Logger.info(TAG, `fetchDetailData then,navResDTO.timestamp ${resDTO.timestamp}`); | ||
| 282 | + // Logger.info(TAG, `fetchDetailData then,navResDTO: ${JSON.stringify(resDTO)}`); | ||
| 283 | + // Logger.info(TAG, `fetchDetailData then,navResDTO.data: ${JSON.stringify(resDTO.data)}`); | ||
| 284 | + if (!resDTO || !resDTO.data) { | ||
| 285 | + Logger.error(TAG, 'fetchDetailData is empty'); | ||
| 286 | + return | ||
| 287 | + } | ||
| 288 | + if (resDTO.code != 0) { | ||
| 289 | + Logger.error(TAG, `fetchDetailData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 290 | + return | ||
| 291 | + } | ||
| 292 | + this.contentDetailData = resDTO.data?.[0]; | ||
| 293 | + if(this.contentDetailData?.photoList && this.contentDetailData?.photoList?.length === 0) { | ||
| 294 | + this.netStatus = 0 | ||
| 295 | + } | ||
| 273 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) | 296 | Logger.info(TAG, `contentDetailData:${JSON.stringify(this.contentDetailData)}`) |
| 297 | + if (HttpUrlUtils.getUserId()) { | ||
| 298 | + this.getInteractBrowsOperate() | ||
| 299 | + this.getBatchAttentionStatus() | ||
| 300 | + } | ||
| 301 | + }).catch((err: Error) => { | ||
| 302 | + Logger.info(TAG, `fetchDetailData then,err: ${JSON.stringify(err)}`); | ||
| 303 | + /*// 请求失败处理 | ||
| 304 | + if (err.response) { | ||
| 305 | + // 请求已发出,但服务器响应的状态码不在2xx范围内 | ||
| 306 | + console.error('请求失败,状态码:', err.response.status); | ||
| 307 | + console.error('响应数据:', err.response.data); | ||
| 308 | + } else if (err.request) { | ||
| 309 | + // 请求已发出,但无响应(例如:网络故障) | ||
| 310 | + console.error('请求已发出,但无响应:', err.request); | ||
| 311 | + } else { | ||
| 312 | + // 发生了其他类型的错误(如配置错误或拒绝权限等) | ||
| 313 | + console.error('请求发生错误:', err.message); | ||
| 314 | + }*/ | ||
| 315 | + }) | ||
| 274 | } catch (exception) { | 316 | } catch (exception) { |
| 275 | 317 | ||
| 276 | } | 318 | } |
| @@ -312,9 +354,10 @@ export struct MultiPictureDetailPageComponent { | @@ -312,9 +354,10 @@ export struct MultiPictureDetailPageComponent { | ||
| 312 | /** | 354 | /** |
| 313 | * 关注号主 | 355 | * 关注号主 |
| 314 | */ | 356 | */ |
| 315 | - handleAccention() { | 357 | + async handleAccention() { |
| 316 | // 未登录,跳转登录 | 358 | // 未登录,跳转登录 |
| 317 | - if (!HttpUrlUtils.getUserId()) { | 359 | + const user_id = await SPHelper.default.get(SpConstants.USER_ID, '') |
| 360 | + if (!user_id) { | ||
| 318 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 361 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 319 | return | 362 | return |
| 320 | } | 363 | } |
| @@ -33,9 +33,17 @@ export class commentListModel extends PageModel{ | @@ -33,9 +33,17 @@ export class commentListModel extends PageModel{ | ||
| 33 | totalCount: number = 0 | 33 | totalCount: number = 0 |
| 34 | hasNext: number = 0 | 34 | hasNext: number = 0 |
| 35 | list: commentItemModel[] = [] | 35 | list: commentItemModel[] = [] |
| 36 | +} | ||
| 36 | 37 | ||
| 38 | +export class commentStatusListModel extends PageModel{ | ||
| 39 | + pageNum: number = 0 | ||
| 40 | + pageSize: number = 0 | ||
| 41 | + totalCount: number = 0 | ||
| 42 | + hasNext: number = 0 | ||
| 43 | + list: commentStatusModel[] = [] | ||
| 37 | } | 44 | } |
| 38 | 45 | ||
| 46 | + | ||
| 39 | @Observed | 47 | @Observed |
| 40 | export class commentItemModel { | 48 | export class commentItemModel { |
| 41 | authorLike: string = '' | 49 | authorLike: string = '' |
| @@ -94,9 +102,17 @@ export class commentItemModel { | @@ -94,9 +102,17 @@ export class commentItemModel { | ||
| 94 | targetType:string = ''; | 102 | targetType:string = ''; |
| 95 | visitorComment:string = ''; | 103 | visitorComment:string = ''; |
| 96 | shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel; | 104 | shareInfo:commentItemShareInfoModel = new commentItemShareInfoModel; |
| 97 | - // targetId:string = ''; | ||
| 98 | - // targetId:string = ''; | ||
| 99 | - // targetId:string = ''; | 105 | + |
| 106 | + api_commentId:string = ''; | ||
| 107 | + api_status:string = ''; | ||
| 108 | + | ||
| 109 | + api_level:string = ''; | ||
| 110 | + api_levelHead:string = 'http'; | ||
| 111 | + api_userId:string = ''; | ||
| 112 | + | ||
| 113 | + api_creatorId:string = ''; | ||
| 114 | + api_userType:string = ''; | ||
| 115 | + api_authIcon:string = ''; | ||
| 100 | 116 | ||
| 101 | } | 117 | } |
| 102 | 118 | ||
| @@ -106,3 +122,18 @@ export class commentItemShareInfoModel { | @@ -106,3 +122,18 @@ export class commentItemShareInfoModel { | ||
| 106 | shareTitle: string = '' | 122 | shareTitle: string = '' |
| 107 | shareUrl: string = '' | 123 | shareUrl: string = '' |
| 108 | } | 124 | } |
| 125 | + | ||
| 126 | +export class commentStatusModel { | ||
| 127 | + commentId:string = ''; | ||
| 128 | + status:string = ''; | ||
| 129 | + | ||
| 130 | + level:string = ''; | ||
| 131 | + levelHead:string = ''; | ||
| 132 | + userId:string = ''; | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + creatorId:string = ''; | ||
| 136 | + userType:string = ''; | ||
| 137 | + authIcon:string = ''; | ||
| 138 | + | ||
| 139 | +} |
| @@ -6,6 +6,13 @@ import { commentItemModel, commentListModel, WDPublicUserType } from '../model/C | @@ -6,6 +6,13 @@ import { commentItemModel, commentListModel, WDPublicUserType } from '../model/C | ||
| 6 | import commentViewModel from '../viewmodel/CommentViewModel' | 6 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 7 | import { CommentText } from './CommentText'; | 7 | import { CommentText } from './CommentText'; |
| 8 | import measure from '@ohos.measure' | 8 | import measure from '@ohos.measure' |
| 9 | +import {CommentCustomDialog} from './CommentCustomDialog' | ||
| 10 | + | ||
| 11 | +const TAG = 'CommentComponent'; | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 9 | 16 | ||
| 10 | @Entry | 17 | @Entry |
| 11 | @Preview | 18 | @Preview |
| @@ -13,10 +20,19 @@ import measure from '@ohos.measure' | @@ -13,10 +20,19 @@ import measure from '@ohos.measure' | ||
| 13 | export struct CommentComponent { | 20 | export struct CommentComponent { |
| 14 | @State private browSingModel: commentListModel = new commentListModel() | 21 | @State private browSingModel: commentListModel = new commentListModel() |
| 15 | isloading: boolean = false | 22 | isloading: boolean = false |
| 16 | - // @State allDatas :commentItemModel[] = []; | ||
| 17 | - | ||
| 18 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 23 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 19 | 24 | ||
| 25 | + dialogController: CustomDialogController = new CustomDialogController({ | ||
| 26 | + builder: CommentCustomDialog(), | ||
| 27 | + autoCancel: true, | ||
| 28 | + alignment: DialogAlignment.Bottom, | ||
| 29 | + customStyle: true, | ||
| 30 | + offset: { | ||
| 31 | + dx: 0, | ||
| 32 | + dy: -20 | ||
| 33 | + } | ||
| 34 | + }) | ||
| 35 | + | ||
| 20 | aboutToAppear() { | 36 | aboutToAppear() { |
| 21 | this.getData(); | 37 | this.getData(); |
| 22 | this.getData(); | 38 | this.getData(); |
| @@ -59,7 +75,7 @@ export struct CommentComponent { | @@ -59,7 +75,7 @@ export struct CommentComponent { | ||
| 59 | .height('32') | 75 | .height('32') |
| 60 | .objectFit(ImageFit.Cover) | 76 | .objectFit(ImageFit.Cover) |
| 61 | .borderRadius(16) | 77 | .borderRadius(16) |
| 62 | - Image($r('app.media.icon_border_test')) | 78 | + Image(item.api_levelHead) |
| 63 | .width('48') | 79 | .width('48') |
| 64 | .height('48') | 80 | .height('48') |
| 65 | .objectFit(ImageFit.Cover) | 81 | .objectFit(ImageFit.Cover) |
| @@ -167,7 +183,6 @@ export struct CommentComponent { | @@ -167,7 +183,6 @@ export struct CommentComponent { | ||
| 167 | // ///1天~2天:1天前 | 183 | // ///1天~2天:1天前 |
| 168 | // ///2天~:日期隐藏 | 184 | // ///2天~:日期隐藏 |
| 169 | 185 | ||
| 170 | - | ||
| 171 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime))) | 186 | Text(DateTimeUtils.getCommentTime(Number.parseFloat(item.createTime))) |
| 172 | .fontColor($r('app.color.color_B0B0B0')) | 187 | .fontColor($r('app.color.color_B0B0B0')) |
| 173 | .fontSize(12) | 188 | .fontSize(12) |
| @@ -212,6 +227,10 @@ export struct CommentComponent { | @@ -212,6 +227,10 @@ export struct CommentComponent { | ||
| 212 | 227 | ||
| 213 | List() { | 228 | List() { |
| 214 | ListItemGroup({ header: this.titleHeader() }) | 229 | ListItemGroup({ header: this.titleHeader() }) |
| 230 | + .onClick(()=>{ | ||
| 231 | + console.log(TAG) | ||
| 232 | + this.dialogController.open() | ||
| 233 | + }) | ||
| 215 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 234 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| 216 | if (item.hasMore) { | 235 | if (item.hasMore) { |
| 217 | ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) { | 236 | ListItemGroup({ header: this.CommentHeaderItem(item), footer: this.GroupFooterView(item) }) { |
| @@ -219,6 +238,9 @@ export struct CommentComponent { | @@ -219,6 +238,9 @@ export struct CommentComponent { | ||
| 219 | ListItem() { | 238 | ListItem() { |
| 220 | ChildCommentItem(); | 239 | ChildCommentItem(); |
| 221 | } | 240 | } |
| 241 | + .onClick(()=>{ | ||
| 242 | + console.log(TAG) | ||
| 243 | + }) | ||
| 222 | }) | 244 | }) |
| 223 | } | 245 | } |
| 224 | }else { | 246 | }else { |
| @@ -227,6 +249,9 @@ export struct CommentComponent { | @@ -227,6 +249,9 @@ export struct CommentComponent { | ||
| 227 | ListItem() { | 249 | ListItem() { |
| 228 | ChildCommentItem(); | 250 | ChildCommentItem(); |
| 229 | } | 251 | } |
| 252 | + .onClick(()=>{ | ||
| 253 | + console.log(TAG) | ||
| 254 | + }) | ||
| 230 | }) | 255 | }) |
| 231 | } | 256 | } |
| 232 | } | 257 | } |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentCustomDialog.ets
0 → 100644
| 1 | +@Preview | ||
| 2 | +@CustomDialog | ||
| 3 | +export struct CommentCustomDialog { | ||
| 4 | + controller: CustomDialogController = new CustomDialogController({ | ||
| 5 | + builder: CommentCustomDialog(), | ||
| 6 | + autoCancel: true, | ||
| 7 | + alignment: DialogAlignment.Bottom, | ||
| 8 | + customStyle: true, | ||
| 9 | + }) | ||
| 10 | + | ||
| 11 | + build() { | ||
| 12 | + Column() { | ||
| 13 | + Row() { | ||
| 14 | + TextArea({ placeholder: '优质评论会获得最佳评论人的称号' }) | ||
| 15 | + .height('100%') | ||
| 16 | + .width('100%') | ||
| 17 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 18 | + } | ||
| 19 | + .backgroundColor('#F9F9F9') | ||
| 20 | + // .width('100%') | ||
| 21 | + .margin({ top: 12,right: 12, left: 12, bottom: 10 }) | ||
| 22 | + .height(80) | ||
| 23 | + .borderRadius(4) | ||
| 24 | + | ||
| 25 | + Row(){ | ||
| 26 | + Row() { | ||
| 27 | + Row({ space: 12 }) { | ||
| 28 | + //语音暂时不做,隐藏 | ||
| 29 | + // Image($r('app.media.WDInput_voice')).width(30).height(30) | ||
| 30 | + | ||
| 31 | + Image($r('app.media.WDInput_keyboardImage')).width(30).height(30) | ||
| 32 | + } | ||
| 33 | + // Blank() | ||
| 34 | + | ||
| 35 | + Row() { | ||
| 36 | + Text('发布') | ||
| 37 | + .backgroundColor('#F89381') | ||
| 38 | + .width(80) | ||
| 39 | + .height(30) | ||
| 40 | + .fontSize(15) | ||
| 41 | + .fontColor(Color.White) | ||
| 42 | + .textAlign(TextAlign.Center) | ||
| 43 | + .borderRadius(4) | ||
| 44 | + } | ||
| 45 | + }.justifyContent(FlexAlign.SpaceBetween) | ||
| 46 | + .width('100%') | ||
| 47 | + .height(60) | ||
| 48 | + // .margin({ right: 12, left: 12 }) | ||
| 49 | + // .backgroundColor(Color.Red) | ||
| 50 | + }.padding({left:12, right:12}) | ||
| 51 | + }.backgroundColor(Color.White) | ||
| 52 | + .width('100%') | ||
| 53 | + .offset({ | ||
| 54 | + y: 20 | ||
| 55 | + }) | ||
| 56 | + } | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + |
| @@ -11,7 +11,7 @@ export struct LiveCommentComponent { | @@ -11,7 +11,7 @@ export struct LiveCommentComponent { | ||
| 11 | 11 | ||
| 12 | build() { | 12 | build() { |
| 13 | Row() { | 13 | Row() { |
| 14 | - Image($r('app.media.back_icon')) | 14 | + Image($r('app.media.iv_back_left_black')) |
| 15 | .width(24) | 15 | .width(24) |
| 16 | .height(24) | 16 | .height(24) |
| 17 | .margin({ | 17 | .margin({ |
| @@ -71,7 +71,7 @@ export struct LiveCommentComponent { | @@ -71,7 +71,7 @@ export struct LiveCommentComponent { | ||
| 71 | left: 6, | 71 | left: 6, |
| 72 | right: 2 | 72 | right: 2 |
| 73 | }) | 73 | }) |
| 74 | - Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal')) | 74 | + Image(this.isLike ? $r('app.media.icon_like_selected_redheart') : $r('app.media.iv_live_heart_normal')) |
| 75 | .width(24) | 75 | .width(24) |
| 76 | .height(24) | 76 | .height(24) |
| 77 | .margin({ | 77 | .margin({ |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/QualityCommentsComponent.ets
| @@ -2,7 +2,8 @@ import { ViewType } from 'wdConstant/Index' | @@ -2,7 +2,8 @@ import { ViewType } from 'wdConstant/Index' | ||
| 2 | import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index' | 2 | import { DateTimeUtils, LazyDataSource, WindowModel } from 'wdKit/Index' |
| 3 | import { commentItemModel, commentListModel } from '../model/CommentModel' | 3 | import { commentItemModel, commentListModel } from '../model/CommentModel' |
| 4 | import commentViewModel from '../viewmodel/CommentViewModel' | 4 | import commentViewModel from '../viewmodel/CommentViewModel' |
| 5 | -import { window } from '@kit.ArkUI' | 5 | +import { router, window } from '@kit.ArkUI' |
| 6 | +import { CustomTitleUI } from '../../reusable/CustomTitleUI' | ||
| 6 | 7 | ||
| 7 | const TAG = 'QualityCommentsComponent'; | 8 | const TAG = 'QualityCommentsComponent'; |
| 8 | 9 | ||
| @@ -10,11 +11,14 @@ const TAG = 'QualityCommentsComponent'; | @@ -10,11 +11,14 @@ const TAG = 'QualityCommentsComponent'; | ||
| 10 | @Preview | 11 | @Preview |
| 11 | @Component | 12 | @Component |
| 12 | export struct QualityCommentsComponent { | 13 | export struct QualityCommentsComponent { |
| 14 | + @State tileOpacity: number = 0; | ||
| 15 | + firstPositionY: number = 0; | ||
| 13 | bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; | 16 | bottomSafeHeight: string = AppStorage.get<number>('bottomSafeHeight') + 'px'; |
| 17 | + topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; | ||
| 14 | @State private browSingModel: commentListModel = new commentListModel() | 18 | @State private browSingModel: commentListModel = new commentListModel() |
| 15 | isloading: boolean = false | 19 | isloading: boolean = false |
| 16 | - lastWindowColor:string = '#ffffff' | ||
| 17 | - currentWindowColor:string = '#FF4202' | 20 | + lastWindowColor: string = '#ffffff' |
| 21 | + currentWindowColor: string = '#FF4202' | ||
| 18 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); | 22 | @State allDatas: LazyDataSource<commentItemModel> = new LazyDataSource(); |
| 19 | 23 | ||
| 20 | aboutToDisappear(): void { | 24 | aboutToDisappear(): void { |
| @@ -32,25 +36,25 @@ export struct QualityCommentsComponent { | @@ -32,25 +36,25 @@ export struct QualityCommentsComponent { | ||
| 32 | this.fullScreen(); | 36 | this.fullScreen(); |
| 33 | 37 | ||
| 34 | 38 | ||
| 35 | - commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => { | ||
| 36 | - this.allDatas.push(...commentListModel.list) | ||
| 37 | - }) | ||
| 38 | - | ||
| 39 | - // commentViewModel.fetchQualityCommentList('1').then((commentListModel) => { | ||
| 40 | - // if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | ||
| 41 | - // // commentListModel.hasMore = true; | ||
| 42 | - // // this.browSingModel.viewType = ViewType.LOADED; | 39 | + // commentViewModel.fetchQualityCommentListLocal(getContext()).then(commentListModel => { |
| 43 | // this.allDatas.push(...commentListModel.list) | 40 | // this.allDatas.push(...commentListModel.list) |
| 44 | - // // if (commentListModel.list.length === this.browSingModel.pageSize) { | ||
| 45 | - // // this.browSingModel.currentPage++; | ||
| 46 | - // // this.browSingModel.hasMore = true; | ||
| 47 | - // // } else { | ||
| 48 | - // // this.browSingModel.hasMore = false; | ||
| 49 | - // // } | 41 | + // }) |
| 42 | + | ||
| 43 | + commentViewModel.fetchQualityCommentList('1').then((commentListModel) => { | ||
| 44 | + if (commentListModel && commentListModel.list && commentListModel.list.length > 0) { | ||
| 45 | + // commentListModel.hasMore = true; | ||
| 46 | + // this.browSingModel.viewType = ViewType.LOADED; | ||
| 47 | + this.allDatas.push(...commentListModel.list) | ||
| 48 | + // if (commentListModel.list.length === this.browSingModel.pageSize) { | ||
| 49 | + // this.browSingModel.currentPage++; | ||
| 50 | + // this.browSingModel.hasMore = true; | ||
| 50 | // } else { | 51 | // } else { |
| 51 | - // this.browSingModel.viewType = ViewType.EMPTY; | 52 | + // this.browSingModel.hasMore = false; |
| 52 | // } | 53 | // } |
| 53 | - // }) | 54 | + } else { |
| 55 | + this.browSingModel.viewType = ViewType.EMPTY; | ||
| 56 | + } | ||
| 57 | + }) | ||
| 54 | } | 58 | } |
| 55 | 59 | ||
| 56 | fullScreen() { | 60 | fullScreen() { |
| @@ -69,30 +73,143 @@ export struct QualityCommentsComponent { | @@ -69,30 +73,143 @@ export struct QualityCommentsComponent { | ||
| 69 | @Builder | 73 | @Builder |
| 70 | titleHeader() { | 74 | titleHeader() { |
| 71 | Row() { | 75 | Row() { |
| 72 | - Image($r('app.media.comment_img_banner')).width('100%').aspectRatio(375 / 283); | 76 | + Image($r('app.media.comment_img_banner')).width('100%') |
| 77 | + .height(283) | ||
| 78 | + // .aspectRatio(375 / 283); | ||
| 79 | + } | ||
| 80 | + .onAreaChange((oldValue: Area, newValue: Area) => { | ||
| 81 | + | ||
| 82 | + let persent = Math.abs(Number(newValue.globalPosition.y)) / 150 | ||
| 83 | + if (persent > 1) { | ||
| 84 | + persent = 1 | ||
| 85 | + } | ||
| 86 | + this.tileOpacity = persent | ||
| 87 | + | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + /*透明导航栏*/ | ||
| 92 | + @Builder | ||
| 93 | + TabbarTransparent() { | ||
| 94 | + RelativeContainer() { | ||
| 95 | + //标题栏目 | ||
| 96 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 97 | + .width(24) | ||
| 98 | + .height(24) | ||
| 99 | + .objectFit(ImageFit.Auto) | ||
| 100 | + .id("back_icon") | ||
| 101 | + .alignRules({ | ||
| 102 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 103 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 104 | + }) | ||
| 105 | + .offset({ | ||
| 106 | + y: (this.topSafeHeight / 2) + 'px' | ||
| 107 | + }) | ||
| 108 | + .margin({ left: 16 }) | ||
| 109 | + .onClick(() => { | ||
| 110 | + router.back() | ||
| 111 | + }) | ||
| 73 | } | 112 | } |
| 113 | + .visibility(this.tileOpacity > 0 ? 1 : 0) | ||
| 114 | + .height(this.topSafeHeight + vp2px(44) + 'px') | ||
| 115 | + .width('100%') | ||
| 116 | + .backgroundColor($r('app.color.color_transparent')) | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /*导航栏*/ | ||
| 120 | + @Builder | ||
| 121 | + TabbarNormal() { | ||
| 122 | + RelativeContainer() { | ||
| 123 | + //标题栏目 | ||
| 124 | + Image($r('app.media.icon_arrow_left')) | ||
| 125 | + .width(24) | ||
| 126 | + .height(24) | ||
| 127 | + .objectFit(ImageFit.Auto) | ||
| 128 | + .id("back_icon") | ||
| 129 | + .alignRules({ | ||
| 130 | + center: { anchor: "__container__", align: VerticalAlign.Center }, | ||
| 131 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 132 | + }) | ||
| 133 | + .offset({ | ||
| 134 | + y: (this.topSafeHeight / 2) + 'px' | ||
| 135 | + }) | ||
| 136 | + .margin({ left: 16 }) | ||
| 137 | + .onClick(() => { | ||
| 138 | + router.back() | ||
| 139 | + }) | ||
| 140 | + | ||
| 141 | + Text('精选评论') | ||
| 142 | + // .height('42lpx') | ||
| 143 | + .maxLines(1) | ||
| 144 | + .id("title") | ||
| 145 | + .fontSize('35lpx') | ||
| 146 | + .fontWeight(400) | ||
| 147 | + .fontColor($r('app.color.color_222222')) | ||
| 148 | + .lineHeight('42lpx') | ||
| 149 | + .alignRules({ | ||
| 150 | + center: {anchor: "__container__", align: VerticalAlign.Center}, | ||
| 151 | + middle: {anchor: "__container__", align: HorizontalAlign.Center} | ||
| 152 | + }) | ||
| 153 | + .offset({ | ||
| 154 | + y: (this.topSafeHeight / 2) + 'px' | ||
| 155 | + }) | ||
| 156 | + } | ||
| 157 | + .visibility(this.tileOpacity > 0 ? 0 : 1) | ||
| 158 | + .opacity(this.tileOpacity) | ||
| 159 | + .height(this.topSafeHeight + vp2px(44) + 'px') | ||
| 160 | + .width('100%') | ||
| 161 | + .backgroundColor($r('app.color.white')) | ||
| 74 | } | 162 | } |
| 75 | 163 | ||
| 76 | build() { | 164 | build() { |
| 77 | Column() { | 165 | Column() { |
| 78 | - // this.titleHeader() | ||
| 79 | - List({ space: 28 }) { | ||
| 80 | - ListItemGroup({ header: this.titleHeader() }) | 166 | + Stack({ alignContent: Alignment.Top }) { |
| 167 | + | ||
| 168 | + Scroll() { | ||
| 169 | + Column() { | ||
| 170 | + Stack() { | ||
| 171 | + this.titleHeader() | ||
| 81 | 172 | ||
| 173 | + List({ space: 12 }) { | ||
| 174 | + // ListItemGroup({ header: this.titleHeader() }) | ||
| 82 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { | 175 | LazyForEach(this.allDatas, (item: commentItemModel, index: number) => { |
| 83 | ListItem() { | 176 | ListItem() { |
| 84 | QualityCommentItem({ item: item }).margin({ left: 12, right: 12 }) | 177 | QualityCommentItem({ item: item }).margin({ left: 12, right: 12 }) |
| 85 | } | 178 | } |
| 86 | - // .offset({ | ||
| 87 | - // y:-87 | ||
| 88 | - // }) | ||
| 89 | }) | 179 | }) |
| 180 | + ListItem() { | ||
| 181 | + | ||
| 182 | + }.height(this.bottomSafeHeight) | ||
| 90 | } | 183 | } |
| 91 | - // .contentStartOffset(- 87) | 184 | + .margin({ top: 196 }) |
| 185 | + .height("100%") | ||
| 186 | + .width("100%") | ||
| 92 | .edgeEffect(EdgeEffect.Spring) | 187 | .edgeEffect(EdgeEffect.Spring) |
| 93 | - .margin({bottom:this.bottomSafeHeight}) | 188 | + .nestedScroll({ |
| 189 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 190 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 191 | + }) | ||
| 192 | + | ||
| 193 | + // .margin({ bottom: this.bottomSafeHeight }) | ||
| 194 | + | ||
| 94 | // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) | 195 | // .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.BOTTOM]) |
| 95 | - }.backgroundColor(this.currentWindowColor).height('100%').width('100%') | 196 | + }.alignContent(Alignment.Top) |
| 197 | + }.backgroundColor(this.currentWindowColor).width('100%') | ||
| 198 | + } | ||
| 199 | + .friction(0.6) | ||
| 200 | + .scrollBar(BarState.Off) | ||
| 201 | + .edgeEffect(EdgeEffect.None) | ||
| 202 | + .width('100%') | ||
| 203 | + .height('100%') | ||
| 204 | + | ||
| 205 | + this.TabbarTransparent() | ||
| 206 | + this.TabbarNormal() | ||
| 207 | + | ||
| 208 | + | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + } | ||
| 212 | + | ||
| 96 | } | 213 | } |
| 97 | } | 214 | } |
| 98 | 215 | ||
| @@ -103,8 +220,11 @@ struct QualityCommentItem { | @@ -103,8 +220,11 @@ struct QualityCommentItem { | ||
| 103 | 220 | ||
| 104 | build() { | 221 | build() { |
| 105 | Column() { | 222 | Column() { |
| 223 | + Column().height(16).width('100%').opacity(0) | ||
| 224 | + Column() { | ||
| 106 | /*头像以及昵称*/ | 225 | /*头像以及昵称*/ |
| 107 | RelativeContainer() { | 226 | RelativeContainer() { |
| 227 | + | ||
| 108 | Image(this.item.fromUserHeader) | 228 | Image(this.item.fromUserHeader) |
| 109 | .width(50) | 229 | .width(50) |
| 110 | .height(50) | 230 | .height(50) |
| @@ -185,22 +305,35 @@ struct QualityCommentItem { | @@ -185,22 +305,35 @@ struct QualityCommentItem { | ||
| 185 | /*时间 点赞评论*/ | 305 | /*时间 点赞评论*/ |
| 186 | Row() { | 306 | Row() { |
| 187 | 307 | ||
| 188 | - Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime))).fontSize(14).fontColor('#999999') | 308 | + Text(DateTimeUtils.getCommentTime(DateTimeUtils.getDateTimestamp(this.item.createTime))) |
| 309 | + .fontSize(14) | ||
| 310 | + .fontColor('#999999') | ||
| 189 | 311 | ||
| 190 | - Row({space:16}){ | ||
| 191 | - Row(){ | 312 | + Row({ space: 16 }) { |
| 313 | + Row() { | ||
| 192 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) | 314 | Image($r('app.media.comment_icon_pinglun')).width(16).height(16) |
| 193 | } | 315 | } |
| 194 | 316 | ||
| 195 | - Row(){ | 317 | + Row() { |
| 196 | //comment_like_select | 318 | //comment_like_select |
| 197 | - Image($r(this.item.likeNum?'app.media.comment_like_select':'app.media.comment_like_normal')).width(16).height(16) | ||
| 198 | - if (this.item.likeNum){Text(this.item.likeNum).fontColor(this.item.isLike?'#ED2800':'#999999').fontSize(14).margin({left:3})} | 319 | + Image($r(this.item.likeNum ? 'app.media.comment_like_select' : 'app.media.comment_like_normal')) |
| 320 | + .width(16) | ||
| 321 | + .height(16) | ||
| 322 | + if (this.item.likeNum) { | ||
| 323 | + Text(this.item.likeNum) | ||
| 324 | + .fontColor(this.item.isLike ? '#ED2800' : '#999999') | ||
| 325 | + .fontSize(14) | ||
| 326 | + .margin({ left: 3 }) | ||
| 327 | + } | ||
| 199 | } | 328 | } |
| 200 | } | 329 | } |
| 201 | }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween) | 330 | }.height(38).width('100%').justifyContent(FlexAlign.SpaceBetween) |
| 202 | 331 | ||
| 203 | }.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4) | 332 | }.backgroundColor('#FFFFFF').padding({ top: 0, left: 16, right: 16 }).borderRadius(4) |
| 333 | + } | ||
| 204 | 334 | ||
| 205 | } | 335 | } |
| 206 | } | 336 | } |
| 337 | + | ||
| 338 | + | ||
| 339 | + |
| 1 | import { Logger, ResourcesUtils } from 'wdKit/Index'; | 1 | import { Logger, ResourcesUtils } from 'wdKit/Index'; |
| 2 | -import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | 2 | +import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 3 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 3 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 4 | -import { commentItemModel, commentListModel } from '../model/CommentModel'; | 4 | +import { commentItemModel, commentListModel, commentStatusListModel, commentStatusModel } from '../model/CommentModel'; |
| 5 | import HashMap from '@ohos.util.HashMap'; | 5 | import HashMap from '@ohos.util.HashMap'; |
| 6 | +import { ifaa } from '@kit.OnlineAuthenticationKit'; | ||
| 6 | 7 | ||
| 7 | const TAG = "CommentViewModel" | 8 | const TAG = "CommentViewModel" |
| 8 | 9 | ||
| 9 | class CommentViewModel { | 10 | class CommentViewModel { |
| 10 | private static instance: CommentViewModel | 11 | private static instance: CommentViewModel |
| 12 | + | ||
| 11 | /** | 13 | /** |
| 12 | * 单例模式 | 14 | * 单例模式 |
| 13 | * @returns | 15 | * @returns |
| @@ -19,35 +21,34 @@ class CommentViewModel { | @@ -19,35 +21,34 @@ class CommentViewModel { | ||
| 19 | return CommentViewModel.instance; | 21 | return CommentViewModel.instance; |
| 20 | } | 22 | } |
| 21 | 23 | ||
| 22 | - | ||
| 23 | /*获取本地mock数据*/ | 24 | /*获取本地mock数据*/ |
| 24 | async getCommentLocal(context: Context): Promise<commentListModel> { | 25 | async getCommentLocal(context: Context): Promise<commentListModel> { |
| 25 | Logger.info(TAG, `getBottomNavDataMock start`); | 26 | Logger.info(TAG, `getBottomNavDataMock start`); |
| 26 | - let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'comment_local.json' ); | 27 | + let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'comment_local.json'); |
| 27 | if (!compRes || !compRes.data) { | 28 | if (!compRes || !compRes.data) { |
| 28 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | 29 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); |
| 29 | return new commentListModel() | 30 | return new commentListModel() |
| 30 | } | 31 | } |
| 31 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | 32 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); |
| 32 | - return compRes.data | 33 | + return this.fetchCommentStatusAndConfigAuthIcon(compRes.data) |
| 34 | + // this.fetchCommentStatusAndConfigAuthIcon(compRes.data) | ||
| 35 | + // return compRes.data | ||
| 33 | } | 36 | } |
| 34 | 37 | ||
| 35 | - /*获取本地mock数据*/ | 38 | + /*获取热门评论本地mock数据*/ |
| 36 | async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> { | 39 | async fetchQualityCommentListLocal(context: Context): Promise<commentListModel> { |
| 37 | Logger.info(TAG, `getBottomNavDataMock start`); | 40 | Logger.info(TAG, `getBottomNavDataMock start`); |
| 38 | - let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context,'qualityComment_local.json' ); | 41 | + let compRes: ResponseDTO<commentListModel> | null = await ResourcesUtils.getResourcesJson<ResponseDTO<commentListModel>>(context, 'qualityComment_local.json'); |
| 39 | if (!compRes || !compRes.data) { | 42 | if (!compRes || !compRes.data) { |
| 40 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); | 43 | Logger.info(TAG, `getAppointmentListDataLocal compRes is empty`); |
| 41 | return new commentListModel() | 44 | return new commentListModel() |
| 42 | } | 45 | } |
| 43 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); | 46 | Logger.info(TAG, `getAppointmentListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`); |
| 44 | - return compRes.data | 47 | + return this.fetchCommentStatusAndConfigAuthIcon(compRes.data) |
| 45 | } | 48 | } |
| 46 | 49 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - //qualityComment_local.json | ||
| 50 | - fetchQualityCommentList(pageNum: string) { | 50 | + /*获取热门评论*/ |
| 51 | + fetchQualityCommentList(pageNum: string): Promise<commentListModel> { | ||
| 51 | let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}` | 52 | let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}` |
| 52 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 53 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 53 | return new Promise<commentListModel>((success, fail) => { | 54 | return new Promise<commentListModel>((success, fail) => { |
| @@ -62,7 +63,15 @@ class CommentViewModel { | @@ -62,7 +63,15 @@ class CommentViewModel { | ||
| 62 | } | 63 | } |
| 63 | let listData = data.data as commentListModel | 64 | let listData = data.data as commentListModel |
| 64 | 65 | ||
| 65 | - success(listData) | 66 | + this.fetchCommentStatusAndConfigAuthIcon(listData).then((commentListModel) =>{ |
| 67 | + console.log(TAG, 'fetchCommentStatusAndConfigAuthIcon完成') | ||
| 68 | + success(commentListModel) | ||
| 69 | + }) | ||
| 70 | + | ||
| 71 | + // return this.fetchCommentStatusAndConfigAuthIcon(listData) | ||
| 72 | + | ||
| 73 | + // this.fetchCommentStatusAndConfigAuthIcon(listData) | ||
| 74 | + // success(listData) | ||
| 66 | }, (error: Error) => { | 75 | }, (error: Error) => { |
| 67 | fail(error.message) | 76 | fail(error.message) |
| 68 | Logger.debug(TAG, error.toString()) | 77 | Logger.debug(TAG, error.toString()) |
| @@ -70,35 +79,192 @@ class CommentViewModel { | @@ -70,35 +79,192 @@ class CommentViewModel { | ||
| 70 | }) | 79 | }) |
| 71 | } | 80 | } |
| 72 | 81 | ||
| 82 | + /*多接口批查*/ | ||
| 83 | + fetchCommentStatusAndConfigAuthIcon(model: commentListModel): Promise<commentListModel> { | ||
| 84 | + | ||
| 85 | + let commentIDs: string[] = []; | ||
| 86 | + | ||
| 87 | + let fromUserIDs: string[] = []; | ||
| 88 | + | ||
| 89 | + let creatorIDs: string[] = []; | ||
| 90 | + | ||
| 91 | + //主评论 | ||
| 92 | + for (const element of model.list) { | ||
| 93 | + if ((element.id + '').length > 0) { | ||
| 94 | + commentIDs.push(element.id + '') | ||
| 95 | + } | ||
| 96 | + if ((element.fromUserId + '').length > 0) { | ||
| 97 | + fromUserIDs.push(element.fromUserId) | ||
| 98 | + } | ||
| 99 | + if ((element.fromCreatorId + '').length > 0) { | ||
| 100 | + creatorIDs.push(element.fromCreatorId) | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + //子评论 | ||
| 105 | + if (element.childComments) { | ||
| 106 | + for (const obj2 of element.childComments) { | ||
| 107 | + if ((obj2.id + '').length > 0) { | ||
| 108 | + commentIDs.push(obj2.id + '') | ||
| 109 | + } | ||
| 110 | + if ((obj2.fromUserId + '').length > 0) { | ||
| 111 | + fromUserIDs.push(obj2.fromUserId) | ||
| 112 | + } | ||
| 113 | + if ((obj2.fromCreatorId + '').length > 0) { | ||
| 114 | + creatorIDs.push(obj2.fromCreatorId) | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + } | ||
| 73 | 119 | ||
| 74 | - // BaseGetRequest(contentID:number,contentType:string,pageNum:string){ | ||
| 75 | - // let url = HttpUrlUtils.getMyCollectionListDataUrl()+ `?type=${type}&operateTag=${1}&pageSize=${10}&pageNum=${pageNum}` | ||
| 76 | - // if (tagId.length > 0) { | ||
| 77 | - // url = url + `&tagId=${tagId}` | ||
| 78 | - // } | ||
| 79 | - // let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders() | ||
| 80 | - // return WDHttp.get<ResponseDTO<commentListModel>>(url, headers) | ||
| 81 | - // } | ||
| 82 | - // | ||
| 83 | - // | ||
| 84 | - // fetchCommentList(contentID:number,contentType:string,pageNum:string):Promise<commentListModel>{ | ||
| 85 | - // return new Promise<commentListModel>((success,error) => { | ||
| 86 | - // this.BaseGetRequest(contentID,contentType,pageNum).then((navResDTO: ResponseDTO<commentListModel>) => { | ||
| 87 | - // if (!navResDTO || navResDTO.code != 0) { | ||
| 88 | - // // success(this.getAppointmentListDataLocal(context)) | ||
| 89 | - // return | ||
| 90 | - // } | ||
| 91 | - // Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp); | ||
| 92 | - // let listData = navResDTO.data as commentListModel | ||
| 93 | - // success(listData) | ||
| 94 | - // }).catch((err: Error) => { | ||
| 95 | - // Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 96 | - // error("page data invalid"); | ||
| 97 | - // }) | ||
| 98 | - // }) | ||
| 99 | - // } | ||
| 100 | 120 | ||
| 121 | + let promiseArray: Promise<commentStatusListModel | void>[] = []; | ||
| 101 | 122 | ||
| 123 | + //TODO 未登录不用批查 | ||
| 124 | + if (commentIDs.length > 0) { | ||
| 125 | + let promise1 = new Promise<void>((success) => { | ||
| 126 | + // HttpRequest HttpBizUtil | ||
| 127 | + let url = HttpUrlUtils.getBatchCommentStatusUrl(); | ||
| 128 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 129 | + let bean: Record<string, string[]> = {}; | ||
| 130 | + bean['commentIdList'] = commentIDs; | ||
| 131 | + HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { | ||
| 132 | + if (!data || !data.data) { | ||
| 133 | + success() | ||
| 134 | + return | ||
| 135 | + } | ||
| 136 | + if (data.code != 0) { | ||
| 137 | + success() | ||
| 138 | + return | ||
| 139 | + } | ||
| 140 | + if (data.data.length == 0) { | ||
| 141 | + success() | ||
| 142 | + return | ||
| 143 | + } | ||
| 144 | + let listData = data.data as commentStatusModel[] | ||
| 145 | + | ||
| 146 | + for (const element of listData) { | ||
| 147 | + for (const commentModel of model.list) { | ||
| 148 | + if (element.commentId == commentModel.id) { | ||
| 149 | + commentModel.api_status = element.status | ||
| 150 | + } | ||
| 151 | + if (commentModel.childComments) { | ||
| 152 | + for (const childCommentModel of commentModel.childComments) { | ||
| 153 | + if (element.commentId == childCommentModel.id) { | ||
| 154 | + childCommentModel.api_status = element.status | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + } | ||
| 160 | + success() | ||
| 161 | + }, (error: Error) => { | ||
| 162 | + success() | ||
| 163 | + Logger.debug(TAG, error.toString()) | ||
| 164 | + }) | ||
| 165 | + }) | ||
| 166 | + promiseArray.push(promise1); | ||
| 167 | + } | ||
| 168 | + | ||
| 169 | + if (fromUserIDs.length > 0) { | ||
| 170 | + let promise2 = new Promise<void>((success) => { | ||
| 171 | + let url = HttpUrlUtils.getBatchUserUrl(); | ||
| 172 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 173 | + // HttpRequest HttpBizUtil | ||
| 174 | + HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, fromUserIDs, headers).then((data: ResponseDTO<commentStatusModel[]>) => { | ||
| 175 | + if (!data || !data.data) { | ||
| 176 | + success() | ||
| 177 | + return | ||
| 178 | + } | ||
| 179 | + if (data.code != 0) { | ||
| 180 | + success() | ||
| 181 | + return | ||
| 182 | + } | ||
| 183 | + if (data.data.length == 0) { | ||
| 184 | + success() | ||
| 185 | + return | ||
| 186 | + } | ||
| 187 | + let listData = data.data as commentStatusModel[] | ||
| 188 | + | ||
| 189 | + for (const element of listData) { | ||
| 190 | + for (const commentModel of model.list) { | ||
| 191 | + if (element.userId == commentModel.fromUserId) { | ||
| 192 | + commentModel.api_levelHead = element.levelHead | ||
| 193 | + } | ||
| 194 | + if (commentModel.childComments) { | ||
| 195 | + for (const childCommentModel of commentModel.childComments) { | ||
| 196 | + if (element.userId == childCommentModel.fromUserId) { | ||
| 197 | + childCommentModel.api_levelHead = element.levelHead | ||
| 198 | + } | ||
| 199 | + } | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + success() | ||
| 204 | + }, (error: Error) => { | ||
| 205 | + success() | ||
| 206 | + Logger.debug(TAG, error.toString()) | ||
| 207 | + }) | ||
| 208 | + }) | ||
| 209 | + promiseArray.push(promise2); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + //TODO 一次20个上限 | ||
| 213 | + if (creatorIDs.length > 0) { | ||
| 214 | + let promise3 = new Promise<void>((success) => { | ||
| 215 | + let url = HttpUrlUtils.getDetailListUrl(); | ||
| 216 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 217 | + let bean: Record<string, string[]> = {}; | ||
| 218 | + bean['creatorIdList'] = creatorIDs; | ||
| 219 | + // HttpRequest HttpBizUtil | ||
| 220 | + HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => { | ||
| 221 | + if (!data || !data.data) { | ||
| 222 | + success() | ||
| 223 | + return | ||
| 224 | + } | ||
| 225 | + if (data.code != 0) { | ||
| 226 | + success() | ||
| 227 | + return | ||
| 228 | + } | ||
| 229 | + if (data.data.length == 0) { | ||
| 230 | + success() | ||
| 231 | + return | ||
| 232 | + } | ||
| 233 | + let listData = data.data as commentStatusModel[] | ||
| 234 | + | ||
| 235 | + for (const element of listData) { | ||
| 236 | + for (const commentModel of model.list) { | ||
| 237 | + if (element.creatorId == commentModel.fromCreatorId) { | ||
| 238 | + commentModel.api_authIcon = element.authIcon | ||
| 239 | + } | ||
| 240 | + if (commentModel.childComments) { | ||
| 241 | + for (const childCommentModel of commentModel.childComments) { | ||
| 242 | + if (element.creatorId == childCommentModel.fromCreatorId) { | ||
| 243 | + childCommentModel.api_authIcon = element.authIcon | ||
| 244 | + } | ||
| 245 | + } | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + success() | ||
| 250 | + }, (error: Error) => { | ||
| 251 | + success() | ||
| 252 | + Logger.debug(TAG, error.toString()) | ||
| 253 | + }) | ||
| 254 | + }) | ||
| 255 | + promiseArray.push(promise3); | ||
| 256 | + } | ||
| 257 | + | ||
| 258 | + return new Promise<commentListModel>((success) => { | ||
| 259 | + Promise.all(promiseArray).then(() => { | ||
| 260 | + console.log(TAG, 'Promise.all'); | ||
| 261 | + success(model) | ||
| 262 | + }) | ||
| 263 | + | ||
| 264 | + }) | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + } | ||
| 102 | } | 268 | } |
| 103 | 269 | ||
| 104 | 270 |
| @@ -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 { StringUtils } from 'wdKit/Index' | 1 | +import { StringUtils, ToastUtils } from 'wdKit/Index' |
| 2 | import { HttpUrlUtils } from 'wdNetwork/Index' | 2 | import { HttpUrlUtils } from 'wdNetwork/Index' |
| 3 | +import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | ||
| 3 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 4 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 4 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| 5 | import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem' | 6 | import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem' |
| @@ -12,14 +13,18 @@ export struct FollowChildComponent{ | @@ -12,14 +13,18 @@ export struct FollowChildComponent{ | ||
| 12 | build() { | 13 | build() { |
| 13 | if(this.type == 0 ){ | 14 | if(this.type == 0 ){ |
| 14 | Column(){ | 15 | Column(){ |
| 15 | - Blank().height('27lpx') | 16 | + Column(){ |
| 16 | 17 | ||
| 17 | Row() { | 18 | Row() { |
| 19 | + Row(){ | ||
| 18 | Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | 20 | Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) |
| 19 | .objectFit(ImageFit.Auto) | 21 | .objectFit(ImageFit.Auto) |
| 20 | .width('92lpx') | 22 | .width('92lpx') |
| 21 | .height('92lpx') | 23 | .height('92lpx') |
| 22 | .margin({right:'15lpx'}) | 24 | .margin({right:'15lpx'}) |
| 25 | + .borderRadius(50) | ||
| 26 | + .borderWidth('1lpx') | ||
| 27 | + .borderColor($r('app.color.color_0D000000')) | ||
| 23 | 28 | ||
| 24 | Column(){ | 29 | Column(){ |
| 25 | Text(this.data.cnUserName) | 30 | Text(this.data.cnUserName) |
| @@ -28,17 +33,30 @@ export struct FollowChildComponent{ | @@ -28,17 +33,30 @@ export struct FollowChildComponent{ | ||
| 28 | .lineHeight('38lpx') | 33 | .lineHeight('38lpx') |
| 29 | .fontColor($r('app.color.color_222222')) | 34 | .fontColor($r('app.color.color_222222')) |
| 30 | .maxLines(1) | 35 | .maxLines(1) |
| 36 | + .margin({bottom:'8lpx'}) | ||
| 37 | + | ||
| 31 | Text(`粉丝${this.data.cnFansNum}`) | 38 | Text(`粉丝${this.data.cnFansNum}`) |
| 32 | .fontColor($r('app.color.color_B0B0B0')) | 39 | .fontColor($r('app.color.color_B0B0B0')) |
| 33 | .fontSize('23lpx') | 40 | .fontSize('23lpx') |
| 34 | - .maxLines(1) | 41 | + .fontWeight('400lpx') |
| 42 | + .lineHeight('31lpx') | ||
| 43 | + .margin({bottom:'8lpx'}) | ||
| 44 | + | ||
| 35 | Text(`${this.data.introduction}`) | 45 | Text(`${this.data.introduction}`) |
| 36 | .fontColor($r('app.color.color_B0B0B0')) | 46 | .fontColor($r('app.color.color_B0B0B0')) |
| 37 | .fontSize('23lpx') | 47 | .fontSize('23lpx') |
| 38 | .maxLines(2) | 48 | .maxLines(2) |
| 49 | + .textAlign(TextAlign.Start) | ||
| 39 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 50 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 40 | - }.layoutWeight(1) | 51 | + } |
| 52 | + .layoutWeight(1) | ||
| 41 | .alignItems(HorizontalAlign.Start) | 53 | .alignItems(HorizontalAlign.Start) |
| 54 | + .justifyContent(FlexAlign.Start) | ||
| 55 | + }.layoutWeight(1) | ||
| 56 | + .alignItems(VerticalAlign.Top) | ||
| 57 | + .onClick(()=>{ | ||
| 58 | + this.jumpCreatorHomePage() | ||
| 59 | + }) | ||
| 42 | 60 | ||
| 43 | if(this.data.status == "1"){ | 61 | if(this.data.status == "1"){ |
| 44 | Row(){ | 62 | Row(){ |
| @@ -47,18 +65,13 @@ export struct FollowChildComponent{ | @@ -47,18 +65,13 @@ export struct FollowChildComponent{ | ||
| 47 | .fontSize('23lpx') | 65 | .fontSize('23lpx') |
| 48 | .fontWeight('500lpx') | 66 | .fontWeight('500lpx') |
| 49 | .lineHeight('35lpx') | 67 | .lineHeight('35lpx') |
| 50 | - }.backgroundColor($r('app.color.color_F5F5F5')) | ||
| 51 | - .borderRadius('6lpx') | ||
| 52 | - .borderColor($r('app.color.color_F5F5F5')) | ||
| 53 | - .borderWidth('2lpx') | 68 | + } |
| 54 | .justifyContent(FlexAlign.Center) | 69 | .justifyContent(FlexAlign.Center) |
| 55 | .width('100lpx') | 70 | .width('100lpx') |
| 56 | .height('46lpx') | 71 | .height('46lpx') |
| 57 | - .margin({left:'4lpx',top:'23lpx'}) | ||
| 58 | .onClick(()=>{ | 72 | .onClick(()=>{ |
| 59 | this.followOperation() | 73 | this.followOperation() |
| 60 | - // this.data.status = "0" | ||
| 61 | - }) | 74 | + }).margin({top:'29lpx'}) |
| 62 | }else{ | 75 | }else{ |
| 63 | Row(){ | 76 | Row(){ |
| 64 | Image($r('app.media.follow_icon')) | 77 | Image($r('app.media.follow_icon')) |
| @@ -76,27 +89,27 @@ export struct FollowChildComponent{ | @@ -76,27 +89,27 @@ export struct FollowChildComponent{ | ||
| 76 | .justifyContent(FlexAlign.Center) | 89 | .justifyContent(FlexAlign.Center) |
| 77 | .width('100lpx') | 90 | .width('100lpx') |
| 78 | .height('46lpx') | 91 | .height('46lpx') |
| 79 | - .margin({left:'4lpx',top:'23lpx'}) | 92 | + .margin({top:'29lpx'}) |
| 80 | .onClick(()=>{ | 93 | .onClick(()=>{ |
| 81 | this.followOperation() | 94 | this.followOperation() |
| 82 | - // this.data.status = "1" | ||
| 83 | }) | 95 | }) |
| 84 | } | 96 | } |
| 85 | - }.alignItems(VerticalAlign.Top) | 97 | + } |
| 98 | + .padding({top:'27lpx'}) | ||
| 86 | .width('100%') | 99 | .width('100%') |
| 87 | - .layoutWeight(1) | 100 | + .justifyContent(FlexAlign.SpaceBetween) |
| 101 | + .alignItems(VerticalAlign.Top) | ||
| 102 | + | ||
| 103 | + }.height('202lpx') | ||
| 104 | + .justifyContent(FlexAlign.Start) | ||
| 88 | 105 | ||
| 89 | Divider().width('100%') | 106 | Divider().width('100%') |
| 90 | - .height('2lpx') | 107 | + .height('1lpx') |
| 91 | .strokeWidth('1lpx') | 108 | .strokeWidth('1lpx') |
| 92 | .backgroundColor($r('app.color.color_EDEDED')) | 109 | .backgroundColor($r('app.color.color_EDEDED')) |
| 110 | + }.width('100%') | ||
| 93 | 111 | ||
| 94 | - }.height('146lpx') | ||
| 95 | - .justifyContent(FlexAlign.Center) | ||
| 96 | - .onClick(()=>{ | ||
| 97 | - //跳转 人民号的 主页 | ||
| 98 | - }) | ||
| 99 | - }else if(this.type == 1 ){ | 112 | + }else { |
| 100 | Column(){ | 113 | Column(){ |
| 101 | Column(){ | 114 | Column(){ |
| 102 | 115 | ||
| @@ -140,7 +153,13 @@ export struct FollowChildComponent{ | @@ -140,7 +153,13 @@ export struct FollowChildComponent{ | ||
| 140 | .layoutWeight(1) | 153 | .layoutWeight(1) |
| 141 | .alignItems(HorizontalAlign.Start) | 154 | .alignItems(HorizontalAlign.Start) |
| 142 | }.layoutWeight(1) | 155 | }.layoutWeight(1) |
| 156 | + .onClick(()=>{ | ||
| 157 | + this.jumpCreatorHomePage() | ||
| 158 | + }) | ||
| 143 | 159 | ||
| 160 | + if(this.type === 2){ | ||
| 161 | + Blank() | ||
| 162 | + }else { | ||
| 144 | if(this.data.status == "1"){ | 163 | if(this.data.status == "1"){ |
| 145 | Row(){ | 164 | Row(){ |
| 146 | Text(`已关注`) | 165 | Text(`已关注`) |
| @@ -177,6 +196,7 @@ export struct FollowChildComponent{ | @@ -177,6 +196,7 @@ export struct FollowChildComponent{ | ||
| 177 | }) | 196 | }) |
| 178 | } | 197 | } |
| 179 | } | 198 | } |
| 199 | + } | ||
| 180 | .width('100%') | 200 | .width('100%') |
| 181 | .height('92lpx') | 201 | .height('92lpx') |
| 182 | .justifyContent(FlexAlign.SpaceBetween) | 202 | .justifyContent(FlexAlign.SpaceBetween) |
| @@ -206,4 +226,15 @@ export struct FollowChildComponent{ | @@ -206,4 +226,15 @@ export struct FollowChildComponent{ | ||
| 206 | } | 226 | } |
| 207 | }) | 227 | }) |
| 208 | } | 228 | } |
| 229 | + | ||
| 230 | + jumpCreatorHomePage() { | ||
| 231 | + if(this.data.mainControl === 0){ | ||
| 232 | + ToastUtils.shortToast("无法查看此用户主页") | ||
| 233 | + }else if(this.data.banControl === 1){ | ||
| 234 | + ToastUtils.shortToast("该账号已封禁,不予访问") | ||
| 235 | + }else{ | ||
| 236 | + let params = {'creatorId': this.data.creatorId} as Record<string, string>; | ||
| 237 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 238 | + } | ||
| 239 | + } | ||
| 209 | } | 240 | } |
| 1 | import { LazyDataSource } from 'wdKit'; | 1 | import { LazyDataSource } from 'wdKit'; |
| 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 3 | +import SearcherAboutDataModel from '../../../model/SearcherAboutDataModel'; | ||
| 4 | +import { CreatorDetailRequestItem } from '../../../viewmodel/CreatorDetailRequestItem'; | ||
| 3 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| 4 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 6 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 5 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; | 7 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; |
| @@ -73,8 +75,7 @@ export struct FollowListDetailUI{ | @@ -73,8 +75,7 @@ export struct FollowListDetailUI{ | ||
| 73 | this.hasMore = false | 75 | this.hasMore = false |
| 74 | }else{ | 76 | }else{ |
| 75 | value.list.forEach((value)=>{ | 77 | value.list.forEach((value)=>{ |
| 76 | - | ||
| 77 | - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) | 78 | + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) |
| 78 | }) | 79 | }) |
| 79 | this.data.notifyDataReload() | 80 | this.data.notifyDataReload() |
| 80 | this.count = this.data.totalCount() | 81 | this.count = this.data.totalCount() |
| @@ -109,31 +110,72 @@ export struct FollowListDetailUI{ | @@ -109,31 +110,72 @@ export struct FollowListDetailUI{ | ||
| 109 | } | 110 | } |
| 110 | } | 111 | } |
| 111 | 112 | ||
| 112 | - getFollowListStatus(value:MineFollowListDetailItem){ | 113 | + getFollowListStatus(result:MineFollowListDetailItem){ |
| 114 | + let data_temp : FollowListDetailItem[] = [] | ||
| 115 | + result.list.forEach((item)=>{ | ||
| 116 | + data_temp.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId,item.cnMainControl,-1)) | ||
| 117 | + }) | ||
| 118 | + let request = new CreatorDetailRequestItem() | ||
| 119 | + | ||
| 120 | + data_temp.forEach((data)=>{ | ||
| 121 | + request.creatorIdList.push(data.creatorId) | ||
| 122 | + }) | ||
| 123 | + SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ | ||
| 124 | + if(value!=null && value.length>0){ | ||
| 125 | + data_temp.forEach((data)=>{ | ||
| 126 | + value.forEach((item)=>{ | ||
| 127 | + if(data.creatorId == item.creatorId){ | ||
| 128 | + data.headPhotoUrl = item.headPhotoUrl | ||
| 129 | + if(item.fansNum>10000){ | ||
| 130 | + let temp = (item.fansNum/10000)+"" | ||
| 131 | + let index = temp.indexOf('.') | ||
| 132 | + if(index != -1){ | ||
| 133 | + temp = temp.substring(0,index+2) | ||
| 134 | + }else{ | ||
| 135 | + temp = temp | ||
| 136 | + } | ||
| 137 | + data.cnFansNum = temp + "万" | ||
| 138 | + }else{ | ||
| 139 | + data.cnFansNum = item.fansNum + "" | ||
| 140 | + } | ||
| 141 | + data.introduction = item.introduction | ||
| 142 | + data.mainControl = item.mainControl | ||
| 143 | + data.banControl = item.banControl | ||
| 144 | + } | ||
| 145 | + }) | ||
| 146 | + }) | ||
| 147 | + this.getFollowStatus(data_temp,result.totalCount) | ||
| 148 | + } | ||
| 149 | + }).catch((err:Error)=>{ | ||
| 150 | + console.log(TAG,JSON.stringify(err)) | ||
| 151 | + this.isLoading = false | ||
| 152 | + this.count = this.count===-1?0:this.count | ||
| 153 | + }) | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + getFollowStatus(result : FollowListDetailItem[],totalCount:number){ | ||
| 113 | let status = new FollowListStatusRequestItem() | 157 | let status = new FollowListStatusRequestItem() |
| 114 | - let data : FollowListDetailItem[] = [] | ||
| 115 | - value.list.forEach((item)=>{ | 158 | + result.forEach((item)=>{ |
| 116 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) | 159 | status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) |
| 117 | - data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId)) | ||
| 118 | }) | 160 | }) |
| 119 | 161 | ||
| 120 | MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ | 162 | MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ |
| 121 | newValue.forEach((item)=>{ | 163 | newValue.forEach((item)=>{ |
| 122 | - data.forEach((list)=>{ | 164 | + result.forEach((list)=>{ |
| 123 | if (item.creatorId == list.creatorId) { | 165 | if (item.creatorId == list.creatorId) { |
| 124 | list.status = item.status | 166 | list.status = item.status |
| 125 | } | 167 | } |
| 126 | }) | 168 | }) |
| 127 | }) | 169 | }) |
| 128 | 170 | ||
| 129 | - data.forEach((item)=>{ | ||
| 130 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId)) | 171 | + result.forEach((item)=>{ |
| 172 | + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl)) | ||
| 131 | }) | 173 | }) |
| 132 | 174 | ||
| 133 | this.data.notifyDataReload() | 175 | this.data.notifyDataReload() |
| 134 | 176 | ||
| 135 | this.count = this.data.totalCount() | 177 | this.count = this.data.totalCount() |
| 136 | - if (this.data.totalCount() < value.totalCount) { | 178 | + if (this.data.totalCount() < totalCount) { |
| 137 | this.curPageNum++ | 179 | this.curPageNum++ |
| 138 | }else { | 180 | }else { |
| 139 | this.hasMore = false | 181 | this.hasMore = false |
| 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'; |
| 9 | +import { FollowChildComponent } from '../follow/FollowChildComponent'; | ||
| 11 | 10 | ||
| 12 | const TAG = "HomePageBottomComponent" | 11 | const TAG = "HomePageBottomComponent" |
| 13 | @Component | 12 | @Component |
| @@ -21,6 +20,7 @@ export struct HomePageBottomComponent{ | @@ -21,6 +20,7 @@ export struct HomePageBottomComponent{ | ||
| 21 | @State count:number = 0; | 20 | @State count:number = 0; |
| 22 | @State isMineAccount:boolean = true; | 21 | @State isMineAccount:boolean = true; |
| 23 | @State userId:string = ""; | 22 | @State userId:string = ""; |
| 23 | + @Link commentNum:number | ||
| 24 | 24 | ||
| 25 | aboutToAppear(){ | 25 | aboutToAppear(){ |
| 26 | this.getNewPageData() | 26 | this.getNewPageData() |
| @@ -35,6 +35,7 @@ export struct HomePageBottomComponent{ | @@ -35,6 +35,7 @@ export struct HomePageBottomComponent{ | ||
| 35 | 35 | ||
| 36 | if(this.count === 0){ | 36 | if(this.count === 0){ |
| 37 | if(this.style === 1){ | 37 | if(this.style === 1){ |
| 38 | + Column(){ | ||
| 38 | Row(){ | 39 | Row(){ |
| 39 | Text("关注更多人民号") | 40 | Text("关注更多人民号") |
| 40 | .fontWeight('400lpx') | 41 | .fontWeight('400lpx') |
| @@ -59,6 +60,8 @@ export struct HomePageBottomComponent{ | @@ -59,6 +60,8 @@ export struct HomePageBottomComponent{ | ||
| 59 | } | 60 | } |
| 60 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) | 61 | WDRouterRule.jumpWithPage(WDRouterPage.followListPage,params) |
| 61 | }) | 62 | }) |
| 63 | + }.layoutWeight(1) | ||
| 64 | + .justifyContent(FlexAlign.Start) | ||
| 62 | }else{ | 65 | }else{ |
| 63 | ListHasNoMoreDataUI({style:2}) | 66 | ListHasNoMoreDataUI({style:2}) |
| 64 | .layoutWeight(1) | 67 | .layoutWeight(1) |
| @@ -95,7 +98,7 @@ export struct HomePageBottomComponent{ | @@ -95,7 +98,7 @@ export struct HomePageBottomComponent{ | ||
| 95 | 98 | ||
| 96 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | 99 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { |
| 97 | ListItem() { | 100 | ListItem() { |
| 98 | - ChildFollowComponent({data: item}) | 101 | + FollowChildComponent({data: item,type:1}) |
| 99 | } | 102 | } |
| 100 | .onClick(() => { | 103 | .onClick(() => { |
| 101 | }) | 104 | }) |
| @@ -184,7 +187,7 @@ export struct HomePageBottomComponent{ | @@ -184,7 +187,7 @@ export struct HomePageBottomComponent{ | ||
| 184 | this.hasMore = false | 187 | this.hasMore = false |
| 185 | }else{ | 188 | }else{ |
| 186 | value.list.forEach((value)=>{ | 189 | value.list.forEach((value)=>{ |
| 187 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) | 190 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId,value.mainControl,value.banControl)) |
| 188 | }) | 191 | }) |
| 189 | this.data_follow.notifyDataReload() | 192 | this.data_follow.notifyDataReload() |
| 190 | this.count = this.data_follow.totalCount() | 193 | this.count = this.data_follow.totalCount() |
| @@ -210,7 +213,8 @@ export struct HomePageBottomComponent{ | @@ -210,7 +213,8 @@ export struct HomePageBottomComponent{ | ||
| 210 | this.hasMore = false | 213 | this.hasMore = false |
| 211 | }else{ | 214 | }else{ |
| 212 | value.list.forEach((value)=>{ | 215 | value.list.forEach((value)=>{ |
| 213 | - 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)) | ||
| 214 | }) | 218 | }) |
| 215 | this.data_comment.notifyDataReload() | 219 | this.data_comment.notifyDataReload() |
| 216 | this.count = this.data_comment.totalCount() | 220 | this.count = this.data_comment.totalCount() |
| @@ -221,6 +225,7 @@ export struct HomePageBottomComponent{ | @@ -221,6 +225,7 @@ export struct HomePageBottomComponent{ | ||
| 221 | } | 225 | } |
| 222 | } | 226 | } |
| 223 | this.isLoading = false | 227 | this.isLoading = false |
| 228 | + this.commentNum = value.totalCount | ||
| 224 | }).catch((err:Error)=>{ | 229 | }).catch((err:Error)=>{ |
| 225 | console.log(TAG,"请求失败") | 230 | console.log(TAG,"请求失败") |
| 226 | this.isLoading = false | 231 | this.isLoading = false |
| @@ -231,107 +236,6 @@ export struct HomePageBottomComponent{ | @@ -231,107 +236,6 @@ export struct HomePageBottomComponent{ | ||
| 231 | } | 236 | } |
| 232 | 237 | ||
| 233 | @Component | 238 | @Component |
| 234 | -struct ChildFollowComponent { | ||
| 235 | - @ObjectLink data: FollowListDetailItem | ||
| 236 | - | ||
| 237 | - build() { | ||
| 238 | - Column(){ | ||
| 239 | - Blank().height('27lpx') | ||
| 240 | - | ||
| 241 | - Row() { | ||
| 242 | - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 243 | - .objectFit(ImageFit.Auto) | ||
| 244 | - .width('92lpx') | ||
| 245 | - .height('92lpx') | ||
| 246 | - .margin({right:'15lpx'}) | ||
| 247 | - | ||
| 248 | - Column(){ | ||
| 249 | - Text(this.data.cnUserName) | ||
| 250 | - .fontWeight('400lpx') | ||
| 251 | - .fontSize('31lpx') | ||
| 252 | - .lineHeight('38lpx') | ||
| 253 | - .fontColor($r('app.color.color_222222')) | ||
| 254 | - Text(`粉丝${this.data.cnFansNum}`) | ||
| 255 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 256 | - .fontSize('23lpx') | ||
| 257 | - .maxLines(1) | ||
| 258 | - Text(`${this.data.introduction}`) | ||
| 259 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 260 | - .fontSize('23lpx') | ||
| 261 | - .maxLines(2) | ||
| 262 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 263 | - }.layoutWeight(1) | ||
| 264 | - .alignItems(HorizontalAlign.Start) | ||
| 265 | - | ||
| 266 | - if(this.data.status == "1"){ | ||
| 267 | - Row(){ | ||
| 268 | - Text(`已关注`) | ||
| 269 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 270 | - .fontSize('23lpx') | ||
| 271 | - .fontWeight('500lpx') | ||
| 272 | - .lineHeight('35lpx') | ||
| 273 | - }.backgroundColor($r('app.color.color_F5F5F5')) | ||
| 274 | - .borderRadius('6lpx') | ||
| 275 | - .borderColor($r('app.color.color_F5F5F5')) | ||
| 276 | - .borderWidth('2lpx') | ||
| 277 | - .justifyContent(FlexAlign.Center) | ||
| 278 | - .width('100lpx') | ||
| 279 | - .height('46lpx') | ||
| 280 | - .margin({left:'4lpx',top:'23lpx'}) | ||
| 281 | - .onClick(()=>{ | ||
| 282 | - // this.data.status = "0" | ||
| 283 | - this.followOperation() | ||
| 284 | - }) | ||
| 285 | - }else{ | ||
| 286 | - Row(){ | ||
| 287 | - Image($r('app.media.follow_icon')) | ||
| 288 | - .margin({right:'4lpx'}) | ||
| 289 | - .width('23lpx') | ||
| 290 | - .height('23lpx') | ||
| 291 | - Text(`关注`) | ||
| 292 | - .fontColor($r('app.color.color_ED2800')) | ||
| 293 | - .fontSize('23lpx') | ||
| 294 | - .fontWeight('500lpx') | ||
| 295 | - .lineHeight('35lpx') | ||
| 296 | - }.borderColor($r('app.color.color_1AED2800')) | ||
| 297 | - .borderRadius('6lpx') | ||
| 298 | - .borderWidth('2lpx') | ||
| 299 | - .justifyContent(FlexAlign.Center) | ||
| 300 | - .width('100lpx') | ||
| 301 | - .height('46lpx') | ||
| 302 | - .margin({left:'4lpx',top:'23lpx'}) | ||
| 303 | - .onClick(()=>{ | ||
| 304 | - // this.data.status = "1" | ||
| 305 | - this.followOperation() | ||
| 306 | - }) | ||
| 307 | - } | ||
| 308 | - }.alignItems(VerticalAlign.Top) | ||
| 309 | - .width('100%') | ||
| 310 | - .layoutWeight(1) | ||
| 311 | - | ||
| 312 | - Divider().width('100%') | ||
| 313 | - .height('2lpx') | ||
| 314 | - .strokeWidth('1lpx') | ||
| 315 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 316 | - | ||
| 317 | - }.height('146lpx') | ||
| 318 | - .justifyContent(FlexAlign.Center) | ||
| 319 | - } | ||
| 320 | - | ||
| 321 | - followOperation(){ | ||
| 322 | - let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,UserDataLocal.getUserType(),UserDataLocal.getUserId(),this.data.status==="0" ? 1:0) | ||
| 323 | - MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 324 | - if(value!=null){ | ||
| 325 | - if (value.code === 0 || value.code.toString() === "0") { | ||
| 326 | - this.data.status = this.data.status ==="0"?"1":"0" | ||
| 327 | - } | ||
| 328 | - } | ||
| 329 | - }) | ||
| 330 | - } | ||
| 331 | - | ||
| 332 | -} | ||
| 333 | - | ||
| 334 | -@Component | ||
| 335 | struct ChildCommentComponent { | 239 | struct ChildCommentComponent { |
| 336 | @ObjectLink data: CommentListItem | 240 | @ObjectLink data: CommentListItem |
| 337 | isLastItem: boolean = false | 241 | isLastItem: boolean = false |
| @@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'; | @@ -5,6 +5,7 @@ import MinePageDatasModel from '../../../model/MinePageDatasModel'; | ||
| 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; | 5 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'; |
| 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; | 6 | import { UserFollowListRequestItem } from '../../../viewmodel/UserFollowListRequestItem'; |
| 7 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 7 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 8 | +import { FollowChildComponent } from '../follow/FollowChildComponent'; | ||
| 8 | 9 | ||
| 9 | const TAG = "HomePageBottomComponent" | 10 | const TAG = "HomePageBottomComponent" |
| 10 | @Component | 11 | @Component |
| @@ -62,7 +63,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -62,7 +63,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 62 | 63 | ||
| 63 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { | 64 | LazyForEach(this.data_follow, (item: FollowListDetailItem, index: number = 0) => { |
| 64 | ListItem() { | 65 | ListItem() { |
| 65 | - ChildFollowComponent({data: item}) | 66 | + FollowChildComponent({data: item,type:2}) |
| 66 | } | 67 | } |
| 67 | .onClick(() => { | 68 | .onClick(() => { |
| 68 | }) | 69 | }) |
| @@ -116,7 +117,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -116,7 +117,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 116 | this.hasMore = false | 117 | this.hasMore = false |
| 117 | }else{ | 118 | }else{ |
| 118 | value.list.forEach((value)=>{ | 119 | value.list.forEach((value)=>{ |
| 119 | - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId)) | 120 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId,value.mainControl,value.banControl)) |
| 120 | }) | 121 | }) |
| 121 | this.data_follow.notifyDataReload() | 122 | this.data_follow.notifyDataReload() |
| 122 | this.count = this.data_follow.totalCount() | 123 | this.count = this.data_follow.totalCount() |
| @@ -135,49 +136,3 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -135,49 +136,3 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 135 | } | 136 | } |
| 136 | } | 137 | } |
| 137 | } | 138 | } |
| 138 | - | ||
| 139 | -@Component | ||
| 140 | -struct ChildFollowComponent { | ||
| 141 | - @ObjectLink data: FollowListDetailItem | ||
| 142 | - | ||
| 143 | - build() { | ||
| 144 | - Column(){ | ||
| 145 | - Blank().height('27lpx') | ||
| 146 | - | ||
| 147 | - Row() { | ||
| 148 | - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 149 | - .objectFit(ImageFit.Auto) | ||
| 150 | - .width('92lpx') | ||
| 151 | - .height('92lpx') | ||
| 152 | - .margin({right:'15lpx'}) | ||
| 153 | - | ||
| 154 | - Column(){ | ||
| 155 | - Text(this.data.cnUserName) | ||
| 156 | - .fontWeight('400lpx') | ||
| 157 | - .fontSize('31lpx') | ||
| 158 | - .lineHeight('38lpx') | ||
| 159 | - .fontColor($r('app.color.color_222222')) | ||
| 160 | - Text(`粉丝${this.data.cnFansNum}`) | ||
| 161 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 162 | - .fontSize('23lpx') | ||
| 163 | - .maxLines(1) | ||
| 164 | - Text(`${this.data.introduction}`) | ||
| 165 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 166 | - .fontSize('23lpx') | ||
| 167 | - .maxLines(2) | ||
| 168 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 169 | - }.layoutWeight(1) | ||
| 170 | - .alignItems(HorizontalAlign.Start) | ||
| 171 | - }.alignItems(VerticalAlign.Top) | ||
| 172 | - .width('100%') | ||
| 173 | - .layoutWeight(1) | ||
| 174 | - | ||
| 175 | - Divider().width('100%') | ||
| 176 | - .height('2lpx') | ||
| 177 | - .strokeWidth('1lpx') | ||
| 178 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 179 | - | ||
| 180 | - }.height('146lpx') | ||
| 181 | - .justifyContent(FlexAlign.Center) | ||
| 182 | - } | ||
| 183 | -} |
| @@ -18,12 +18,15 @@ export struct BottomNavigationComponent { | @@ -18,12 +18,15 @@ export struct BottomNavigationComponent { | ||
| 18 | @Provide bottomRectHeight: number = 0 | 18 | @Provide bottomRectHeight: number = 0 |
| 19 | @Provide topRectHeight: number = 0 | 19 | @Provide topRectHeight: number = 0 |
| 20 | @Provide isLayoutFullScreen: boolean = false | 20 | @Provide isLayoutFullScreen: boolean = false |
| 21 | + @Provide isImmersive: boolean = false // 是否开启沉浸式模式 http://192.168.1.3:3300/project/3802/interface/api/189229 | ||
| 22 | + @Provide isNight: boolean = false // 是否开启夜间模式 | ||
| 21 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | 23 | @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 |
| 22 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 24 | @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 23 | // 底导/顶导全部数据 | 25 | // 底导/顶导全部数据 |
| 24 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] | 26 | @State @Watch('onBottomNavigationDataUpdated') bottomNavList: BottomNavDTO[] = [] |
| 25 | // 底导当前选中/焦点下标 | 27 | // 底导当前选中/焦点下标 |
| 26 | @State currentNavIndex: number = BottomNavi.NEWS; | 28 | @State currentNavIndex: number = BottomNavi.NEWS; |
| 29 | + // @State currentTopNavSelectedIndex: number = 0; // | ||
| 27 | @State barBackgroundColor: Color = Color.Transparent | 30 | @State barBackgroundColor: Color = Color.Transparent |
| 28 | // 底导TabsController | 31 | // 底导TabsController |
| 29 | private navController: TabsController = new TabsController(); | 32 | private navController: TabsController = new TabsController(); |
| @@ -42,6 +45,8 @@ export struct BottomNavigationComponent { | @@ -42,6 +45,8 @@ export struct BottomNavigationComponent { | ||
| 42 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) | 45 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) |
| 43 | if (bottomNav && bottomNav.bottomNavList != null) { | 46 | if (bottomNav && bottomNav.bottomNavList != null) { |
| 44 | Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`); | 47 | Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`); |
| 48 | + // 使用filter方法移除name为'服务'的项 | ||
| 49 | + bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); | ||
| 45 | this.bottomNavList = bottomNav.bottomNavList | 50 | this.bottomNavList = bottomNav.bottomNavList |
| 46 | } | 51 | } |
| 47 | } | 52 | } |
| @@ -61,7 +66,7 @@ export struct BottomNavigationComponent { | @@ -61,7 +66,7 @@ export struct BottomNavigationComponent { | ||
| 61 | } else { | 66 | } else { |
| 62 | TopNavigationComponent({ | 67 | TopNavigationComponent({ |
| 63 | groupId: navItem.id, | 68 | groupId: navItem.id, |
| 64 | - topNavList: navItem.topNavChannelList, | 69 | + topNavList: navItem.topNavChannelList.filter(item => item.channelId != 2073), |
| 65 | _currentNavIndex: this.currentNavIndex, | 70 | _currentNavIndex: this.currentNavIndex, |
| 66 | changeBarBackgroundColor: (color: Color) => { | 71 | changeBarBackgroundColor: (color: Color) => { |
| 67 | this.barBackgroundColor = color | 72 | this.barBackgroundColor = color |
| @@ -2,19 +2,20 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' | @@ -2,19 +2,20 @@ import { CustomTitleAndEditUI } from '../reusable/CustomTitleAndEditUI' | ||
| 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; | 2 | import MyCollectionViewModel from '../../viewmodel/MyCollectionViewModel'; |
| 3 | import PageModel from '../../viewmodel/PageModel'; | 3 | import PageModel from '../../viewmodel/PageModel'; |
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | -import { EmptyComponent } from '../view/EmptyComponent' | 5 | +import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | import RefreshLayout from './RefreshLayout' | 7 | import RefreshLayout from './RefreshLayout' |
| 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; | 8 | import { RefreshLayoutBean } from './RefreshLayoutBean'; |
| 9 | import { CompDTO, ContentDTO } from 'wdBean' | 9 | import { CompDTO, ContentDTO } from 'wdBean' |
| 10 | import LoadMoreLayout from './LoadMoreLayout' | 10 | import LoadMoreLayout from './LoadMoreLayout' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 11 | import NoMoreLayout from './NoMoreLayout' |
| 12 | -import { CompParser } from '../CompParser' | ||
| 13 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | 12 | import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; |
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 13 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 14 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; | 15 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; |
| 17 | 16 | ||
| 17 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 18 | + | ||
| 18 | @Entry | 19 | @Entry |
| 19 | @Component | 20 | @Component |
| 20 | struct BrowsingHistoryPage { | 21 | struct BrowsingHistoryPage { |
| @@ -25,6 +26,8 @@ struct BrowsingHistoryPage { | @@ -25,6 +26,8 @@ struct BrowsingHistoryPage { | ||
| 25 | @State selectDatas :ContentDTO[] = []; | 26 | @State selectDatas :ContentDTO[] = []; |
| 26 | @Provide deleteNum :number = 0; | 27 | @Provide deleteNum :number = 0; |
| 27 | @Provide isAllSelect:boolean = false | 28 | @Provide isAllSelect:boolean = false |
| 29 | + private scroller: Scroller = new Scroller(); | ||
| 30 | + | ||
| 28 | aboutToAppear(){ | 31 | aboutToAppear(){ |
| 29 | this.getData() | 32 | this.getData() |
| 30 | } | 33 | } |
| @@ -37,15 +40,30 @@ struct BrowsingHistoryPage { | @@ -37,15 +40,30 @@ struct BrowsingHistoryPage { | ||
| 37 | this.selectDatas = [] | 40 | this.selectDatas = [] |
| 38 | this.deleteNum = 0 | 41 | this.deleteNum = 0 |
| 39 | }}) | 42 | }}) |
| 40 | - if (this.browSingModel.viewType == ViewType.LOADING){ | ||
| 41 | - this.LoadingLayout() | ||
| 42 | - }else if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 43 | - ErrorComponent() | ||
| 44 | - }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 45 | - EmptyComponent() | ||
| 46 | - }else { | ||
| 47 | - this.ListLayout() | ||
| 48 | - } | 43 | + |
| 44 | + // if (this.browSingModel.viewType == ViewType.LOADING){ | ||
| 45 | + // this.LoadingLayout() | ||
| 46 | + // }else if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 47 | + // ErrorComponent() | ||
| 48 | + // }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 49 | + EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoHistory}) | ||
| 50 | + // }else { | ||
| 51 | + // CustomPullToRefresh({ | ||
| 52 | + // alldata:this.allDatas, | ||
| 53 | + // scroller:this.scroller, | ||
| 54 | + // customList:()=>{ | ||
| 55 | + // this.ListLayout() | ||
| 56 | + // }, | ||
| 57 | + // onRefresh:(resolve)=>{ | ||
| 58 | + // this.browSingModel.currentPage = 0 | ||
| 59 | + // this.getData(resolve) | ||
| 60 | + // }, | ||
| 61 | + // onLoadMore:(resolve)=> { | ||
| 62 | + // this.browSingModel.currentPage++ | ||
| 63 | + // this.getData() | ||
| 64 | + // } | ||
| 65 | + // }) | ||
| 66 | + // } | ||
| 49 | 67 | ||
| 50 | if (this.isEditState){ | 68 | if (this.isEditState){ |
| 51 | CustomBottomFuctionUI({ | 69 | CustomBottomFuctionUI({ |
| @@ -64,34 +82,27 @@ struct BrowsingHistoryPage { | @@ -64,34 +82,27 @@ struct BrowsingHistoryPage { | ||
| 64 | } | 82 | } |
| 65 | 83 | ||
| 66 | @Builder ListLayout() { | 84 | @Builder ListLayout() { |
| 67 | - List() { | 85 | + List({scroller: this.scroller}) { |
| 68 | // 下拉刷新 | 86 | // 下拉刷新 |
| 69 | - ListItem() { | ||
| 70 | - RefreshLayout({ | ||
| 71 | - refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage, | ||
| 72 | - this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight) | ||
| 73 | - }) | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | 87 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 77 | ListItem() { | 88 | ListItem() { |
| 78 | this.newCompParser(compDTO,compIndex) | 89 | this.newCompParser(compDTO,compIndex) |
| 79 | } | 90 | } |
| 80 | }) | 91 | }) |
| 81 | - | ||
| 82 | // 加载更多 | 92 | // 加载更多 |
| 83 | ListItem() { | 93 | ListItem() { |
| 84 | if (this.browSingModel.hasMore) { | 94 | if (this.browSingModel.hasMore) { |
| 85 | - LoadMoreLayout({ | ||
| 86 | - refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage, | ||
| 87 | - this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight) | ||
| 88 | - }) | 95 | + // LoadMoreLayout({ |
| 96 | + // refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage, | ||
| 97 | + // this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight) | ||
| 98 | + // }) | ||
| 89 | } else { | 99 | } else { |
| 90 | NoMoreLayout() | 100 | NoMoreLayout() |
| 91 | } | 101 | } |
| 92 | } | 102 | } |
| 93 | } | 103 | } |
| 94 | .height(CommonConstants.FULL_PARENT) | 104 | .height(CommonConstants.FULL_PARENT) |
| 105 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 95 | } | 106 | } |
| 96 | 107 | ||
| 97 | @Builder | 108 | @Builder |
| @@ -117,9 +128,9 @@ struct BrowsingHistoryPage { | @@ -117,9 +128,9 @@ struct BrowsingHistoryPage { | ||
| 117 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) | 128 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) |
| 118 | } | 129 | } |
| 119 | 130 | ||
| 120 | - async getData() { | ||
| 121 | - this.browSingModel.currentPage = 1 | 131 | + async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 122 | MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | 132 | MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 133 | + if(resolve) resolve('刷新成功') | ||
| 123 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 134 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 124 | this.browSingModel.viewType = ViewType.LOADED; | 135 | this.browSingModel.viewType = ViewType.LOADED; |
| 125 | this.allDatas.push(...collectionItem.list) | 136 | this.allDatas.push(...collectionItem.list) |
| @@ -287,16 +287,6 @@ struct ChannelDialog { | @@ -287,16 +287,6 @@ struct ChannelDialog { | ||
| 287 | .height('100%') | 287 | .height('100%') |
| 288 | .justifyContent(FlexAlign.Center) | 288 | .justifyContent(FlexAlign.Center) |
| 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') | 289 | .backgroundColor(item.homeChannel === '1' || item.movePermitted === 0 ? '#F5F5F5' : '#ffffff') |
| 290 | - .onClick(() => { | ||
| 291 | - if (this.isEditIng) { | ||
| 292 | - if (item.delPermitted === 1) { | ||
| 293 | - this.delChannelItem(index) | ||
| 294 | - } | ||
| 295 | - } else { | ||
| 296 | - this.confirm(index) | ||
| 297 | - this.controller?.close() | ||
| 298 | - } | ||
| 299 | - }) | ||
| 300 | } | 290 | } |
| 301 | .width('23%') | 291 | .width('23%') |
| 302 | .height(40) | 292 | .height(40) |
| @@ -307,9 +297,19 @@ struct ChannelDialog { | @@ -307,9 +297,19 @@ struct ChannelDialog { | ||
| 307 | }) | 297 | }) |
| 308 | .zIndex(this.dragItem == item.num ? 1 : 0) | 298 | .zIndex(this.dragItem == item.num ? 1 : 0) |
| 309 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) | 299 | .translate(this.dragItem == item.num ? { x: this.offsetX, y: this.offsetY } : { x: 0, y: 0 }) |
| 310 | - | ||
| 311 | .gesture( | 300 | .gesture( |
| 312 | - GestureGroup(GestureMode.Sequence, | 301 | + GestureGroup(GestureMode.Parallel, |
| 302 | + TapGesture() | ||
| 303 | + .onAction((event?: GestureEvent) => { | ||
| 304 | + if (this.isEditIng) { | ||
| 305 | + if (item.delPermitted === 1) { | ||
| 306 | + this.delChannelItem(index) | ||
| 307 | + } | ||
| 308 | + } else { | ||
| 309 | + this.confirm(index) | ||
| 310 | + this.controller?.close() | ||
| 311 | + } | ||
| 312 | + }), | ||
| 313 | PanGesture({ fingers: 1, direction: null, distance: 0 }) | 313 | PanGesture({ fingers: 1, direction: null, distance: 0 }) |
| 314 | .onActionStart((event: GestureEvent) => { | 314 | .onActionStart((event: GestureEvent) => { |
| 315 | this.dragItem = item.num | 315 | this.dragItem = item.num |
| @@ -330,8 +330,7 @@ struct ChannelDialog { | @@ -330,8 +330,7 @@ struct ChannelDialog { | ||
| 330 | this.dragRefOffsetY = 0 | 330 | this.dragRefOffsetY = 0 |
| 331 | }) | 331 | }) |
| 332 | }) | 332 | }) |
| 333 | - ) | ||
| 334 | - .onCancel(() => { | 333 | + ).onCancel(() => { |
| 335 | animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { | 334 | animateTo({ curve: curves.interpolatingSpring(0, 1, 400, 38) }, () => { |
| 336 | this.dragItem = -1 | 335 | this.dragItem = -1 |
| 337 | this.offsetX = 0 | 336 | this.offsetX = 0 |
| @@ -339,8 +338,8 @@ struct ChannelDialog { | @@ -339,8 +338,8 @@ struct ChannelDialog { | ||
| 339 | this.dragRefOffsetX = 0 | 338 | this.dragRefOffsetX = 0 |
| 340 | this.dragRefOffsetY = 0 | 339 | this.dragRefOffsetY = 0 |
| 341 | }) | 340 | }) |
| 342 | - })) | ||
| 343 | - | 341 | + }) |
| 342 | + ) | ||
| 344 | }, (item: TopNavDTO) => JSON.stringify(item)) | 343 | }, (item: TopNavDTO) => JSON.stringify(item)) |
| 345 | } | 344 | } |
| 346 | .width('100%') | 345 | .width('100%') |
| @@ -127,7 +127,8 @@ struct EditUserInfoPage { | @@ -127,7 +127,8 @@ struct EditUserInfoPage { | ||
| 127 | lunar:false, | 127 | lunar:false, |
| 128 | onAccept:(value:DatePickerResult) => { | 128 | onAccept:(value:DatePickerResult) => { |
| 129 | let mon = value.month as number + 1 | 129 | let mon = value.month as number + 1 |
| 130 | - this.currentUserInfo.userExtend.birthday = value.year+'-'+mon.toString()+'-'+value.day; | 130 | + let monStr = mon < 10? '0'+mon.toString():mon.toString(); |
| 131 | + this.currentUserInfo.userExtend.birthday = value.year+'-'+monStr+'-'+value.day; | ||
| 131 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday | 132 | this.currentUserInfo.editDataType = WDEditDataModelType.WDEditDataModelType_birthday |
| 132 | this.updateEditModel() | 133 | this.updateEditModel() |
| 133 | } | 134 | } |
| @@ -171,8 +172,10 @@ struct EditUserInfoPage { | @@ -171,8 +172,10 @@ struct EditUserInfoPage { | ||
| 171 | 172 | ||
| 172 | updateEditModel(){ | 173 | updateEditModel(){ |
| 173 | this.listData = [] | 174 | this.listData = [] |
| 174 | - this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) | ||
| 175 | - EditInfoViewModel.updateUserInfo(this.currentUserInfo) | 175 | + // this.listData.push(...EditInfoViewModel.getEditListInfo(this.currentUserInfo)) |
| 176 | + EditInfoViewModel.updateUserInfo(this.currentUserInfo).then(()=>{ | ||
| 177 | + this.getAccountOwnerInfo() | ||
| 178 | + }) | ||
| 176 | } | 179 | } |
| 177 | getAccountOwnerInfo(){ | 180 | getAccountOwnerInfo(){ |
| 178 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { | 181 | EditInfoViewModel.queryAccountOwnerInfo(1,getContext(this)).then((editModel) => { |
| @@ -4,17 +4,13 @@ import PageModel from '../../viewmodel/PageModel'; | @@ -4,17 +4,13 @@ import PageModel from '../../viewmodel/PageModel'; | ||
| 4 | import { CommonConstants, ViewType } from 'wdConstant' | 4 | import { CommonConstants, ViewType } from 'wdConstant' |
| 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' | 5 | import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent' |
| 6 | import { ErrorComponent } from '../view/ErrorComponent' | 6 | import { ErrorComponent } from '../view/ErrorComponent' |
| 7 | -import RefreshLayout from './RefreshLayout' | ||
| 8 | -import { RefreshLayoutBean } from './RefreshLayoutBean'; | ||
| 9 | -import { CompDTO, ContentDTO } from 'wdBean' | ||
| 10 | -import LoadMoreLayout from './LoadMoreLayout' | 7 | +import { ContentDTO } from 'wdBean' |
| 11 | import NoMoreLayout from './NoMoreLayout' | 8 | import NoMoreLayout from './NoMoreLayout' |
| 12 | -import { CompParser } from '../CompParser' | ||
| 13 | -import CustomRefreshLoadLayout from './CustomRefreshLoadLayout'; | ||
| 14 | import { CustomSelectUI } from '../view/CustomSelectUI'; | 9 | import { CustomSelectUI } from '../view/CustomSelectUI'; |
| 15 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; | 10 | import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI'; |
| 16 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; | 11 | import { BigPicCardComponent } from '../view/BigPicCardComponent'; |
| 17 | import { contentListItemParams } from '../../model/MyCollectionModel'; | 12 | import { contentListItemParams } from '../../model/MyCollectionModel'; |
| 13 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh'; | ||
| 18 | 14 | ||
| 19 | @Entry | 15 | @Entry |
| 20 | @Component | 16 | @Component |
| @@ -26,6 +22,10 @@ struct MyCollectionListPage { | @@ -26,6 +22,10 @@ struct MyCollectionListPage { | ||
| 26 | @State selectDatas :ContentDTO[] = []; | 22 | @State selectDatas :ContentDTO[] = []; |
| 27 | @Provide deleteNum :number = 0; | 23 | @Provide deleteNum :number = 0; |
| 28 | @Provide isAllSelect:boolean = false | 24 | @Provide isAllSelect:boolean = false |
| 25 | + | ||
| 26 | + @State currentPage: number = 1; | ||
| 27 | + private scroller: Scroller = new Scroller(); | ||
| 28 | + | ||
| 29 | aboutToAppear(){ | 29 | aboutToAppear(){ |
| 30 | this.getData() | 30 | this.getData() |
| 31 | } | 31 | } |
| @@ -38,17 +38,35 @@ struct MyCollectionListPage { | @@ -38,17 +38,35 @@ struct MyCollectionListPage { | ||
| 38 | this.selectDatas = [] | 38 | this.selectDatas = [] |
| 39 | this.deleteNum = 0 | 39 | this.deleteNum = 0 |
| 40 | }}) | 40 | }}) |
| 41 | - if (this.browSingModel.viewType == ViewType.LOADING){ | ||
| 42 | - this.LoadingLayout() | ||
| 43 | - }else if(this.browSingModel.viewType == ViewType.ERROR){ | 41 | + |
| 42 | + if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 44 | ErrorComponent() | 43 | ErrorComponent() |
| 45 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ | 44 | }else if(this.browSingModel.viewType == ViewType.EMPTY){ |
| 46 | EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection}) | 45 | EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection}) |
| 47 | }else { | 46 | }else { |
| 47 | + CustomPullToRefresh({ | ||
| 48 | + alldata:this.allDatas, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 48 | this.ListLayout() | 51 | this.ListLayout() |
| 52 | + }, | ||
| 53 | + onRefresh:(resolve)=>{ | ||
| 54 | + this.currentPage = 1 | ||
| 55 | + this.getData(resolve) | ||
| 56 | + }, | ||
| 57 | + onLoadMore:(resolve)=> { | ||
| 58 | + if (this.browSingModel.hasMore === false) { | ||
| 59 | + if(resolve) resolve('') | ||
| 60 | + return | ||
| 61 | + } | ||
| 62 | + this.currentPage++ | ||
| 63 | + this.getData(resolve) | ||
| 64 | + } | ||
| 65 | + }) | ||
| 49 | } | 66 | } |
| 50 | 67 | ||
| 51 | if (this.isEditState){ | 68 | if (this.isEditState){ |
| 69 | + Stack(){ | ||
| 52 | CustomBottomFuctionUI({ | 70 | CustomBottomFuctionUI({ |
| 53 | selectAllCallback:(isAllSelect)=>{ | 71 | selectAllCallback:(isAllSelect)=>{ |
| 54 | this.allSelectDatas(isAllSelect) | 72 | this.allSelectDatas(isAllSelect) |
| @@ -57,7 +75,7 @@ struct MyCollectionListPage { | @@ -57,7 +75,7 @@ struct MyCollectionListPage { | ||
| 57 | this.deleteDatas() | 75 | this.deleteDatas() |
| 58 | } | 76 | } |
| 59 | }) | 77 | }) |
| 60 | - .position({y:'92%'}) | 78 | + }.position({y:'92%'}) |
| 61 | } | 79 | } |
| 62 | } | 80 | } |
| 63 | .width(CommonConstants.FULL_WIDTH) | 81 | .width(CommonConstants.FULL_WIDTH) |
| @@ -65,34 +83,19 @@ struct MyCollectionListPage { | @@ -65,34 +83,19 @@ struct MyCollectionListPage { | ||
| 65 | } | 83 | } |
| 66 | 84 | ||
| 67 | @Builder ListLayout() { | 85 | @Builder ListLayout() { |
| 68 | - List() { | ||
| 69 | - // 下拉刷新 | ||
| 70 | - ListItem() { | ||
| 71 | - RefreshLayout({ | ||
| 72 | - refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage, | ||
| 73 | - this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight) | ||
| 74 | - }) | ||
| 75 | - } | ||
| 76 | - | 86 | + List({scroller: this.scroller}) { |
| 77 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | 87 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 78 | ListItem() { | 88 | ListItem() { |
| 79 | this.newCompParser(compDTO,compIndex) | 89 | this.newCompParser(compDTO,compIndex) |
| 80 | } | 90 | } |
| 81 | }) | 91 | }) |
| 82 | - | ||
| 83 | // 加载更多 | 92 | // 加载更多 |
| 84 | ListItem() { | 93 | ListItem() { |
| 85 | - if (this.browSingModel.hasMore) { | ||
| 86 | - LoadMoreLayout({ | ||
| 87 | - refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage, | ||
| 88 | - this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight) | ||
| 89 | - }) | ||
| 90 | - } else { | ||
| 91 | - NoMoreLayout() | ||
| 92 | - } | 94 | + if (this.browSingModel.hasMore === false) NoMoreLayout() |
| 93 | } | 95 | } |
| 94 | } | 96 | } |
| 95 | .height(CommonConstants.FULL_PARENT) | 97 | .height(CommonConstants.FULL_PARENT) |
| 98 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 96 | } | 99 | } |
| 97 | 100 | ||
| 98 | @Builder | 101 | @Builder |
| @@ -113,26 +116,26 @@ struct MyCollectionListPage { | @@ -113,26 +116,26 @@ struct MyCollectionListPage { | ||
| 113 | } | 116 | } |
| 114 | } | 117 | } |
| 115 | 118 | ||
| 116 | - @Builder LoadingLayout() { | ||
| 117 | - CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true, | ||
| 118 | - $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) | ||
| 119 | - } | ||
| 120 | - | ||
| 121 | - async getData() { | ||
| 122 | - this.browSingModel.currentPage = 1 | ||
| 123 | - MyCollectionViewModel.fetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | 119 | + async getData(resolve?: (value: string | PromiseLike<string>) => void) { |
| 120 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 121 | + if(resolve) resolve('刷新成功') | ||
| 124 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 122 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 125 | - this.browSingModel.viewType = ViewType.LOADED; | 123 | + if (this.currentPage === 1) { |
| 124 | + this.allDatas = [] | ||
| 126 | this.allDatas.push(...collectionItem.list) | 125 | this.allDatas.push(...collectionItem.list) |
| 127 | - if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 128 | - this.browSingModel.currentPage++; | ||
| 129 | - this.browSingModel.hasMore = true; | ||
| 130 | - } else { | 126 | + }else { |
| 127 | + this.allDatas = this.allDatas.concat(...collectionItem.list) | ||
| 128 | + } | ||
| 129 | + if (collectionItem.hasNext === 0) { | ||
| 131 | this.browSingModel.hasMore = false; | 130 | this.browSingModel.hasMore = false; |
| 131 | + } else { | ||
| 132 | + this.browSingModel.hasMore = true; | ||
| 132 | } | 133 | } |
| 133 | } else { | 134 | } else { |
| 135 | + if (this.currentPage === 1) { | ||
| 134 | this.browSingModel.viewType = ViewType.EMPTY; | 136 | this.browSingModel.viewType = ViewType.EMPTY; |
| 135 | } | 137 | } |
| 138 | + } | ||
| 136 | }) | 139 | }) |
| 137 | } | 140 | } |
| 138 | 141 |
| @@ -19,7 +19,6 @@ import { | @@ -19,7 +19,6 @@ import { | ||
| 19 | struct PeopleShipHomePage { | 19 | struct PeopleShipHomePage { |
| 20 | // Todo 传入数据 后续在修改 | 20 | // Todo 传入数据 后续在修改 |
| 21 | creatorId: string = (router.getParams() as Record<string, string>)['creatorId']; | 21 | creatorId: string = (router.getParams() as Record<string, string>)['creatorId']; |
| 22 | - @State arr: number[] = [] | ||
| 23 | // 页面详情数据 | 22 | // 页面详情数据 |
| 24 | @Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData | 23 | @Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData |
| 25 | // 每个分类数量 | 24 | // 每个分类数量 |
| @@ -108,9 +107,12 @@ struct PeopleShipHomePage { | @@ -108,9 +107,12 @@ struct PeopleShipHomePage { | ||
| 108 | Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`) | 107 | Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`) |
| 109 | 108 | ||
| 110 | // 获取关注 | 109 | // 获取关注 |
| 110 | + // 登录后获取,是否关注 | ||
| 111 | + if (HttpUrlUtils.getUserId()) { | ||
| 111 | let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) | 112 | let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) |
| 112 | Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) | 113 | Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) |
| 113 | this.findFollowStata(followList) | 114 | this.findFollowStata(followList) |
| 115 | + } | ||
| 114 | 116 | ||
| 115 | } catch (exception) { | 117 | } catch (exception) { |
| 116 | 118 | ||
| @@ -128,14 +130,17 @@ struct PeopleShipHomePage { | @@ -128,14 +130,17 @@ struct PeopleShipHomePage { | ||
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | handleChangeAttentionStata() { | 132 | handleChangeAttentionStata() { |
| 133 | + | ||
| 131 | if (!this.isLoadingAttention) { | 134 | if (!this.isLoadingAttention) { |
| 132 | return | 135 | return |
| 133 | } | 136 | } |
| 134 | // 未登录,跳转登录 | 137 | // 未登录,跳转登录 |
| 135 | if (!HttpUrlUtils.getUserId()) { | 138 | if (!HttpUrlUtils.getUserId()) { |
| 139 | + this.isLoadingAttention = false | ||
| 136 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 140 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 137 | return | 141 | return |
| 138 | } | 142 | } |
| 143 | + | ||
| 139 | let status = 0 | 144 | let status = 0 |
| 140 | if (this.isAttention == '0') { | 145 | if (this.isAttention == '0') { |
| 141 | status = 1 | 146 | status = 1 |
| @@ -151,36 +151,25 @@ export struct TopNavigationComponent { | @@ -151,36 +151,25 @@ export struct TopNavigationComponent { | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | indexChange() { | 153 | indexChange() { |
| 154 | - if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex === 0 && this.changeBarBackgroundColor) { | ||
| 155 | - this.barBackgroundColor = Color.Black | ||
| 156 | - this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 157 | - } else { | ||
| 158 | - this.barBackgroundColor = Color.Transparent | ||
| 159 | - this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 160 | - } | ||
| 161 | 154 | ||
| 155 | + // 判断视频频道待处理 | ||
| 162 | if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) { | 156 | if (this._currentNavIndex === 2 && this.currentTopNavSelectedIndex == 0) { |
| 163 | - if (!this.isLayoutFullScreen) { | ||
| 164 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 165 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 166 | - windowClass.setWindowLayoutFullScreen(true).then(() => { | 157 | + this.barBackgroundColor = Color.Black |
| 158 | + this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 159 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 160 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 167 | this.isLayoutFullScreen = true | 161 | this.isLayoutFullScreen = true |
| 168 | this.bottomRectHeight = this.bottomSafeHeight | 162 | this.bottomRectHeight = this.bottomSafeHeight |
| 169 | this.topRectHeight = this.topSafeHeight | 163 | this.topRectHeight = this.topSafeHeight |
| 170 | - }) | ||
| 171 | - } | ||
| 172 | 164 | ||
| 173 | } else { | 165 | } else { |
| 174 | - if (this.isLayoutFullScreen) { | ||
| 175 | - const windowStage = WindowModel.shared.getWindowStage() as window.WindowStage | ||
| 176 | - const windowClass: window.Window = windowStage.getMainWindowSync(); // 获取应用主窗口 | ||
| 177 | - windowClass.setWindowLayoutFullScreen(false).then(() => { | 166 | + this.barBackgroundColor = Color.Transparent |
| 167 | + this.changeBarBackgroundColor && this.changeBarBackgroundColor(this.barBackgroundColor) | ||
| 168 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 169 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 178 | this.isLayoutFullScreen = false | 170 | this.isLayoutFullScreen = false |
| 179 | this.bottomRectHeight = 0 | 171 | this.bottomRectHeight = 0 |
| 180 | this.topRectHeight = 0 | 172 | this.topRectHeight = 0 |
| 181 | - console.error(' this.isLayoutFullScreen ', this.isLayoutFullScreen) | ||
| 182 | - }) | ||
| 183 | - } | ||
| 184 | } | 173 | } |
| 185 | } | 174 | } |
| 186 | 175 |
| @@ -20,24 +20,26 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | @@ -20,24 +20,26 @@ import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | 20 | import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' |
| 21 | import { ErrorComponent } from '../view/ErrorComponent'; | 21 | import { ErrorComponent } from '../view/ErrorComponent'; |
| 22 | import NoMoreLayout from '../page/NoMoreLayout'; | 22 | import NoMoreLayout from '../page/NoMoreLayout'; |
| 23 | -import { LazyDataSource } from 'wdKit'; | 23 | +// import { LazyDataSource } from 'wdKit'; |
| 24 | +import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh' | ||
| 24 | 25 | ||
| 25 | const TAG = 'PeopleShipHomeArticleListComponent'; | 26 | const TAG = 'PeopleShipHomeArticleListComponent'; |
| 26 | 27 | ||
| 27 | @Component | 28 | @Component |
| 28 | export struct PeopleShipHomeArticleListComponent { | 29 | export struct PeopleShipHomeArticleListComponent { |
| 29 | - // @State arr: ContentDTO[] = [] | ||
| 30 | - @State arr: LazyDataSource<ContentDTO> = new LazyDataSource(); | 30 | + @State arr: ContentDTO[] = [] |
| 31 | + // @State arr: LazyDataSource<ContentDTO> = new LazyDataSource(); | ||
| 31 | @State typeModel: ArticleTypeData = new ArticleTypeData() | 32 | @State typeModel: ArticleTypeData = new ArticleTypeData() |
| 32 | @State creatorId: string = '' | 33 | @State creatorId: string = '' |
| 33 | @Consume detailModel: PeopleShipUserDetailData | 34 | @Consume detailModel: PeopleShipUserDetailData |
| 34 | - @State private viewType: number = 1; | ||
| 35 | - currentIndex: number = 0 | 35 | + @State private viewType: number = 1 |
| 36 | + currentIndex: number = 1 | ||
| 36 | @Link @Watch('onChange') currentTopSelectedIndex: number | 37 | @Link @Watch('onChange') currentTopSelectedIndex: number |
| 37 | @State private hasMore: boolean = true | 38 | @State private hasMore: boolean = true |
| 38 | - @State currentPage: number = 1 | 39 | + @State private currentPage: number = 1 |
| 39 | @State private isLoading: boolean = false | 40 | @State private isLoading: boolean = false |
| 40 | @Consume topHeight: number | 41 | @Consume topHeight: number |
| 42 | + private scroller: Scroller = new Scroller() | ||
| 41 | 43 | ||
| 42 | build() { | 44 | build() { |
| 43 | if (this.viewType == 1) { | 45 | if (this.viewType == 1) { |
| @@ -46,7 +48,34 @@ export struct PeopleShipHomeArticleListComponent { | @@ -46,7 +48,34 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 46 | } else if (this.viewType == 2) { | 48 | } else if (this.viewType == 2) { |
| 47 | ErrorComponent() | 49 | ErrorComponent() |
| 48 | } else { | 50 | } else { |
| 51 | + CustomPullToRefresh({ | ||
| 52 | + alldata:this.arr, | ||
| 53 | + scroller:this.scroller, | ||
| 54 | + hasMore: this.hasMore, | ||
| 55 | + customList:()=>{ | ||
| 49 | this.ListLayout() | 56 | this.ListLayout() |
| 57 | + }, | ||
| 58 | + onRefresh:(resolve)=>{ | ||
| 59 | + this.currentPage = 1 | ||
| 60 | + this.getPeopleShipPageArticleList(resolve) | ||
| 61 | + }, | ||
| 62 | + onLoadMore:(resolve)=> { | ||
| 63 | + if (this.hasMore === false) { | ||
| 64 | + if(resolve) { | ||
| 65 | + resolve('') | ||
| 66 | + } | ||
| 67 | + return | ||
| 68 | + } | ||
| 69 | + if(!this.isLoading && this.hasMore){ | ||
| 70 | + //加载分页数据 | ||
| 71 | + this.getPeopleShipPageArticleList(resolve) | ||
| 72 | + }else { | ||
| 73 | + if(resolve) { | ||
| 74 | + resolve('') | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + }, | ||
| 78 | + }) | ||
| 50 | } | 79 | } |
| 51 | 80 | ||
| 52 | } | 81 | } |
| @@ -62,10 +91,10 @@ export struct PeopleShipHomeArticleListComponent { | @@ -62,10 +91,10 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 62 | @Builder | 91 | @Builder |
| 63 | ListLayout() { | 92 | ListLayout() { |
| 64 | 93 | ||
| 65 | - List() { | 94 | + List({scroller: this.scroller}) { |
| 66 | // 下拉刷新 | 95 | // 下拉刷新 |
| 67 | 96 | ||
| 68 | - LazyForEach(this.arr, (item: ContentDTO) => { | 97 | + ForEach(this.arr, (item: ContentDTO) => { |
| 69 | ListItem() { | 98 | ListItem() { |
| 70 | CardParser({ contentDTO: item }) | 99 | CardParser({ contentDTO: item }) |
| 71 | }.width("100%") | 100 | }.width("100%") |
| @@ -74,25 +103,25 @@ export struct PeopleShipHomeArticleListComponent { | @@ -74,25 +103,25 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 74 | 103 | ||
| 75 | // 加载更多 | 104 | // 加载更多 |
| 76 | ListItem() { | 105 | ListItem() { |
| 77 | - if (!this.hasMore) { | 106 | + if (!this.hasMore && !this.isLoading) { |
| 78 | NoMoreLayout() | 107 | NoMoreLayout() |
| 79 | } | 108 | } |
| 80 | } | 109 | } |
| 81 | } | 110 | } |
| 82 | .width("100%") | 111 | .width("100%") |
| 83 | .height("100%") | 112 | .height("100%") |
| 84 | - .edgeEffect(EdgeEffect.Spring) | 113 | + .edgeEffect(EdgeEffect.None) |
| 85 | .nestedScroll({ | 114 | .nestedScroll({ |
| 86 | scrollForward: NestedScrollMode.PARENT_FIRST, | 115 | scrollForward: NestedScrollMode.PARENT_FIRST, |
| 87 | scrollBackward: NestedScrollMode.SELF_FIRST | 116 | scrollBackward: NestedScrollMode.SELF_FIRST |
| 88 | }) | 117 | }) |
| 89 | 118 | ||
| 90 | - .onReachEnd(() => { | ||
| 91 | - if(!this.isLoading && this.hasMore){ | ||
| 92 | - //加载分页数据 | ||
| 93 | - this.getPeopleShipPageArticleList() | ||
| 94 | - } | ||
| 95 | - }) | 119 | + // .onReachEnd(() => { |
| 120 | + // if(!this.isLoading && this.hasMore){ | ||
| 121 | + // //加载分页数据 | ||
| 122 | + // this.getPeopleShipPageArticleList() | ||
| 123 | + // } | ||
| 124 | + // }) | ||
| 96 | } | 125 | } |
| 97 | 126 | ||
| 98 | aboutToAppear() { | 127 | aboutToAppear() { |
| @@ -109,16 +138,28 @@ export struct PeopleShipHomeArticleListComponent { | @@ -109,16 +138,28 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 109 | } | 138 | } |
| 110 | } | 139 | } |
| 111 | 140 | ||
| 112 | - private async getPeopleShipPageArticleList() { | 141 | + |
| 142 | + private async getPeopleShipPageArticleList(resolve?: (value: string | PromiseLike<string>) => void) { | ||
| 113 | Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`) | 143 | Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`) |
| 114 | if (this.isLoading) { | 144 | if (this.isLoading) { |
| 145 | + if (resolve) { | ||
| 146 | + resolve('') | ||
| 147 | + } | ||
| 115 | return | 148 | return |
| 116 | } | 149 | } |
| 117 | try { | 150 | try { |
| 118 | this.isLoading = true | 151 | this.isLoading = true |
| 119 | let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type) | 152 | let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type) |
| 120 | Logger.debug(TAG, `获取页面信息, ${listData.list.length}`); | 153 | Logger.debug(TAG, `获取页面信息, ${listData.list.length}`); |
| 154 | + Logger.debug(TAG, `已更新值最新, ${this.currentPage}`); | ||
| 121 | 155 | ||
| 156 | + if (resolve ) { | ||
| 157 | + if (this.currentPage == 1) { | ||
| 158 | + resolve('已更新至最新') | ||
| 159 | + }else { | ||
| 160 | + resolve('') | ||
| 161 | + } | ||
| 162 | + } | ||
| 122 | if (listData && listData.list && listData.list.length > 0) { | 163 | if (listData && listData.list && listData.list.length > 0) { |
| 123 | this.viewType = 3; | 164 | this.viewType = 3; |
| 124 | if (listData.list.length === 20) { | 165 | if (listData.list.length === 20) { |
| @@ -130,15 +171,18 @@ export struct PeopleShipHomeArticleListComponent { | @@ -130,15 +171,18 @@ export struct PeopleShipHomeArticleListComponent { | ||
| 130 | } else { | 171 | } else { |
| 131 | this.viewType = 1; | 172 | this.viewType = 1; |
| 132 | } | 173 | } |
| 174 | + this.isLoading = false | ||
| 133 | this.queryArticleContentInteractCount(listData) | 175 | this.queryArticleContentInteractCount(listData) |
| 134 | - Logger.debug(TAG, '展示的总数', `${this.arr.totalCount()}`) | 176 | + Logger.debug(TAG, '展示的总数', `${this.arr.length}`) |
| 135 | }catch (exception) { | 177 | }catch (exception) { |
| 178 | + if (resolve) { | ||
| 179 | + resolve('') | ||
| 180 | + } | ||
| 136 | this.isLoading = false | 181 | this.isLoading = false |
| 137 | - if (this.arr.totalCount() == 0) { | 182 | + if (this.arr.length == 0) { |
| 138 | this.viewType = 2 | 183 | this.viewType = 2 |
| 139 | } | 184 | } |
| 140 | } | 185 | } |
| 141 | - | ||
| 142 | } | 186 | } |
| 143 | 187 | ||
| 144 | /** | 188 | /** |
| @@ -15,13 +15,13 @@ export struct PeopleShipHomePageHeadComponent { | @@ -15,13 +15,13 @@ export struct PeopleShipHomePageHeadComponent { | ||
| 15 | .borderWidth('1vp') | 15 | .borderWidth('1vp') |
| 16 | .borderStyle(BorderStyle.Solid) | 16 | .borderStyle(BorderStyle.Solid) |
| 17 | .borderColor(Color.White) | 17 | .borderColor(Color.White) |
| 18 | - .objectFit(ImageFit.Auto) | 18 | + .objectFit(ImageFit.Cover) |
| 19 | if(this.authIcon.length > 0 ) { | 19 | if(this.authIcon.length > 0 ) { |
| 20 | Image( this.authIcon ) | 20 | Image( this.authIcon ) |
| 21 | .width(this.iconDiameter) | 21 | .width(this.iconDiameter) |
| 22 | .height(this.iconDiameter) | 22 | .height(this.iconDiameter) |
| 23 | .borderRadius(this.iconDiameter/2) | 23 | .borderRadius(this.iconDiameter/2) |
| 24 | - .objectFit(ImageFit.Auto) | 24 | + .objectFit(ImageFit.Cover) |
| 25 | .margin({ | 25 | .margin({ |
| 26 | right: '-3vp' | 26 | right: '-3vp' |
| 27 | }) | 27 | }) |
sight_harmony/features/wdComponent/src/main/ets/components/reusable/CustomPullToRefresh.ets
0 → 100644
| 1 | +import { PullToRefresh, PullToRefreshConfigurator } from '@ohos/pulltorefresh'; | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct CustomPullToRefresh { | ||
| 5 | + @Link alldata: Object[]; | ||
| 6 | + scroller: Scroller = new Scroller(); | ||
| 7 | + @BuilderParam customList: () => void; | ||
| 8 | + onRefresh: (resolve?: (value: string | PromiseLike<string>) => void) => void = () => { | ||
| 9 | + } | ||
| 10 | + onLoadMore: (resolve?: (value: string | PromiseLike<string>) => void) => void = () => { | ||
| 11 | + } | ||
| 12 | + ///是否存在上拉更多 | ||
| 13 | + @Prop hasMore: boolean = true | ||
| 14 | + refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator().setHasLoadMore(this.hasMore); | ||
| 15 | + build() { | ||
| 16 | + Column(){ | ||
| 17 | + PullToRefresh({ | ||
| 18 | + data:this.alldata, | ||
| 19 | + scroller:this.scroller, | ||
| 20 | + refreshConfigurator:this.refreshConfigurator, | ||
| 21 | + customList:()=>{ | ||
| 22 | + this.customList(); | ||
| 23 | + }, | ||
| 24 | + onRefresh:()=>{ | ||
| 25 | + return new Promise<string>((resolve, reject) => { | ||
| 26 | + this.onRefresh(resolve) | ||
| 27 | + }); | ||
| 28 | + }, | ||
| 29 | + onLoadMore:()=>{ | ||
| 30 | + return new Promise<string>((resolve, reject) => { | ||
| 31 | + this.onLoadMore(resolve) | ||
| 32 | + }); | ||
| 33 | + }, | ||
| 34 | + customLoad: null, | ||
| 35 | + customRefresh: null, | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | +} |
| 1 | +import { ToastUtils } from 'wdKit/Index' | ||
| 2 | +import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | ||
| 1 | import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | 3 | import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' |
| 2 | 4 | ||
| 3 | @Component | 5 | @Component |
| @@ -21,5 +23,19 @@ export struct SearchCreatorComponent{ | @@ -21,5 +23,19 @@ export struct SearchCreatorComponent{ | ||
| 21 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 23 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 22 | }.alignItems(HorizontalAlign.Center) | 24 | }.alignItems(HorizontalAlign.Center) |
| 23 | .justifyContent(FlexAlign.Center) | 25 | .justifyContent(FlexAlign.Center) |
| 26 | + .onClick(()=>{ | ||
| 27 | + this.jumpCreatorHomePage() | ||
| 28 | + }) | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + jumpCreatorHomePage() { | ||
| 32 | + if(Number.parseInt(this.item.mainControl) === 0){ | ||
| 33 | + ToastUtils.shortToast("无法查看此用户主页") | ||
| 34 | + }else if(Number.parseInt(this.item.banControl) === 1){ | ||
| 35 | + ToastUtils.shortToast("该账号已封禁,不予访问") | ||
| 36 | + }else{ | ||
| 37 | + let params = {'creatorId': this.item.id} as Record<string, string>; | ||
| 38 | + WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params) | ||
| 39 | + } | ||
| 24 | } | 40 | } |
| 25 | } | 41 | } |
| @@ -72,6 +72,7 @@ export struct SearchResultContentComponent{ | @@ -72,6 +72,7 @@ export struct SearchResultContentComponent{ | ||
| 72 | value.forEach((item)=>{ | 72 | value.forEach((item)=>{ |
| 73 | if(data.creatorId == item.creatorId){ | 73 | if(data.creatorId == item.creatorId){ |
| 74 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] | 74 | data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] |
| 75 | + data.mainControl = item.mainControl+"" | ||
| 75 | } | 76 | } |
| 76 | }) | 77 | }) |
| 77 | }) | 78 | }) |
| 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; | 1 | import { BottomNavi, CommonConstants, SpConstants } from 'wdConstant'; |
| 2 | -import { Logger, SPHelper } from 'wdKit'; | 2 | +import { Logger, SPHelper, StringUtils } from 'wdKit'; |
| 3 | import PageViewModel from '../../viewmodel/PageViewModel'; | 3 | import PageViewModel from '../../viewmodel/PageViewModel'; |
| 4 | import storageStatistics from "@ohos.file.storageStatistics"; | 4 | import storageStatistics from "@ohos.file.storageStatistics"; |
| 5 | import { BusinessError } from '@ohos.base'; | 5 | import { BusinessError } from '@ohos.base'; |
| @@ -12,7 +12,7 @@ import { CustomCacheDialog } from './CustomCacheDialog'; | @@ -12,7 +12,7 @@ import { CustomCacheDialog } from './CustomCacheDialog'; | ||
| 12 | import MineSettingDatasModel from '../../model/MineSettingDatasModel'; | 12 | import MineSettingDatasModel from '../../model/MineSettingDatasModel'; |
| 13 | import { MineMainSettingFunctionItem } from '../../viewmodel/MineMainSettingFunctionItem'; | 13 | import { MineMainSettingFunctionItem } from '../../viewmodel/MineMainSettingFunctionItem'; |
| 14 | import common from '@ohos.app.ability.common'; | 14 | import common from '@ohos.app.ability.common'; |
| 15 | - | 15 | +import dataPreferences from '@ohos.data.preferences'; |
| 16 | 16 | ||
| 17 | @Component | 17 | @Component |
| 18 | export struct MineSettingComponent { | 18 | export struct MineSettingComponent { |
| @@ -21,6 +21,7 @@ export struct MineSettingComponent { | @@ -21,6 +21,7 @@ export struct MineSettingComponent { | ||
| 21 | @State privacySwitch: boolean = false | 21 | @State privacySwitch: boolean = false |
| 22 | @State cacheSize: number = 0 | 22 | @State cacheSize: number = 0 |
| 23 | @State accountState:boolean=false | 23 | @State accountState:boolean=false |
| 24 | + preferences: dataPreferences.Preferences | null = null; | ||
| 24 | dialogController: CustomDialogController = new CustomDialogController({ | 25 | dialogController: CustomDialogController = new CustomDialogController({ |
| 25 | builder: CustomCacheDialog({ | 26 | builder: CustomCacheDialog({ |
| 26 | cancel: () => { | 27 | cancel: () => { |
| @@ -41,6 +42,8 @@ export struct MineSettingComponent { | @@ -41,6 +42,8 @@ export struct MineSettingComponent { | ||
| 41 | 42 | ||
| 42 | this.getAccountState() | 43 | this.getAccountState() |
| 43 | 44 | ||
| 45 | + this.addLoginStatusObserver() | ||
| 46 | + | ||
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | async getAccountState(){ | 49 | async getAccountState(){ |
| @@ -304,4 +307,14 @@ export struct MineSettingComponent { | @@ -304,4 +307,14 @@ export struct MineSettingComponent { | ||
| 304 | } | 307 | } |
| 305 | }); | 308 | }); |
| 306 | } | 309 | } |
| 310 | + | ||
| 311 | + async addLoginStatusObserver(){ | ||
| 312 | + this.preferences = await SPHelper.default.getPreferences(); | ||
| 313 | + let observer = (key: string) => { | ||
| 314 | + if(key == SpConstants.USER_ID){ | ||
| 315 | + this.getSettingPageData() | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + this.preferences.on('change', observer); | ||
| 319 | + } | ||
| 307 | } | 320 | } |
| @@ -108,6 +108,8 @@ export struct EmptyComponent { | @@ -108,6 +108,8 @@ export struct EmptyComponent { | ||
| 108 | let contentString: string = '暂无内容' | 108 | let contentString: string = '暂无内容' |
| 109 | if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { | 109 | if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { |
| 110 | contentString = '暂无收藏' | 110 | contentString = '暂无收藏' |
| 111 | + } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) { | ||
| 112 | + contentString = '暂无浏览历史' | ||
| 111 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { | 113 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { |
| 112 | contentString = '暂无消息' | 114 | contentString = '暂无消息' |
| 113 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) { | 115 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoComment) { |
| @@ -140,7 +142,7 @@ export struct EmptyComponent { | @@ -140,7 +142,7 @@ export struct EmptyComponent { | ||
| 140 | buildNoDataTipImage(): Resource | string { | 142 | buildNoDataTipImage(): Resource | string { |
| 141 | Logger.info(TAG, "buildNoDataTip"); | 143 | Logger.info(TAG, "buildNoDataTip"); |
| 142 | let imageString: Resource | string = $r('app.media.icon_no_content') | 144 | let imageString: Resource | string = $r('app.media.icon_no_content') |
| 143 | - if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection) { | 145 | + if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoCollection||this.emptyType === WDViewDefaultType.WDViewDefaultType_NoHistory) { |
| 144 | imageString = $r('app.media.icon_no_collection') | 146 | imageString = $r('app.media.icon_no_collection') |
| 145 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { | 147 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoMessage) { |
| 146 | imageString = $r('app.media.icon_no_message') | 148 | imageString = $r('app.media.icon_no_message') |
| 1 | import { CommonConstants } from 'wdConstant' | 1 | import { CommonConstants } from 'wdConstant' |
| 2 | -import { ContentDTO,CompDTO } from 'wdBean' | 2 | +import { ContentDTO, CompDTO } from 'wdBean' |
| 3 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 3 | 4 | ||
| 4 | @Component | 5 | @Component |
| 5 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | 6 | export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { |
| @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | @@ -59,13 +60,12 @@ export struct HorizontalStrokeCardThreeTwoRadioForMoreComponent { | ||
| 59 | .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) | 60 | .padding({ left: (index == 0) ? 16 : 0, right: (index == this.compDTO.operDataList.length - 1) ? 16 : 0 }) |
| 60 | // .offset({x:16}) | 61 | // .offset({x:16}) |
| 61 | .onClick(() => { | 62 | .onClick(() => { |
| 62 | - if (item.objectType != '0') { | ||
| 63 | - console.log(item.objectId) | ||
| 64 | - } | 63 | + ProcessUtils.processPage(item) |
| 65 | }) | 64 | }) |
| 66 | }) | 65 | }) |
| 67 | 66 | ||
| 68 | }.listDirection(Axis.Horizontal) | 67 | }.listDirection(Axis.Horizontal) |
| 68 | + .scrollBar(BarState.Off) | ||
| 69 | .width('100%') | 69 | .width('100%') |
| 70 | 70 | ||
| 71 | // .backgroundColor($r("app.color.color_FE4B05")) | 71 | // .backgroundColor($r("app.color.color_FE4B05")) |
| @@ -2,10 +2,12 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | @@ -2,10 +2,12 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean' | ||
| 2 | import { WDRouterRule } from 'wdRouter/Index' | 2 | import { WDRouterRule } from 'wdRouter/Index' |
| 3 | import { Logger } from 'wdKit/Index' | 3 | import { Logger } from 'wdKit/Index' |
| 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 4 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 5 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 5 | 6 | ||
| 6 | @Component | 7 | @Component |
| 7 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | 8 | export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { |
| 8 | @State compDTO: CompDTO = {} as CompDTO | 9 | @State compDTO: CompDTO = {} as CompDTO |
| 10 | + | ||
| 9 | build() { | 11 | build() { |
| 10 | Column() { | 12 | Column() { |
| 11 | Row() { | 13 | Row() { |
| @@ -30,7 +32,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -30,7 +32,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 30 | .height(14) | 32 | .height(14) |
| 31 | } | 33 | } |
| 32 | }.justifyContent(FlexAlign.SpaceBetween) | 34 | }.justifyContent(FlexAlign.SpaceBetween) |
| 33 | - .margin({ top: 8 ,bottom: 8}) | 35 | + .margin({ top: 8, bottom: 8 }) |
| 34 | .width('100%') | 36 | .width('100%') |
| 35 | 37 | ||
| 36 | 38 | ||
| @@ -45,12 +47,13 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -45,12 +47,13 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 45 | .fontColor($r("app.color.color_212228")) | 47 | .fontColor($r("app.color.color_212228")) |
| 46 | .fontWeight(400) | 48 | .fontWeight(400) |
| 47 | .maxLines(1) | 49 | .maxLines(1) |
| 48 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。 | 50 | + .textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。 |
| 49 | .textAlign(TextAlign.Start) | 51 | .textAlign(TextAlign.Start) |
| 50 | .margin({ top: 8 }) | 52 | .margin({ top: 8 }) |
| 51 | .width('100%') | 53 | .width('100%') |
| 52 | 54 | ||
| 53 | - }.width("100%") | 55 | + } |
| 56 | + .width("100%") | ||
| 54 | .padding({ | 57 | .padding({ |
| 55 | top: 14, | 58 | top: 14, |
| 56 | left: 16, | 59 | left: 16, |
| @@ -59,16 +62,26 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -59,16 +62,26 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 59 | }) | 62 | }) |
| 60 | .backgroundColor($r("app.color.white")) | 63 | .backgroundColor($r("app.color.white")) |
| 61 | .margin({ bottom: 8 }) | 64 | .margin({ bottom: 8 }) |
| 62 | - .onClick(()=>{ | 65 | + .onClick(() => { |
| 63 | this.gotoLive(this.compDTO?.operDataList[0]) | 66 | this.gotoLive(this.compDTO?.operDataList[0]) |
| 64 | }) | 67 | }) |
| 65 | } | 68 | } |
| 66 | - gotoLive(content: ContentDTO) { | 69 | + |
| 70 | + async gotoLive(content: ContentDTO) { | ||
| 71 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 72 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 73 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + console.error('liveDetail===', liveDetail) | ||
| 77 | + | ||
| 78 | + | ||
| 67 | let taskAction: Action = { | 79 | let taskAction: Action = { |
| 68 | type: 'JUMP_DETAIL_PAGE', | 80 | type: 'JUMP_DETAIL_PAGE', |
| 69 | params: { | 81 | params: { |
| 70 | detailPageType: 2, | 82 | detailPageType: 2, |
| 71 | contentID: content?.objectId, | 83 | contentID: content?.objectId, |
| 84 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 72 | extra: { | 85 | extra: { |
| 73 | relType: content?.relType, | 86 | relType: content?.relType, |
| 74 | relId: content?.relId, | 87 | relId: content?.relId, |
| @@ -76,6 +89,6 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | @@ -76,6 +89,6 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent { | ||
| 76 | } as Params, | 89 | } as Params, |
| 77 | }; | 90 | }; |
| 78 | WDRouterRule.jumpWithAction(taskAction) | 91 | WDRouterRule.jumpWithAction(taskAction) |
| 79 | - Logger.debug(`gotoLive, ${content.objectId}`); | 92 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 80 | } | 93 | } |
| 81 | } | 94 | } |
| 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 { Logger } from 'wdKit/Index' | ||
| 2 | +import { LikeViewModel } from '../../viewmodel/LikeViewModel' | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct LikeComponent { | ||
| 6 | + @State likeStatus: boolean = false | ||
| 7 | + viewModel: LikeViewModel = new LikeViewModel() | ||
| 8 | + @Prop data: Record<string, string> | ||
| 9 | + enableBtn = true | ||
| 10 | + | ||
| 11 | + //上层传值 样例 | ||
| 12 | + // this.data['contentId'] = '30035444649' //必须 | ||
| 13 | + // this.data['userName'] = '人民日报网友2kD2xW' | ||
| 14 | + // this.data['contentType'] = '8' //必须 | ||
| 15 | + // this.data['title'] = '开创两校交流先河!克罗地亚教育代表团访问同济大学' | ||
| 16 | + // this.data['userHeaderUrl'] = "" | ||
| 17 | + // this.data['channelId'] = "2059" //必须 | ||
| 18 | + // this.data['status'] = "1" //必须 | ||
| 19 | + | ||
| 20 | + aboutToAppear(): void { | ||
| 21 | + if (this.data) { | ||
| 22 | + Logger.debug("ddd: " + this.data['status']) | ||
| 23 | + if (this.data['status'] == '1') { | ||
| 24 | + this.likeStatus = true | ||
| 25 | + } else { | ||
| 26 | + this.likeStatus = false | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + build() { | ||
| 34 | + Column() { | ||
| 35 | + Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default')) | ||
| 36 | + .width(24) | ||
| 37 | + .height(24) | ||
| 38 | + .onClick(() => { | ||
| 39 | + if (!this.enableBtn) { | ||
| 40 | + return | ||
| 41 | + } | ||
| 42 | + if (this.likeStatus) { | ||
| 43 | + //1 | ||
| 44 | + this.executeLike('1') | ||
| 45 | + } else { | ||
| 46 | + //0 | ||
| 47 | + this.executeLike('0') | ||
| 48 | + } | ||
| 49 | + }) | ||
| 50 | + }.width(24).height(24) | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + executeLike(status: string) { | ||
| 54 | + this.data['status'] = status | ||
| 55 | + this.viewModel.executeLike2(this.data).then(() => { | ||
| 56 | + this.likeStatus = !this.likeStatus | ||
| 57 | + this.enableBtn = true | ||
| 58 | + }).catch(() => { | ||
| 59 | + this.enableBtn = true | ||
| 60 | + }) | ||
| 61 | + } | ||
| 62 | +} |
| @@ -6,6 +6,7 @@ import { WDRouterRule } from 'wdRouter/Index' | @@ -6,6 +6,7 @@ import { WDRouterRule } from 'wdRouter/Index' | ||
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 8 | import { Logger } from 'wdKit/Index' | 8 | import { Logger } from 'wdKit/Index' |
| 9 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct LiveHorizontalCardComponent { | 12 | export struct LiveHorizontalCardComponent { |
| @@ -100,12 +101,22 @@ export struct LiveHorizontalCardComponent { | @@ -100,12 +101,22 @@ export struct LiveHorizontalCardComponent { | ||
| 100 | }) | 101 | }) |
| 101 | .backgroundColor($r("app.color.white")) | 102 | .backgroundColor($r("app.color.white")) |
| 102 | } | 103 | } |
| 103 | - gotoLive(content: ContentDTO) { | 104 | + |
| 105 | + async gotoLive(content: ContentDTO) { | ||
| 106 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 107 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 108 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 109 | + | ||
| 110 | + | ||
| 111 | + console.error('liveDetail===', liveDetail) | ||
| 112 | + | ||
| 113 | + | ||
| 104 | let taskAction: Action = { | 114 | let taskAction: Action = { |
| 105 | type: 'JUMP_DETAIL_PAGE', | 115 | type: 'JUMP_DETAIL_PAGE', |
| 106 | params: { | 116 | params: { |
| 107 | detailPageType: 2, | 117 | detailPageType: 2, |
| 108 | contentID: content?.objectId, | 118 | contentID: content?.objectId, |
| 119 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 109 | extra: { | 120 | extra: { |
| 110 | relType: content?.relType, | 121 | relType: content?.relType, |
| 111 | relId: content?.relId, | 122 | relId: content?.relId, |
| @@ -113,6 +124,6 @@ export struct LiveHorizontalCardComponent { | @@ -113,6 +124,6 @@ export struct LiveHorizontalCardComponent { | ||
| 113 | } as Params, | 124 | } as Params, |
| 114 | }; | 125 | }; |
| 115 | WDRouterRule.jumpWithAction(taskAction) | 126 | WDRouterRule.jumpWithAction(taskAction) |
| 116 | - Logger.debug(`gotoLive, ${content.objectId}`); | 127 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 117 | } | 128 | } |
| 118 | } | 129 | } |
| @@ -6,6 +6,7 @@ import { Logger, StringUtils } from 'wdKit/Index' | @@ -6,6 +6,7 @@ import { Logger, StringUtils } from 'wdKit/Index' | ||
| 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 6 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' | 7 | import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' |
| 8 | import { WDRouterRule } from 'wdRouter/Index' | 8 | import { WDRouterRule } from 'wdRouter/Index' |
| 9 | +import { LiveModel } from '../../viewmodel/LiveModel' | ||
| 9 | 10 | ||
| 10 | @Component | 11 | @Component |
| 11 | export struct LiveHorizontalReservationComponent { | 12 | export struct LiveHorizontalReservationComponent { |
| @@ -92,12 +93,21 @@ export struct LiveHorizontalReservationComponent { | @@ -92,12 +93,21 @@ export struct LiveHorizontalReservationComponent { | ||
| 92 | .backgroundColor($r("app.color.white")) | 93 | .backgroundColor($r("app.color.white")) |
| 93 | } | 94 | } |
| 94 | 95 | ||
| 95 | - gotoLive(content: ContentDTO) { | 96 | + async gotoLive(content: ContentDTO) { |
| 97 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 98 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 99 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + console.error('liveDetail===', liveDetail) | ||
| 103 | + | ||
| 104 | + | ||
| 96 | let taskAction: Action = { | 105 | let taskAction: Action = { |
| 97 | type: 'JUMP_DETAIL_PAGE', | 106 | type: 'JUMP_DETAIL_PAGE', |
| 98 | params: { | 107 | params: { |
| 99 | detailPageType: 2, | 108 | detailPageType: 2, |
| 100 | contentID: content?.objectId, | 109 | contentID: content?.objectId, |
| 110 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, | ||
| 101 | extra: { | 111 | extra: { |
| 102 | relType: content?.relType, | 112 | relType: content?.relType, |
| 103 | relId: content?.relId, | 113 | relId: content?.relId, |
| @@ -105,6 +115,6 @@ export struct LiveHorizontalReservationComponent { | @@ -105,6 +115,6 @@ export struct LiveHorizontalReservationComponent { | ||
| 105 | } as Params, | 115 | } as Params, |
| 106 | }; | 116 | }; |
| 107 | WDRouterRule.jumpWithAction(taskAction) | 117 | WDRouterRule.jumpWithAction(taskAction) |
| 108 | - Logger.debug(`gotoLive, ${content.objectId}`); | 118 | + // Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 109 | } | 119 | } |
| 110 | } | 120 | } |
| 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 | } |
| @@ -30,10 +30,10 @@ export struct RecommendList { | @@ -30,10 +30,10 @@ export struct RecommendList { | ||
| 30 | ForEach(this.recommendList, (item: ContentDTO, index: number) => { | 30 | ForEach(this.recommendList, (item: ContentDTO, index: number) => { |
| 31 | Row() { | 31 | Row() { |
| 32 | CardParser({ contentDTO: item }); | 32 | CardParser({ contentDTO: item }); |
| 33 | - }.border({ | ||
| 34 | - width: { bottom: this.recommendList.length === index + 1 ? 0 : 1 }, | ||
| 35 | - color: '#f5f5f5' | ||
| 36 | - }) | 33 | + } |
| 34 | + if (this.recommendList.length !== index + 1) { | ||
| 35 | + Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 }) | ||
| 36 | + } | ||
| 37 | }, (item: ContentDTO) => JSON.stringify(item)) | 37 | }, (item: ContentDTO) => JSON.stringify(item)) |
| 38 | }.width('100%') | 38 | }.width('100%') |
| 39 | } | 39 | } |
| @@ -33,6 +33,7 @@ export struct SecondLevelComponent { | @@ -33,6 +33,7 @@ export struct SecondLevelComponent { | ||
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | onFirstChange(){ | 35 | onFirstChange(){ |
| 36 | + this.select = 0 | ||
| 36 | if (!this.currentFirst) { | 37 | if (!this.currentFirst) { |
| 37 | this.mTip = '暂无数据'; | 38 | this.mTip = '暂无数据'; |
| 38 | } else { | 39 | } else { |
| @@ -34,10 +34,11 @@ export struct ThirdLevelComponent { | @@ -34,10 +34,11 @@ export struct ThirdLevelComponent { | ||
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | onFirstChange(){ | 36 | onFirstChange(){ |
| 37 | - | 37 | + this.select = 0 |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | onSecondChange(){ | 40 | onSecondChange(){ |
| 41 | + this.select = 0 | ||
| 41 | if (!this.currentSecondBean) { | 42 | if (!this.currentSecondBean) { |
| 42 | this.mTip = '暂无数据'; | 43 | this.mTip = '暂无数据'; |
| 43 | } else { | 44 | } else { |
| @@ -16,6 +16,12 @@ export class ContentConstants { | @@ -16,6 +16,12 @@ export class ContentConstants { | ||
| 16 | * 5:专题详情 | 16 | * 5:专题详情 |
| 17 | */ | 17 | */ |
| 18 | static readonly TYPE_SPECIAL_TOPIC: string = "5"; | 18 | static readonly TYPE_SPECIAL_TOPIC: string = "5"; |
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 6:链接 | ||
| 22 | + */ | ||
| 23 | + static readonly TYPE_LINK: string = "6"; | ||
| 24 | + | ||
| 19 | /** | 25 | /** |
| 20 | * 8:图文详情,这里是h5页面 | 26 | * 8:图文详情,这里是h5页面 |
| 21 | */ | 27 | */ |
| @@ -12,7 +12,7 @@ export struct ENewspaperListDialog { | @@ -12,7 +12,7 @@ export struct ENewspaperListDialog { | ||
| 12 | @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string | 12 | @Consume @Watch('onCurrentPageNumUpdated') currentPageNum: string |
| 13 | @State pageDialogShow: boolean = false | 13 | @State pageDialogShow: boolean = false |
| 14 | @State scrollIndex: number = 0 | 14 | @State scrollIndex: number = 0 |
| 15 | - newspaperListBean: NewspaperListBean = {} as NewspaperListBean | 15 | + @Prop newspaperListBean: NewspaperListBean = {} as NewspaperListBean |
| 16 | private listScroller: Scroller = new Scroller(); | 16 | private listScroller: Scroller = new Scroller(); |
| 17 | //文字版选择弹框 | 17 | //文字版选择弹框 |
| 18 | pageListDialogController: CustomDialogController = new CustomDialogController({ | 18 | pageListDialogController: CustomDialogController = new CustomDialogController({ |
| @@ -21,13 +21,14 @@ export struct ENewspaperListDialog { | @@ -21,13 +21,14 @@ export struct ENewspaperListDialog { | ||
| 21 | newspaperListBean: this.newspaperListBean, | 21 | newspaperListBean: this.newspaperListBean, |
| 22 | }), | 22 | }), |
| 23 | alignment: DialogAlignment.TopStart, | 23 | alignment: DialogAlignment.TopStart, |
| 24 | - offset: { dx: 0, dy: 214 }, | 24 | + offset: { dx: 0, dy: 224 }, |
| 25 | customStyle: true, | 25 | customStyle: true, |
| 26 | }) | 26 | }) |
| 27 | //页面半屏弹窗(实现在上个组件)若尝试在CustomDialog中传入多个其他的Controller, | 27 | //页面半屏弹窗(实现在上个组件)若尝试在CustomDialog中传入多个其他的Controller, |
| 28 | // 以实现在CustomDialog中打开另一个或另一些CustomDialog, | 28 | // 以实现在CustomDialog中打开另一个或另一些CustomDialog, |
| 29 | // 那么此处需要将指向自己的controller放在所有controller的后面 | 29 | // 那么此处需要将指向自己的controller放在所有controller的后面 |
| 30 | - listDialogController: CustomDialogController | 30 | + // listDialogController: CustomDialogController |
| 31 | + public closeDialog?: () => void | ||
| 31 | 32 | ||
| 32 | //watch监听报纸页码回调 | 33 | //watch监听报纸页码回调 |
| 33 | onCurrentPageNumUpdated(): void { | 34 | onCurrentPageNumUpdated(): void { |
| @@ -53,6 +54,7 @@ export struct ENewspaperListDialog { | @@ -53,6 +54,7 @@ export struct ENewspaperListDialog { | ||
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | build() { | 56 | build() { |
| 57 | + Stack() { | ||
| 56 | Column() { | 58 | Column() { |
| 57 | Row() | 59 | Row() |
| 58 | .width(43) | 60 | .width(43) |
| @@ -62,6 +64,11 @@ export struct ENewspaperListDialog { | @@ -62,6 +64,11 @@ export struct ENewspaperListDialog { | ||
| 62 | top: 10, | 64 | top: 10, |
| 63 | bottom: 10 | 65 | bottom: 10 |
| 64 | }) | 66 | }) |
| 67 | + .onClick(() => { | ||
| 68 | + if (this.closeDialog) { | ||
| 69 | + this.closeDialog() | ||
| 70 | + } | ||
| 71 | + }) | ||
| 65 | Row() { | 72 | Row() { |
| 66 | Text(this.currentPageNum) | 73 | Text(this.currentPageNum) |
| 67 | .fontSize($r('app.float.font_size_36')) | 74 | .fontSize($r('app.float.font_size_36')) |
| @@ -142,6 +149,7 @@ export struct ENewspaperListDialog { | @@ -142,6 +149,7 @@ export struct ENewspaperListDialog { | ||
| 142 | .fontColor($r('app.color.color_999999')) | 149 | .fontColor($r('app.color.color_999999')) |
| 143 | .margin({ top: 15, bottom: 15 }) | 150 | .margin({ top: 15, bottom: 15 }) |
| 144 | .maxLines(5) | 151 | .maxLines(5) |
| 152 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 145 | } | 153 | } |
| 146 | } | 154 | } |
| 147 | .alignItems(HorizontalAlign.Start) | 155 | .alignItems(HorizontalAlign.Start) |
| @@ -159,9 +167,9 @@ export struct ENewspaperListDialog { | @@ -159,9 +167,9 @@ export struct ENewspaperListDialog { | ||
| 159 | } as Params, | 167 | } as Params, |
| 160 | }; | 168 | }; |
| 161 | WDRouterRule.jumpWithAction(taskAction) | 169 | WDRouterRule.jumpWithAction(taskAction) |
| 162 | - if (this.listDialogController) { | ||
| 163 | - this.listDialogController.close() | ||
| 164 | - } | 170 | + // if (this.listDialogController) { |
| 171 | + // this.listDialogController.close() | ||
| 172 | + // } | ||
| 165 | }) | 173 | }) |
| 166 | } | 174 | } |
| 167 | 175 | ||
| @@ -172,6 +180,9 @@ export struct ENewspaperListDialog { | @@ -172,6 +180,9 @@ export struct ENewspaperListDialog { | ||
| 172 | } | 180 | } |
| 173 | .width('100%') | 181 | .width('100%') |
| 174 | .padding({ left: 15, right: 15 }) | 182 | .padding({ left: 15, right: 15 }) |
| 183 | + .margin({ | ||
| 184 | + bottom: 85 | ||
| 185 | + }) | ||
| 175 | .scrollBar(BarState.Off) | 186 | .scrollBar(BarState.Off) |
| 176 | .divider({ | 187 | .divider({ |
| 177 | strokeWidth: 0.5, | 188 | strokeWidth: 0.5, |
| @@ -191,9 +202,20 @@ export struct ENewspaperListDialog { | @@ -191,9 +202,20 @@ export struct ENewspaperListDialog { | ||
| 191 | console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) | 202 | console.info(`onScroll scrollState = ScrollState` + scrollState + `, scrollOffset = ` + scrollOffset) |
| 192 | }) | 203 | }) |
| 193 | } | 204 | } |
| 205 | + .margin({ top: 124 }) | ||
| 194 | .width('100%') | 206 | .width('100%') |
| 195 | .backgroundColor(Color.White) | 207 | .backgroundColor(Color.White) |
| 208 | + .onClick(() => { | ||
| 196 | 209 | ||
| 210 | + }) | ||
| 211 | + }.width('100%') | ||
| 212 | + .height('100%') | ||
| 213 | + .backgroundColor('#80000000') | ||
| 214 | + .onClick(() => { | ||
| 215 | + if (this.closeDialog) { | ||
| 216 | + this.closeDialog() | ||
| 217 | + } | ||
| 218 | + }) | ||
| 197 | } | 219 | } |
| 198 | 220 | ||
| 199 | updateCurrentPageNum(firstIndex: number): void { | 221 | updateCurrentPageNum(firstIndex: number): void { |
| 1 | +import { HashMap } from '@kit.ArkTS'; | ||
| 2 | +import { Logger } from 'wdKit/Index'; | ||
| 3 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | ||
| 4 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 5 | + | ||
| 6 | +export class LikeModel { | ||
| 7 | + executeLike(data: Record<string, string>) { | ||
| 8 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 9 | + | ||
| 10 | + return new Promise<object>((success, fail) => { | ||
| 11 | + HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => { | ||
| 12 | + if (data.code != 0) { | ||
| 13 | + fail(data.message) | ||
| 14 | + return | ||
| 15 | + } | ||
| 16 | + success(data) | ||
| 17 | + }, (error: Error) => { | ||
| 18 | + fail(error.message) | ||
| 19 | + Logger.debug("LoginViewModel:error ", error.toString()) | ||
| 20 | + }) | ||
| 21 | + }) | ||
| 22 | + } | ||
| 23 | +} |
| @@ -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')) |
| @@ -40,8 +40,9 @@ struct SearchCreatorPage { | @@ -40,8 +40,9 @@ struct SearchCreatorPage { | ||
| 40 | this.hasMore = false | 40 | this.hasMore = false |
| 41 | this.isLoading = false | 41 | this.isLoading = false |
| 42 | }else{ | 42 | }else{ |
| 43 | + this.data_temp = [] | ||
| 43 | result.list.forEach((data)=>{ | 44 | result.list.forEach((data)=>{ |
| 44 | - this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId)) | 45 | + this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId,Number.parseInt(data.data.mainControl),-1)) |
| 45 | }) | 46 | }) |
| 46 | 47 | ||
| 47 | let request = new CreatorDetailRequestItem() | 48 | let request = new CreatorDetailRequestItem() |
| @@ -69,6 +70,8 @@ struct SearchCreatorPage { | @@ -69,6 +70,8 @@ struct SearchCreatorPage { | ||
| 69 | data.cnFansNum = item.fansNum + "" | 70 | data.cnFansNum = item.fansNum + "" |
| 70 | } | 71 | } |
| 71 | data.introduction = item.introduction | 72 | data.introduction = item.introduction |
| 73 | + data.mainControl = item.mainControl | ||
| 74 | + data.banControl = item.banControl | ||
| 72 | } | 75 | } |
| 73 | }) | 76 | }) |
| 74 | }) | 77 | }) |
| @@ -104,7 +107,7 @@ struct SearchCreatorPage { | @@ -104,7 +107,7 @@ struct SearchCreatorPage { | ||
| 104 | }) | 107 | }) |
| 105 | 108 | ||
| 106 | this.data_temp.forEach((item)=>{ | 109 | this.data_temp.forEach((item)=>{ |
| 107 | - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId)) | 110 | + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId,item.mainControl,item.banControl)) |
| 108 | }) | 111 | }) |
| 109 | 112 | ||
| 110 | this.data.notifyDataReload() | 113 | this.data.notifyDataReload() |
| 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(); |
| @@ -43,6 +43,9 @@ export class ProcessUtils { | @@ -43,6 +43,9 @@ export class ProcessUtils { | ||
| 43 | // 图文详情,跳转h5 | 43 | // 图文详情,跳转h5 |
| 44 | ProcessUtils.gotoWeb(content); | 44 | ProcessUtils.gotoWeb(content); |
| 45 | break; | 45 | break; |
| 46 | + case ContentConstants.TYPE_LINK: | ||
| 47 | + ProcessUtils.gotoDefaultWeb(content); | ||
| 48 | + break; | ||
| 46 | //图集详情页 | 49 | //图集详情页 |
| 47 | case ContentConstants.TYPE_NINE: | 50 | case ContentConstants.TYPE_NINE: |
| 48 | ProcessUtils.gotoAtlasDetailPage(content); | 51 | ProcessUtils.gotoAtlasDetailPage(content); |
| @@ -53,6 +56,7 @@ export class ProcessUtils { | @@ -53,6 +56,7 @@ export class ProcessUtils { | ||
| 53 | break; | 56 | break; |
| 54 | //动态详情页(动态图文) | 57 | //动态详情页(动态图文) |
| 55 | case ContentConstants.TYPE_FOURTEEN: | 58 | case ContentConstants.TYPE_FOURTEEN: |
| 59 | + break; | ||
| 56 | //动态详情页(动态视频) | 60 | //动态详情页(动态视频) |
| 57 | case ContentConstants.TYPE_FIFTEEN: | 61 | case ContentConstants.TYPE_FIFTEEN: |
| 58 | ProcessUtils.gotoDynamicDetailPage(content); | 62 | ProcessUtils.gotoDynamicDetailPage(content); |
| @@ -113,6 +117,17 @@ export class ProcessUtils { | @@ -113,6 +117,17 @@ export class ProcessUtils { | ||
| 113 | WDRouterRule.jumpWithAction(taskAction) | 117 | WDRouterRule.jumpWithAction(taskAction) |
| 114 | } | 118 | } |
| 115 | 119 | ||
| 120 | + private static gotoDefaultWeb(content: ContentDTO) { | ||
| 121 | + let taskAction: Action = { | ||
| 122 | + type: 'JUMP_H5_BY_WEB_VIEW', | ||
| 123 | + params: { | ||
| 124 | + url: content.linkUrl, | ||
| 125 | + } as Params, | ||
| 126 | + }; | ||
| 127 | + WDRouterRule.jumpWithAction(taskAction) | ||
| 128 | + Logger.debug(TAG, `gotoWeb, ${content.objectId}`); | ||
| 129 | + } | ||
| 130 | + | ||
| 116 | private static gotoWeb(content: ContentDTO) { | 131 | private static gotoWeb(content: ContentDTO) { |
| 117 | // // topicId | 132 | // // topicId |
| 118 | // content.channelId; | 133 | // content.channelId; |
| @@ -34,7 +34,7 @@ export class RefreshConstants { | @@ -34,7 +34,7 @@ export class RefreshConstants { | ||
| 34 | /** | 34 | /** |
| 35 | * The refresh and load height. | 35 | * The refresh and load height. |
| 36 | */ | 36 | */ |
| 37 | - static readonly CUSTOM_LAYOUT_HEIGHT: number = 70; | 37 | + static readonly CUSTOM_LAYOUT_HEIGHT: number = 90; |
| 38 | /** | 38 | /** |
| 39 | * Full the width. | 39 | * Full the width. |
| 40 | */ | 40 | */ |
| @@ -44,7 +44,7 @@ class EditInfoViewModel { | @@ -44,7 +44,7 @@ class EditInfoViewModel { | ||
| 44 | new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), | 44 | new EditListInfo('简介',item&&item.userExtend.introduction?item.userExtend.introduction:'待完善'), |
| 45 | new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), | 45 | new EditListInfo('地区',item&&item.userExtend.address?item.userExtend.address:'待完善'), |
| 46 | new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), | 46 | new EditListInfo('生日',item&&item.userExtend.birthday?item.userExtend.birthday:'待完善'), |
| 47 | - new EditListInfo('性别',item?(item.userExtend.sex === 1?'男':'女'):'待完善'),] | 47 | + new EditListInfo('性别',item?(item.userExtend.sex === 10?'待完善':(item.userExtend.sex === 1?'男':'女')):'待完善'),] |
| 48 | return this.editListData | 48 | return this.editListData |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -129,6 +129,7 @@ class EditInfoViewModel { | @@ -129,6 +129,7 @@ class EditInfoViewModel { | ||
| 129 | .then((navResDTO: ResponseDTO) => { | 129 | .then((navResDTO: ResponseDTO) => { |
| 130 | if (navResDTO.code == 0) { | 130 | if (navResDTO.code == 0) { |
| 131 | promptAction.showToast({ message: '修改成功' }) | 131 | promptAction.showToast({ message: '修改成功' }) |
| 132 | + success(navResDTO) | ||
| 132 | }else { | 133 | }else { |
| 133 | promptAction.showToast({ message: navResDTO.message }) | 134 | promptAction.showToast({ message: navResDTO.message }) |
| 134 | } | 135 | } |
| @@ -71,16 +71,20 @@ export class FollowListDetailItem{ | @@ -71,16 +71,20 @@ export class FollowListDetailItem{ | ||
| 71 | 71 | ||
| 72 | cnUserType:string = "" | 72 | cnUserType:string = "" |
| 73 | cnUserId:string = "" | 73 | cnUserId:string = "" |
| 74 | + mainControl:number = 0 | ||
| 74 | 75 | ||
| 76 | + cnMainControl:number = 0 | ||
| 75 | attentionCreatorId:string = "" | 77 | attentionCreatorId:string = "" |
| 76 | attentionUserType:string = "" | 78 | attentionUserType:string = "" |
| 77 | 79 | ||
| 78 | attentionHeadPhotoUrl:string = "" | 80 | attentionHeadPhotoUrl:string = "" |
| 79 | attentionUserName:string = "" | 81 | attentionUserName:string = "" |
| 80 | fansNum :number = 0 | 82 | fansNum :number = 0 |
| 83 | + banControl:number = -1 | ||
| 81 | 84 | ||
| 82 | 85 | ||
| 83 | - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) { | 86 | + |
| 87 | + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string,mainControl:number,banControl:number) { | ||
| 84 | this.headPhotoUrl = headPhotoUrl | 88 | this.headPhotoUrl = headPhotoUrl |
| 85 | this.cnUserName = cnUserName | 89 | this.cnUserName = cnUserName |
| 86 | this.cnFansNum = cnFansNum | 90 | this.cnFansNum = cnFansNum |
| @@ -90,5 +94,7 @@ export class FollowListDetailItem{ | @@ -90,5 +94,7 @@ export class FollowListDetailItem{ | ||
| 90 | this.attentionUserId = attentionUserId | 94 | this.attentionUserId = attentionUserId |
| 91 | this.cnUserType = cnUserType | 95 | this.cnUserType = cnUserType |
| 92 | this.cnUserId = cnUserId | 96 | this.cnUserId = cnUserId |
| 97 | + this.mainControl = mainControl | ||
| 98 | + this.banControl = banControl | ||
| 93 | } | 99 | } |
| 94 | } | 100 | } |
| 1 | +import { LikeModel } from '../model/LikeModel' | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 点赞*/ | ||
| 5 | +export class LikeViewModel { | ||
| 6 | + likeModel: LikeModel | ||
| 7 | + | ||
| 8 | + constructor() { | ||
| 9 | + this.likeModel = new LikeModel(); | ||
| 10 | + } | ||
| 11 | + | ||
| 12 | + executeLike(contentId: string, userName: string, contentType: string, title: string, userHeaderUrl: string, channelId: string, status: string) { | ||
| 13 | + let bean: Record<string, string> = {} | ||
| 14 | + bean['contentId'] = contentId | ||
| 15 | + bean['userName'] = userName | ||
| 16 | + bean['contentType'] = contentType | ||
| 17 | + bean['title'] = title | ||
| 18 | + bean['userHeaderUrl'] = userHeaderUrl | ||
| 19 | + bean['channelId'] = channelId | ||
| 20 | + bean['status'] = status | ||
| 21 | + this.likeModel.executeLike(bean) | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + executeLike2(bean: Record<string, string>) { | ||
| 25 | + | ||
| 26 | + return new Promise<object>((success, fail) => { | ||
| 27 | + this.likeModel.executeLike(bean).then((data) => { | ||
| 28 | + success(data) | ||
| 29 | + }).catch((error: string) => { | ||
| 30 | + fail(error) | ||
| 31 | + }) | ||
| 32 | + }) | ||
| 33 | + | ||
| 34 | + } | ||
| 35 | +} |
| 1 | -import { PageDTO, CompDTO, PageInfoDTO } from 'wdBean'; | 1 | +import { PageDTO, CompDTO, PageInfoDTO, ContentDTO } from 'wdBean'; |
| 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; | 2 | import { CompStyle, ViewType } from 'wdConstant/Index'; |
| 3 | import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; | 3 | import { CollectionUtils, DateTimeUtils, Logger } from 'wdKit'; |
| 4 | import { closeRefresh } from '../utils/PullDownRefresh'; | 4 | import { closeRefresh } from '../utils/PullDownRefresh'; |
| @@ -58,7 +58,6 @@ export class PageHelper { | @@ -58,7 +58,6 @@ export class PageHelper { | ||
| 58 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { | 58 | if (pageDto && pageDto.compList && pageDto.compList.length > 0) { |
| 59 | pageModel.viewType = ViewType.LOADED; | 59 | pageModel.viewType = ViewType.LOADED; |
| 60 | let sizeBefore: number = pageModel.compList.size(); | 60 | let sizeBefore: number = pageModel.compList.size(); |
| 61 | - pageModel.compList.push(...pageDto.compList) | ||
| 62 | if (pageDto.compList.length === pageModel.pageSize) { | 61 | if (pageDto.compList.length === pageModel.pageSize) { |
| 63 | pageModel.currentPage++; | 62 | pageModel.currentPage++; |
| 64 | pageModel.hasMore = true; | 63 | pageModel.hasMore = true; |
| @@ -66,6 +65,11 @@ export class PageHelper { | @@ -66,6 +65,11 @@ export class PageHelper { | ||
| 66 | pageModel.hasMore = false; | 65 | pageModel.hasMore = false; |
| 67 | } | 66 | } |
| 68 | 67 | ||
| 68 | + //移除音频 和 活动 | ||
| 69 | + this.removeComp(pageModel,pageDto) | ||
| 70 | + | ||
| 71 | + // pageModel.compList.push(...pageDto.compList) | ||
| 72 | + | ||
| 69 | // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) | 73 | // TODO 暂时去掉互动数据,待优化。(主要是互动数据返回,如何渲染到ui上) |
| 70 | // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 | 74 | // TODO updateItems(sizeBefore, data),这里可能有时序问题,导致覆盖别的group数据,需要优化,考虑精准替换 |
| 71 | // 二次请求,批查互动数据 | 75 | // 二次请求,批查互动数据 |
| @@ -108,7 +112,11 @@ export class PageHelper { | @@ -108,7 +112,11 @@ export class PageHelper { | ||
| 108 | pageModel.hasMore = false; | 112 | pageModel.hasMore = false; |
| 109 | } | 113 | } |
| 110 | let sizeBefore: number = pageModel.compList.size(); | 114 | let sizeBefore: number = pageModel.compList.size(); |
| 111 | - pageModel.compList.push(...data.compList) | 115 | + |
| 116 | + //移除音频 和 活动 | ||
| 117 | + this.removeComp(pageModel,data) | ||
| 118 | + // | ||
| 119 | + // pageModel.compList.push(...data.compList) | ||
| 112 | PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { | 120 | PageViewModel.getInteractData(data.compList).then((data: CompDTO[]) => { |
| 113 | // 刷新,替换所有数据 | 121 | // 刷新,替换所有数据 |
| 114 | pageModel.compList.updateItems(sizeBefore, data) | 122 | pageModel.compList.updateItems(sizeBefore, data) |
| @@ -119,6 +127,23 @@ export class PageHelper { | @@ -119,6 +127,23 @@ export class PageHelper { | ||
| 119 | promptAction.showToast({ message: err }); | 127 | promptAction.showToast({ message: err }); |
| 120 | }) | 128 | }) |
| 121 | } | 129 | } |
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 移除comp | ||
| 133 | + */ | ||
| 134 | + private removeComp(pageModel: PageModel, pageDto: PageDTO) { | ||
| 135 | + let datas = pageDto.compList | ||
| 136 | + for (let index = 0; index < datas.length; index++) { | ||
| 137 | + const element = datas[index]; | ||
| 138 | + let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0); | ||
| 139 | + //移除音频 和 活动 | ||
| 140 | + if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) { | ||
| 141 | + Logger.debug(TAG, 'getGroupData 移除音频 和 活动'); | ||
| 142 | + }else { | ||
| 143 | + pageModel.compList.push(element) | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } | ||
| 122 | } | 147 | } |
| 123 | 148 | ||
| 124 | 149 |
| @@ -31,6 +31,22 @@ | @@ -31,6 +31,22 @@ | ||
| 31 | { | 31 | { |
| 32 | "name": "refresh_fail_text", | 32 | "name": "refresh_fail_text", |
| 33 | "value": "刷新失败" | 33 | "value": "刷新失败" |
| 34 | + }, | ||
| 35 | + { | ||
| 36 | + "name": "image_request_success", | ||
| 37 | + "value": "图片下载到图库成功" | ||
| 38 | + }, | ||
| 39 | + { | ||
| 40 | + "name": "image_request_fail", | ||
| 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" | ||
| 34 | } | 50 | } |
| 35 | ] | 51 | ] |
| 36 | } | 52 | } |
1.15 KB
581 Bytes
789 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/iv_live_heart_normal.png
0 → 100644
2.29 KB
| @@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
| 6 | "pages/MineHomePage", | 6 | "pages/MineHomePage", |
| 7 | "components/page/SettingPage", | 7 | "components/page/SettingPage", |
| 8 | "components/page/SettingAboutPage", | 8 | "components/page/SettingAboutPage", |
| 9 | + "components/page/QualityCommentsPage", | ||
| 9 | "components/page/PrivacySettingPage", | 10 | "components/page/PrivacySettingPage", |
| 10 | "components/page/EditUserInfoPage", | 11 | "components/page/EditUserInfoPage", |
| 11 | "components/page/EditUserNikeNamePage", | 12 | "components/page/EditUserNikeNamePage", |
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayHLivePage.ets
deleted
100644 → 0
| 1 | -import { TabComponent } from '../widgets/details/TabComponent'; | ||
| 2 | -import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | ||
| 3 | - | ||
| 4 | - | ||
| 5 | -@Component | ||
| 6 | -export struct DetailPlayHLivePage { | ||
| 7 | - aboutToAppear(): void { | ||
| 8 | - | ||
| 9 | - } | ||
| 10 | - | ||
| 11 | - build() { | ||
| 12 | - Column() { | ||
| 13 | - TopPlayComponent() | ||
| 14 | - TabComponent() | ||
| 15 | - } | ||
| 16 | - .height('100%') | ||
| 17 | - .width('100%') | ||
| 18 | - } | ||
| 19 | - | ||
| 20 | - onPageShow(): void { | ||
| 21 | - | ||
| 22 | - } | ||
| 23 | - | ||
| 24 | - aboutToDisappear(): void { | ||
| 25 | - | ||
| 26 | - } | ||
| 27 | -} |
| @@ -5,6 +5,7 @@ import { WindowModel } from 'wdKit/Index'; | @@ -5,6 +5,7 @@ import { WindowModel } from 'wdKit/Index'; | ||
| 5 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; | 5 | import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; |
| 6 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; | 6 | import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; |
| 7 | import { WDPlayerController } from 'wdPlayer/Index'; | 7 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 8 | +import { DisplayDirection } from 'wdConstant/Index'; | ||
| 8 | 9 | ||
| 9 | const storage = LocalStorage.getShared(); | 10 | const storage = LocalStorage.getShared(); |
| 10 | 11 | ||
| @@ -19,7 +20,9 @@ export struct DetailPlayVLivePage { | @@ -19,7 +20,9 @@ export struct DetailPlayVLivePage { | ||
| 19 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | 20 | @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 |
| 20 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean | 21 | @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean |
| 21 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean | 22 | @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean |
| 22 | - @Provide isMenuVisible: boolean = false | 23 | + @Provide isShowControl: boolean = false |
| 24 | + @Provide liveState: string = '' | ||
| 25 | + @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL //横竖屏,默认竖屏 | ||
| 23 | @State relId: string = '' | 26 | @State relId: string = '' |
| 24 | @State contentId: string = '' | 27 | @State contentId: string = '' |
| 25 | @State relType: string = '' | 28 | @State relType: string = '' |
| @@ -42,7 +45,6 @@ export struct DetailPlayVLivePage { | @@ -42,7 +45,6 @@ export struct DetailPlayVLivePage { | ||
| 42 | aboutToDisappear(): void { | 45 | aboutToDisappear(): void { |
| 43 | WindowModel.shared.setWindowLayoutFullScreen(false) | 46 | WindowModel.shared.setWindowLayoutFullScreen(false) |
| 44 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | 47 | WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) |
| 45 | - | ||
| 46 | } | 48 | } |
| 47 | 49 | ||
| 48 | build() { | 50 | build() { |
| @@ -51,9 +53,6 @@ export struct DetailPlayVLivePage { | @@ -51,9 +53,6 @@ export struct DetailPlayVLivePage { | ||
| 51 | PlayerComponent({ | 53 | PlayerComponent({ |
| 52 | playerController: this.playerController | 54 | playerController: this.playerController |
| 53 | }) | 55 | }) |
| 54 | - .onClick(() => { | ||
| 55 | - this.isMenuVisible = !this.isMenuVisible | ||
| 56 | - }) | ||
| 57 | 56 | ||
| 58 | PlayerInfoComponent({ | 57 | PlayerInfoComponent({ |
| 59 | playerController: this.playerController, | 58 | playerController: this.playerController, |
| @@ -63,9 +62,11 @@ export struct DetailPlayVLivePage { | @@ -63,9 +62,11 @@ export struct DetailPlayVLivePage { | ||
| 63 | 62 | ||
| 64 | Image($r('app.media.icon_live_more')) | 63 | Image($r('app.media.icon_live_more')) |
| 65 | .width(40) | 64 | .width(40) |
| 66 | - .aspectRatio(1)// .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | 65 | + .aspectRatio(1) |
| 66 | + .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 67 | .animation({ duration: 500 }) | 67 | .animation({ duration: 500 }) |
| 68 | - .position({ x: '95%', y: '95%' }) | 68 | + .position({ x: '100%', y: '100%' }) |
| 69 | + .markAnchor({ x: 56, y: 56 }) | ||
| 69 | .onClick(() => { | 70 | .onClick(() => { |
| 70 | this.swiperController.showNext() | 71 | this.swiperController.showNext() |
| 71 | }) | 72 | }) |
| @@ -78,16 +79,13 @@ export struct DetailPlayVLivePage { | @@ -78,16 +79,13 @@ export struct DetailPlayVLivePage { | ||
| 78 | .width('100%') | 79 | .width('100%') |
| 79 | } | 80 | } |
| 80 | 81 | ||
| 81 | - onPageShow(): void { | ||
| 82 | - | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | getLiveDetails() { | 82 | getLiveDetails() { |
| 86 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) | 83 | this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) |
| 87 | .then( | 84 | .then( |
| 88 | (data) => { | 85 | (data) => { |
| 89 | if (data.length > 0) { | 86 | if (data.length > 0) { |
| 90 | this.liveDetailsBean = data[0] | 87 | this.liveDetailsBean = data[0] |
| 88 | + this.liveState = this.liveDetailsBean.liveInfo?.liveState | ||
| 91 | console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) | 89 | console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) |
| 92 | } | 90 | } |
| 93 | }, | 91 | }, |
| 1 | import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | 1 | import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | -import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index' | 2 | +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI,WDViewDefaultType } from 'wdComponent/Index' |
| 3 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | 3 | import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' |
| 4 | import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | 4 | import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' |
| 5 | import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | 5 | import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' |
| @@ -79,7 +79,7 @@ export struct TabChatComponent { | @@ -79,7 +79,7 @@ export struct TabChatComponent { | ||
| 79 | getLiveChatList() { | 79 | getLiveChatList() { |
| 80 | this.pageModel.currentPage = 1 | 80 | this.pageModel.currentPage = 1 |
| 81 | this.liveViewModel.getLiveChatList( | 81 | this.liveViewModel.getLiveChatList( |
| 82 | - 1, | 82 | + this.pageModel.currentPage, |
| 83 | this.liveDetailsBean?.liveInfo?.mlive?.mliveId, | 83 | this.liveDetailsBean?.liveInfo?.mlive?.mliveId, |
| 84 | this.liveDetailsBean?.newsId, | 84 | this.liveDetailsBean?.newsId, |
| 85 | 20,) | 85 | 20,) |
| 1 | import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | 1 | import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' |
| 2 | -import { ListHasNoMoreDataUI } from 'wdComponent/Index' | 2 | +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index' |
| 3 | import { StringUtils } from 'wdKit/Index' | 3 | import { StringUtils } from 'wdKit/Index' |
| 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 5 | import { TabLiveItemComponent } from './TabLiveItemComponent' | 5 | import { TabLiveItemComponent } from './TabLiveItemComponent' |
| 6 | +import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | ||
| 7 | +import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' | ||
| 8 | +import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | ||
| 9 | +import { ViewType } from 'wdConstant/Index' | ||
| 10 | +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | ||
| 11 | +import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | ||
| 6 | 12 | ||
| 7 | @Component | 13 | @Component |
| 8 | export struct TabLiveComponent { | 14 | export struct TabLiveComponent { |
| 9 | liveViewModel: LiveViewModel = new LiveViewModel() | 15 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 10 | @State liveList: Array<LiveRoomItemBean> = [] | 16 | @State liveList: Array<LiveRoomItemBean> = [] |
| 11 | @Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean | 17 | @Consume @Watch('updateDate') liveDetailsBean: LiveDetailsBean |
| 18 | + @State private pageModel: PageModel = new PageModel() | ||
| 12 | 19 | ||
| 13 | updateDate() { | 20 | updateDate() { |
| 14 | this.getLiveList() | 21 | this.getLiveList() |
| @@ -20,36 +27,70 @@ export struct TabLiveComponent { | @@ -20,36 +27,70 @@ export struct TabLiveComponent { | ||
| 20 | 27 | ||
| 21 | build() { | 28 | build() { |
| 22 | Stack() { | 29 | Stack() { |
| 23 | - if (this.liveList.length == 0) { | ||
| 24 | - ListHasNoMoreDataUI({ style: 2 }) | 30 | + if (this.pageModel.viewType == ViewType.LOADING) { |
| 31 | + this.LoadingLayout() | ||
| 32 | + } else if (this.pageModel.viewType == ViewType.ERROR) { | ||
| 33 | + ErrorComponent() | ||
| 34 | + } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 35 | + EmptyComponent() | ||
| 25 | } else { | 36 | } else { |
| 37 | + this.ListLayout() | ||
| 38 | + } | ||
| 39 | + } | ||
| 40 | + .alignContent(Alignment.Top) | ||
| 41 | + .backgroundColor('#F5F5F5') | ||
| 42 | + .height('100%') | ||
| 43 | + .width('100%') | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @Builder | ||
| 47 | + ListLayout() { | ||
| 26 | List() { | 48 | List() { |
| 49 | + ListItem() { | ||
| 50 | + // 下拉刷新 | ||
| 51 | + RefreshLayout({ | ||
| 52 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 53 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 54 | + }) | ||
| 55 | + } | ||
| 56 | + | ||
| 27 | ForEach(this.liveList, (item: LiveRoomItemBean) => { | 57 | ForEach(this.liveList, (item: LiveRoomItemBean) => { |
| 28 | ListItem() { | 58 | ListItem() { |
| 29 | TabLiveItemComponent({ item: item }) | 59 | TabLiveItemComponent({ item: item }) |
| 30 | } | 60 | } |
| 31 | }) | 61 | }) |
| 62 | + // 加载更多 | ||
| 32 | ListItem() { | 63 | ListItem() { |
| 64 | + if (this.pageModel.hasMore) { | ||
| 65 | + LoadMoreLayout({ | ||
| 66 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 67 | + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 68 | + }) | ||
| 69 | + } else { | ||
| 33 | ListHasNoMoreDataUI() | 70 | ListHasNoMoreDataUI() |
| 34 | } | 71 | } |
| 35 | } | 72 | } |
| 36 | } | 73 | } |
| 37 | } | 74 | } |
| 38 | - .alignContent(Alignment.Top) | ||
| 39 | - .backgroundColor('#F5F5F5') | ||
| 40 | - .height('100%') | ||
| 41 | - .width('100%') | ||
| 42 | 75 | ||
| 76 | + @Builder | ||
| 77 | + LoadingLayout() { | ||
| 78 | + CustomRefreshLoadLayout({ | ||
| 79 | + refreshBean: new RefreshLayoutBean(true, | ||
| 80 | + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | ||
| 81 | + }) | ||
| 43 | } | 82 | } |
| 44 | 83 | ||
| 45 | getLiveList() { | 84 | getLiveList() { |
| 85 | + this.pageModel.currentPage = 1 | ||
| 46 | this.liveViewModel.getLiveList( | 86 | this.liveViewModel.getLiveList( |
| 47 | - 1, | 87 | + this.pageModel.currentPage, |
| 48 | this.liveDetailsBean?.liveInfo?.mlive?.mliveId, | 88 | this.liveDetailsBean?.liveInfo?.mlive?.mliveId, |
| 49 | this.liveDetailsBean?.newsId, | 89 | this.liveDetailsBean?.newsId, |
| 50 | 20) | 90 | 20) |
| 51 | .then( | 91 | .then( |
| 52 | (data) => { | 92 | (data) => { |
| 93 | + if (data.barrageResponses && data.barrageResponses.length > 0) { | ||
| 53 | /** | 94 | /** |
| 54 | * 在直播聊天添加一条新内容逻辑: | 95 | * 在直播聊天添加一条新内容逻辑: |
| 55 | 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait" | 96 | 判断 oldNewsId:迁移id非空 且 直播状态不是预约:"wait" |
| @@ -58,13 +99,26 @@ export struct TabLiveComponent { | @@ -58,13 +99,26 @@ export struct TabLiveComponent { | ||
| 58 | 2.名称固定:人民日报主持人 | 99 | 2.名称固定:人民日报主持人 |
| 59 | 3.内容:详情接口的简介,newIntroduction | 100 | 3.内容:详情接口的简介,newIntroduction |
| 60 | */ | 101 | */ |
| 61 | - if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId) && this.liveDetailsBean && this.liveDetailsBean.liveInfo.liveState != 'wait') { | 102 | + if (StringUtils.isNotEmpty(this.liveDetailsBean.oldNewsId) |
| 103 | + && this.liveDetailsBean | ||
| 104 | + && this.liveDetailsBean.liveInfo.liveState != 'wait' | ||
| 105 | + && this.pageModel.currentPage == 1) { | ||
| 62 | let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean | 106 | let liveRoomItemBeanTemp: LiveRoomItemBean = {} as LiveRoomItemBean |
| 63 | liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction | 107 | liveRoomItemBeanTemp.text = this.liveDetailsBean.newIntroduction |
| 64 | liveRoomItemBeanTemp.senderUserName = '人民日报主持人' | 108 | liveRoomItemBeanTemp.senderUserName = '人民日报主持人' |
| 65 | data.barrageResponses.push(liveRoomItemBeanTemp) | 109 | data.barrageResponses.push(liveRoomItemBeanTemp) |
| 66 | } | 110 | } |
| 67 | - this.liveList = data.barrageResponses | 111 | + this.pageModel.viewType = ViewType.LOADED; |
| 112 | + this.liveList.push(...data.barrageResponses) | ||
| 113 | + if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 114 | + this.pageModel.currentPage++; | ||
| 115 | + this.pageModel.hasMore = true; | ||
| 116 | + } else { | ||
| 117 | + this.pageModel.hasMore = false; | ||
| 118 | + } | ||
| 119 | + } else { | ||
| 120 | + this.pageModel.viewType = ViewType.EMPTY; | ||
| 121 | + } | ||
| 68 | }, | 122 | }, |
| 69 | () => { | 123 | () => { |
| 70 | 124 |
| 1 | -import { LiveRoomItemBean } from 'wdBean/Index' | 1 | +import { LiveRoomItemBean, PhotoListBean } from 'wdBean/Index' |
| 2 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' | 2 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' |
| 3 | 3 | ||
| 4 | @Component | 4 | @Component |
| 5 | export struct TabLiveItemComponent { | 5 | export struct TabLiveItemComponent { |
| 6 | item: LiveRoomItemBean = {} as LiveRoomItemBean | 6 | item: LiveRoomItemBean = {} as LiveRoomItemBean |
| 7 | + photoList: PhotoListBean[] = [] | ||
| 7 | 8 | ||
| 8 | aboutToAppear(): void { | 9 | aboutToAppear(): void { |
| 9 | 10 | ||
| @@ -86,8 +87,17 @@ export struct TabLiveItemComponent { | @@ -86,8 +87,17 @@ export struct TabLiveItemComponent { | ||
| 86 | .aspectRatio(310 / 174) | 87 | .aspectRatio(310 / 174) |
| 87 | .objectFit(ImageFit.Auto) | 88 | .objectFit(ImageFit.Auto) |
| 88 | .borderRadius(4) | 89 | .borderRadius(4) |
| 90 | + }.onClick(() => { | ||
| 91 | + for (let item of this.item.pictureUrls) { | ||
| 92 | + this.photoList.push({ | ||
| 93 | + width: 0, | ||
| 94 | + height: 0, | ||
| 95 | + picPath: item, | ||
| 96 | + picDesc: '' | ||
| 97 | + }) | ||
| 89 | } | 98 | } |
| 90 | }) | 99 | }) |
| 100 | + }) | ||
| 91 | }.margin({ | 101 | }.margin({ |
| 92 | left: 32, | 102 | left: 32, |
| 93 | top: 8 | 103 | top: 8 |
| @@ -200,6 +200,8 @@ export struct PlayUIComponent { | @@ -200,6 +200,8 @@ export struct PlayUIComponent { | ||
| 200 | } else { | 200 | } else { |
| 201 | Blank() | 201 | Blank() |
| 202 | } | 202 | } |
| 203 | + if (this.liveDetailsBean?.liveInfo?.liveState == 'running' | ||
| 204 | + || this.liveDetailsBean?.liveInfo?.liveState == 'end') { | ||
| 203 | Image($r('app.media.icon_live_player_full_screen')) | 205 | Image($r('app.media.icon_live_player_full_screen')) |
| 204 | .width(24) | 206 | .width(24) |
| 205 | .height(24) | 207 | .height(24) |
| @@ -213,6 +215,7 @@ export struct PlayUIComponent { | @@ -213,6 +215,7 @@ export struct PlayUIComponent { | ||
| 213 | window.Orientation.LANDSCAPE); | 215 | window.Orientation.LANDSCAPE); |
| 214 | }) | 216 | }) |
| 215 | } | 217 | } |
| 218 | + } | ||
| 216 | .alignItems(VerticalAlign.Center) | 219 | .alignItems(VerticalAlign.Center) |
| 217 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | 220 | .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) |
| 218 | .width('100%') | 221 | .width('100%') |
| 1 | -import { window } from '@kit.ArkUI' | ||
| 2 | -import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' | ||
| 3 | - | ||
| 4 | -import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | ||
| 5 | -import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | ||
| 6 | -import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | ||
| 7 | - | ||
| 8 | -@Entry | ||
| 9 | -@Component | ||
| 10 | -export struct PlayVUIComponent { | ||
| 11 | - playerController: WDPlayerController = new WDPlayerController(); | ||
| 12 | - //菜单键是否可见 | ||
| 13 | - @State isMenuVisible: boolean = true | ||
| 14 | - @State isFullScreen: boolean = false | ||
| 15 | - @Consume liveDetailsBean: LiveDetailsBean | ||
| 16 | - @Consume liveRoomDataBean: LiveRoomDataBean | ||
| 17 | - @State currentTime: string = '' | ||
| 18 | - @State totalTime: string = '' | ||
| 19 | - @State progressVal: number = 0; | ||
| 20 | - //是否处于播放状态中 | ||
| 21 | - @State isPlayStatus: boolean = true | ||
| 22 | - | ||
| 23 | - aboutToAppear(): void { | ||
| 24 | - //播放进度监听 | ||
| 25 | - this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 26 | - this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 27 | - this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 28 | - this.progressVal = Math.floor(position * 100 / duration); | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - build() { | ||
| 33 | - Column() { | ||
| 34 | - this.getTopUIComponent() | ||
| 35 | - this.getMiddleUIComponent() | ||
| 36 | - this.getBottomUIComponent() | ||
| 37 | - } | ||
| 38 | - .width('100%') | ||
| 39 | - .height('100%') | ||
| 40 | - .alignItems(HorizontalAlign.Start) | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - @Builder | ||
| 44 | - getTopUIComponent() { | ||
| 45 | - Column() { | ||
| 46 | - Row() { | ||
| 47 | - Image($r('app.media.icon_arrow_left_white')) | ||
| 48 | - .width(24) | ||
| 49 | - .aspectRatio(1) | ||
| 50 | - .visibility(Visibility.None) | ||
| 51 | - .margin({ | ||
| 52 | - right: 10 | ||
| 53 | - }) | ||
| 54 | - if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { | ||
| 55 | - Text(this.liveDetailsBean.newsTitle) | ||
| 56 | - .maxLines(1) | ||
| 57 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 58 | - .fontSize('16fp') | ||
| 59 | - .fontWeight(500) | ||
| 60 | - .fontColor(Color.White) | ||
| 61 | - .textAlign(TextAlign.Start) | ||
| 62 | - .layoutWeight(1) | ||
| 63 | - } else { | ||
| 64 | - Blank() | ||
| 65 | - } | ||
| 66 | - Image($r('app.media.icon_share')) | ||
| 67 | - .width(24) | ||
| 68 | - .aspectRatio(1) | ||
| 69 | - .visibility(Visibility.None) | ||
| 70 | - } | ||
| 71 | - .width('100%') | ||
| 72 | - .alignItems(VerticalAlign.Center) | ||
| 73 | - .margin({ | ||
| 74 | - bottom: 10 | ||
| 75 | - }) | ||
| 76 | - | ||
| 77 | - this.getLiveStatusView() | ||
| 78 | - }.width('100%') | ||
| 79 | - .padding({ | ||
| 80 | - top: 20, | ||
| 81 | - bottom: 6, | ||
| 82 | - left: 10, | ||
| 83 | - right: 10 | ||
| 84 | - }) | ||
| 85 | - .alignItems(HorizontalAlign.Start) | ||
| 86 | - .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - @Builder | ||
| 90 | - getLiveStatusView() { | ||
| 91 | - // 直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 92 | - // 预约 | ||
| 93 | - if (this.liveDetailsBean.liveInfo?.liveState == 'wait') { | ||
| 94 | - Row() { | ||
| 95 | - Image($r('app.media.icon_live_status_wait')) | ||
| 96 | - .width(22) | ||
| 97 | - .height(18) | ||
| 98 | - Text('预约') | ||
| 99 | - .fontSize('11fp') | ||
| 100 | - .fontWeight(400) | ||
| 101 | - .fontColor(Color.White) | ||
| 102 | - } | ||
| 103 | - .backgroundColor('#4D000000') | ||
| 104 | - .padding({ | ||
| 105 | - top: 1, | ||
| 106 | - right: 4, | ||
| 107 | - bottom: 1 | ||
| 108 | - }) | ||
| 109 | - } | ||
| 110 | - // 直播中 | ||
| 111 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | ||
| 112 | - Row() { | ||
| 113 | - Image($r('app.media.icon_live_status_running')) | ||
| 114 | - .width(22) | ||
| 115 | - .height(18) | ||
| 116 | - Text('直播中') | ||
| 117 | - .fontSize('11fp') | ||
| 118 | - .fontWeight(400) | ||
| 119 | - .fontColor(Color.White) | ||
| 120 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 121 | - .width(12) | ||
| 122 | - .height(12) | ||
| 123 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 124 | - .fontSize('11fp') | ||
| 125 | - .fontWeight(400) | ||
| 126 | - .fontColor(Color.White) | ||
| 127 | - } | ||
| 128 | - .backgroundColor('#4D000000') | ||
| 129 | - .padding({ | ||
| 130 | - top: 1, | ||
| 131 | - right: 4, | ||
| 132 | - bottom: 1 | ||
| 133 | - }) | ||
| 134 | - } | ||
| 135 | - //回看 | ||
| 136 | - else if (this.liveDetailsBean.liveInfo?.liveState == 'end') { | ||
| 137 | - Row() { | ||
| 138 | - Text('回看') | ||
| 139 | - .fontSize('11fp') | ||
| 140 | - .fontWeight(400) | ||
| 141 | - .fontColor(Color.White) | ||
| 142 | - Image($r('app.media.icon_live_player_status_end')) | ||
| 143 | - .width(12) | ||
| 144 | - .height(12) | ||
| 145 | - Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 146 | - .fontSize('11fp') | ||
| 147 | - .fontWeight(400) | ||
| 148 | - .fontColor(Color.White) | ||
| 149 | - } | ||
| 150 | - .backgroundColor('#4D000000') | ||
| 151 | - .padding({ | ||
| 152 | - left: 4, | ||
| 153 | - top: 1, | ||
| 154 | - right: 4, | ||
| 155 | - bottom: 1 | ||
| 156 | - }) | ||
| 157 | - } | ||
| 158 | - } | ||
| 159 | - | ||
| 160 | - @Builder | ||
| 161 | - getMiddleUIComponent() { | ||
| 162 | - Stack() | ||
| 163 | - .layoutWeight(1) | ||
| 164 | - .width('100%') | ||
| 165 | - .onClick(() => { | ||
| 166 | - this.isMenuVisible = !this.isMenuVisible | ||
| 167 | - }) | ||
| 168 | - } | ||
| 169 | - | ||
| 170 | - @Builder | ||
| 171 | - getBottomUIComponent() { | ||
| 172 | - Row() { | ||
| 173 | - if (this.liveDetailsBean?.liveInfo?.liveState == 'end') { | ||
| 174 | - this.playOrPauseBtn() | ||
| 175 | - Text(this.currentTime) | ||
| 176 | - .fontColor(Color.White) | ||
| 177 | - .fontWeight(600) | ||
| 178 | - .fontSize('12fp') | ||
| 179 | - .margin({ | ||
| 180 | - left: 16 | ||
| 181 | - }) | ||
| 182 | - | ||
| 183 | - this.playProgressView() | ||
| 184 | - | ||
| 185 | - Text(this.totalTime) | ||
| 186 | - .fontColor(Color.White) | ||
| 187 | - .fontWeight(600) | ||
| 188 | - .fontSize('12fp') | ||
| 189 | - .margin({ | ||
| 190 | - right: 16 | ||
| 191 | - }) | ||
| 192 | - } else { | ||
| 193 | - Blank() | ||
| 194 | - } | ||
| 195 | - Image($r('app.media.icon_live_player_full_screen')) | ||
| 196 | - .width(24) | ||
| 197 | - .height(24) | ||
| 198 | - .onClick(() => { | ||
| 199 | - this.isFullScreen = !this.isFullScreen | ||
| 200 | - WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 201 | - devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 202 | - }) | ||
| 203 | - } | ||
| 204 | - .alignItems(VerticalAlign.Center) | ||
| 205 | - .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | ||
| 206 | - .width('100%') | ||
| 207 | - .padding({ | ||
| 208 | - left: 10, | ||
| 209 | - right: 10, | ||
| 210 | - top: 15, | ||
| 211 | - bottom: 15 | ||
| 212 | - }) | ||
| 213 | - .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | ||
| 214 | - } | ||
| 215 | - | ||
| 216 | - @Builder | ||
| 217 | - playOrPauseBtn() { | ||
| 218 | - //暂停、播放 | ||
| 219 | - Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic')) | ||
| 220 | - .width(24) | ||
| 221 | - .height(24) | ||
| 222 | - .onClick(() => { | ||
| 223 | - if (this.isPlayStatus) { | ||
| 224 | - this.isPlayStatus = false | ||
| 225 | - this.playerController.pause() | ||
| 226 | - } else { | ||
| 227 | - this.isPlayStatus = true | ||
| 228 | - this.playerController.play() | ||
| 229 | - } | ||
| 230 | - }) | ||
| 231 | - } | ||
| 232 | - | ||
| 233 | - @Builder | ||
| 234 | - playProgressView() { | ||
| 235 | - Slider({ | ||
| 236 | - value: this.progressVal, | ||
| 237 | - step: 1, | ||
| 238 | - style: SliderStyle.OutSet | ||
| 239 | - }) | ||
| 240 | - .blockSize({ | ||
| 241 | - width: 18, | ||
| 242 | - height: 12 | ||
| 243 | - })// .blockStyle({ | ||
| 244 | - // type: SliderBlockType.IMAGE, | ||
| 245 | - // image: $r('app.media.ic_player_block') | ||
| 246 | - // }) | ||
| 247 | - .blockColor(Color.White) | ||
| 248 | - .trackColor('#4DFFFFFF') | ||
| 249 | - .selectedColor('#FFED2800') | ||
| 250 | - .height(14) | ||
| 251 | - .trackThickness(1) | ||
| 252 | - .layoutWeight(1) | ||
| 253 | - .margin({ | ||
| 254 | - left: 8, | ||
| 255 | - right: 8 | ||
| 256 | - }) | ||
| 257 | - .onChange((value: number, mode: SliderChangeMode) => { | ||
| 258 | - this.playerController?.setSeekTime(value, mode); | ||
| 259 | - }) | ||
| 260 | - } | ||
| 261 | -} |
| 1 | -import { LiveDetailsBean } from 'wdBean/Index'; | ||
| 2 | -import { WDPlayerController, WDPlayerRenderView } from 'wdPlayer/Index'; | ||
| 3 | -import { PlayUIComponent } from './PlayUIComponent'; | ||
| 4 | - | ||
| 5 | -@Component | ||
| 6 | -export struct TopPlayVComponent { | ||
| 7 | - @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | ||
| 8 | - playerController: WDPlayerController = new WDPlayerController(); | ||
| 9 | - | ||
| 10 | - aboutToAppear(): void { | ||
| 11 | - this.playerController.onCanplay = () => { | ||
| 12 | - this.playerController.play() | ||
| 13 | - } | ||
| 14 | - } | ||
| 15 | - | ||
| 16 | - updateData() { | ||
| 17 | - //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 18 | - if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { | ||
| 19 | - let playUrl = '' | ||
| 20 | - if (this.liveDetailsBean.liveInfo.liveState == 'running') { | ||
| 21 | - playUrl = this.liveDetailsBean.liveInfo.vlive[0].liveUrl | ||
| 22 | - } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { | ||
| 23 | - playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | ||
| 24 | - } | ||
| 25 | - this.playerController.firstPlay(playUrl); | ||
| 26 | - } | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - build() { | ||
| 30 | - Stack() { | ||
| 31 | - // https://developer.huawei.com/consumer/cn/doc/harmonyos-references/ts-universal-attributes-image-effect-0000001862607345 | ||
| 32 | - Image(this.liveDetailsBean.fullColumnImgUrls[0].url) | ||
| 33 | - .height('100%') | ||
| 34 | - .width('100%') | ||
| 35 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 36 | - .blur(100) | ||
| 37 | - | ||
| 38 | - WDPlayerRenderView({ | ||
| 39 | - playerController: this.playerController, | ||
| 40 | - onLoad: async () => { | ||
| 41 | - } | ||
| 42 | - })// .height('100%') | ||
| 43 | - .width('100%')// 扩展至所有非安全区域 | ||
| 44 | - .onClick(() => { | ||
| 45 | - this.playerController.play() | ||
| 46 | - }) | ||
| 47 | - // PlayUIComponent({ playerController: this.playerController }) | ||
| 48 | - } | ||
| 49 | - // .height('100%') | ||
| 50 | - .width('100%') | ||
| 51 | - // 扩展至所有非安全区域 | ||
| 52 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | ||
| 53 | - } | ||
| 54 | - | ||
| 55 | - aboutToDisappear(): void { | ||
| 56 | - this.playerController.pause() | ||
| 57 | - } | ||
| 58 | -} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/ChartItemCompereComponent.ets
0 → 100644
| 1 | +import { LiveDetailsBean } from 'wdBean/Index' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct ChartItemCompereComponent { | ||
| 5 | + @Consume liveDetailsBean: LiveDetailsBean | ||
| 6 | + | ||
| 7 | + aboutToAppear(): void { | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + ListItem() { | ||
| 12 | + Column() { | ||
| 13 | + Row() { | ||
| 14 | + Image($r('app.media.icon_live_status_running')) | ||
| 15 | + .borderRadius(10) | ||
| 16 | + .width(20) | ||
| 17 | + .height(20) | ||
| 18 | + .margin({ right: 8 }) | ||
| 19 | + | ||
| 20 | + Text('人民日报') | ||
| 21 | + .fontSize(14) | ||
| 22 | + .fontColor('#FFFFFFFF') | ||
| 23 | + .margin({ right: 8 }) | ||
| 24 | + | ||
| 25 | + Text(' 主持人 ') | ||
| 26 | + .fontSize(11) | ||
| 27 | + .backgroundColor('808562') | ||
| 28 | + .fontColor('#FFFFFFFF') | ||
| 29 | + .padding({ top: 2, bottom: 2, left: 4, right: 4 }) | ||
| 30 | + .borderRadius(4) | ||
| 31 | + }.margin({ bottom: 8 }) | ||
| 32 | + | ||
| 33 | + Text(this.liveDetailsBean.newIntroduction).lineHeight(22) | ||
| 34 | + } | ||
| 35 | + .backgroundColor('#4D000000') | ||
| 36 | + .borderRadius(3) | ||
| 37 | + .padding({ | ||
| 38 | + top: 6, | ||
| 39 | + bottom: 6, | ||
| 40 | + left: 8, | ||
| 41 | + right: 8 | ||
| 42 | + }) | ||
| 43 | + .margin({ left: 16, bottom: 4 }) | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/ChartItemComponent.ets
0 → 100644
| 1 | +import { LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct ChatItemComponent { | ||
| 5 | + item: LiveRoomItemBean = {} as LiveRoomItemBean | ||
| 6 | + | ||
| 7 | + aboutToAppear(): void { | ||
| 8 | + } | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Row() { | ||
| 12 | + Text() { | ||
| 13 | + if (this.item.senderUserName) { | ||
| 14 | + Span(' 主持人 ') | ||
| 15 | + .fontSize(11) | ||
| 16 | + .lineHeight(20) | ||
| 17 | + .textBackgroundStyle({ color: '#808562', radius: 2 }) | ||
| 18 | + Span(' ') | ||
| 19 | + } | ||
| 20 | + Span(this.item.senderUserName + ': ') | ||
| 21 | + .fontColor('#FFFFC63F') | ||
| 22 | + .padding({ right: 118 }) | ||
| 23 | + // | ||
| 24 | + | ||
| 25 | + Span(this.item.text) | ||
| 26 | + } | ||
| 27 | + .fontSize(14) | ||
| 28 | + .fontColor('#FFFFFFFF') | ||
| 29 | + .lineHeight(22) | ||
| 30 | + .textShadow({ offsetX: 1, offsetY: 1, color: '#4D000000', radius: 1 }) | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + .backgroundColor('#4D000000') | ||
| 34 | + .borderRadius(3) | ||
| 35 | + .padding({ | ||
| 36 | + top: 6, | ||
| 37 | + bottom: 6, | ||
| 38 | + left: 8, | ||
| 39 | + right: 8 | ||
| 40 | + }) | ||
| 41 | + .margin({ left: 16, bottom: 4 }) | ||
| 42 | + } | ||
| 43 | +} |
| 1 | +import { LiveDetailsBean, LiveRoomDataBean, LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | +import { LiveCommentComponent } from 'wdComponent/Index' | ||
| 3 | +import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | ||
| 4 | +import { DisplayDirection, ViewType } from 'wdConstant/Index' | ||
| 5 | +import { LiveViewModel } from '../../viewModel/LiveViewModel' | ||
| 6 | +import { ChartItemCompereComponent } from './ChartItemCompereComponent' | ||
| 7 | +import { ChatItemComponent } from './ChartItemComponent' | ||
| 8 | + | ||
| 9 | + | ||
| 1 | @Component | 10 | @Component |
| 2 | export struct PlayerCommentComponent { | 11 | export struct PlayerCommentComponent { |
| 12 | + liveViewModel: LiveViewModel = new LiveViewModel() | ||
| 13 | + @Consume @Watch('liveDetailsBeanChange') liveDetailsBean: LiveDetailsBean | ||
| 14 | + @Consume liveRoomDataBean: LiveRoomDataBean | ||
| 15 | + @Consume displayDirection: DisplayDirection | ||
| 16 | + @State private pageModel: PageModel = new PageModel() | ||
| 17 | + @State liveChatList: Array<LiveRoomItemBean> = [] | ||
| 18 | + | ||
| 19 | + aboutToAppear(): void { | ||
| 20 | + this.getLiveChatList() | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + liveDetailsBeanChange() { | ||
| 24 | + this.getLiveChatList() | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + getLiveChatList() { | ||
| 28 | + this.pageModel.currentPage = 1 | ||
| 29 | + this.liveViewModel.getLiveChatList( | ||
| 30 | + 1, | ||
| 31 | + this.liveDetailsBean?.liveInfo?.mlive?.mliveId, | ||
| 32 | + this.liveDetailsBean?.newsId, | ||
| 33 | + 20,) | ||
| 34 | + .then( | ||
| 35 | + (data) => { | ||
| 36 | + if (data.barrageResponses && data.barrageResponses.length > 0) { | ||
| 37 | + | ||
| 38 | + this.pageModel.viewType = ViewType.LOADED; | ||
| 39 | + this.liveChatList.push(...data.barrageResponses) | ||
| 40 | + console.log('liveChatList===', this.liveChatList) | ||
| 41 | + if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 42 | + this.pageModel.currentPage++; | ||
| 43 | + this.pageModel.hasMore = true; | ||
| 44 | + } else { | ||
| 45 | + this.pageModel.hasMore = false; | ||
| 46 | + } | ||
| 47 | + } else { | ||
| 48 | + this.pageModel.viewType = ViewType.EMPTY; | ||
| 49 | + } | ||
| 50 | + }, | ||
| 51 | + () => { | ||
| 52 | + | ||
| 53 | + }) | ||
| 54 | + } | ||
| 55 | + | ||
| 3 | build() { | 56 | build() { |
| 57 | + Column() { | ||
| 58 | + List() { | ||
| 59 | + // 主持人 | ||
| 60 | + if (this.liveDetailsBean.oldNewsId) { | ||
| 61 | + ChartItemCompereComponent() | ||
| 62 | + } | ||
| 63 | + ForEach(this.liveChatList, (item: LiveRoomItemBean) => { | ||
| 64 | + ListItem() { | ||
| 65 | + ChatItemComponent({ item: item }) | ||
| 66 | + } | ||
| 67 | + }) | ||
| 68 | + } | ||
| 69 | + .height(280) | ||
| 70 | + .width('80%') | ||
| 71 | + .scrollBar(BarState.Off) | ||
| 72 | + .margin({ bottom: 20 }) | ||
| 73 | + | ||
| 74 | + LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | ||
| 75 | + .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | ||
| 76 | + .backgroundColor(Color.Transparent) | ||
| 77 | + }.alignItems(HorizontalAlign.Start) | ||
| 78 | + | ||
| 4 | } | 79 | } |
| 5 | } | 80 | } |
| @@ -13,6 +13,7 @@ export struct PlayerComponent { | @@ -13,6 +13,7 @@ export struct PlayerComponent { | ||
| 13 | @State imgUrl: string = '' | 13 | @State imgUrl: string = '' |
| 14 | @State isWait: boolean = false | 14 | @State isWait: boolean = false |
| 15 | @State liveStreamType: number | null = -1 | 15 | @State liveStreamType: number | null = -1 |
| 16 | + @State playUrl: string = '' | ||
| 16 | 17 | ||
| 17 | aboutToAppear(): void { | 18 | aboutToAppear(): void { |
| 18 | if (this.playerController) { | 19 | if (this.playerController) { |
| @@ -48,8 +49,10 @@ export struct PlayerComponent { | @@ -48,8 +49,10 @@ export struct PlayerComponent { | ||
| 48 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | 49 | playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri |
| 49 | liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType | 50 | liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType |
| 50 | } | 51 | } |
| 52 | + | ||
| 51 | this.liveStreamType = liveStreamType | 53 | this.liveStreamType = liveStreamType |
| 52 | - this.playerController?.firstPlay(playUrl); | 54 | + this.playUrl = playUrl |
| 55 | + | ||
| 53 | } | 56 | } |
| 54 | } | 57 | } |
| 55 | 58 | ||
| @@ -60,12 +63,14 @@ export struct PlayerComponent { | @@ -60,12 +63,14 @@ export struct PlayerComponent { | ||
| 60 | .height('100%') | 63 | .height('100%') |
| 61 | .width('100%') | 64 | .width('100%') |
| 62 | .blur(100) | 65 | .blur(100) |
| 66 | + .renderFit(RenderFit.RESIZE_COVER) | ||
| 63 | 67 | ||
| 64 | // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,liveStreamType=0横屏正常展示 | 68 | // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,liveStreamType=0横屏正常展示 |
| 65 | if (this.liveStreamType == null) { | 69 | if (this.liveStreamType == null) { |
| 66 | WDPlayerRenderVLiveView({ | 70 | WDPlayerRenderVLiveView({ |
| 67 | playerController: this.playerController, | 71 | playerController: this.playerController, |
| 68 | onLoad: () => { | 72 | onLoad: () => { |
| 73 | + this.playerController?.firstPlay(this.playUrl); | ||
| 69 | } | 74 | } |
| 70 | }).height('100%') | 75 | }).height('100%') |
| 71 | .width('100%') | 76 | .width('100%') |
| @@ -73,8 +78,9 @@ export struct PlayerComponent { | @@ -73,8 +78,9 @@ export struct PlayerComponent { | ||
| 73 | WDPlayerRenderView({ | 78 | WDPlayerRenderView({ |
| 74 | playerController: this.playerController, | 79 | playerController: this.playerController, |
| 75 | onLoad: () => { | 80 | onLoad: () => { |
| 81 | + this.playerController?.firstPlay(this.playUrl); | ||
| 76 | } | 82 | } |
| 77 | - }).padding({ top: 195 }) | 83 | + }).margin({ top: 195 }).height(211) |
| 78 | } | 84 | } |
| 79 | } | 85 | } |
| 80 | .height('100%') | 86 | .height('100%') |
-
Please register or login to post a comment