Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool
Showing
113 changed files
with
4279 additions
and
555 deletions
| @@ -19,4 +19,6 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum'; | @@ -19,4 +19,6 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum'; | ||
| 19 | 19 | ||
| 20 | export { ScreenType } from './src/main/ets/enum/ScreenType'; | 20 | export { ScreenType } from './src/main/ets/enum/ScreenType'; |
| 21 | 21 | ||
| 22 | -export { SpConstants } from './src/main/ets/constants/SpConstants'; | ||
| 22 | +export { SpConstants } from './src/main/ets/constants/SpConstants'; | ||
| 23 | + | ||
| 24 | +export { DisplayDirection } from './src/main/ets/constants/VideoConstants'; |
| @@ -16,7 +16,7 @@ export const enum CompStyle { | @@ -16,7 +16,7 @@ export const enum CompStyle { | ||
| 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ | 16 | Single_Column_05 = 'Single_Column-05', // 海报图卡:/ |
| 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ | 17 | Single_Column_06 = 'Single_Column-06', // 留言板卡:/ |
| 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 | 18 | Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播 |
| 19 | - Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单 | 19 | + Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡 :视频、直播、榜单 |
| 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 | 20 | Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动 |
| 21 | 21 | ||
| 22 | 22 |
| @@ -26,6 +26,7 @@ export class Size { | @@ -26,6 +26,7 @@ export class Size { | ||
| 26 | export class WindowModel { | 26 | export class WindowModel { |
| 27 | private windowStage?: window.WindowStage; | 27 | private windowStage?: window.WindowStage; |
| 28 | private windowClass?: window.Window; | 28 | private windowClass?: window.Window; |
| 29 | + private isFullScreen: boolean = false | ||
| 29 | static shared: WindowModel = new WindowModel() | 30 | static shared: WindowModel = new WindowModel() |
| 30 | static TAG = "WindowModel"; | 31 | static TAG = "WindowModel"; |
| 31 | 32 | ||
| @@ -129,7 +130,15 @@ export class WindowModel { | @@ -129,7 +130,15 @@ export class WindowModel { | ||
| 129 | this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => { | 130 | this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => { |
| 130 | callback && callback(err) | 131 | callback && callback(err) |
| 131 | }) | 132 | }) |
| 133 | + } | ||
| 134 | + | ||
| 135 | + setWindowLayoutFullScreen(isFullScreen: boolean) { | ||
| 136 | + this.isFullScreen = isFullScreen | ||
| 137 | + this.windowClass?.setWindowLayoutFullScreen(isFullScreen) | ||
| 138 | + } | ||
| 132 | 139 | ||
| 140 | + getIsFullScreen(): boolean { | ||
| 141 | + return this.isFullScreen | ||
| 133 | } | 142 | } |
| 134 | } | 143 | } |
| 135 | 144 |
| @@ -238,6 +238,20 @@ export class HttpUrlUtils { | @@ -238,6 +238,20 @@ export class HttpUrlUtils { | ||
| 238 | * 创作者详情接口 | 238 | * 创作者详情接口 |
| 239 | */ | 239 | */ |
| 240 | static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList"; | 240 | static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList"; |
| 241 | + /** | ||
| 242 | + * 客态查询发布作品数量 | ||
| 243 | + */ | ||
| 244 | + static readonly ARTICLE_COUNT_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/count"; | ||
| 245 | + | ||
| 246 | + /** | ||
| 247 | + * 客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表 | ||
| 248 | + */ | ||
| 249 | + static readonly ARTICLE_LIST_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/articleList"; | ||
| 250 | + | ||
| 251 | + /** | ||
| 252 | + * 客户端 客态主页页面-获取影响力 | ||
| 253 | + */ | ||
| 254 | + static readonly CREATOR_INFLUENCE_HOTS_DATA_PATH: string = "/api/rmrb-bigdata-bi/zh/c/stats/creator/influence/info"; | ||
| 241 | 255 | ||
| 242 | /** | 256 | /** |
| 243 | * 早晚报列表 | 257 | * 早晚报列表 |
| @@ -727,6 +741,21 @@ export class HttpUrlUtils { | @@ -727,6 +741,21 @@ export class HttpUrlUtils { | ||
| 727 | return url | 741 | return url |
| 728 | } | 742 | } |
| 729 | 743 | ||
| 744 | + static getArticleCountHotsDataUrl() { | ||
| 745 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH | ||
| 746 | + return url | ||
| 747 | + } | ||
| 748 | + | ||
| 749 | + static getArticleListHotsDataUrl() { | ||
| 750 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH | ||
| 751 | + return url | ||
| 752 | + } | ||
| 753 | + | ||
| 754 | + static getCreatorInfluenceInfoHotsDataUrl() { | ||
| 755 | + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH | ||
| 756 | + return url | ||
| 757 | + } | ||
| 758 | + | ||
| 730 | // static getYcgCommonHeaders(): HashMap<string, string> { | 759 | // static getYcgCommonHeaders(): HashMap<string, string> { |
| 731 | // let headers: HashMap<string, string> = new HashMap<string, string>() | 760 | // let headers: HashMap<string, string> = new HashMap<string, string>() |
| 732 | // | 761 | // |
| @@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
| 8 | "version": "1.0.0", | 8 | "version": "1.0.0", |
| 9 | "dependencies": { | 9 | "dependencies": { |
| 10 | "wdKit": "file:../wdKit", | 10 | "wdKit": "file:../wdKit", |
| 11 | - "wdBean": "file:../../features/wdBean" | 11 | + "wdBean": "file:../../features/wdBean", |
| 12 | + "wdNetwork": "file:../../commons/wdNetwork" | ||
| 12 | } | 13 | } |
| 13 | -} | 14 | +} |
| @@ -50,13 +50,17 @@ export function registerRouter() { | @@ -50,13 +50,17 @@ export function registerRouter() { | ||
| 50 | 50 | ||
| 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { | 51 | Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => { |
| 52 | if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { | 52 | if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) { |
| 53 | - return WDRouterPage.detailPlayLivePage | 53 | + if (action.params?.liveStyle === 0) { |
| 54 | + return WDRouterPage.detailPlayLivePage | ||
| 55 | + } else { | ||
| 56 | + return WDRouterPage.detailPlayVLivePage | ||
| 57 | + } | ||
| 54 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { | 58 | } else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) { |
| 55 | return WDRouterPage.detailVideoListPage | 59 | return WDRouterPage.detailVideoListPage |
| 56 | - }else if(action.params?.detailPageType == 9){ | 60 | + } else if (action.params?.detailPageType == 9) { |
| 57 | //图集详情页 | 61 | //图集详情页 |
| 58 | return WDRouterPage.multiPictureDetailPage | 62 | return WDRouterPage.multiPictureDetailPage |
| 59 | - }else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){ | 63 | + } else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) { |
| 60 | //动态详情页 | 64 | //动态详情页 |
| 61 | return WDRouterPage.dynamicDetailPage | 65 | return WDRouterPage.dynamicDetailPage |
| 62 | } else if (action.params?.detailPageType == 17) { | 66 | } else if (action.params?.detailPageType == 17) { |
| @@ -14,6 +14,16 @@ export class WDRouterPage { | @@ -14,6 +14,16 @@ export class WDRouterPage { | ||
| 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` | 14 | return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}` |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | + static getLoginBundleInfo() { | ||
| 18 | + let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 19 | + return `@bundle:${bundleInfo.name}/${"wdLogin"}/${"ets/pages/login/LoginPage"}` | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + static getSettingBundleInfo() { | ||
| 23 | + let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | ||
| 24 | + return `@bundle:${bundleInfo.name}/${"wdComponent"}/${"ets/components/page/SettingPage"}` | ||
| 25 | + } | ||
| 26 | + | ||
| 17 | 27 | ||
| 18 | url() { | 28 | url() { |
| 19 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) | 29 | let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT) |
| @@ -99,4 +109,6 @@ export class WDRouterPage { | @@ -99,4 +109,6 @@ export class WDRouterPage { | ||
| 99 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); | 109 | static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); |
| 100 | //搜索人民号主页 | 110 | //搜索人民号主页 |
| 101 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); | 111 | static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); |
| 112 | + //人民号主页 | ||
| 113 | + static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage"); | ||
| 102 | } | 114 | } |
| @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) { | @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) { | ||
| 41 | class AppInfo { | 41 | class AppInfo { |
| 42 | plat: string = '' | 42 | plat: string = '' |
| 43 | system: string = '' | 43 | system: string = '' |
| 44 | + networkStatus: number = 1 | ||
| 44 | // TODO 完善 | 45 | // TODO 完善 |
| 45 | } | 46 | } |
| 46 | 47 | ||
| @@ -52,6 +53,7 @@ function getAppPublicInfo(): string { | @@ -52,6 +53,7 @@ function getAppPublicInfo(): string { | ||
| 52 | info.plat = 'Phone' | 53 | info.plat = 'Phone' |
| 53 | // 直接用Android,后续适配再新增鸿蒙 | 54 | // 直接用Android,后续适配再新增鸿蒙 |
| 54 | info.system = 'Android' | 55 | info.system = 'Android' |
| 56 | + info.networkStatus = 1 | ||
| 55 | let result = JSON.stringify(info) | 57 | let result = JSON.stringify(info) |
| 56 | return result; | 58 | return result; |
| 57 | } | 59 | } |
| @@ -82,8 +82,7 @@ export struct WdWebLocalComponent { | @@ -82,8 +82,7 @@ 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) { | 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) { |
| 89 | this.webHeight = Number(data?.data?.webViewHeight) | 88 | this.webHeight = Number(data?.data?.webViewHeight) |
| @@ -37,7 +37,8 @@ export { | @@ -37,7 +37,8 @@ export { | ||
| 37 | postExecuteCollectRecordParams, | 37 | postExecuteCollectRecordParams, |
| 38 | contentListParams, | 38 | contentListParams, |
| 39 | postInteractAccentionOperateParams, | 39 | postInteractAccentionOperateParams, |
| 40 | - postRecommendListParams | 40 | + postRecommendListParams, |
| 41 | + contentListItem | ||
| 41 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; | 42 | } from './src/main/ets/bean/detail/MultiPictureDetailPageDTO'; |
| 42 | 43 | ||
| 43 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; | 44 | export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam'; |
| @@ -122,3 +123,21 @@ export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoom | @@ -122,3 +123,21 @@ export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoom | ||
| 122 | 123 | ||
| 123 | export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; | 124 | export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; |
| 124 | 125 | ||
| 126 | +export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; | ||
| 127 | + | ||
| 128 | +export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; | ||
| 129 | + | ||
| 130 | +export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO'; | ||
| 131 | + | ||
| 132 | +export { ContentExtDTO } from './src/main/ets/bean/peoples/ContentExtDTO'; | ||
| 133 | + | ||
| 134 | +export { ContentShareDTO } from './src/main/ets/bean/peoples/ContentShareDTO'; | ||
| 135 | + | ||
| 136 | +export { | ||
| 137 | + PeopleShipUserDetailData, | ||
| 138 | + ArticleCountData, | ||
| 139 | + ArticleTypeData, | ||
| 140 | + ArticleListData, | ||
| 141 | + InfluenceData | ||
| 142 | +} from './src/main/ets/bean/peoples/PeopleShipUserDetailData'; | ||
| 143 | + |
| @@ -6,9 +6,14 @@ | @@ -6,9 +6,14 @@ | ||
| 6 | */ | 6 | */ |
| 7 | import { appStyleImagesDTO } from '../content/appStyleImagesDTO' | 7 | import { appStyleImagesDTO } from '../content/appStyleImagesDTO' |
| 8 | import {contentVideosDTO} from '../content/contentVideosDTO' | 8 | import {contentVideosDTO} from '../content/contentVideosDTO' |
| 9 | +import { VlivesDTO } from '../peoples/VlivesDTO' | ||
| 10 | +import { LiveDTO } from '../peoples/LiveDTO' | ||
| 11 | +import { ContentExtDTO } from '../peoples/ContentExtDTO' | ||
| 12 | +import { ContentShareDTO } from '../peoples/ContentShareDTO' | ||
| 13 | + | ||
| 9 | export interface ArticleListDTO { | 14 | export interface ArticleListDTO { |
| 10 | listTitle: string; | 15 | listTitle: string; |
| 11 | - mainPicCount: string; | 16 | + mainPicCount: number; |
| 12 | videosCount: string; | 17 | videosCount: string; |
| 13 | voicesCount: string; | 18 | voicesCount: string; |
| 14 | landscape: number; | 19 | landscape: number; |
| @@ -20,7 +25,7 @@ export interface ArticleListDTO { | @@ -20,7 +25,7 @@ export interface ArticleListDTO { | ||
| 20 | id: string; | 25 | id: string; |
| 21 | serialsId: string; | 26 | serialsId: string; |
| 22 | oldContentId: string; | 27 | oldContentId: string; |
| 23 | - type: string; | 28 | + type: number; |
| 24 | tenancy: string; | 29 | tenancy: string; |
| 25 | clientPubFlag: string; | 30 | clientPubFlag: string; |
| 26 | grayScale: string; | 31 | grayScale: string; |
| @@ -62,11 +67,12 @@ export interface ArticleListDTO { | @@ -62,11 +67,12 @@ export interface ArticleListDTO { | ||
| 62 | joinActivity: string; | 67 | joinActivity: string; |
| 63 | userType: string; | 68 | userType: string; |
| 64 | content: object; | 69 | content: object; |
| 65 | - contentShare: []; | 70 | + contentShare: ContentShareDTO[]; |
| 66 | contentLinkData: string; | 71 | contentLinkData: string; |
| 67 | - contentExt: []; | 72 | + contentExt: ContentExtDTO[]; |
| 68 | contentVideos: contentVideosDTO[]; | 73 | contentVideos: contentVideosDTO[]; |
| 69 | - contentPictures: []; | 74 | + appStyleVideos: contentVideosDTO[]; |
| 75 | + contentPictures: appStyleImagesDTO[]; | ||
| 70 | contentPayments: string; | 76 | contentPayments: string; |
| 71 | contentPaymentStaffs: string; | 77 | contentPaymentStaffs: string; |
| 72 | contentTxt: []; | 78 | contentTxt: []; |
| @@ -78,7 +84,7 @@ export interface ArticleListDTO { | @@ -78,7 +84,7 @@ export interface ArticleListDTO { | ||
| 78 | contentStatistics: string; | 84 | contentStatistics: string; |
| 79 | topicExistHeadImage: string; | 85 | topicExistHeadImage: string; |
| 80 | topicComps: string; | 86 | topicComps: string; |
| 81 | - live: string; | 87 | + live: LiveDTO; |
| 82 | statusInfo: string; | 88 | statusInfo: string; |
| 83 | askInfo: string; | 89 | askInfo: string; |
| 84 | askAttachmentList: string; | 90 | askAttachmentList: string; |
| @@ -87,5 +93,5 @@ export interface ArticleListDTO { | @@ -87,5 +93,5 @@ export interface ArticleListDTO { | ||
| 87 | ttopicInteracts: string; | 93 | ttopicInteracts: string; |
| 88 | ttopic: string; | 94 | ttopic: string; |
| 89 | mlive: string; | 95 | mlive: string; |
| 90 | - vlives: string | 96 | + vlives: VlivesDTO[]; |
| 91 | } | 97 | } |
| @@ -21,6 +21,7 @@ export interface ContentDTO { | @@ -21,6 +21,7 @@ export interface ContentDTO { | ||
| 21 | lengthTime?: object; | 21 | lengthTime?: object; |
| 22 | linkUrl: string; | 22 | linkUrl: string; |
| 23 | openLikes: number; | 23 | openLikes: number; |
| 24 | + openComment?: number; | ||
| 24 | openUrl: string; | 25 | openUrl: string; |
| 25 | pageId: string; | 26 | pageId: string; |
| 26 | // playUrls: any[]; | 27 | // playUrls: any[]; |
| @@ -18,5 +18,6 @@ export interface Params { | @@ -18,5 +18,6 @@ export interface Params { | ||
| 18 | // 8.专辑竖屏详情页 | 18 | // 8.专辑竖屏详情页 |
| 19 | // 13.音频详情页 | 19 | // 13.音频详情页 |
| 20 | // 17.多图(图集)详情页 | 20 | // 17.多图(图集)详情页 |
| 21 | - detailPageType?:number; // 详情页类型 | 21 | + detailPageType?: number; // 详情页类型 |
| 22 | + liveStyle?: number; // 直播类型:0横屏,1竖屏 | ||
| 22 | } | 23 | } |
| @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams { | @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams { | ||
| 160 | contentList: postExecuteCollectRecordParamsItem[] | 160 | contentList: postExecuteCollectRecordParamsItem[] |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | -interface contentListItem { | 163 | +export interface contentListItem { |
| 164 | contentId: string; | 164 | contentId: string; |
| 165 | contentType: number; | 165 | contentType: number; |
| 166 | } | 166 | } |
| @@ -164,6 +164,7 @@ export interface LiveDetailsBean { | @@ -164,6 +164,7 @@ export interface LiveDetailsBean { | ||
| 164 | //迁移id | 164 | //迁移id |
| 165 | oldNewsId: string | 165 | oldNewsId: string |
| 166 | reLInfo: ReLInfo | 166 | reLInfo: ReLInfo |
| 167 | + rmhInfo: RmhInfo | ||
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | export interface LiveInfo { | 170 | export interface LiveInfo { |
| @@ -189,8 +190,18 @@ export interface Vlive { | @@ -189,8 +190,18 @@ export interface Vlive { | ||
| 189 | liveUrl: string | 190 | liveUrl: string |
| 190 | //直播回看地址,多路直播录制文件URL | 191 | //直播回看地址,多路直播录制文件URL |
| 191 | replayUri: string | 192 | replayUri: string |
| 193 | + // 画面兼容 0-横屏流画面,1-竖屏流画面(仅竖屏直播使用)【前端使用, 可能竖屏模式但是直播流画面是横屏流,前端使用该字段】 | ||
| 194 | + liveStreamType: number | null | ||
| 192 | } | 195 | } |
| 193 | 196 | ||
| 194 | export interface ReLInfo { | 197 | export interface ReLInfo { |
| 195 | relId: string | 198 | relId: string |
| 199 | +} | ||
| 200 | + | ||
| 201 | +export interface RmhInfo { | ||
| 202 | + rmhName: string; | ||
| 203 | + rmhHeadUrl: string; | ||
| 204 | + rmhId: string; | ||
| 205 | + userId: string; | ||
| 206 | + userType: string; | ||
| 196 | } | 207 | } |
| 1 | +export interface ContentExtDTO { | ||
| 2 | + id: number; | ||
| 3 | + contentId: number; | ||
| 4 | + openLikes: number; | ||
| 5 | + openComment: number; | ||
| 6 | + openDownload: number; | ||
| 7 | + likesStyle: number; | ||
| 8 | + top: number; | ||
| 9 | + joinActivity: number; | ||
| 10 | + hotFlag: number; | ||
| 11 | + preCommentFlag: number; | ||
| 12 | + currentPoliticsFlag: number; | ||
| 13 | + appStyle: number; | ||
| 14 | + tenancy: number; | ||
| 15 | + downloadFlag: number; | ||
| 16 | + publishType: number; | ||
| 17 | + payment: number; | ||
| 18 | + deleted: number; | ||
| 19 | + createUser: string; | ||
| 20 | + createTime: string; | ||
| 21 | + updateUser: string; | ||
| 22 | + updateTime: string; | ||
| 23 | + keyArticle: number; | ||
| 24 | + toExamine: number; | ||
| 25 | + bestNoticer: number; | ||
| 26 | + commentDisplay: number; | ||
| 27 | + imageQuality: number; | ||
| 28 | + haveAdver: number; | ||
| 29 | + openAudio: number; | ||
| 30 | + withdrawNum: number; | ||
| 31 | + menuShow: string; | ||
| 32 | + recommendShow: string; | ||
| 33 | + recommendSelf: string; | ||
| 34 | + concentration: string; | ||
| 35 | + objectPosId: string; | ||
| 36 | + articleExistVote: number; | ||
| 37 | + zhExpireTimeAi: number; | ||
| 38 | + zhTagsAi: string; | ||
| 39 | + appReadCountShow: number; | ||
| 40 | +} |
| 1 | +export interface LiveDTO { | ||
| 2 | + status: string; | ||
| 3 | + previewType: number; | ||
| 4 | + planStartTime: number; | ||
| 5 | + tplId: number; | ||
| 6 | + startTime: number; | ||
| 7 | + endTime: number; | ||
| 8 | + userOrigin: string; | ||
| 9 | + liveStyle: number; | ||
| 10 | + liveWay: number; | ||
| 11 | + liveStreamType: number; | ||
| 12 | + liveExperienceSwitch: boolean; | ||
| 13 | + liveExperienceTime: number; | ||
| 14 | + handAngleSwitch: boolean; | ||
| 15 | + likeStyle: string; | ||
| 16 | + liveType: string; | ||
| 17 | + preDisplay: number; | ||
| 18 | + playbackSwitch: boolean; | ||
| 19 | + originalAddress: string; | ||
| 20 | + provinceName: string; | ||
| 21 | + liveRemindSwitch: boolean; | ||
| 22 | + recordUrlFlag: number; | ||
| 23 | + vr: number; | ||
| 24 | + landscape: string; | ||
| 25 | + recordUrl: string; | ||
| 26 | + uri: string; | ||
| 27 | +} |
| 1 | +import { ArticleListDTO } from '../component/ArticleListDTO' | ||
| 2 | +/** | ||
| 3 | +* http://192.168.1.3:3300/project/3796/interface/api/188629 | ||
| 4 | +* 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表 | ||
| 5 | + * 接口路径:/contact/zh/c/master/detail | ||
| 6 | + * 人民号-主页详情页面数据 | ||
| 7 | + */ | ||
| 8 | +export interface PeopleShipUserDetailData { | ||
| 9 | + articleCreation: number; | ||
| 10 | + attentionNum: number; | ||
| 11 | + authIcon: string; | ||
| 12 | + authId: number; | ||
| 13 | + authPersonal: string; | ||
| 14 | + authTitle: string; | ||
| 15 | + avatarFrame: string; | ||
| 16 | + banControl: number; | ||
| 17 | + browseNum: number; | ||
| 18 | + categoryAuth: string; | ||
| 19 | + city: string; | ||
| 20 | + cnContentPublish: number; | ||
| 21 | + cnIsComment: number; | ||
| 22 | + cnIsLike: number; | ||
| 23 | + cnLiveCommentControl: number; | ||
| 24 | + cnLiveGiftControl: number; | ||
| 25 | + cnLiveLikeControl: number; | ||
| 26 | + cnLivePublish: number; | ||
| 27 | + cnLiveShareControl: number; | ||
| 28 | + cnShareControl: number; | ||
| 29 | + contentPublish: number; | ||
| 30 | + creatorId: string; | ||
| 31 | + district: string; | ||
| 32 | + dynamicControl: number; | ||
| 33 | + dynamicCreation: number; | ||
| 34 | + fansNum: number; | ||
| 35 | + headPhotoUrl: string; | ||
| 36 | + honoraryIcon: string; | ||
| 37 | + honoraryTitle: string; | ||
| 38 | + introduction: string; | ||
| 39 | + isAttention: number; | ||
| 40 | + isComment: number; | ||
| 41 | + isLike: number; | ||
| 42 | + liveCommentControl: number; | ||
| 43 | + liveGiftControl: number; | ||
| 44 | + liveLikeControl: number; | ||
| 45 | + livePublish: number; | ||
| 46 | + liveShareControl: number; | ||
| 47 | + liveSwitch: number; | ||
| 48 | + mainControl: number; | ||
| 49 | + originUserId: string; | ||
| 50 | + pictureCollectionCreation: number; | ||
| 51 | + posterShareControl: number; | ||
| 52 | + province: string; | ||
| 53 | + region: string; | ||
| 54 | + registTime: number; | ||
| 55 | + shareControl: number; | ||
| 56 | + shareUrl: string; | ||
| 57 | + subjectType: number; | ||
| 58 | + userId: string; | ||
| 59 | + userName: string; | ||
| 60 | + userType: string; | ||
| 61 | + videoCollectionCreation: number; | ||
| 62 | + videoCreation: number; | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +//article/count | ||
| 66 | +/* | ||
| 67 | + * 客户端 客态查询发布作品数量 | ||
| 68 | + * http://192.168.1.3:3300/project/3856/interface/api/190579 | ||
| 69 | + * 接口路径:/zh/c/article/count | ||
| 70 | + * */ | ||
| 71 | +export interface ArticleCountData { | ||
| 72 | + zbCount: number; //直播数量 (直播) | ||
| 73 | + dtCount: number; //动态数量 (动态) | ||
| 74 | + twCount: number; //图文数量 (文章) | ||
| 75 | + ztCount: number; //组图数量 (图集) | ||
| 76 | + spCount: number; // 视频数量 (视频) | ||
| 77 | + publishCount: number; // 发布数量 | ||
| 78 | + serialsCount: number; // | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +export class ArticleTypeData { | ||
| 82 | + name?: string; //名称 | ||
| 83 | + type?: number; // 类型 | ||
| 84 | + | ||
| 85 | + constructor(name?: string, type?: number) { | ||
| 86 | + this.name = name; | ||
| 87 | + this.type = type; | ||
| 88 | + } | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +export interface ArticleListData { | ||
| 92 | + totalCount: number; | ||
| 93 | + pageNum: number; | ||
| 94 | + pageSize: number; | ||
| 95 | + list: ArticleListDTO[]; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +// 影响力 | ||
| 99 | +export interface InfluenceData { | ||
| 100 | + creatorId: string; | ||
| 101 | + influence: number; | ||
| 102 | + influenceTotal: number; | ||
| 103 | +} |
| 1 | +export interface VlivesDTO { | ||
| 2 | + id: number; | ||
| 3 | + type: string; | ||
| 4 | + // definition?: any; | ||
| 5 | + // streamAppName?: any; | ||
| 6 | + // streamName?: any; | ||
| 7 | + pullStreamUrl: string; | ||
| 8 | + // streamStatus?: any; | ||
| 9 | + // shiftEnable?: any; | ||
| 10 | + // clipEnable?: any; | ||
| 11 | + // recordEnable?: any; | ||
| 12 | + status: string; | ||
| 13 | + liveId: number; | ||
| 14 | + name: string; | ||
| 15 | + // serialNum?: any; | ||
| 16 | + streamWH: string; | ||
| 17 | + recordUrl: string; | ||
| 18 | + // playPreviewImageUri?: any; | ||
| 19 | + // playPreviewImageFullUrl?: any; | ||
| 20 | + // playPreviewImageBucket?: any; | ||
| 21 | + showPad: boolean; | ||
| 22 | + // liveStreamManagerId?: any; | ||
| 23 | + // recordBucket?: any; | ||
| 24 | + // recordUri?: any; | ||
| 25 | +} |
| @@ -64,5 +64,8 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | @@ -64,5 +64,8 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi | ||
| 64 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" | 64 | export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel" |
| 65 | 65 | ||
| 66 | export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent" | 66 | export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent" |
| 67 | + | ||
| 67 | export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" | 68 | export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton" |
| 68 | 69 | ||
| 70 | +export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent" | ||
| 71 | + |
| @@ -8,8 +8,11 @@ import { Card6Component } from './cardview/Card6Component'; | @@ -8,8 +8,11 @@ import { Card6Component } from './cardview/Card6Component'; | ||
| 8 | import { Card9Component } from './cardview/Card9Component'; | 8 | import { Card9Component } from './cardview/Card9Component'; |
| 9 | import { Card10Component } from './cardview/Card10Component'; | 9 | import { Card10Component } from './cardview/Card10Component'; |
| 10 | import { Card11Component } from './cardview/Card11Component'; | 10 | import { Card11Component } from './cardview/Card11Component'; |
| 11 | -import { Card17Component } from './cardview/Card17Component'; | 11 | +import { Card12Component } from './cardview/Card12Component'; |
| 12 | +import { Card14Component } from './cardview/Card14Component'; | ||
| 12 | import { Card15Component } from './cardview/Card15Component'; | 13 | import { Card15Component } from './cardview/Card15Component'; |
| 14 | +import { Card16Component } from './cardview/Card16Component'; | ||
| 15 | +import { Card17Component } from './cardview/Card17Component'; | ||
| 13 | import { Card19Component } from './cardview/Card19Component'; | 16 | import { Card19Component } from './cardview/Card19Component'; |
| 14 | import { Card20Component } from './cardview/Card20Component'; | 17 | import { Card20Component } from './cardview/Card20Component'; |
| 15 | import { Card21Component } from './cardview/Card21Component'; | 18 | import { Card21Component } from './cardview/Card21Component'; |
| @@ -45,8 +48,14 @@ export struct CardParser { | @@ -45,8 +48,14 @@ export struct CardParser { | ||
| 45 | Card10Component({ contentDTO }) | 48 | Card10Component({ contentDTO }) |
| 46 | } else if (contentDTO.appStyle === CompStyle.Card_11) { | 49 | } else if (contentDTO.appStyle === CompStyle.Card_11) { |
| 47 | Card11Component({ contentDTO }) | 50 | Card11Component({ contentDTO }) |
| 51 | + } else if (contentDTO.appStyle === CompStyle.Card_12) { | ||
| 52 | + Card12Component({ contentDTO }) | ||
| 53 | + } else if (contentDTO.appStyle === CompStyle.Card_14) { | ||
| 54 | + Card14Component({ contentDTO }) | ||
| 48 | } else if (contentDTO.appStyle === CompStyle.Card_15) { | 55 | } else if (contentDTO.appStyle === CompStyle.Card_15) { |
| 49 | Card15Component({ contentDTO }) | 56 | Card15Component({ contentDTO }) |
| 57 | + } else if (contentDTO.appStyle === CompStyle.Card_16) { | ||
| 58 | + Card16Component({ contentDTO }) | ||
| 50 | } else if (contentDTO.appStyle === CompStyle.Card_17) { | 59 | } else if (contentDTO.appStyle === CompStyle.Card_17) { |
| 51 | Card17Component({ contentDTO }) | 60 | Card17Component({ contentDTO }) |
| 52 | } else if (contentDTO.appStyle === CompStyle.Card_19) { | 61 | } else if (contentDTO.appStyle === CompStyle.Card_19) { |
| @@ -9,6 +9,7 @@ import { | @@ -9,6 +9,7 @@ import { | ||
| 9 | import { | 9 | import { |
| 10 | HorizontalStrokeCardThreeTwoRadioForOneComponent | 10 | HorizontalStrokeCardThreeTwoRadioForOneComponent |
| 11 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; | 11 | } from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent'; |
| 12 | +import { ZhSingleRow02 } from './compview/ZhSingleRow02'; | ||
| 12 | import { ZhSingleRow04 } from './compview/ZhSingleRow04'; | 13 | import { ZhSingleRow04 } from './compview/ZhSingleRow04'; |
| 13 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; | 14 | import { ZhSingleColumn04 } from './compview/ZhSingleColumn04'; |
| 14 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; | 15 | import { ZhSingleColumn05 } from './compview/ZhSingleColumn05'; |
| @@ -29,7 +30,10 @@ export struct CompParser { | @@ -29,7 +30,10 @@ export struct CompParser { | ||
| 29 | compIndex: number = 0; | 30 | compIndex: number = 0; |
| 30 | 31 | ||
| 31 | build() { | 32 | build() { |
| 32 | - this.componentBuilder(this.compDTO, this.compIndex); | 33 | + Column(){ |
| 34 | + this.componentBuilder(this.compDTO, this.compIndex); | ||
| 35 | + Divider().strokeWidth(1).color('#f5f5f5').padding({left:16,right:16}) | ||
| 36 | + } | ||
| 33 | } | 37 | } |
| 34 | 38 | ||
| 35 | @Builder | 39 | @Builder |
| @@ -46,6 +50,8 @@ export struct CompParser { | @@ -46,6 +50,8 @@ export struct CompParser { | ||
| 46 | } else { | 50 | } else { |
| 47 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) | 51 | HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO }) |
| 48 | } | 52 | } |
| 53 | + } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) { | ||
| 54 | + ZhSingleRow02({ compDTO }) | ||
| 49 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { | 55 | } else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) { |
| 50 | LiveHorizontalReservationComponent({ compDTO: compDTO }) | 56 | LiveHorizontalReservationComponent({ compDTO: compDTO }) |
| 51 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { | 57 | } else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { |
| 1 | -import { Logger } from 'wdKit'; | 1 | +import { AccountManagerUtils, Logger } from 'wdKit'; |
| 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 2 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 3 | -import { ContentDetailDTO } from 'wdBean'; | 3 | +import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams, |
| 4 | + PhotoListBean, | ||
| 5 | + ContentDTO, } from 'wdBean'; | ||
| 4 | import media from '@ohos.multimedia.media'; | 6 | import media from '@ohos.multimedia.media'; |
| 5 | import { OperRowListView } from './view/OperRowListView'; | 7 | import { OperRowListView } from './view/OperRowListView'; |
| 6 | import { WDPlayerController } from 'wdPlayer/Index'; | 8 | import { WDPlayerController } from 'wdPlayer/Index'; |
| 9 | +import { ContentConstants } from '../constants/ContentConstants'; | ||
| 10 | +import { ProcessUtils } from '../utils/ProcessUtils'; | ||
| 7 | 11 | ||
| 8 | const TAG = 'DynamicDetailComponent' | 12 | const TAG = 'DynamicDetailComponent' |
| 9 | @Preview | 13 | @Preview |
| @@ -19,8 +23,11 @@ export struct DynamicDetailComponent { | @@ -19,8 +23,11 @@ export struct DynamicDetailComponent { | ||
| 19 | /** | 23 | /** |
| 20 | * 默认未关注 点击去关注 | 24 | * 默认未关注 点击去关注 |
| 21 | */ | 25 | */ |
| 22 | - private followStatus: boolean = false; | 26 | + private followStatus: String = '0'; |
| 27 | + @State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态 | ||
| 23 | 28 | ||
| 29 | + //跳转 | ||
| 30 | + private mJumpInfo: ContentDTO = {} as ContentDTO; | ||
| 24 | 31 | ||
| 25 | async aboutToAppear() { | 32 | async aboutToAppear() { |
| 26 | await this.getContentDetailData() | 33 | await this.getContentDetailData() |
| @@ -85,7 +92,7 @@ export struct DynamicDetailComponent { | @@ -85,7 +92,7 @@ export struct DynamicDetailComponent { | ||
| 85 | .fontWeight(FontWeight.Medium) | 92 | .fontWeight(FontWeight.Medium) |
| 86 | .margin({ left: $r('app.float.margin_5') }) | 93 | .margin({ left: $r('app.float.margin_5') }) |
| 87 | } | 94 | } |
| 88 | - if (!this.followStatus) { | 95 | + if (this.followStatus == '0') { |
| 89 | Text('关注') | 96 | Text('关注') |
| 90 | .width(60) | 97 | .width(60) |
| 91 | .height($r('app.float.margin_48')) | 98 | .height($r('app.float.margin_48')) |
| @@ -121,6 +128,31 @@ export struct DynamicDetailComponent { | @@ -121,6 +128,31 @@ export struct DynamicDetailComponent { | ||
| 121 | .margin({ top: $r('app.float.margin_6') | 128 | .margin({ top: $r('app.float.margin_6') |
| 122 | ,left: $r('app.float.margin_16') | 129 | ,left: $r('app.float.margin_16') |
| 123 | ,right: $r('app.float.margin_16') }) | 130 | ,right: $r('app.float.margin_16') }) |
| 131 | + if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){ | ||
| 132 | + //附件内容:图片/视频 | ||
| 133 | + if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 134 | + GridRow({ | ||
| 135 | + columns: { sm: this.contentDetailData.photoList.length | ||
| 136 | + , md: this.contentDetailData.photoList.length == 1?1: | ||
| 137 | + this.contentDetailData.photoList.length == 4?2: | ||
| 138 | + 3 }, | ||
| 139 | + breakpoints: { value: ['320vp', '520vp', '840vp'] } | ||
| 140 | + }) { | ||
| 141 | + ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 142 | + GridCol() { | ||
| 143 | + this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index); | ||
| 144 | + } | ||
| 145 | + }) | ||
| 146 | + } | ||
| 147 | + }else{ | ||
| 148 | + //附件内容:视频,只有一个 | ||
| 149 | + ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => { | ||
| 150 | + GridCol() { | ||
| 151 | + this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index); | ||
| 152 | + } | ||
| 153 | + }) | ||
| 154 | + } | ||
| 155 | + } | ||
| 124 | //特别声明 | 156 | //特别声明 |
| 125 | Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") | 157 | Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。") |
| 126 | .fontColor($r('app.color.color_CCCCCC')) | 158 | .fontColor($r('app.color.color_CCCCCC')) |
| @@ -160,17 +192,253 @@ export struct DynamicDetailComponent { | @@ -160,17 +192,253 @@ export struct DynamicDetailComponent { | ||
| 160 | .margin({ left: $r('app.float.margin_2')}) | 192 | .margin({ left: $r('app.float.margin_2')}) |
| 161 | } | 193 | } |
| 162 | //评论组件/底部组件 | 194 | //评论组件/底部组件 |
| 195 | + | ||
| 163 | } | 196 | } |
| 164 | } | 197 | } |
| 165 | .backgroundColor('#FFFFFFFF') | 198 | .backgroundColor('#FFFFFFFF') |
| 166 | } | 199 | } |
| 200 | + /** | ||
| 201 | + * 请求(动态)详情页数据 | ||
| 202 | + * */ | ||
| 167 | private async getContentDetailData() { | 203 | private async getContentDetailData() { |
| 168 | try { | 204 | try { |
| 169 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) | 205 | let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType) |
| 170 | this.contentDetailData = data[0]; | 206 | this.contentDetailData = data[0]; |
| 207 | + this.makeJumpInfo | ||
| 171 | console.log('动态详情',JSON.stringify(this.contentDetailData)) | 208 | console.log('动态详情',JSON.stringify(this.contentDetailData)) |
| 172 | } catch (exception) { | 209 | } catch (exception) { |
| 173 | console.log('请求失败',JSON.stringify(exception)) | 210 | console.log('请求失败',JSON.stringify(exception)) |
| 174 | } | 211 | } |
| 212 | + this.getBatchAttentionStatus | ||
| 213 | + this.getInteractDataStatus | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + // 查询当前登录用户点赞状态 | ||
| 217 | + private async getInteractDataStatus() { | ||
| 218 | + //未登录 | ||
| 219 | + if(!AccountManagerUtils.isLoginSync() || this.contentDetailData?.openLikes != 1){ | ||
| 220 | + return | ||
| 221 | + } | ||
| 222 | + try { | ||
| 223 | + const params: batchLikeAndCollectParams = { | ||
| 224 | + contentList: [ | ||
| 225 | + { | ||
| 226 | + contentId: this.contentDetailData?.newsId + '', | ||
| 227 | + contentType: this.contentDetailData?.newsType + '', | ||
| 228 | + } | ||
| 229 | + ] | ||
| 230 | + } | ||
| 231 | + console.error(TAG, JSON.stringify(this.contentDetailData)) | ||
| 232 | + let data = await MultiPictureDetailViewModel.getInteractDataStatus(params) | ||
| 233 | + console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data)) | ||
| 234 | + this.newsStatusOfUser = data[0]; | ||
| 235 | + Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`) | ||
| 236 | + } catch (exception) { | ||
| 237 | + console.error(TAG, JSON.stringify(exception)) | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + /** | ||
| 242 | + * 查询当前登录用户是否关注作品号主 | ||
| 243 | + * */ | ||
| 244 | + private async getBatchAttentionStatus() { | ||
| 245 | + try { | ||
| 246 | + const params: postBatchAttentionStatusParams = { | ||
| 247 | + creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }] | ||
| 248 | + } | ||
| 249 | + let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params) | ||
| 250 | + this.followStatus = data[0]?.status; | ||
| 251 | + Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`) | ||
| 252 | + } catch (exception) { | ||
| 253 | + | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + @Builder | ||
| 257 | + setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){ | ||
| 258 | + //四角圆角 | ||
| 259 | + Image(picPath) | ||
| 260 | + .width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight}) | ||
| 261 | + } | ||
| 262 | + /** | ||
| 263 | + * 组件项 | ||
| 264 | + * | ||
| 265 | + * @param programmeBean item 组件项, 上面icon,下面标题 | ||
| 266 | + */ | ||
| 267 | + @Builder | ||
| 268 | + buildItemCard(item: PhotoListBean,len: number,index: number) { | ||
| 269 | + Column() { | ||
| 270 | + this.setItemImageRoundCorner(len, item, index) | ||
| 271 | + Flex({ direction: FlexDirection.Row }) { | ||
| 272 | + Image($r('app.media.icon_long_pic')) | ||
| 273 | + .width(14) | ||
| 274 | + .height(14) | ||
| 275 | + .margin({right: 4}) | ||
| 276 | + Text('长图') | ||
| 277 | + .fontSize(12) | ||
| 278 | + .fontWeight(400) | ||
| 279 | + .fontColor(0xffffff) | ||
| 280 | + .fontFamily('PingFang SC') | ||
| 281 | + } | ||
| 282 | + .width(48) | ||
| 283 | + .padding({bottom: 9}) | ||
| 284 | + } | ||
| 285 | + .width('100%') | ||
| 286 | + .onClick((event: ClickEvent) => { | ||
| 287 | + if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){ | ||
| 288 | + //fixme 跳转到查看图片页面(带页脚/下载按钮) | ||
| 289 | + // this.mJumpInfo.objectType = ContentConstants.TYPE_ | ||
| 290 | + ProcessUtils.processPage(this.mJumpInfo) | ||
| 291 | + }else{ | ||
| 292 | + //fixme 跳转到播放视频页面(点播) | ||
| 293 | + this.mJumpInfo.objectType = ContentConstants.TYPE_VOD | ||
| 294 | + ProcessUtils.processPage(this.mJumpInfo) | ||
| 295 | + } | ||
| 296 | + }) | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + //创建跳转信息 | ||
| 300 | + makeJumpInfo(){ | ||
| 301 | + this.mJumpInfo.pageId = 'dynamicDetailPage'; | ||
| 302 | + // this.mJumpInfo.from = 'dynamicDetailPage'; | ||
| 303 | + this.mJumpInfo.objectId = this.contentDetailData.newsId+""; | ||
| 304 | + this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+""; | ||
| 305 | + this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+""; | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + //设置图片圆角 | ||
| 309 | + @Builder | ||
| 310 | + setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) { | ||
| 311 | + if (len == 1) { | ||
| 312 | + //四角圆角 | ||
| 313 | + this.setItemImageStyle(item.picPath, 4, 4, 4, 4); | ||
| 314 | + } else if (len == 2) { | ||
| 315 | + if (index == 0) { | ||
| 316 | + //左边圆角 | ||
| 317 | + this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 318 | + } else { | ||
| 319 | + //右边圆角 | ||
| 320 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 321 | + } | ||
| 322 | + } else if (3 == len) { | ||
| 323 | + if (index == 0) { | ||
| 324 | + //左边圆角 | ||
| 325 | + this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 326 | + } else if (index == 1) { | ||
| 327 | + //直角 | ||
| 328 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 329 | + } else { | ||
| 330 | + //右边圆角 | ||
| 331 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 332 | + } | ||
| 333 | + } else if (4 == len) { | ||
| 334 | + if (index == 0) { | ||
| 335 | + //左边圆角 | ||
| 336 | + this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 337 | + } else if (index == 1) { | ||
| 338 | + //右边圆角 | ||
| 339 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 340 | + } else if (index = 2) { | ||
| 341 | + //左边圆角 | ||
| 342 | + this.setItemImageStyle(item.picPath, 4, 0, 4, 0); | ||
| 343 | + } else { | ||
| 344 | + //右边圆角 | ||
| 345 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 4); | ||
| 346 | + } | ||
| 347 | + } else if (5 == len) { | ||
| 348 | + if (index == 0) { | ||
| 349 | + this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 350 | + } else if (index == 1) { | ||
| 351 | + //直角 | ||
| 352 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 353 | + } else if (index = 2) { | ||
| 354 | + this.setItemImageStyle(item.picPath, 4, 4, 4, 4); | ||
| 355 | + } else if (index = 3) { | ||
| 356 | + this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 357 | + } else { | ||
| 358 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 359 | + } | ||
| 360 | + } else if (6 == len) { | ||
| 361 | + if (index == 0) { | ||
| 362 | + this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 363 | + } else if (index == 1) { | ||
| 364 | + //直角 | ||
| 365 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 366 | + } else if (index = 2) { | ||
| 367 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 368 | + } else if (index = 3) { | ||
| 369 | + this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 370 | + } else if (index = 4) { | ||
| 371 | + //直角 | ||
| 372 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 373 | + } else { | ||
| 374 | + //右边圆角 | ||
| 375 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 376 | + } | ||
| 377 | + } else if (7 == len) { | ||
| 378 | + if (index == 0) { | ||
| 379 | + this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 380 | + } else if (index == 1) { | ||
| 381 | + //直角 | ||
| 382 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 383 | + } else if (index = 2) { | ||
| 384 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 385 | + } else if (index = 3) { | ||
| 386 | + //直角 | ||
| 387 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 388 | + } else if (index = 4) { | ||
| 389 | + //直角 | ||
| 390 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 391 | + } else if (index = 5) { | ||
| 392 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 393 | + } else { | ||
| 394 | + this.setItemImageStyle(item.picPath, 0, 0, 4, 4); | ||
| 395 | + } | ||
| 396 | + } else if (8 == len) { | ||
| 397 | + if (index == 0) { | ||
| 398 | + this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 399 | + } else if (index == 1) { | ||
| 400 | + //直角 | ||
| 401 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 402 | + } else if (index = 2) { | ||
| 403 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 404 | + } else if (index = 3) { | ||
| 405 | + //直角 | ||
| 406 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 407 | + } else if (index = 4) { | ||
| 408 | + //直角 | ||
| 409 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 410 | + } else if (index = 5) { | ||
| 411 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 412 | + } else if (index = 6) { | ||
| 413 | + this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 414 | + } else { | ||
| 415 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 416 | + } | ||
| 417 | + } else { | ||
| 418 | + if (index == 0) { | ||
| 419 | + this.setItemImageStyle(item.picPath, 4, 0, 0, 0); | ||
| 420 | + } else if (index == 1) { | ||
| 421 | + //直角 | ||
| 422 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 423 | + } else if (index == 2) { | ||
| 424 | + this.setItemImageStyle(item.picPath, 0, 4, 0, 0); | ||
| 425 | + } else if (index == 3) { | ||
| 426 | + //直角 | ||
| 427 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 428 | + } else if (index == 4) { | ||
| 429 | + //直角 | ||
| 430 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 431 | + } else if (index == 5) { | ||
| 432 | + //直角 | ||
| 433 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 434 | + } else if (index == 6) { | ||
| 435 | + this.setItemImageStyle(item.picPath, 0, 0, 4, 0); | ||
| 436 | + } else if (index == 7) { | ||
| 437 | + //直角 | ||
| 438 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 0); | ||
| 439 | + } else { | ||
| 440 | + this.setItemImageStyle(item.picPath, 0, 0, 0, 4); | ||
| 441 | + } | ||
| 442 | + } | ||
| 175 | } | 443 | } |
| 176 | } | 444 | } |
| @@ -55,7 +55,13 @@ export struct ImageAndTextWebComponent { | @@ -55,7 +55,13 @@ export struct ImageAndTextWebComponent { | ||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | // TODO 对接user信息、登录情况 | 57 | // TODO 对接user信息、登录情况 |
| 58 | - let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean | 58 | + let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { |
| 59 | + creatorId: '', | ||
| 60 | + isLogin: '0', | ||
| 61 | + networkStatus: 1, | ||
| 62 | + loadImageOnlyWifiSwitch: '2', | ||
| 63 | + | ||
| 64 | + } as H5ReceiveDataExtraBean | ||
| 59 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { | 65 | let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = { |
| 60 | contentId: contentId, | 66 | contentId: contentId, |
| 61 | contentType: contentType | 67 | contentType: contentType |
| @@ -86,7 +92,7 @@ export struct ImageAndTextWebComponent { | @@ -86,7 +92,7 @@ export struct ImageAndTextWebComponent { | ||
| 86 | webResource: $rawfile('apph5/index.html'), | 92 | webResource: $rawfile('apph5/index.html'), |
| 87 | backVisibility: false, | 93 | backVisibility: false, |
| 88 | onWebPrepared: this.onWebPrepared.bind(this), | 94 | onWebPrepared: this.onWebPrepared.bind(this), |
| 89 | - isPageEnd:$isPageEnd | 95 | + isPageEnd: $isPageEnd |
| 90 | 96 | ||
| 91 | }) | 97 | }) |
| 92 | } | 98 | } |
| 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_MEDIA', | ||
| 11 | + 'ohos.permission.WRITE_MEDIA' | ||
| 12 | +]; | ||
| 13 | + | ||
| 14 | +@Component | ||
| 15 | +export struct ImageDownloadComponent { | ||
| 16 | + @State image: PixelMap | undefined = undefined; | ||
| 17 | + @State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例 | ||
| 18 | + @State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer | ||
| 19 | + url: string = '' | ||
| 20 | + | ||
| 21 | + build() { | ||
| 22 | + Column() { | ||
| 23 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 24 | + .width(24) | ||
| 25 | + .height(24) | ||
| 26 | + .aspectRatio(1) | ||
| 27 | + .interpolation(ImageInterpolation.High) | ||
| 28 | + .rotate({ angle: -90 }) | ||
| 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'; | 3 | import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent'; |
| 4 | -import { display } from '@kit.ArkUI'; | 4 | +import { display, router } from '@kit.ArkUI'; |
| 5 | +import { ImageDownloadComponent } from './ImageDownloadComponent'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'ImageSwiperComponent'; | 7 | const TAG = 'ImageSwiperComponent'; |
| 7 | 8 | ||
| @@ -35,6 +36,20 @@ export struct ImageSwiperComponent { | @@ -35,6 +36,20 @@ export struct ImageSwiperComponent { | ||
| 35 | 36 | ||
| 36 | build() { | 37 | build() { |
| 37 | RelativeContainer() { | 38 | RelativeContainer() { |
| 39 | + Image($r('app.media.icon_arrow_left_white')) | ||
| 40 | + .width(24) | ||
| 41 | + .height(24) | ||
| 42 | + .aspectRatio(1) | ||
| 43 | + .interpolation(ImageInterpolation.High) | ||
| 44 | + .alignRules({ | ||
| 45 | + top: { anchor: "__container__", align: VerticalAlign.Top }, | ||
| 46 | + left: { anchor: "__container__", align: HorizontalAlign.Start } | ||
| 47 | + }) | ||
| 48 | + .onClick(() => { | ||
| 49 | + router.back(); | ||
| 50 | + }) | ||
| 51 | + .id("backImg") | ||
| 52 | + | ||
| 38 | if (this.photoList && this.photoList?.length > 0) { | 53 | if (this.photoList && this.photoList?.length > 0) { |
| 39 | Swiper(this.swiperController) { | 54 | Swiper(this.swiperController) { |
| 40 | ForEach(this.photoList, (item: PhotoListBean) => { | 55 | ForEach(this.photoList, (item: PhotoListBean) => { |
| @@ -96,6 +111,19 @@ export struct ImageSwiperComponent { | @@ -96,6 +111,19 @@ export struct ImageSwiperComponent { | ||
| 96 | middle: { anchor: "__container__", align: HorizontalAlign.Center } | 111 | middle: { anchor: "__container__", align: HorizontalAlign.Center } |
| 97 | }) | 112 | }) |
| 98 | } | 113 | } |
| 114 | + | ||
| 115 | + ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath }) | ||
| 116 | + .alignRules({ | ||
| 117 | + bottom: { anchor: "__container__", align: VerticalAlign.Bottom }, | ||
| 118 | + right: { anchor: "__container__", align: HorizontalAlign.End } | ||
| 119 | + }) | ||
| 120 | + .margin({ | ||
| 121 | + top: 8, | ||
| 122 | + left: 18, | ||
| 123 | + bottom: 24, | ||
| 124 | + right: 18 | ||
| 125 | + }) | ||
| 126 | + .id("downloadImg") | ||
| 99 | } | 127 | } |
| 100 | .width('100%') | 128 | .width('100%') |
| 101 | .height('100%') | 129 | .height('100%') |
| @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'Card12Component'; | 7 | const TAG = 'Card12Component'; |
| 7 | 8 | ||
| @@ -10,39 +11,7 @@ const TAG = 'Card12Component'; | @@ -10,39 +11,7 @@ const TAG = 'Card12Component'; | ||
| 10 | */ | 11 | */ |
| 11 | @Component | 12 | @Component |
| 12 | export struct Card12Component { | 13 | export struct Card12Component { |
| 13 | - @State contentDTO: ContentDTO = { | ||
| 14 | - appStyle: '20', | ||
| 15 | - coverType: 1, | ||
| 16 | - coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | - fullColumnImgUrls: [ | ||
| 18 | - { | ||
| 19 | - landscape: 1, | ||
| 20 | - size: 1, | ||
| 21 | - url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | - weight: 1600 | ||
| 23 | - } | ||
| 24 | - ], | ||
| 25 | - newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 26 | - rmhInfo: { | ||
| 27 | - authIcon: | ||
| 28 | - 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | - authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | - authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | - banControl: 0, | ||
| 32 | - cnIsAttention: 1, | ||
| 33 | - rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | - rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | - rmhName: '王烁然', | ||
| 36 | - userId: '522435359667845', | ||
| 37 | - userType: '2' | ||
| 38 | - }, | ||
| 39 | - objectType: '1', | ||
| 40 | - videoInfo: { | ||
| 41 | - firstFrameImageUri: '', | ||
| 42 | - videoDuration: 37, | ||
| 43 | - videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | - } | ||
| 45 | - } as ContentDTO; | 14 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 46 | 15 | ||
| 47 | aboutToAppear(): void { | 16 | aboutToAppear(): void { |
| 48 | } | 17 | } |
| @@ -50,7 +19,9 @@ export struct Card12Component { | @@ -50,7 +19,9 @@ export struct Card12Component { | ||
| 50 | build() { | 19 | build() { |
| 51 | Column() { | 20 | Column() { |
| 52 | // rmh信息 | 21 | // rmh信息 |
| 53 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | 22 | + if (this.contentDTO.rmhInfo) { |
| 23 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 24 | + } | ||
| 54 | // 标题 | 25 | // 标题 |
| 55 | if (this.contentDTO.newsTitle) { | 26 | if (this.contentDTO.newsTitle) { |
| 56 | Text(this.contentDTO.newsTitle) | 27 | Text(this.contentDTO.newsTitle) |
| @@ -64,9 +35,6 @@ export struct Card12Component { | @@ -64,9 +35,6 @@ export struct Card12Component { | ||
| 64 | .fontFamily('PingFang SC-Regular') | 35 | .fontFamily('PingFang SC-Regular') |
| 65 | } | 36 | } |
| 66 | 37 | ||
| 67 | - // if (this.contentDTO.fullColumnImgUrls?.[0]) { | ||
| 68 | - // createImg({ contentDTO: this.contentDTO }) | ||
| 69 | - // } | ||
| 70 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 | 38 | //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件 |
| 71 | } | 39 | } |
| 72 | .padding({ | 40 | .padding({ |
| @@ -75,6 +43,9 @@ export struct Card12Component { | @@ -75,6 +43,9 @@ export struct Card12Component { | ||
| 75 | top: $r('app.float.card_comp_pagePadding_tb'), | 43 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 76 | bottom: $r('app.float.card_comp_pagePadding_tb') | 44 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 77 | }) | 45 | }) |
| 46 | + .onClick((event: ClickEvent) => { | ||
| 47 | + ProcessUtils.processPage(this.contentDTO) | ||
| 48 | + }) | ||
| 78 | } | 49 | } |
| 79 | } | 50 | } |
| 80 | 51 | ||
| @@ -85,45 +56,6 @@ interface radiusType { | @@ -85,45 +56,6 @@ interface radiusType { | ||
| 85 | bottomRight: number | Resource; | 56 | bottomRight: number | Resource; |
| 86 | } | 57 | } |
| 87 | 58 | ||
| 88 | -@Component | ||
| 89 | -struct createImg { | ||
| 90 | - @Prop contentDTO: ContentDTO | ||
| 91 | - | ||
| 92 | - build() { | ||
| 93 | - GridRow() { | ||
| 94 | - if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) { | ||
| 95 | - // 横屏 | ||
| 96 | - GridCol({ | ||
| 97 | - span: { xs: 12 } | ||
| 98 | - }) { | ||
| 99 | - Stack() { | ||
| 100 | - Image(this.contentDTO.coverUrl) | ||
| 101 | - .width(CommonConstants.FULL_WIDTH) | ||
| 102 | - .aspectRatio(16 / 9) | ||
| 103 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 104 | - CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 105 | - } | ||
| 106 | - .align(Alignment.BottomEnd) | ||
| 107 | - } | ||
| 108 | - } else { | ||
| 109 | - // 竖图显示,宽度占50%,高度自适应 | ||
| 110 | - GridCol({ | ||
| 111 | - span: { xs: 6 } | ||
| 112 | - }) { | ||
| 113 | - Stack() { | ||
| 114 | - Image(this.contentDTO.coverUrl) | ||
| 115 | - .width(CommonConstants.FULL_WIDTH) | ||
| 116 | - .borderRadius($r('app.float.image_border_radius')) | ||
| 117 | - CardMediaInfo({ contentDTO: this.contentDTO }) | ||
| 118 | - } | ||
| 119 | - .align(Alignment.BottomEnd) | ||
| 120 | - } | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - } | ||
| 124 | -} | ||
| 125 | - | ||
| 126 | - | ||
| 127 | @Extend(Text) | 59 | @Extend(Text) |
| 128 | function textOverflowStyle(maxLine: number) { | 60 | function textOverflowStyle(maxLine: number) { |
| 129 | .maxLines(maxLine) | 61 | .maxLines(maxLine) |
| @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean'; | @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'Card14Component'; | 7 | const TAG = 'Card14Component'; |
| 7 | 8 | ||
| @@ -11,37 +12,37 @@ const TAG = 'Card14Component'; | @@ -11,37 +12,37 @@ const TAG = 'Card14Component'; | ||
| 11 | @Component | 12 | @Component |
| 12 | export struct Card14Component { | 13 | export struct Card14Component { |
| 13 | @State contentDTO: ContentDTO = { | 14 | @State contentDTO: ContentDTO = { |
| 14 | - // appStyle: '20', | ||
| 15 | - // coverType: 1, | ||
| 16 | - // coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | - // fullColumnImgUrls: [ | ||
| 18 | - // { | ||
| 19 | - // landscape: 1, | ||
| 20 | - // size: 1, | ||
| 21 | - // url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | - // weight: 1600 | ||
| 23 | - // } | ||
| 24 | - // ], | ||
| 25 | - // newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 26 | - // rmhInfo: { | ||
| 27 | - // authIcon: | ||
| 28 | - // 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | - // authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | - // authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | - // banControl: 0, | ||
| 32 | - // cnIsAttention: 1, | ||
| 33 | - // rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | - // rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | - // rmhName: '王烁然', | ||
| 36 | - // userId: '522435359667845', | ||
| 37 | - // userType: '2' | ||
| 38 | - // }, | ||
| 39 | - // objectType: '1', | ||
| 40 | - // videoInfo: { | ||
| 41 | - // firstFrameImageUri: '', | ||
| 42 | - // videoDuration: 37, | ||
| 43 | - // videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | - // } | 15 | + appStyle: '20', |
| 16 | + coverType: 1, | ||
| 17 | + coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 18 | + fullColumnImgUrls: [ | ||
| 19 | + { | ||
| 20 | + landscape: 1, | ||
| 21 | + size: 1, | ||
| 22 | + url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 23 | + weight: 1600 | ||
| 24 | + } | ||
| 25 | + ], | ||
| 26 | + newsTitle: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》', | ||
| 27 | + rmhInfo: { | ||
| 28 | + authIcon: | ||
| 29 | + 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 30 | + authTitle: '10后音乐人王烁然个人人民号', | ||
| 31 | + authTitle2: '10后音乐人王烁然个人人民号', | ||
| 32 | + banControl: 0, | ||
| 33 | + cnIsAttention: 1, | ||
| 34 | + rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 35 | + rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 36 | + rmhName: '王烁然', | ||
| 37 | + userId: '522435359667845', | ||
| 38 | + userType: '2' | ||
| 39 | + }, | ||
| 40 | + objectType: '1', | ||
| 41 | + videoInfo: { | ||
| 42 | + firstFrameImageUri: '', | ||
| 43 | + videoDuration: 37, | ||
| 44 | + videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 45 | + } | ||
| 45 | } as ContentDTO; | 46 | } as ContentDTO; |
| 46 | 47 | ||
| 47 | aboutToAppear(): void { | 48 | aboutToAppear(): void { |
| @@ -50,9 +51,11 @@ export struct Card14Component { | @@ -50,9 +51,11 @@ export struct Card14Component { | ||
| 50 | build() { | 51 | build() { |
| 51 | Column() { | 52 | Column() { |
| 52 | // rmh信息 | 53 | // rmh信息 |
| 53 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | 54 | + if (this.contentDTO.rmhInfo) { |
| 55 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 56 | + } | ||
| 54 | // 左标题,右图 | 57 | // 左标题,右图 |
| 55 | - Flex({ direction: FlexDirection.Row }) { | 58 | + Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) { |
| 56 | 59 | ||
| 57 | Text(this.contentDTO.newsTitle) | 60 | Text(this.contentDTO.newsTitle) |
| 58 | .fontSize($r('app.float.font_size_17')) | 61 | .fontSize($r('app.float.font_size_17')) |
| @@ -61,12 +64,13 @@ export struct Card14Component { | @@ -61,12 +64,13 @@ export struct Card14Component { | ||
| 61 | .lineHeight(25) | 64 | .lineHeight(25) |
| 62 | .fontFamily('PingFang SC-Regular') | 65 | .fontFamily('PingFang SC-Regular') |
| 63 | .textAlign(TextAlign.Start) | 66 | .textAlign(TextAlign.Start) |
| 64 | - .flexBasis('auto') | 67 | + // .flexBasis('auto') |
| 65 | .margin({right: 12}) | 68 | .margin({right: 12}) |
| 69 | + .flexBasis(214) | ||
| 66 | 70 | ||
| 67 | Image(this.contentDTO.coverUrl) | 71 | Image(this.contentDTO.coverUrl) |
| 68 | - .flexBasis(174) | ||
| 69 | - .height(75) | 72 | + .flexBasis(117) |
| 73 | + .height(78) | ||
| 70 | .borderRadius($r('app.float.image_border_radius')) | 74 | .borderRadius($r('app.float.image_border_radius')) |
| 71 | // .flexBasis(160) | 75 | // .flexBasis(160) |
| 72 | .backgroundImageSize(ImageSize.Auto) | 76 | .backgroundImageSize(ImageSize.Auto) |
| @@ -85,6 +89,9 @@ export struct Card14Component { | @@ -85,6 +89,9 @@ export struct Card14Component { | ||
| 85 | top: $r('app.float.card_comp_pagePadding_tb'), | 89 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 86 | bottom: $r('app.float.card_comp_pagePadding_tb') | 90 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 87 | }) | 91 | }) |
| 92 | + .onClick((event: ClickEvent) => { | ||
| 93 | + ProcessUtils.processPage(this.contentDTO) | ||
| 94 | + }) | ||
| 88 | } | 95 | } |
| 89 | } | 96 | } |
| 90 | 97 |
| @@ -2,47 +2,21 @@ import { ContentDTO } from 'wdBean'; | @@ -2,47 +2,21 @@ import { ContentDTO } from 'wdBean'; | ||
| 2 | import { RmhTitle } from '../cardCommon/RmhTitle' | 2 | import { RmhTitle } from '../cardCommon/RmhTitle' |
| 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' | 3 | import { CardMediaInfo } from '../cardCommon/CardMediaInfo' |
| 4 | import { CommonConstants } from 'wdConstant/Index'; | 4 | import { CommonConstants } from 'wdConstant/Index'; |
| 5 | +import { ProcessUtils } from '../../utils/ProcessUtils'; | ||
| 5 | 6 | ||
| 6 | const TAG = 'Card16Component'; | 7 | const TAG = 'Card16Component'; |
| 7 | 8 | ||
| 9 | +interface fullColumnImgUrlItem { | ||
| 10 | + url: string | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | + | ||
| 8 | /** | 14 | /** |
| 9 | * 人民号-动态---16:人民号三图卡; | 15 | * 人民号-动态---16:人民号三图卡; |
| 10 | */ | 16 | */ |
| 11 | @Component | 17 | @Component |
| 12 | export struct Card16Component { | 18 | export struct Card16Component { |
| 13 | - @State contentDTO: ContentDTO = { | ||
| 14 | - appStyle: '20', | ||
| 15 | - coverType: 1, | ||
| 16 | - coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 17 | - fullColumnImgUrls: [ | ||
| 18 | - { | ||
| 19 | - landscape: 1, | ||
| 20 | - size: 1, | ||
| 21 | - url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90', | ||
| 22 | - weight: 1600 | ||
| 23 | - } | ||
| 24 | - ], | ||
| 25 | - newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号', | ||
| 26 | - rmhInfo: { | ||
| 27 | - authIcon: | ||
| 28 | - 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png', | ||
| 29 | - authTitle: '10后音乐人王烁然个人人民号', | ||
| 30 | - authTitle2: '10后音乐人王烁然个人人民号', | ||
| 31 | - banControl: 0, | ||
| 32 | - cnIsAttention: 1, | ||
| 33 | - rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人', | ||
| 34 | - rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg', | ||
| 35 | - rmhName: '王烁然', | ||
| 36 | - userId: '522435359667845', | ||
| 37 | - userType: '2' | ||
| 38 | - }, | ||
| 39 | - objectType: '1', | ||
| 40 | - videoInfo: { | ||
| 41 | - firstFrameImageUri: '', | ||
| 42 | - videoDuration: 37, | ||
| 43 | - videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4' | ||
| 44 | - } | ||
| 45 | - } as ContentDTO; | 19 | + @State contentDTO: ContentDTO = {} as ContentDTO; |
| 46 | 20 | ||
| 47 | aboutToAppear(): void { | 21 | aboutToAppear(): void { |
| 48 | } | 22 | } |
| @@ -50,7 +24,9 @@ export struct Card16Component { | @@ -50,7 +24,9 @@ export struct Card16Component { | ||
| 50 | build() { | 24 | build() { |
| 51 | Column() { | 25 | Column() { |
| 52 | // rmh信息 | 26 | // rmh信息 |
| 53 | - RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | 27 | + if (this.contentDTO.rmhInfo) { |
| 28 | + RmhTitle({ rmhInfo: this.contentDTO.rmhInfo }) | ||
| 29 | + } | ||
| 54 | // 标题 | 30 | // 标题 |
| 55 | if (this.contentDTO.newsTitle) { | 31 | if (this.contentDTO.newsTitle) { |
| 56 | Text(this.contentDTO.newsTitle) | 32 | Text(this.contentDTO.newsTitle) |
| @@ -61,10 +37,10 @@ export struct Card16Component { | @@ -61,10 +37,10 @@ export struct Card16Component { | ||
| 61 | .margin({ bottom: 8 }) | 37 | .margin({ bottom: 8 }) |
| 62 | .lineHeight(25) | 38 | .lineHeight(25) |
| 63 | } | 39 | } |
| 64 | - if (this.contentDTO.coverUrl) { | 40 | + if (this.contentDTO.fullColumnImgUrls?.length > 0) { |
| 65 | Flex() { | 41 | Flex() { |
| 66 | - ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => { | ||
| 67 | - Image(item).flexBasis(113).height(75).margin({right: 2}) | 42 | + ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => { |
| 43 | + Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 }) | ||
| 68 | }) | 44 | }) |
| 69 | } | 45 | } |
| 70 | } | 46 | } |
| @@ -76,6 +52,9 @@ export struct Card16Component { | @@ -76,6 +52,9 @@ export struct Card16Component { | ||
| 76 | top: $r('app.float.card_comp_pagePadding_tb'), | 52 | top: $r('app.float.card_comp_pagePadding_tb'), |
| 77 | bottom: $r('app.float.card_comp_pagePadding_tb') | 53 | bottom: $r('app.float.card_comp_pagePadding_tb') |
| 78 | }) | 54 | }) |
| 55 | + .onClick((event: ClickEvent) => { | ||
| 56 | + ProcessUtils.processPage(this.contentDTO) | ||
| 57 | + }) | ||
| 79 | } | 58 | } |
| 80 | } | 59 | } |
| 81 | 60 |
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/LiveCommentComponent.ets
0 → 100644
| 1 | +import { router } from '@kit.ArkUI' | ||
| 2 | +import { NumberFormatterUtils, ToastUtils } from 'wdKit/Index' | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct LiveCommentComponent { | ||
| 6 | + public clickCollect?: (isCollect: boolean) => void | ||
| 7 | + public clickHeart?: (isHeart: boolean) => void | ||
| 8 | + @State isCollect: boolean = false | ||
| 9 | + @State isLike: boolean = false | ||
| 10 | + @State heartNum: number = 0 | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Row() { | ||
| 14 | + Image($r('app.media.back_icon')) | ||
| 15 | + .width(24) | ||
| 16 | + .height(24) | ||
| 17 | + .margin({ | ||
| 18 | + left: 16, | ||
| 19 | + right: 12 | ||
| 20 | + }) | ||
| 21 | + .onClick(() => { | ||
| 22 | + router.back() | ||
| 23 | + }) | ||
| 24 | + Stack() { | ||
| 25 | + Image($r('app.media.background_search')) | ||
| 26 | + .interpolation(ImageInterpolation.High) | ||
| 27 | + .width('100%') | ||
| 28 | + .height(30) | ||
| 29 | + TextArea({ placeholder: '说两句...' }) | ||
| 30 | + .backgroundColor(Color.Transparent) | ||
| 31 | + .enabled(false) | ||
| 32 | + .margin({ | ||
| 33 | + left: 5, | ||
| 34 | + right: 20 | ||
| 35 | + }) | ||
| 36 | + } | ||
| 37 | + .layoutWeight(1) | ||
| 38 | + .onClick(() => { | ||
| 39 | + ToastUtils.shortToast('依赖其它功能开发') | ||
| 40 | + }) | ||
| 41 | + | ||
| 42 | + Image(this.isCollect ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un')) | ||
| 43 | + .width(24) | ||
| 44 | + .height(24) | ||
| 45 | + .margin({ | ||
| 46 | + left: 20, | ||
| 47 | + right: 24 | ||
| 48 | + }) | ||
| 49 | + .onClick(() => { | ||
| 50 | + this.isCollect = !this.isCollect | ||
| 51 | + }) | ||
| 52 | + Image($r('app.media.iv_live_comment_share')) | ||
| 53 | + .width(24) | ||
| 54 | + .height(24) | ||
| 55 | + .onClick(() => { | ||
| 56 | + ToastUtils.shortToast('依赖其它功能开发') | ||
| 57 | + }) | ||
| 58 | + Stack() { | ||
| 59 | + Text(NumberFormatterUtils.formatNumberWithWan(this.heartNum)) | ||
| 60 | + .height(12) | ||
| 61 | + .fontSize('8fp') | ||
| 62 | + .fontWeight(500) | ||
| 63 | + .fontColor(Color.White) | ||
| 64 | + .backgroundImage($r('app.media.iv_live_comment_hert_num')) | ||
| 65 | + .backgroundImageSize(ImageSize.Cover) | ||
| 66 | + .margin({ | ||
| 67 | + left: 6, | ||
| 68 | + bottom: 33 | ||
| 69 | + }) | ||
| 70 | + .padding({ | ||
| 71 | + left: 6, | ||
| 72 | + right: 2 | ||
| 73 | + }) | ||
| 74 | + Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal')) | ||
| 75 | + .width(24) | ||
| 76 | + .height(24) | ||
| 77 | + .margin({ | ||
| 78 | + right: 20, | ||
| 79 | + }) | ||
| 80 | + } | ||
| 81 | + .width(44) | ||
| 82 | + .height(56) | ||
| 83 | + .margin({ | ||
| 84 | + left: 24 | ||
| 85 | + }) | ||
| 86 | + .onClick(() => { | ||
| 87 | + this.isLike = !this.isLike | ||
| 88 | + }) | ||
| 89 | + } | ||
| 90 | + .height(56) | ||
| 91 | + .width('100%') | ||
| 92 | + .backgroundColor(Color.White) | ||
| 93 | + } | ||
| 94 | +} |
| @@ -56,6 +56,9 @@ export struct ZhGridLayout03 { | @@ -56,6 +56,9 @@ export struct ZhGridLayout03 { | ||
| 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) | 56 | .textOverflow({ overflow: TextOverflow.Ellipsis }) |
| 57 | } | 57 | } |
| 58 | .width('100%') | 58 | .width('100%') |
| 59 | + .onClick((event: ClickEvent) => { | ||
| 60 | + ProcessUtils.processPage(item) | ||
| 61 | + }) | ||
| 59 | } | 62 | } |
| 60 | } | 63 | } |
| 61 | 64 |
| @@ -38,6 +38,15 @@ export default struct MinePagePersonFunctionUI { | @@ -38,6 +38,15 @@ export default struct MinePagePersonFunctionUI { | ||
| 38 | }.onClick(()=>{ | 38 | }.onClick(()=>{ |
| 39 | console.log(index+"") | 39 | console.log(index+"") |
| 40 | switch (item.msg){ | 40 | switch (item.msg){ |
| 41 | + case "评论":{ | ||
| 42 | + if(!this.isLogin){ | ||
| 43 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 44 | + return | ||
| 45 | + }else { | ||
| 46 | + WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage) | ||
| 47 | + } | ||
| 48 | + break; | ||
| 49 | + } | ||
| 41 | case "预约":{ | 50 | case "预约":{ |
| 42 | if(!this.isLogin){ | 51 | if(!this.isLogin){ |
| 43 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 52 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowChildComponent.ets
0 → 100644
| 1 | +import { StringUtils } from 'wdKit/Index' | ||
| 2 | +import { HttpUrlUtils } from 'wdNetwork/Index' | ||
| 3 | +import MinePageDatasModel from '../../../model/MinePageDatasModel' | ||
| 4 | +import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | ||
| 5 | +import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem' | ||
| 6 | + | ||
| 7 | +@Component | ||
| 8 | +export struct FollowChildComponent{ | ||
| 9 | + @ObjectLink data: FollowListDetailItem | ||
| 10 | + @State type:number = 0 | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + if(this.type == 0 ){ | ||
| 14 | + Column(){ | ||
| 15 | + Blank().height('27lpx') | ||
| 16 | + | ||
| 17 | + Row() { | ||
| 18 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 19 | + .objectFit(ImageFit.Auto) | ||
| 20 | + .width('92lpx') | ||
| 21 | + .height('92lpx') | ||
| 22 | + .margin({right:'15lpx'}) | ||
| 23 | + | ||
| 24 | + Column(){ | ||
| 25 | + Text(this.data.cnUserName) | ||
| 26 | + .fontWeight('400lpx') | ||
| 27 | + .fontSize('31lpx') | ||
| 28 | + .lineHeight('38lpx') | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .maxLines(1) | ||
| 31 | + Text(`粉丝${this.data.cnFansNum}`) | ||
| 32 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 33 | + .fontSize('23lpx') | ||
| 34 | + .maxLines(1) | ||
| 35 | + Text(`${this.data.introduction}`) | ||
| 36 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 37 | + .fontSize('23lpx') | ||
| 38 | + .maxLines(2) | ||
| 39 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 40 | + }.layoutWeight(1) | ||
| 41 | + .alignItems(HorizontalAlign.Start) | ||
| 42 | + | ||
| 43 | + if(this.data.status == "1"){ | ||
| 44 | + Row(){ | ||
| 45 | + Text(`已关注`) | ||
| 46 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 47 | + .fontSize('23lpx') | ||
| 48 | + .fontWeight('500lpx') | ||
| 49 | + .lineHeight('35lpx') | ||
| 50 | + }.backgroundColor($r('app.color.color_F5F5F5')) | ||
| 51 | + .borderRadius('6lpx') | ||
| 52 | + .borderColor($r('app.color.color_F5F5F5')) | ||
| 53 | + .borderWidth('2lpx') | ||
| 54 | + .justifyContent(FlexAlign.Center) | ||
| 55 | + .width('100lpx') | ||
| 56 | + .height('46lpx') | ||
| 57 | + .margin({left:'4lpx',top:'23lpx'}) | ||
| 58 | + .onClick(()=>{ | ||
| 59 | + this.followOperation() | ||
| 60 | + // this.data.status = "0" | ||
| 61 | + }) | ||
| 62 | + }else{ | ||
| 63 | + Row(){ | ||
| 64 | + Image($r('app.media.follow_icon')) | ||
| 65 | + .margin({right:'4lpx'}) | ||
| 66 | + .width('23lpx') | ||
| 67 | + .height('23lpx') | ||
| 68 | + Text(`关注`) | ||
| 69 | + .fontColor($r('app.color.color_ED2800')) | ||
| 70 | + .fontSize('23lpx') | ||
| 71 | + .fontWeight('500lpx') | ||
| 72 | + .lineHeight('35lpx') | ||
| 73 | + }.borderColor($r('app.color.color_1AED2800')) | ||
| 74 | + .borderRadius('6lpx') | ||
| 75 | + .borderWidth('2lpx') | ||
| 76 | + .justifyContent(FlexAlign.Center) | ||
| 77 | + .width('100lpx') | ||
| 78 | + .height('46lpx') | ||
| 79 | + .margin({left:'4lpx',top:'23lpx'}) | ||
| 80 | + .onClick(()=>{ | ||
| 81 | + this.followOperation() | ||
| 82 | + // this.data.status = "1" | ||
| 83 | + }) | ||
| 84 | + } | ||
| 85 | + }.alignItems(VerticalAlign.Top) | ||
| 86 | + .width('100%') | ||
| 87 | + .layoutWeight(1) | ||
| 88 | + | ||
| 89 | + Divider().width('100%') | ||
| 90 | + .height('2lpx') | ||
| 91 | + .strokeWidth('1lpx') | ||
| 92 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 93 | + | ||
| 94 | + }.height('146lpx') | ||
| 95 | + .justifyContent(FlexAlign.Center) | ||
| 96 | + .onClick(()=>{ | ||
| 97 | + //跳转 人民号的 主页 | ||
| 98 | + }) | ||
| 99 | + }else if(this.type == 1 ){ | ||
| 100 | + Column(){ | ||
| 101 | + Column(){ | ||
| 102 | + | ||
| 103 | + Row() { | ||
| 104 | + Row(){ | ||
| 105 | + Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 106 | + .objectFit(ImageFit.Auto) | ||
| 107 | + .width('92lpx') | ||
| 108 | + .height('92lpx') | ||
| 109 | + .margin({right:'15lpx'}) | ||
| 110 | + .borderRadius(50) | ||
| 111 | + .borderWidth('1lpx') | ||
| 112 | + .borderColor($r('app.color.color_0D000000')) | ||
| 113 | + | ||
| 114 | + Column(){ | ||
| 115 | + Text(this.data.cnUserName) | ||
| 116 | + .fontWeight('400lpx') | ||
| 117 | + .fontSize('31lpx') | ||
| 118 | + .lineHeight('38lpx') | ||
| 119 | + .fontColor($r('app.color.color_222222')) | ||
| 120 | + .maxLines(1) | ||
| 121 | + .margin({bottom:'12lpx'}) | ||
| 122 | + Row(){ | ||
| 123 | + Text(`粉丝${this.data.cnFansNum}`) | ||
| 124 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 125 | + .fontSize('23lpx') | ||
| 126 | + | ||
| 127 | + Image($r("app.media.point")) | ||
| 128 | + .width('31lpx') | ||
| 129 | + .height('31lpx') | ||
| 130 | + .objectFit(ImageFit.Auto) | ||
| 131 | + | ||
| 132 | + Text(`${this.data.introduction}`) | ||
| 133 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 134 | + .fontSize('23lpx') | ||
| 135 | + .layoutWeight(1) | ||
| 136 | + .maxLines(1) | ||
| 137 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 138 | + }.width('100%') | ||
| 139 | + } | ||
| 140 | + .layoutWeight(1) | ||
| 141 | + .alignItems(HorizontalAlign.Start) | ||
| 142 | + }.layoutWeight(1) | ||
| 143 | + | ||
| 144 | + if(this.data.status == "1"){ | ||
| 145 | + Row(){ | ||
| 146 | + Text(`已关注`) | ||
| 147 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 148 | + .fontSize('23lpx') | ||
| 149 | + .fontWeight('500lpx') | ||
| 150 | + .lineHeight('35lpx') | ||
| 151 | + } | ||
| 152 | + .justifyContent(FlexAlign.Center) | ||
| 153 | + .width('100lpx') | ||
| 154 | + .height('46lpx') | ||
| 155 | + .onClick(()=>{ | ||
| 156 | + this.followOperation() | ||
| 157 | + }) | ||
| 158 | + }else{ | ||
| 159 | + Row(){ | ||
| 160 | + Image($r('app.media.follow_icon')) | ||
| 161 | + .margin({right:'4lpx'}) | ||
| 162 | + .width('23lpx') | ||
| 163 | + .height('23lpx') | ||
| 164 | + Text(`关注`) | ||
| 165 | + .fontColor($r('app.color.color_ED2800')) | ||
| 166 | + .fontSize('23lpx') | ||
| 167 | + .fontWeight('500lpx') | ||
| 168 | + .lineHeight('35lpx') | ||
| 169 | + }.borderColor($r('app.color.color_1AED2800')) | ||
| 170 | + .borderRadius('6lpx') | ||
| 171 | + .borderWidth('2lpx') | ||
| 172 | + .justifyContent(FlexAlign.Center) | ||
| 173 | + .width('100lpx') | ||
| 174 | + .height('46lpx') | ||
| 175 | + .onClick(()=>{ | ||
| 176 | + this.followOperation() | ||
| 177 | + }) | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + .width('100%') | ||
| 181 | + .height('92lpx') | ||
| 182 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 183 | + | ||
| 184 | + }.height('146lpx') | ||
| 185 | + .justifyContent(FlexAlign.Center) | ||
| 186 | + .onClick(()=>{ | ||
| 187 | + }) | ||
| 188 | + | ||
| 189 | + Divider().width('100%') | ||
| 190 | + .height('1lpx') | ||
| 191 | + .strokeWidth('1lpx') | ||
| 192 | + .backgroundColor($r('app.color.color_EDEDED')) | ||
| 193 | + }.width('100%') | ||
| 194 | + | ||
| 195 | + } | ||
| 196 | + | ||
| 197 | + } | ||
| 198 | + | ||
| 199 | + followOperation(){ | ||
| 200 | + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | ||
| 201 | + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 202 | + if(value!=null){ | ||
| 203 | + if (value.code === 0 || value.code.toString() === "0") { | ||
| 204 | + this.data.status = this.data.status ==="0"?"1":"0" | ||
| 205 | + } | ||
| 206 | + } | ||
| 207 | + }) | ||
| 208 | + } | ||
| 209 | +} |
| 1 | -import { Params } from 'wdBean'; | ||
| 2 | -import { LazyDataSource, StringUtils } from 'wdKit'; | ||
| 3 | -import { HttpUrlUtils } from 'wdNetwork'; | ||
| 4 | -import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 1 | +import { LazyDataSource } from 'wdKit'; |
| 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; | 2 | import MinePageDatasModel from '../../../model/MinePageDatasModel'; |
| 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 3 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| 7 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; | 4 | import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem'; |
| 8 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; | 5 | import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem'; |
| 9 | -import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'; | ||
| 10 | import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem'; | 6 | import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem'; |
| 11 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; | 7 | import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem'; |
| 12 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; | 8 | import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI'; |
| 9 | +import { FollowChildComponent } from './FollowChildComponent'; | ||
| 13 | 10 | ||
| 14 | const TAG = "FollowListDetailUI" | 11 | const TAG = "FollowListDetailUI" |
| 15 | @Component | 12 | @Component |
| 16 | export struct FollowListDetailUI{ | 13 | export struct FollowListDetailUI{ |
| 17 | @State creatorDirectoryId:number = -1; | 14 | @State creatorDirectoryId:number = -1; |
| 15 | + @State type:number = 0 | ||
| 18 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | 16 | @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); |
| 19 | @State count:number = 0; | 17 | @State count:number = 0; |
| 20 | @State isLoading:boolean = false | 18 | @State isLoading:boolean = false |
| @@ -22,7 +20,6 @@ export struct FollowListDetailUI{ | @@ -22,7 +20,6 @@ export struct FollowListDetailUI{ | ||
| 22 | curPageNum:number = 1; | 20 | curPageNum:number = 1; |
| 23 | 21 | ||
| 24 | aboutToAppear(){ | 22 | aboutToAppear(){ |
| 25 | - console.log("YCG","aboutToAppear==="+this.creatorDirectoryId); | ||
| 26 | this.getNewPageData() | 23 | this.getNewPageData() |
| 27 | } | 24 | } |
| 28 | 25 | ||
| @@ -35,7 +32,7 @@ export struct FollowListDetailUI{ | @@ -35,7 +32,7 @@ export struct FollowListDetailUI{ | ||
| 35 | List({ space: 3 }) { | 32 | List({ space: 3 }) { |
| 36 | LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { | 33 | LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { |
| 37 | ListItem() { | 34 | ListItem() { |
| 38 | - ChildComponent({data: item}) | 35 | + FollowChildComponent({data: item,type:this.type}) |
| 39 | } | 36 | } |
| 40 | .onClick(() => { | 37 | .onClick(() => { |
| 41 | }) | 38 | }) |
| @@ -76,7 +73,8 @@ export struct FollowListDetailUI{ | @@ -76,7 +73,8 @@ export struct FollowListDetailUI{ | ||
| 76 | this.hasMore = false | 73 | this.hasMore = false |
| 77 | }else{ | 74 | }else{ |
| 78 | value.list.forEach((value)=>{ | 75 | value.list.forEach((value)=>{ |
| 79 | - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) | 76 | + |
| 77 | + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) | ||
| 80 | }) | 78 | }) |
| 81 | this.data.notifyDataReload() | 79 | this.data.notifyDataReload() |
| 82 | this.count = this.data.totalCount() | 80 | this.count = this.data.totalCount() |
| @@ -148,112 +146,4 @@ export struct FollowListDetailUI{ | @@ -148,112 +146,4 @@ export struct FollowListDetailUI{ | ||
| 148 | }) | 146 | }) |
| 149 | } | 147 | } |
| 150 | 148 | ||
| 151 | -} | ||
| 152 | - | ||
| 153 | -@Component | ||
| 154 | -struct ChildComponent { | ||
| 155 | - @ObjectLink data: FollowListDetailItem | ||
| 156 | - | ||
| 157 | - build() { | ||
| 158 | - Column(){ | ||
| 159 | - Blank().height('27lpx') | ||
| 160 | - | ||
| 161 | - Row() { | ||
| 162 | - Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl) | ||
| 163 | - .objectFit(ImageFit.Auto) | ||
| 164 | - .width('92lpx') | ||
| 165 | - .height('92lpx') | ||
| 166 | - .margin({right:'15lpx'}) | ||
| 167 | - | ||
| 168 | - Column(){ | ||
| 169 | - Text(this.data.cnUserName) | ||
| 170 | - .fontWeight('400lpx') | ||
| 171 | - .fontSize('31lpx') | ||
| 172 | - .lineHeight('38lpx') | ||
| 173 | - .fontColor($r('app.color.color_222222')) | ||
| 174 | - .maxLines(1) | ||
| 175 | - Text(`粉丝${this.data.cnFansNum}`) | ||
| 176 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 177 | - .fontSize('23lpx') | ||
| 178 | - .maxLines(1) | ||
| 179 | - Text(`${this.data.introduction}`) | ||
| 180 | - .fontColor($r('app.color.color_B0B0B0')) | ||
| 181 | - .fontSize('23lpx') | ||
| 182 | - .maxLines(2) | ||
| 183 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 184 | - }.layoutWeight(1) | ||
| 185 | - .alignItems(HorizontalAlign.Start) | ||
| 186 | - | ||
| 187 | - if(this.data.status == "1"){ | ||
| 188 | - Row(){ | ||
| 189 | - Text(`已关注`) | ||
| 190 | - .fontColor($r('app.color.color_CCCCCC')) | ||
| 191 | - .fontSize('23lpx') | ||
| 192 | - .fontWeight('500lpx') | ||
| 193 | - .lineHeight('35lpx') | ||
| 194 | - }.backgroundColor($r('app.color.color_F5F5F5')) | ||
| 195 | - .borderRadius('6lpx') | ||
| 196 | - .borderColor($r('app.color.color_F5F5F5')) | ||
| 197 | - .borderWidth('2lpx') | ||
| 198 | - .justifyContent(FlexAlign.Center) | ||
| 199 | - .width('100lpx') | ||
| 200 | - .height('46lpx') | ||
| 201 | - .margin({left:'4lpx',top:'23lpx'}) | ||
| 202 | - .onClick(()=>{ | ||
| 203 | - this.followOperation() | ||
| 204 | - // this.data.status = "0" | ||
| 205 | - }) | ||
| 206 | - }else{ | ||
| 207 | - Row(){ | ||
| 208 | - Image($r('app.media.follow_icon')) | ||
| 209 | - .margin({right:'4lpx'}) | ||
| 210 | - .width('23lpx') | ||
| 211 | - .height('23lpx') | ||
| 212 | - Text(`关注`) | ||
| 213 | - .fontColor($r('app.color.color_ED2800')) | ||
| 214 | - .fontSize('23lpx') | ||
| 215 | - .fontWeight('500lpx') | ||
| 216 | - .lineHeight('35lpx') | ||
| 217 | - }.borderColor($r('app.color.color_1AED2800')) | ||
| 218 | - .borderRadius('6lpx') | ||
| 219 | - .borderWidth('2lpx') | ||
| 220 | - .justifyContent(FlexAlign.Center) | ||
| 221 | - .width('100lpx') | ||
| 222 | - .height('46lpx') | ||
| 223 | - .margin({left:'4lpx',top:'23lpx'}) | ||
| 224 | - .onClick(()=>{ | ||
| 225 | - this.followOperation() | ||
| 226 | - // this.data.status = "1" | ||
| 227 | - }) | ||
| 228 | - } | ||
| 229 | - }.alignItems(VerticalAlign.Top) | ||
| 230 | - .width('100%') | ||
| 231 | - .layoutWeight(1) | ||
| 232 | - | ||
| 233 | - Divider().width('100%') | ||
| 234 | - .height('2lpx') | ||
| 235 | - .strokeWidth('1lpx') | ||
| 236 | - .backgroundColor($r('app.color.color_EDEDED')) | ||
| 237 | - | ||
| 238 | - }.height('146lpx') | ||
| 239 | - .justifyContent(FlexAlign.Center) | ||
| 240 | - .onClick(()=>{ | ||
| 241 | - //跳转 人民号的 主页 | ||
| 242 | - // let params: Params = { | ||
| 243 | - // pageID: this.data.attentionUserId | ||
| 244 | - // } | ||
| 245 | - // WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params) | ||
| 246 | - }) | ||
| 247 | - } | ||
| 248 | - | ||
| 249 | - followOperation(){ | ||
| 250 | - let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | ||
| 251 | - MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | ||
| 252 | - if(value!=null){ | ||
| 253 | - if (value.code === 0 || value.code.toString() === "0") { | ||
| 254 | - this.data.status = this.data.status ==="0"?"1":"0" | ||
| 255 | - } | ||
| 256 | - } | ||
| 257 | - }) | ||
| 258 | - } | ||
| 259 | } | 149 | } |
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowSecondTabsComponent.ets
| @@ -23,7 +23,8 @@ export struct FollowSecondTabsComponent{ | @@ -23,7 +23,8 @@ export struct FollowSecondTabsComponent{ | ||
| 23 | 23 | ||
| 24 | if(this.data != null){ | 24 | if(this.data != null){ |
| 25 | if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ | 25 | if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){ |
| 26 | - FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1) | 26 | + FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id,type:1}) |
| 27 | + .layoutWeight(1) | ||
| 27 | }else{ | 28 | }else{ |
| 28 | this.FollowSecondUI() | 29 | this.FollowSecondUI() |
| 29 | } | 30 | } |
| @@ -184,7 +184,7 @@ export struct HomePageBottomComponent{ | @@ -184,7 +184,7 @@ export struct HomePageBottomComponent{ | ||
| 184 | this.hasMore = false | 184 | this.hasMore = false |
| 185 | }else{ | 185 | }else{ |
| 186 | value.list.forEach((value)=>{ | 186 | 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)) | 187 | + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId)) |
| 188 | }) | 188 | }) |
| 189 | this.data_follow.notifyDataReload() | 189 | this.data_follow.notifyDataReload() |
| 190 | this.count = this.data_follow.totalCount() | 190 | this.count = this.data_follow.totalCount() |
| @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{ | @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{ | ||
| 116 | this.hasMore = false | 116 | this.hasMore = false |
| 117 | }else{ | 117 | }else{ |
| 118 | value.list.forEach((value)=>{ | 118 | 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)) | 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 | }) | 120 | }) |
| 121 | this.data_follow.notifyDataReload() | 121 | this.data_follow.notifyDataReload() |
| 122 | this.count = this.data_follow.totalCount() | 122 | this.count = this.data_follow.totalCount() |
| @@ -42,6 +42,8 @@ export struct BottomNavigationComponent { | @@ -42,6 +42,8 @@ export struct BottomNavigationComponent { | ||
| 42 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) | 42 | let bottomNav = await PageViewModel.getBottomNavData(getContext(this)) |
| 43 | if (bottomNav && bottomNav.bottomNavList != null) { | 43 | if (bottomNav && bottomNav.bottomNavList != null) { |
| 44 | Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`); | 44 | Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`); |
| 45 | + // 使用filter方法移除name为'服务'的项 | ||
| 46 | + bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务'); | ||
| 45 | this.bottomNavList = bottomNav.bottomNavList | 47 | this.bottomNavList = bottomNav.bottomNavList |
| 46 | } | 48 | } |
| 47 | } | 49 | } |
| @@ -9,12 +9,13 @@ import { RefreshLayoutBean } from './RefreshLayoutBean'; | @@ -9,12 +9,13 @@ 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,33 @@ struct BrowsingHistoryPage { | @@ -37,15 +40,33 @@ 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 | + CustomPullToRefresh({ | ||
| 45 | + alldata:this.allDatas, | ||
| 46 | + scroller:this.scroller, | ||
| 47 | + customList:()=>{ | ||
| 48 | + this.ListLayout() | ||
| 49 | + }, | ||
| 50 | + onRefresh:(resolve)=>{ | ||
| 51 | + this.browSingModel.currentPage = 0 | ||
| 52 | + this.getData(resolve) | ||
| 53 | + }, | ||
| 54 | + onLoadMore:(resolve)=> { | ||
| 55 | + this.browSingModel.currentPage++ | ||
| 56 | + this.getData() | ||
| 57 | + } | ||
| 58 | + }) | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + // if (this.browSingModel.viewType == ViewType.LOADING){ | ||
| 62 | + // this.LoadingLayout() | ||
| 63 | + // }else if(this.browSingModel.viewType == ViewType.ERROR){ | ||
| 64 | + // ErrorComponent() | ||
| 65 | + // }else if(this.browSingModel.viewType == ViewType.EMPTY){ | ||
| 66 | + // EmptyComponent() | ||
| 67 | + // }else { | ||
| 68 | + // this.ListLayout() | ||
| 69 | + // } | ||
| 49 | 70 | ||
| 50 | if (this.isEditState){ | 71 | if (this.isEditState){ |
| 51 | CustomBottomFuctionUI({ | 72 | CustomBottomFuctionUI({ |
| @@ -64,34 +85,27 @@ struct BrowsingHistoryPage { | @@ -64,34 +85,27 @@ struct BrowsingHistoryPage { | ||
| 64 | } | 85 | } |
| 65 | 86 | ||
| 66 | @Builder ListLayout() { | 87 | @Builder ListLayout() { |
| 67 | - List() { | 88 | + List({scroller: this.scroller}) { |
| 68 | // 下拉刷新 | 89 | // 下拉刷新 |
| 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) => { | 90 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 77 | ListItem() { | 91 | ListItem() { |
| 78 | this.newCompParser(compDTO,compIndex) | 92 | this.newCompParser(compDTO,compIndex) |
| 79 | } | 93 | } |
| 80 | }) | 94 | }) |
| 81 | - | ||
| 82 | // 加载更多 | 95 | // 加载更多 |
| 83 | ListItem() { | 96 | ListItem() { |
| 84 | if (this.browSingModel.hasMore) { | 97 | if (this.browSingModel.hasMore) { |
| 85 | - LoadMoreLayout({ | ||
| 86 | - refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage, | ||
| 87 | - this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight) | ||
| 88 | - }) | 98 | + // LoadMoreLayout({ |
| 99 | + // refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage, | ||
| 100 | + // this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight) | ||
| 101 | + // }) | ||
| 89 | } else { | 102 | } else { |
| 90 | NoMoreLayout() | 103 | NoMoreLayout() |
| 91 | } | 104 | } |
| 92 | } | 105 | } |
| 93 | } | 106 | } |
| 94 | .height(CommonConstants.FULL_PARENT) | 107 | .height(CommonConstants.FULL_PARENT) |
| 108 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 95 | } | 109 | } |
| 96 | 110 | ||
| 97 | @Builder | 111 | @Builder |
| @@ -117,9 +131,9 @@ struct BrowsingHistoryPage { | @@ -117,9 +131,9 @@ struct BrowsingHistoryPage { | ||
| 117 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) | 131 | $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) }) |
| 118 | } | 132 | } |
| 119 | 133 | ||
| 120 | - async getData() { | ||
| 121 | - this.browSingModel.currentPage = 1 | 134 | + async getData(resolve?: (value: string | PromiseLike<string>) => void){ |
| 122 | MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { | 135 | MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => { |
| 136 | + if(resolve) resolve('刷新成功') | ||
| 123 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 137 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 124 | this.browSingModel.viewType = ViewType.LOADED; | 138 | this.browSingModel.viewType = ViewType.LOADED; |
| 125 | this.allDatas.push(...collectionItem.list) | 139 | this.allDatas.push(...collectionItem.list) |
| @@ -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,14 +38,31 @@ struct MyCollectionListPage { | @@ -38,14 +38,31 @@ 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 { |
| 48 | - this.ListLayout() | 47 | + CustomPullToRefresh({ |
| 48 | + alldata:this.allDatas, | ||
| 49 | + scroller:this.scroller, | ||
| 50 | + customList:()=>{ | ||
| 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){ |
| @@ -65,34 +82,19 @@ struct MyCollectionListPage { | @@ -65,34 +82,19 @@ struct MyCollectionListPage { | ||
| 65 | } | 82 | } |
| 66 | 83 | ||
| 67 | @Builder ListLayout() { | 84 | @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 | - | 85 | + List({scroller: this.scroller}) { |
| 77 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { | 86 | ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => { |
| 78 | ListItem() { | 87 | ListItem() { |
| 79 | this.newCompParser(compDTO,compIndex) | 88 | this.newCompParser(compDTO,compIndex) |
| 80 | } | 89 | } |
| 81 | }) | 90 | }) |
| 82 | - | ||
| 83 | // 加载更多 | 91 | // 加载更多 |
| 84 | ListItem() { | 92 | 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 | - } | 93 | + if (this.browSingModel.hasMore === false) NoMoreLayout() |
| 93 | } | 94 | } |
| 94 | } | 95 | } |
| 95 | .height(CommonConstants.FULL_PARENT) | 96 | .height(CommonConstants.FULL_PARENT) |
| 97 | + .edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果 | ||
| 96 | } | 98 | } |
| 97 | 99 | ||
| 98 | @Builder | 100 | @Builder |
| @@ -113,22 +115,16 @@ struct MyCollectionListPage { | @@ -113,22 +115,16 @@ struct MyCollectionListPage { | ||
| 113 | } | 115 | } |
| 114 | } | 116 | } |
| 115 | 117 | ||
| 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 => { | 118 | + async getData(resolve?: (value: string | PromiseLike<string>) => void) { |
| 119 | + MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => { | ||
| 120 | + if(resolve) resolve('刷新成功') | ||
| 124 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { | 121 | if (collectionItem && collectionItem.list && collectionItem.list.length > 0) { |
| 125 | - this.browSingModel.viewType = ViewType.LOADED; | ||
| 126 | - this.allDatas.push(...collectionItem.list) | ||
| 127 | - if (collectionItem.list.length === this.browSingModel.pageSize) { | ||
| 128 | - this.browSingModel.currentPage++; | ||
| 129 | - this.browSingModel.hasMore = true; | ||
| 130 | - } else { | 122 | + if (this.currentPage === 1) this.allDatas = [] |
| 123 | + this.allDatas = this.allDatas.concat(...collectionItem.list) | ||
| 124 | + if (collectionItem.totalCount === this.allDatas.length) { | ||
| 131 | this.browSingModel.hasMore = false; | 125 | this.browSingModel.hasMore = false; |
| 126 | + } else { | ||
| 127 | + this.browSingModel.hasMore = true; | ||
| 132 | } | 128 | } |
| 133 | } else { | 129 | } else { |
| 134 | this.browSingModel.viewType = ViewType.EMPTY; | 130 | this.browSingModel.viewType = ViewType.EMPTY; |
| 1 | +import router from '@ohos.router' | ||
| 2 | +import { PeopleShipHomePageNavComponent } from '../peopleShipHomePage/PeopleShipHomeNavComponent' | ||
| 3 | +import { PeopleShipHomePageTopComponent } from '../peopleShipHomePage/PeopleShipHomePageTopComponent' | ||
| 4 | +import { Logger } from 'wdKit' | ||
| 5 | +import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | ||
| 6 | +import { PeopleShipHomeListComponent } from '../peopleShipHomePage/PeopleShipHomeListComponent' | ||
| 7 | +import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | ||
| 8 | +import { HttpUrlUtils } from 'wdNetwork/Index' | ||
| 9 | +import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | ||
| 10 | +import { PageRepository } from '../../repository/PageRepository' | ||
| 11 | +import { | ||
| 12 | + postInteractAccentionOperateParams, | ||
| 13 | + PeopleShipUserDetailData, | ||
| 14 | + ArticleCountData | ||
| 15 | +} from 'wdBean' | ||
| 16 | + | ||
| 17 | +@Entry | ||
| 18 | +@Component | ||
| 19 | +struct PeopleShipHomePage { | ||
| 20 | + // Todo 传入数据 后续在修改 | ||
| 21 | + creatorId: string = (router.getParams() as Record<string, string>)['creatorId']; | ||
| 22 | + @State arr: number[] = [] | ||
| 23 | + // 页面详情数据 | ||
| 24 | + @Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData | ||
| 25 | + // 每个分类数量 | ||
| 26 | + @State articleModel: ArticleCountData = {} as ArticleCountData | ||
| 27 | + // 总滑动空间 | ||
| 28 | + scroller: Scroller = new Scroller() | ||
| 29 | + // 顶部透明度 | ||
| 30 | + @State topOpacity: number = 0 | ||
| 31 | + //发布数量 | ||
| 32 | + @State publishCount: number = 0 | ||
| 33 | + // 是否关注 | ||
| 34 | + @Provide isAttention: string = '0' | ||
| 35 | + // 是否开始更新关注 | ||
| 36 | + @Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false | ||
| 37 | + //关注显示 | ||
| 38 | + @Prop attentionOpacity: boolean = false | ||
| 39 | + @Provide topHeight: number = 400 | ||
| 40 | + | ||
| 41 | + build() { | ||
| 42 | + | ||
| 43 | + Stack({ alignContent: Alignment.TopStart }) { | ||
| 44 | + // 头部返回 | ||
| 45 | + PeopleShipHomePageNavComponent({ | ||
| 46 | + attentionOpacity: this.attentionOpacity, | ||
| 47 | + topOpacity: this.topOpacity, | ||
| 48 | + detailModel: this.detailModel | ||
| 49 | + }) | ||
| 50 | + .height($r('app.float.top_bar_height')) | ||
| 51 | + .zIndex(100) | ||
| 52 | + .backgroundColor(Color.Transparent) | ||
| 53 | + | ||
| 54 | + if (this.detailModel && this.detailModel.userName) { | ||
| 55 | + Scroll(this.scroller) { | ||
| 56 | + Column() { | ||
| 57 | + // 顶部相关 | ||
| 58 | + PeopleShipHomePageTopComponent({ | ||
| 59 | + creatorId: this.creatorId, | ||
| 60 | + detailModel: this.detailModel, | ||
| 61 | + publishCount: this.publishCount, | ||
| 62 | + topHeight: this.topHeight | ||
| 63 | + }) | ||
| 64 | + .width("100%") | ||
| 65 | + .height(this.topHeight) | ||
| 66 | + .backgroundColor(Color.White) | ||
| 67 | + | ||
| 68 | + // 列表 | ||
| 69 | + PeopleShipHomeListComponent({ | ||
| 70 | + publishCount: this.publishCount, | ||
| 71 | + creatorId: this.creatorId | ||
| 72 | + }) | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + .width("100%") | ||
| 76 | + .justifyContent(FlexAlign.Start) | ||
| 77 | + // .height(this.publishCount == 0 ? '100%' : '') | ||
| 78 | + } | ||
| 79 | + .edgeEffect(EdgeEffect.None) | ||
| 80 | + .friction(0.6) | ||
| 81 | + .backgroundColor(Color.White) | ||
| 82 | + .scrollBar(BarState.Off) | ||
| 83 | + .width('100%') | ||
| 84 | + .height('100%') | ||
| 85 | + .onScroll(() => { | ||
| 86 | + // this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2) | ||
| 87 | + this.topOpacity = this.scroller.currentOffset().yOffset / 100 | ||
| 88 | + if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) { | ||
| 89 | + this.attentionOpacity = true | ||
| 90 | + } else { | ||
| 91 | + this.attentionOpacity = false | ||
| 92 | + } | ||
| 93 | + console.log(`全局请求失败拦截,message:${this.topOpacity}`) | ||
| 94 | + // System.out.println("输出高度:"+ AttrHelper.vp2px(height,this)); | ||
| 95 | + | ||
| 96 | + }) | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + async aboutToAppear() { | ||
| 104 | + | ||
| 105 | + try { | ||
| 106 | + // 获取页面信息 | ||
| 107 | + this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '') | ||
| 108 | + Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`) | ||
| 109 | + | ||
| 110 | + // 获取关注 | ||
| 111 | + let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) | ||
| 112 | + Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) | ||
| 113 | + this.findFollowStata(followList) | ||
| 114 | + | ||
| 115 | + } catch (exception) { | ||
| 116 | + | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + findFollowStata(followList: QueryListIsFollowedItem[]) { | ||
| 123 | + if (followList.length > 0) { | ||
| 124 | + let item: QueryListIsFollowedItem = followList[0] | ||
| 125 | + Logger.debug('PeopleShipHomePage', '关注', `${JSON.stringify(item.status)}`) | ||
| 126 | + this.isAttention = item.status | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + handleChangeAttentionStata() { | ||
| 131 | + if (!this.isLoadingAttention) { | ||
| 132 | + return | ||
| 133 | + } | ||
| 134 | + // 未登录,跳转登录 | ||
| 135 | + if (!HttpUrlUtils.getUserId()) { | ||
| 136 | + WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | ||
| 137 | + return | ||
| 138 | + } | ||
| 139 | + let status = 0 | ||
| 140 | + if (this.isAttention == '0') { | ||
| 141 | + status = 1 | ||
| 142 | + } | ||
| 143 | + const params: postInteractAccentionOperateParams = { | ||
| 144 | + attentionUserType: this.detailModel.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号) | ||
| 145 | + attentionUserId: this.detailModel.userId || '', // 被关注用户号主id | ||
| 146 | + attentionCreatorId: this.creatorId || '', // 被关注用户号主id | ||
| 147 | + // userType: 1, | ||
| 148 | + // userId: HttpUrlUtils.getUserId(), | ||
| 149 | + status: status, | ||
| 150 | + } | ||
| 151 | + PageRepository.postInteractAccentionOperate(params).then(res => { | ||
| 152 | + if (this.isAttention == '1') { | ||
| 153 | + this.isAttention = '0' | ||
| 154 | + } else { | ||
| 155 | + this.isAttention = '1' | ||
| 156 | + } | ||
| 157 | + this.isLoadingAttention = false | ||
| 158 | + }) | ||
| 159 | + .catch(() => { | ||
| 160 | + this.isLoadingAttention = false | ||
| 161 | + }) | ||
| 162 | + } | ||
| 163 | +} | ||
| 164 | + |
| 1 | +import { Logger, DisplayUtils} from 'wdKit' | ||
| 2 | +import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | ||
| 3 | +import { | ||
| 4 | + ContentDTO, | ||
| 5 | + ArticleListDTO, | ||
| 6 | + LiveDTO, | ||
| 7 | + LiveInfoDTO, | ||
| 8 | + FullColumnImgUrlDTO, | ||
| 9 | + VideoInfoDTO, | ||
| 10 | + RmhInfoDTO, | ||
| 11 | + contentListParams, | ||
| 12 | + InteractDataDTO, | ||
| 13 | + ArticleTypeData, | ||
| 14 | + ArticleListData, | ||
| 15 | + PeopleShipUserDetailData | ||
| 16 | +} from 'wdBean' | ||
| 17 | +import { CardParser } from '../CardParser' | ||
| 18 | +import { PageRepository } from '../../repository/PageRepository' | ||
| 19 | +import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 20 | +import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | ||
| 21 | +import { ErrorComponent } from '../view/ErrorComponent'; | ||
| 22 | +import NoMoreLayout from '../page/NoMoreLayout'; | ||
| 23 | +import { LazyDataSource } from 'wdKit'; | ||
| 24 | + | ||
| 25 | +const TAG = 'PeopleShipHomeArticleListComponent'; | ||
| 26 | + | ||
| 27 | +@Component | ||
| 28 | +export struct PeopleShipHomeArticleListComponent { | ||
| 29 | + // @State arr: ContentDTO[] = [] | ||
| 30 | + @State arr: LazyDataSource<ContentDTO> = new LazyDataSource(); | ||
| 31 | + @State typeModel: ArticleTypeData = new ArticleTypeData() | ||
| 32 | + @State creatorId: string = '' | ||
| 33 | + @Consume detailModel: PeopleShipUserDetailData | ||
| 34 | + @State private viewType: number = 1; | ||
| 35 | + currentIndex: number = 0 | ||
| 36 | + @Link @Watch('onChange') currentTopSelectedIndex: number | ||
| 37 | + @State private hasMore: boolean = true | ||
| 38 | + @State currentPage: number = 1 | ||
| 39 | + @State private isLoading: boolean = false | ||
| 40 | + @Consume topHeight: number | ||
| 41 | + | ||
| 42 | + build() { | ||
| 43 | + if (this.viewType == 1) { | ||
| 44 | + // LoadingComponent() | ||
| 45 | + this.LoadingLayout() | ||
| 46 | + } else if (this.viewType == 2) { | ||
| 47 | + ErrorComponent() | ||
| 48 | + } else { | ||
| 49 | + this.ListLayout() | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @Builder | ||
| 55 | + LoadingLayout() { | ||
| 56 | + CustomRefreshLoadLayout({ | ||
| 57 | + refreshBean: new RefreshLayoutBean(true, | ||
| 58 | + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20) | ||
| 59 | + }).height(DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Builder | ||
| 63 | + ListLayout() { | ||
| 64 | + | ||
| 65 | + List() { | ||
| 66 | + // 下拉刷新 | ||
| 67 | + | ||
| 68 | + LazyForEach(this.arr, (item: ContentDTO) => { | ||
| 69 | + ListItem() { | ||
| 70 | + CardParser({ contentDTO: item }) | ||
| 71 | + }.width("100%") | ||
| 72 | + .backgroundColor(Color.Transparent) | ||
| 73 | + }, (item: ContentDTO, index: number) => item.objectId + index.toString()) | ||
| 74 | + | ||
| 75 | + // 加载更多 | ||
| 76 | + ListItem() { | ||
| 77 | + if (!this.hasMore) { | ||
| 78 | + NoMoreLayout() | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + .width("100%") | ||
| 83 | + .height("100%") | ||
| 84 | + .edgeEffect(EdgeEffect.Spring) | ||
| 85 | + .nestedScroll({ | ||
| 86 | + scrollForward: NestedScrollMode.PARENT_FIRST, | ||
| 87 | + scrollBackward: NestedScrollMode.SELF_FIRST | ||
| 88 | + }) | ||
| 89 | + | ||
| 90 | + .onReachEnd(() => { | ||
| 91 | + if(!this.isLoading && this.hasMore){ | ||
| 92 | + //加载分页数据 | ||
| 93 | + this.getPeopleShipPageArticleList() | ||
| 94 | + } | ||
| 95 | + }) | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + aboutToAppear() { | ||
| 99 | + if (this.currentIndex == this.currentTopSelectedIndex) { | ||
| 100 | + this.currentPage = 1 | ||
| 101 | + this.getPeopleShipPageArticleList() | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + onChange() { | ||
| 106 | + if (this.currentIndex == this.currentTopSelectedIndex) { | ||
| 107 | + this.currentPage = 1 | ||
| 108 | + this.getPeopleShipPageArticleList() | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + private async getPeopleShipPageArticleList() { | ||
| 113 | + Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`) | ||
| 114 | + if (this.isLoading) { | ||
| 115 | + return | ||
| 116 | + } | ||
| 117 | + try { | ||
| 118 | + this.isLoading = true | ||
| 119 | + let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type) | ||
| 120 | + Logger.debug(TAG, `获取页面信息, ${listData.list.length}`); | ||
| 121 | + | ||
| 122 | + if (listData && listData.list && listData.list.length > 0) { | ||
| 123 | + this.viewType = 3; | ||
| 124 | + if (listData.list.length === 20) { | ||
| 125 | + this.currentPage++; | ||
| 126 | + this.hasMore = true; | ||
| 127 | + } else { | ||
| 128 | + this.hasMore = false; | ||
| 129 | + } | ||
| 130 | + } else { | ||
| 131 | + this.viewType = 1; | ||
| 132 | + } | ||
| 133 | + this.queryArticleContentInteractCount(listData) | ||
| 134 | + Logger.debug(TAG, '展示的总数', `${this.arr.totalCount()}`) | ||
| 135 | + }catch (exception) { | ||
| 136 | + this.isLoading = false | ||
| 137 | + if (this.arr.totalCount() == 0) { | ||
| 138 | + this.viewType = 2 | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + /** | ||
| 145 | + * 查询点赞、收藏数量 | ||
| 146 | + */ | ||
| 147 | + private queryArticleContentInteractCount(listData: ArticleListData) { | ||
| 148 | + if (listData && listData.list && listData.list.length > 0) { | ||
| 149 | + const params: contentListParams = { | ||
| 150 | + contentList: [] | ||
| 151 | + } | ||
| 152 | + listData.list.map((item: ArticleListDTO) => { | ||
| 153 | + params.contentList.push({ | ||
| 154 | + contentId: item.id, | ||
| 155 | + contentType: item.type | ||
| 156 | + }) | ||
| 157 | + }); | ||
| 158 | + PageRepository.getContentInteract(params).then(res => { | ||
| 159 | + this.articleListDTOChangeContentDTO(listData, res.data ?? []) | ||
| 160 | + }).catch(() => { | ||
| 161 | + this.articleListDTOChangeContentDTO(listData, []) | ||
| 162 | + }) | ||
| 163 | + | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + private articleListDTOChangeContentDTO(listData: ArticleListData, listCom: InteractDataDTO[]) { | ||
| 168 | + this.isLoading = false | ||
| 169 | + if (listData.list.length) { | ||
| 170 | + for (const element of listData.list) { | ||
| 171 | + let contentDTO = {} as ContentDTO | ||
| 172 | + contentDTO.appStyle = this.changeCommon(element.appStyle) | ||
| 173 | + contentDTO.newsTitle = element.title; | ||
| 174 | + contentDTO.newsSummary = element.description; | ||
| 175 | + contentDTO.objectId = element.id; | ||
| 176 | + // 评论数 | ||
| 177 | + const comModel = listCom.find((item) => { | ||
| 178 | + return item.contentId == element.id | ||
| 179 | + }) | ||
| 180 | + if (comModel) { | ||
| 181 | + contentDTO.interactData = comModel | ||
| 182 | + } | ||
| 183 | + //1:小图卡,2:大图卡,3:无图卡(全标题), | ||
| 184 | + // 4:三图卡,5:头图卡,6:小视频卡,7:作者卡,8:财经快讯卡, | ||
| 185 | + // 9:时间轴卡,10:大专题卡, | ||
| 186 | + // 11.无图卡(标题缩略),12.无图卡(标题缩略)-人民号, | ||
| 187 | + // 13.单图卡,14.单图卡-人民号, | ||
| 188 | + // 15.大图卡-人民号,16.三图卡-人民号,17.图集卡,18.图集卡-人民号, | ||
| 189 | + // 19.动态图文卡-人民号,20.动态视频卡-人民号, | ||
| 190 | + // 21 小视频卡-人民号 | ||
| 191 | + contentDTO.objectType = `${element.type}`; | ||
| 192 | + | ||
| 193 | + // contentDTO.productNum = element.productCount; | ||
| 194 | + // if (master) { | ||
| 195 | + // contentDTO.customWorkStatus = element.workStatus; | ||
| 196 | + // } | ||
| 197 | + // contentDTO.customSchedulePublishTime = element.contentPublishTasks.firstObject.schedulePublishTime; | ||
| 198 | + contentDTO.fullColumnImgUrls = this.fullColumnImgUrls(element); | ||
| 199 | + | ||
| 200 | + let rmhInfo = this.convertToRmhInfoWithAccountModel() | ||
| 201 | + if (rmhInfo) { | ||
| 202 | + contentDTO.rmhInfo = rmhInfo; | ||
| 203 | + } | ||
| 204 | + let liveInfo = this.convertToProgramLiveInfoModel(element.live); | ||
| 205 | + if (liveInfo) { | ||
| 206 | + contentDTO.liveInfo = liveInfo; | ||
| 207 | + if (element.vlives && element.vlives.length > 0) { | ||
| 208 | + let vlivesModel = element.vlives[0] | ||
| 209 | + if (vlivesModel.recordUrl && vlivesModel.recordUrl.length > 0) { | ||
| 210 | + contentDTO.liveInfo.replayUri = vlivesModel.recordUrl | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + | ||
| 215 | + let videInfo1 = this.convertToVideoInfo(element); | ||
| 216 | + if (videInfo1) { | ||
| 217 | + contentDTO.videoInfo = videInfo1 | ||
| 218 | + } | ||
| 219 | + // contentDTO.shareInfo = [self.contentShare.firstObject convertToShareInfo]; | ||
| 220 | + // contentDTO.shareInfo.shareUrl = self.shareUrl; | ||
| 221 | + if (element.createTime.length > 0) { | ||
| 222 | + contentDTO.publishTime = this.convertPublishTimeWith(element.createTime); | ||
| 223 | + } else if (element.updateTime.length > 0) { | ||
| 224 | + contentDTO.publishTime = this.convertPublishTimeWith(element.updateTime); | ||
| 225 | + } else if (element.firstPublishTime.length > 0) { | ||
| 226 | + contentDTO.publishTime = this.convertPublishTimeWith(element.firstPublishTime); | ||
| 227 | + } else if (element.publishTime.length > 0) { | ||
| 228 | + contentDTO.publishTime = this.convertPublishTimeWith(element.publishTime); | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + | ||
| 232 | + //图集数量 | ||
| 233 | + contentDTO.photoNum = element.mainPicCount; | ||
| 234 | + | ||
| 235 | + if (element.contentExt && element.contentExt.length > 0) { | ||
| 236 | + let extModel = element.contentExt[0]; | ||
| 237 | + contentDTO.openLikes = extModel.openLikes; | ||
| 238 | + contentDTO.openComment = extModel.openComment; | ||
| 239 | + } | ||
| 240 | + // 页面 | ||
| 241 | + if (contentDTO.appStyle == '2' || contentDTO.appStyle == '13' || contentDTO.appStyle == '20') { | ||
| 242 | + if (element.appStyleImages && element.appStyleImages.length > 0) { | ||
| 243 | + contentDTO.coverUrl = element.appStyleImages[0].fullUrl | ||
| 244 | + } else if (element.contentPictures && element.contentPictures.length > 0) { | ||
| 245 | + contentDTO.coverUrl = element.contentPictures[0].fullUrl | ||
| 246 | + } | ||
| 247 | + } | ||
| 248 | + // infoModel.api_isFollowListDataSource = YES; | ||
| 249 | + // //infoModel.topicTemplate = [self.topicTemplate integerValue]; | ||
| 250 | + // //infoModel.objectLevel = self.topicType; | ||
| 251 | + // //infoModel.pageId = self.pageId; | ||
| 252 | + contentDTO.source = this.detailModel.userName; | ||
| 253 | + // infoModel.opusAllowEdit = master && !([self.workStatus isEqualToString:@"2"] || | ||
| 254 | + // [self.workStatus isEqualToString:@"6"] || | ||
| 255 | + // [self.workStatus isEqualToString:@"5"] || | ||
| 256 | + // [self.workStatus isEqualToString:@"8"] || | ||
| 257 | + // !self.workStatus); | ||
| 258 | + // infoModel.newsTag = [self convertNewsTagIsMaster:master]; | ||
| 259 | + // if (isSerial) { | ||
| 260 | + // contentDTO.coverUrl = element.fullUrl; | ||
| 261 | + // } | ||
| 262 | + | ||
| 263 | + this.arr.push(contentDTO) | ||
| 264 | + } | ||
| 265 | + | ||
| 266 | + } | ||
| 267 | + | ||
| 268 | + // this.arr = listData.list | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + //人民号主页 | ||
| 272 | + private convertToRmhInfoWithAccountModel() { | ||
| 273 | + if (this.detailModel) { | ||
| 274 | + let rmhInfo = {} as RmhInfoDTO | ||
| 275 | + rmhInfo.rmhHeadUrl = this.detailModel.headPhotoUrl; | ||
| 276 | + rmhInfo.rmhName = this.detailModel.userName; | ||
| 277 | + rmhInfo.rmhId = this.detailModel.creatorId; | ||
| 278 | + rmhInfo.userId = this.detailModel.userId; | ||
| 279 | + rmhInfo.userType = this.detailModel.userType | ||
| 280 | + rmhInfo.rmhDesc = this.detailModel.introduction; | ||
| 281 | + rmhInfo.cnIsAttention = 0; | ||
| 282 | + rmhInfo.cnIsComment = this.detailModel.isComment; | ||
| 283 | + rmhInfo.cnIsLike = this.detailModel.cnIsLike; | ||
| 284 | + rmhInfo.cnMainControl = this.detailModel.mainControl; | ||
| 285 | + rmhInfo.cnShareControl = this.detailModel.shareControl; | ||
| 286 | + rmhInfo.authIcon = this.detailModel.authIcon; | ||
| 287 | + rmhInfo.authTitle = this.detailModel.authTitle; | ||
| 288 | + // rmhInfo.honoraryIcon = this.detailModel.honoraryIcon; | ||
| 289 | + // rmhInfo.honoraryTitle = this.detailModel.honoraryTitle; | ||
| 290 | + rmhInfo.banControl = this.detailModel.banControl; | ||
| 291 | + return rmhInfo | ||
| 292 | + } | ||
| 293 | + return null | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + //视频信息转换 | ||
| 297 | + private convertToVideoInfo(model: ArticleListDTO) { | ||
| 298 | + | ||
| 299 | + if (model.appStyleVideos && model.appStyleVideos.length > 0) { | ||
| 300 | + let firstModel = model.appStyleVideos[0] | ||
| 301 | + let videoInfo: VideoInfoDTO = {} as VideoInfoDTO | ||
| 302 | + | ||
| 303 | + videoInfo.videoDuration = firstModel.duration | ||
| 304 | + videoInfo.videoUrl = firstModel.url | ||
| 305 | + videoInfo.videoLandscape = firstModel.landscape | ||
| 306 | + videoInfo.firstFrameImageUri = firstModel.fullUrl | ||
| 307 | + return videoInfo | ||
| 308 | + } | ||
| 309 | + else if (model.contentVideos && model.contentVideos.length > 0) { | ||
| 310 | + let firstModel = model.contentVideos[0] | ||
| 311 | + let videoInfo: VideoInfoDTO = {} as VideoInfoDTO | ||
| 312 | + videoInfo.videoDuration = firstModel.duration | ||
| 313 | + videoInfo.videoUrl = firstModel.url | ||
| 314 | + videoInfo.videoLandscape = firstModel.landscape | ||
| 315 | + videoInfo.firstFrameImageUri = firstModel.fullUrl | ||
| 316 | + return videoInfo | ||
| 317 | + } | ||
| 318 | + return null | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + // 直播信息转换 | ||
| 322 | + private convertToProgramLiveInfoModel(model: LiveDTO): LiveInfoDTO | null { | ||
| 323 | + if (model) { | ||
| 324 | + let liveInfo = {} as LiveInfoDTO | ||
| 325 | + liveInfo.vrType = model.vr | ||
| 326 | + liveInfo.liveState = model.status | ||
| 327 | + liveInfo.liveLandscape = model.landscape | ||
| 328 | + if (model.recordUrl && model.recordUrl.length > 0) { | ||
| 329 | + liveInfo.replayUri = model.recordUrl | ||
| 330 | + } else if (model.uri && model.uri.length > 0) { | ||
| 331 | + liveInfo.replayUri = model.uri | ||
| 332 | + } | ||
| 333 | + return liveInfo | ||
| 334 | + } | ||
| 335 | + return null | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + // 图片转换 | ||
| 339 | + private fullColumnImgUrls(model: ArticleListDTO) { | ||
| 340 | + let imagesList: FullColumnImgUrlDTO[] = [] as FullColumnImgUrlDTO[] | ||
| 341 | + if (model.appStyleImages && model.appStyleImages.length > 0) { | ||
| 342 | + for (const element of model.appStyleImages) { | ||
| 343 | + let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO | ||
| 344 | + imgUrl.format = element.format | ||
| 345 | + imgUrl.height = element.height | ||
| 346 | + imgUrl.weight = element.weight | ||
| 347 | + imgUrl.size = element.size | ||
| 348 | + imgUrl.landscape = element.landscape | ||
| 349 | + imgUrl.url = element.fullUrl | ||
| 350 | + imgUrl.fullUrl = element.fullUrl | ||
| 351 | + imagesList.push(imgUrl) | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + else if (model.contentPictures && model.contentPictures.length > 0) { | ||
| 355 | + for (const element of model.contentPictures) { | ||
| 356 | + let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO | ||
| 357 | + imgUrl.format = element.format | ||
| 358 | + imgUrl.height = element.height | ||
| 359 | + imgUrl.weight = element.weight | ||
| 360 | + imgUrl.size = element.size | ||
| 361 | + imgUrl.landscape = element.landscape | ||
| 362 | + imgUrl.url = element.fullUrl | ||
| 363 | + imgUrl.fullUrl = element.fullUrl | ||
| 364 | + imagesList.push(imgUrl) | ||
| 365 | + } | ||
| 366 | + } | ||
| 367 | + return imagesList | ||
| 368 | + } | ||
| 369 | + | ||
| 370 | + //时间转时间戳 | ||
| 371 | + private convertPublishTimeWith(time: string): string { | ||
| 372 | + if (time.length) { | ||
| 373 | + return `${new Date(time).getTime()}` | ||
| 374 | + } | ||
| 375 | + return `${new Date().getTime()}` | ||
| 376 | + } | ||
| 377 | + | ||
| 378 | + private changeCommon(appStyle: number): string { | ||
| 379 | + if (appStyle == 12) { | ||
| 380 | + return '11' | ||
| 381 | + } | ||
| 382 | + if (appStyle == 14) { | ||
| 383 | + return '13' | ||
| 384 | + } | ||
| 385 | + if (appStyle == 15) { | ||
| 386 | + return '2' | ||
| 387 | + } | ||
| 388 | + if (appStyle == 16) { | ||
| 389 | + return '4' | ||
| 390 | + } | ||
| 391 | + if (appStyle == 18) { | ||
| 392 | + return '17' | ||
| 393 | + } | ||
| 394 | + if (appStyle == 21) { | ||
| 395 | + return '6' | ||
| 396 | + } | ||
| 397 | + return `${appStyle}` | ||
| 398 | + } | ||
| 399 | +} |
| 1 | +@Component | ||
| 2 | +export struct PeopleShipHomeAttentionComponent { | ||
| 3 | + @Consume isAttention: string | ||
| 4 | + @Consume isLoadingAttention: boolean | ||
| 5 | + build() { | ||
| 6 | + Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { | ||
| 7 | + Button({type: ButtonType.Normal, stateEffect: false } ) { | ||
| 8 | + Stack() { | ||
| 9 | + Image(this.isAttention == '0'? $r('app.media.home_attention_no_left') : $r('app.media.home_attention_left')) | ||
| 10 | + .width('100%') | ||
| 11 | + .height('100%') | ||
| 12 | + .objectFit(ImageFit.Cover) | ||
| 13 | + Row() { | ||
| 14 | + if(this.isAttention == '0') { | ||
| 15 | + if(this.isLoadingAttention) { | ||
| 16 | + LoadingProgress() | ||
| 17 | + .width(20) | ||
| 18 | + .height(20) | ||
| 19 | + .color($r('app.color.color_fff')) | ||
| 20 | + }else { | ||
| 21 | + Text('+ 关注') | ||
| 22 | + .fontColor(Color.White) | ||
| 23 | + .fontSize($r('app.float.vp_14')) | ||
| 24 | + .fontWeight(500) | ||
| 25 | + .margin({ | ||
| 26 | + right: '10vp' | ||
| 27 | + }) | ||
| 28 | + } | ||
| 29 | + }else { | ||
| 30 | + if(this.isLoadingAttention) { | ||
| 31 | + LoadingProgress() | ||
| 32 | + .width(20) | ||
| 33 | + .height(20) | ||
| 34 | + .color( $r('app.color.color_CCCCCC')) | ||
| 35 | + }else { | ||
| 36 | + Text('已关注') | ||
| 37 | + .fontSize($r('app.float.vp_14')) | ||
| 38 | + .fontWeight(500) | ||
| 39 | + .fontColor($r('app.color.color_CCCCCC')) | ||
| 40 | + .margin({ | ||
| 41 | + right: '10vp' | ||
| 42 | + }) | ||
| 43 | + } | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + } | ||
| 47 | + .justifyContent(FlexAlign.Center) | ||
| 48 | + .alignItems(VerticalAlign.Center) | ||
| 49 | + .width('100%') | ||
| 50 | + .height('100%') | ||
| 51 | + } | ||
| 52 | + .width('100%') | ||
| 53 | + .height('100%') | ||
| 54 | + } | ||
| 55 | + .backgroundColor(Color.Transparent) | ||
| 56 | + .width(176) | ||
| 57 | + .height(36) | ||
| 58 | + .padding(0) | ||
| 59 | + .fontColor(Color.Black) | ||
| 60 | + .margin({ | ||
| 61 | + right: '-5vp' | ||
| 62 | + }) | ||
| 63 | + .onClick(() => { | ||
| 64 | + if(this.isLoadingAttention) { | ||
| 65 | + return | ||
| 66 | + } | ||
| 67 | + this.isLoadingAttention = true | ||
| 68 | + }) | ||
| 69 | + | ||
| 70 | + Button({type: ButtonType.Normal, stateEffect: false}) { | ||
| 71 | + Stack() { | ||
| 72 | + Image($r('app.media.home_share_right_icon')) | ||
| 73 | + .width('100%') | ||
| 74 | + .height('100%') | ||
| 75 | + .objectFit(ImageFit.Cover) | ||
| 76 | + Row() { | ||
| 77 | + Image($r('app.media.QR_code_icon')) | ||
| 78 | + .width(16) | ||
| 79 | + .height(16) | ||
| 80 | + .objectFit(ImageFit.Cover) | ||
| 81 | + .margin({ | ||
| 82 | + left: '10vp' | ||
| 83 | + }) | ||
| 84 | + Text('分享名片') | ||
| 85 | + .fontSize($r('app.float.vp_14')) | ||
| 86 | + .fontColor($r('app.color.color_222222')) | ||
| 87 | + .fontWeight(500) | ||
| 88 | + .margin({ left: 5 }) | ||
| 89 | + } | ||
| 90 | + .justifyContent(FlexAlign.Center) | ||
| 91 | + .alignItems(VerticalAlign.Center) | ||
| 92 | + .width('100%') | ||
| 93 | + .height('100%') | ||
| 94 | + } | ||
| 95 | + .width('100%') | ||
| 96 | + .height('100%') | ||
| 97 | + } | ||
| 98 | + .backgroundColor(Color.Transparent) | ||
| 99 | + .width(176) | ||
| 100 | + .height(36) | ||
| 101 | + .padding(0) | ||
| 102 | + .fontColor(Color.White) | ||
| 103 | + .margin({ | ||
| 104 | + left: '-5vp' | ||
| 105 | + }) | ||
| 106 | + .onClick(() => { | ||
| 107 | + | ||
| 108 | + }) | ||
| 109 | + | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + } | ||
| 113 | +} |
| 1 | +import { DisplayUtils, Logger } from 'wdKit' | ||
| 2 | +import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | ||
| 3 | +import { PeopleShipHomeArticleListComponent } from './PeopleShipHomeArticleListComponent' | ||
| 4 | +import { ArticleCountData, ArticleTypeData } from 'wdBean' | ||
| 5 | +import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout' | ||
| 6 | +import { EmptyComponent } from '../view/EmptyComponent'; | ||
| 7 | +import { RefreshLayoutBean } from '../page/RefreshLayoutBean' | ||
| 8 | + | ||
| 9 | +@Component | ||
| 10 | +export struct PeopleShipHomeListComponent { | ||
| 11 | + | ||
| 12 | + private controller: TabsController = new TabsController() | ||
| 13 | + | ||
| 14 | + @State tabArr: ArticleTypeData[] = [] | ||
| 15 | + @State creatorId: string = '' | ||
| 16 | + // 发布数量 | ||
| 17 | + @Link publishCount: number | ||
| 18 | + @State currentIndex: number = 0 | ||
| 19 | + @State private isLoading: boolean = false | ||
| 20 | + @Consume topHeight: number | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + build() { | ||
| 24 | + if (this.isLoading) { | ||
| 25 | + this.LoadingLayout() | ||
| 26 | + } | ||
| 27 | + // 列表 | ||
| 28 | + else if(this.publishCount == 0) { | ||
| 29 | + // 无数据展示 | ||
| 30 | + EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 31 | + } else { | ||
| 32 | + Tabs({ barPosition: BarPosition.Start, controller: this.controller}) { | ||
| 33 | + ForEach(this.tabArr, (item: ArticleTypeData, index: number) => { | ||
| 34 | + TabContent() { | ||
| 35 | + PeopleShipHomeArticleListComponent({ | ||
| 36 | + typeModel: item, | ||
| 37 | + creatorId: this.creatorId, | ||
| 38 | + currentTopSelectedIndex: this.currentIndex, | ||
| 39 | + currentIndex: index | ||
| 40 | + }) | ||
| 41 | + }.tabBar(this.tabBuilder(index, item.name ?? '')) | ||
| 42 | + | ||
| 43 | + }) | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + .backgroundColor(Color.White) | ||
| 47 | + .barWidth('100%') | ||
| 48 | + .barHeight('44vp') | ||
| 49 | + .vertical(false) | ||
| 50 | + .height(DisplayUtils.getDeviceHeight() - 100) | ||
| 51 | + .animationDuration(0) | ||
| 52 | + .divider({ | ||
| 53 | + strokeWidth: '0.5vp', | ||
| 54 | + color: $r('app.color.color_F5F5F5'), | ||
| 55 | + startMargin: 0, | ||
| 56 | + endMargin: 0 | ||
| 57 | + }) | ||
| 58 | + .onChange((index: number) => { | ||
| 59 | + this.currentIndex = index | ||
| 60 | + }) | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @Builder | ||
| 66 | + LoadingLayout() { | ||
| 67 | + CustomRefreshLoadLayout({ | ||
| 68 | + refreshBean: new RefreshLayoutBean(true, | ||
| 69 | + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 70 | + }).height(DisplayUtils.getDeviceHeight() - this.topHeight) | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Builder tabBuilder(index: number, name: string) { | ||
| 74 | + Column() { | ||
| 75 | + Text(name) | ||
| 76 | + .fontColor(this.currentIndex === index ? $r('app.color.color_222222') : $r('app.color.color_666666') ) | ||
| 77 | + .fontSize(18) | ||
| 78 | + .fontWeight(this.currentIndex === index ? 500 : 400) | ||
| 79 | + .lineHeight(22) | ||
| 80 | + .height(22) | ||
| 81 | + .margin({ top: 11, bottom: 1 }) | ||
| 82 | + Divider() | ||
| 83 | + .width('15vp') | ||
| 84 | + .strokeWidth(2) | ||
| 85 | + .color('#CB0000') | ||
| 86 | + .opacity(this.currentIndex === index ? 1 : 0) | ||
| 87 | + }.width('100%') | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + async aboutToAppear() { | ||
| 91 | + try { | ||
| 92 | + this.isLoading = true | ||
| 93 | + // 1:点播(视频),2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件 13:音频 14:动态图文 15:动态视频 | ||
| 94 | + let articleModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleCountData(1, this.creatorId) | ||
| 95 | + Logger.debug('PeopleShipHomeListComponent', '获取页面信息', `${JSON.stringify(articleModel)}`) | ||
| 96 | + this.updateTopBarData(articleModel) | ||
| 97 | + this.isLoading = false | ||
| 98 | + } catch (exception) { | ||
| 99 | + this.isLoading = false | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + // 设置顶部数据 | ||
| 104 | + updateTopBarData(articleModel: ArticleCountData) { | ||
| 105 | + if (articleModel) { | ||
| 106 | + this.publishCount = articleModel.publishCount | ||
| 107 | + this.tabArr = [] | ||
| 108 | + if (articleModel.publishCount != 0) { | ||
| 109 | + let model: ArticleTypeData = new ArticleTypeData('全部') | ||
| 110 | + this.tabArr.push(model) | ||
| 111 | + } | ||
| 112 | + if (articleModel.twCount != 0) { | ||
| 113 | + let model: ArticleTypeData = new ArticleTypeData('文章', 8) | ||
| 114 | + this.tabArr.push(model) | ||
| 115 | + } | ||
| 116 | + if (articleModel.spCount != 0) { | ||
| 117 | + let model: ArticleTypeData = new ArticleTypeData('视频', 1) | ||
| 118 | + this.tabArr.push(model) | ||
| 119 | + } | ||
| 120 | + if (articleModel.zbCount != 0) { | ||
| 121 | + let model: ArticleTypeData = new ArticleTypeData('直播', 2) | ||
| 122 | + this.tabArr.push(model) | ||
| 123 | + } | ||
| 124 | + if (articleModel.dtCount != 0) { | ||
| 125 | + let model: ArticleTypeData = new ArticleTypeData('动态', 4) | ||
| 126 | + this.tabArr.push(model) | ||
| 127 | + } | ||
| 128 | + if (articleModel.ztCount != 0) { | ||
| 129 | + let model: ArticleTypeData = new ArticleTypeData('图集', 9) | ||
| 130 | + this.tabArr.push(model) | ||
| 131 | + } | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | +} |
| 1 | +import router from '@ohos.router' | ||
| 2 | +import { PeopleShipUserDetailData } from 'wdBean' | ||
| 3 | +import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent' | ||
| 4 | + | ||
| 5 | +@Component | ||
| 6 | +export struct PeopleShipHomePageNavComponent { | ||
| 7 | + @Prop topOpacity: number | ||
| 8 | + @Consume isAttention: string | ||
| 9 | + @Consume isLoadingAttention: boolean | ||
| 10 | + @Prop attentionOpacity: boolean | ||
| 11 | + | ||
| 12 | + // 页面详情数据 | ||
| 13 | + @Prop detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData | ||
| 14 | + | ||
| 15 | + build() { | ||
| 16 | + Row() { | ||
| 17 | + Stack({ alignContent: Alignment.TopStart }) { | ||
| 18 | + Row() | ||
| 19 | + .width('100%') | ||
| 20 | + .height('100%') | ||
| 21 | + .backgroundColor($r('app.color.white')) | ||
| 22 | + .opacity(this.topOpacity) | ||
| 23 | + Row() { | ||
| 24 | + | ||
| 25 | + Row() { | ||
| 26 | + // 返回 | ||
| 27 | + Image((this.topOpacity > 0.5 ? $r('app.media.icon_arrow_left') : $r('app.media.icon_arrow_left_white'))) | ||
| 28 | + .width('24vp') | ||
| 29 | + .height('24vp') | ||
| 30 | + .objectFit(ImageFit.Auto) | ||
| 31 | + .margin({ left: '10vp' }) | ||
| 32 | + .onClick(() => { | ||
| 33 | + router.back() | ||
| 34 | + }) | ||
| 35 | + // 头像 | ||
| 36 | + PeopleShipHomePageHeadComponent({ | ||
| 37 | + diameter: 30, | ||
| 38 | + iconDiameter: 10, | ||
| 39 | + headPhotoUrl: this.detailModel.headPhotoUrl, | ||
| 40 | + authIcon: this.detailModel.authIcon | ||
| 41 | + }) | ||
| 42 | + .margin({ | ||
| 43 | + left: '10vp', | ||
| 44 | + }) | ||
| 45 | + .visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden)) | ||
| 46 | + | ||
| 47 | + // 文字 | ||
| 48 | + Text(this.detailModel.userName) | ||
| 49 | + .height('46vp') | ||
| 50 | + .fontSize($r('app.float.vp_14')) | ||
| 51 | + .fontColor($r('app.color.color_222222')) | ||
| 52 | + .margin({ | ||
| 53 | + left: '6vp' | ||
| 54 | + }) | ||
| 55 | + .visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden)) | ||
| 56 | + | ||
| 57 | + if (this.isAttention == '0') { | ||
| 58 | + // 关注 | ||
| 59 | + Button('+关注', { type: ButtonType.Normal, stateEffect: true }) | ||
| 60 | + .borderRadius(4) | ||
| 61 | + .backgroundColor($r('app.color.color_ED2800')) | ||
| 62 | + .width('54vp') | ||
| 63 | + .height('24vp') | ||
| 64 | + .onClick(() => { | ||
| 65 | + if (this.isLoadingAttention){ | ||
| 66 | + return | ||
| 67 | + } | ||
| 68 | + this.isLoadingAttention = true | ||
| 69 | + }) | ||
| 70 | + .margin({ | ||
| 71 | + left: '12vp', | ||
| 72 | + }) | ||
| 73 | + .padding(0) | ||
| 74 | + .fontSize($r('app.float.vp_12')) | ||
| 75 | + .fontColor(Color.White) | ||
| 76 | + .visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden)) | ||
| 77 | + } else { | ||
| 78 | + Button('已关注', { type: ButtonType.Normal, stateEffect: true }) | ||
| 79 | + .borderRadius(4) | ||
| 80 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 81 | + .width('54vp') | ||
| 82 | + .height('24vp') | ||
| 83 | + .onClick(() => { | ||
| 84 | + if (this.isLoadingAttention){ | ||
| 85 | + return | ||
| 86 | + } | ||
| 87 | + this.isLoadingAttention = true | ||
| 88 | + }) | ||
| 89 | + .margin({ | ||
| 90 | + left: '12vp', | ||
| 91 | + }) | ||
| 92 | + .padding(0) | ||
| 93 | + .fontSize($r('app.float.vp_12')) | ||
| 94 | + .fontColor($r('app.color.color_999999')) | ||
| 95 | + .visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden)) | ||
| 96 | + } | ||
| 97 | + } | ||
| 98 | + .height('100%') | ||
| 99 | + Blank() | ||
| 100 | + // 分享 | ||
| 101 | + Image((this.topOpacity > 0.5 ? $r('app.media.icon_forward') : $r('app.media.icon_share'))) | ||
| 102 | + .width('24vp') | ||
| 103 | + .height('24vp') | ||
| 104 | + .objectFit(ImageFit.Auto) | ||
| 105 | + .margin({ right: '10vp' }) | ||
| 106 | + .onClick(() => { | ||
| 107 | + | ||
| 108 | + }) | ||
| 109 | + } | ||
| 110 | + .width('100%') | ||
| 111 | + .height('100%') | ||
| 112 | + .alignItems(VerticalAlign.Center) | ||
| 113 | + .justifyContent(FlexAlign.SpaceBetween) | ||
| 114 | + } | ||
| 115 | + .zIndex(1000) | ||
| 116 | + .width('100%') | ||
| 117 | + .height('100%') | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | +} |
| 1 | +@Component | ||
| 2 | +export struct PeopleShipHomePageAttestationComponent { | ||
| 3 | + @Prop name: string | ||
| 4 | + @Prop content: string | ||
| 5 | + build() { | ||
| 6 | + Row() { | ||
| 7 | + Text(this.name) | ||
| 8 | + .lineHeight('16vp') | ||
| 9 | + .fontColor($r('app.color.color_ED2800')) | ||
| 10 | + .fontSize($r('app.float.vp_11')) | ||
| 11 | + .backgroundColor($r('app.color.color_1AED2800')) | ||
| 12 | + .textAlign(TextAlign.Center) | ||
| 13 | + .borderRadius('2vp') | ||
| 14 | + .margin({ | ||
| 15 | + right: '4vp', | ||
| 16 | + left: '16vp', | ||
| 17 | + }) | ||
| 18 | + .padding({ | ||
| 19 | + top: '3vp', | ||
| 20 | + bottom: '3vp', | ||
| 21 | + right: '6vp', | ||
| 22 | + left: '6vp' | ||
| 23 | + }) | ||
| 24 | + | ||
| 25 | + Text(this.content) | ||
| 26 | + .lineHeight('22vp') | ||
| 27 | + .fontSize($r('app.float.vp_12')) | ||
| 28 | + .layoutWeight(1) | ||
| 29 | + .fontColor($r('app.color.color_222222')) | ||
| 30 | + .textAlign(TextAlign.Start) | ||
| 31 | + .margin({ | ||
| 32 | + right: '16vp' | ||
| 33 | + }) | ||
| 34 | + } | ||
| 35 | + .width('100%') | ||
| 36 | + .alignItems(VerticalAlign.Top) | ||
| 37 | + } | ||
| 38 | +} |
| 1 | +@Component | ||
| 2 | +export struct PeopleShipHomePageHeadComponent { | ||
| 3 | + @State diameter: number = 30 | ||
| 4 | + @State iconDiameter: number = 10 | ||
| 5 | + @Prop headPhotoUrl: string = '' | ||
| 6 | + @Prop authIcon: string = '' | ||
| 7 | + | ||
| 8 | + build() { | ||
| 9 | + Stack({ alignContent: Alignment.BottomEnd }) { | ||
| 10 | + // 头像 | ||
| 11 | + Image( this.headPhotoUrl.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority') ) | ||
| 12 | + .width(this.diameter) | ||
| 13 | + .height(this.diameter) | ||
| 14 | + .borderRadius(this.diameter/2) | ||
| 15 | + .borderWidth('1vp') | ||
| 16 | + .borderStyle(BorderStyle.Solid) | ||
| 17 | + .borderColor(Color.White) | ||
| 18 | + .objectFit(ImageFit.Auto) | ||
| 19 | + if(this.authIcon.length > 0 ) { | ||
| 20 | + Image( this.authIcon ) | ||
| 21 | + .width(this.iconDiameter) | ||
| 22 | + .height(this.iconDiameter) | ||
| 23 | + .borderRadius(this.iconDiameter/2) | ||
| 24 | + .objectFit(ImageFit.Auto) | ||
| 25 | + .margin({ | ||
| 26 | + right: '-3vp' | ||
| 27 | + }) | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + } | ||
| 31 | +} |
| 1 | +import measure from '@ohos.measure' | ||
| 2 | +import { DisplayUtils } from 'wdKit' | ||
| 3 | +import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent' | ||
| 4 | +import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent' | ||
| 5 | +import { Logger } from 'wdKit' | ||
| 6 | +import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | ||
| 7 | +import { InfluenceData, PeopleShipUserDetailData } from 'wdBean' | ||
| 8 | +import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent' | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +@Component | ||
| 12 | +export struct PeopleShipHomePageTopComponent { | ||
| 13 | + @State creatorId: string = '' | ||
| 14 | + // 是否关注 | ||
| 15 | + // @Prop isAttention: string | ||
| 16 | + @State introductionType: number = 0 | ||
| 17 | + @State heightComponent: number = 0 | ||
| 18 | + // 页面详情数据 | ||
| 19 | + @Prop @Watch('onIntroductionUpdated') detailModel: PeopleShipUserDetailData | ||
| 20 | + @Prop publishCount: number | ||
| 21 | + // 影响力 | ||
| 22 | + @State influenceTotal: number = 0 | ||
| 23 | + // 简介是否可以展开 | ||
| 24 | + @State isCollapse: boolean = true | ||
| 25 | + @State maxLines: number = Infinity | ||
| 26 | + @State collapseTxt: string = '…展开'; | ||
| 27 | + private subTxt: string = ''; | ||
| 28 | + @State content: string = '' | ||
| 29 | + @State topFixedHeight: number = 320 | ||
| 30 | + @State lineInNum: number = 1 | ||
| 31 | + @Link topHeight: number | ||
| 32 | + build() { | ||
| 33 | + Column() { | ||
| 34 | + Stack({ alignContent: Alignment.TopStart}) { | ||
| 35 | + // 顶部图片 | ||
| 36 | + Image($r('app.media.home_page_bg')) | ||
| 37 | + .width('100%') | ||
| 38 | + .height('120vp') | ||
| 39 | + .objectFit(ImageFit.Fill) | ||
| 40 | + .backgroundColor(Color.Black) | ||
| 41 | + // 头像和名称 | ||
| 42 | + Row() { | ||
| 43 | + // 头像 | ||
| 44 | + PeopleShipHomePageHeadComponent({ | ||
| 45 | + diameter: 80, | ||
| 46 | + iconDiameter: 20, | ||
| 47 | + headPhotoUrl: this.detailModel.headPhotoUrl, | ||
| 48 | + authIcon: this.detailModel.authIcon | ||
| 49 | + }).margin({ | ||
| 50 | + left: '10vp', | ||
| 51 | + bottom: '20vp' | ||
| 52 | + }) | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + // 文字 | ||
| 56 | + Text(this.detailModel.userName) | ||
| 57 | + .height('50vp') | ||
| 58 | + .fontSize($r('app.float.vp_22')) | ||
| 59 | + .fontColor($r('app.color.color_222222')) | ||
| 60 | + .fontWeight(500) | ||
| 61 | + .textAlign(TextAlign.Start) | ||
| 62 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 63 | + .maxLines(2) | ||
| 64 | + .layoutWeight(1) | ||
| 65 | + .margin({ | ||
| 66 | + left: '12vp', | ||
| 67 | + bottom: '10vp', | ||
| 68 | + right: '12vp' | ||
| 69 | + }) | ||
| 70 | + } | ||
| 71 | + .width('100%') | ||
| 72 | + .height('100%') | ||
| 73 | + .alignItems(VerticalAlign.Bottom) | ||
| 74 | + | ||
| 75 | + } | ||
| 76 | + .width('100%') | ||
| 77 | + .height('180vp') | ||
| 78 | + .backgroundColor(Color.Transparent) | ||
| 79 | + // 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证 | ||
| 80 | + // 官方认证 | ||
| 81 | + if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 82 | + PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth}) | ||
| 83 | + .margin({ | ||
| 84 | + top: '10vp', | ||
| 85 | + bottom: '10vp' | ||
| 86 | + }) | ||
| 87 | + } | ||
| 88 | + if(this.detailModel.authId == 2) { | ||
| 89 | + if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 90 | + PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle}) | ||
| 91 | + .margin({ | ||
| 92 | + top: '10vp', | ||
| 93 | + bottom: '10vp' | ||
| 94 | + }) | ||
| 95 | + } | ||
| 96 | + if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){ | ||
| 97 | + PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal}) | ||
| 98 | + .margin({ | ||
| 99 | + top: '10vp', | ||
| 100 | + bottom: '10vp' | ||
| 101 | + }) | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + // 简介 | ||
| 106 | + if(this.lineInNum > 3) { | ||
| 107 | + Row() { | ||
| 108 | + Text() { | ||
| 109 | + Span(this.content) | ||
| 110 | + .fontColor($r('app.color.color_222222')) | ||
| 111 | + | ||
| 112 | + Span(this.collapseTxt) | ||
| 113 | + .onClick(()=>{ | ||
| 114 | + if(this.isCollapse){ | ||
| 115 | + this.maxLines = Infinity; | ||
| 116 | + this.content = `简介:${this.detailModel.introduction}` | ||
| 117 | + this.isCollapse = false; | ||
| 118 | + this.collapseTxt = '收起'; | ||
| 119 | + this.topHeight = this.topFixedHeight + 21 * this.lineInNum | ||
| 120 | + | ||
| 121 | + }else{ | ||
| 122 | + this.isCollapse = true; | ||
| 123 | + this.collapseTxt = '…展开'; | ||
| 124 | + this.content = this.subTxt; | ||
| 125 | + this.topHeight = this.topFixedHeight + 21 * 3 | ||
| 126 | + } | ||
| 127 | + }) | ||
| 128 | + .fontColor($r('app.color.color_B0B0B0')) | ||
| 129 | + | ||
| 130 | + } | ||
| 131 | + .lineHeight('21vp') | ||
| 132 | + .maxLines(this.maxLines) | ||
| 133 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 134 | + .fontSize($r('app.float.vp_14')) | ||
| 135 | + .key('home_page_introduction') | ||
| 136 | + .margin({ | ||
| 137 | + left: '16vp', | ||
| 138 | + right: '16vp', | ||
| 139 | + bottom: '10vp' | ||
| 140 | + }) | ||
| 141 | + }.width('100%') | ||
| 142 | + .alignItems(VerticalAlign.Top) | ||
| 143 | + }else { | ||
| 144 | + Row() { | ||
| 145 | + Text(`简介:${this.detailModel.introduction}`) | ||
| 146 | + .fontSize($r('app.float.vp_14')) | ||
| 147 | + .fontColor($r('app.color.color_222222')) | ||
| 148 | + .lineHeight('21vp') | ||
| 149 | + .maxLines(3) | ||
| 150 | + .textOverflow({overflow: TextOverflow.Ellipsis}) | ||
| 151 | + .margin({ | ||
| 152 | + left: '16vp', | ||
| 153 | + right: '16vp', | ||
| 154 | + bottom: '10vp' | ||
| 155 | + }) | ||
| 156 | + }.width('100%') | ||
| 157 | + .alignItems(VerticalAlign.Top) | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + // IP归属地 | ||
| 161 | + Text(`IP归属地:${this.detailModel.region}`) | ||
| 162 | + .lineHeight('18vp') | ||
| 163 | + .fontSize($r('app.float.vp_12')) | ||
| 164 | + .fontColor($r('app.color.color_999999')) | ||
| 165 | + .textAlign(TextAlign.Start) | ||
| 166 | + .width('100%') | ||
| 167 | + .alignSelf(ItemAlign.Start) | ||
| 168 | + .margin({ | ||
| 169 | + right: '16vp', | ||
| 170 | + left: '16vp', | ||
| 171 | + }) | ||
| 172 | + | ||
| 173 | + // 发布, 粉丝, 影响力 | ||
| 174 | + Row() { | ||
| 175 | + // 发布 | ||
| 176 | + Text(this.computeShowNum(this.publishCount)) | ||
| 177 | + .fontSize($r('app.float.vp_20')) | ||
| 178 | + .fontColor($r('app.color.color_222222')) | ||
| 179 | + .lineHeight('22vp') | ||
| 180 | + .textAlign(TextAlign.Center) | ||
| 181 | + .fontWeight(600) | ||
| 182 | + .margin({ | ||
| 183 | + right: '4vp', | ||
| 184 | + left: '16vp' | ||
| 185 | + }) | ||
| 186 | + Text('发布') | ||
| 187 | + .fontSize($r('app.float.vp_12')) | ||
| 188 | + .fontColor($r('app.color.color_666666')) | ||
| 189 | + .align(Alignment.Center) | ||
| 190 | + .height('22vp') | ||
| 191 | + | ||
| 192 | + // 粉丝 | ||
| 193 | + Text(this.computeShowNum(this.detailModel.fansNum)) | ||
| 194 | + .fontSize($r('app.float.vp_20')) | ||
| 195 | + .fontColor($r('app.color.color_222222')) | ||
| 196 | + .lineHeight('22vp') | ||
| 197 | + .fontWeight(600) | ||
| 198 | + .textAlign(TextAlign.Center) | ||
| 199 | + .margin({ | ||
| 200 | + right: '4vp', | ||
| 201 | + left: '12vp' | ||
| 202 | + }) | ||
| 203 | + Text('粉丝') | ||
| 204 | + .fontSize($r('app.float.vp_12')) | ||
| 205 | + .fontColor($r('app.color.color_666666')) | ||
| 206 | + .height('22vp') | ||
| 207 | + .align(Alignment.Center) | ||
| 208 | + | ||
| 209 | + //影响力 | ||
| 210 | + Text(this.computeShowNum(this.influenceTotal)) | ||
| 211 | + .lineHeight('22vp') | ||
| 212 | + .fontSize($r('app.float.vp_20')) | ||
| 213 | + .fontColor($r('app.color.color_222222')) | ||
| 214 | + .fontWeight(600) | ||
| 215 | + .height('22vp') | ||
| 216 | + .margin({ | ||
| 217 | + right: '4vp', | ||
| 218 | + left: '12vp' | ||
| 219 | + }) | ||
| 220 | + Text('影响力') | ||
| 221 | + .fontSize($r('app.float.vp_12')) | ||
| 222 | + .fontColor($r('app.color.color_666666')) | ||
| 223 | + .height('22vp') | ||
| 224 | + .align(Alignment.Center) | ||
| 225 | + | ||
| 226 | + } | ||
| 227 | + .alignItems(VerticalAlign.Center) | ||
| 228 | + .backgroundColor(Color.Transparent) | ||
| 229 | + .width('100%') | ||
| 230 | + .margin({ | ||
| 231 | + top: '16vp' | ||
| 232 | + }) | ||
| 233 | + | ||
| 234 | + // 分享-关注 | ||
| 235 | + PeopleShipHomeAttentionComponent() | ||
| 236 | + .width('100%') | ||
| 237 | + .margin({ | ||
| 238 | + top: '10vp', | ||
| 239 | + bottom: '16vp' | ||
| 240 | + }) | ||
| 241 | + Row() | ||
| 242 | + .backgroundColor($r('app.color.color_F5F5F5')) | ||
| 243 | + .width('100%') | ||
| 244 | + .height('6vp') | ||
| 245 | + } | ||
| 246 | + .width('100%') | ||
| 247 | + .height('100%') | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + async aboutToAppear() { | ||
| 251 | + try { | ||
| 252 | + // 获取影响力 | ||
| 253 | + let infData: InfluenceData = await PeopleShipHomePageDataModel.getCreatorInfluenceInfoData(this.creatorId) | ||
| 254 | + Logger.debug('PeopleShipHomePageTopComponent', '获取获取影响力信息', `${JSON.stringify(infData)}`) | ||
| 255 | + this.influenceTotal = infData.influenceTotal | ||
| 256 | + } catch (exception) { | ||
| 257 | + | ||
| 258 | + } | ||
| 259 | + if (this.content.length == 0) { | ||
| 260 | + this.onIntroductionUpdated() | ||
| 261 | + } | ||
| 262 | + | ||
| 263 | + } | ||
| 264 | + | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + // 不听减去2个字-一直到时3行 | ||
| 268 | + private compIntroductionTextHeights() { | ||
| 269 | + let introduction = `简介:${this.detailModel.introduction}` | ||
| 270 | + let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 271 | + while (lineInNum1 > 3 ) { | ||
| 272 | + introduction = introduction.substring(0, introduction.length - 2); | ||
| 273 | + lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 274 | + } | ||
| 275 | + introduction = introduction.substring(0, introduction.length - 3); | ||
| 276 | + Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`) | ||
| 277 | + | ||
| 278 | + this.subTxt = introduction; | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + // 获取文本几行 | ||
| 282 | + private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { | ||
| 283 | + let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize) | ||
| 284 | + let height: number = Number(size.height) | ||
| 285 | + return Math.ceil(px2vp(height)/lineHeight) | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) { | ||
| 289 | + return measure.measureTextSize({ | ||
| 290 | + textContent: text, | ||
| 291 | + fontSize: fontSize, | ||
| 292 | + lineHeight: lineHeight, | ||
| 293 | + constraintWidth: constraintWidth, | ||
| 294 | + }) | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + onIntroductionUpdated() { | ||
| 298 | + if (this.content.length == 0 && this.detailModel.introduction ) { | ||
| 299 | + this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 300 | + if (this.lineInNum > 3) { | ||
| 301 | + this.compIntroductionTextHeights() | ||
| 302 | + this.content = this.subTxt | ||
| 303 | + } | ||
| 304 | + } | ||
| 305 | + if (this.detailModel) { | ||
| 306 | + this.topFixedHeight = 336 | ||
| 307 | + if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) { | ||
| 308 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 309 | + } | ||
| 310 | + else if(this.detailModel.authId == 2) { | ||
| 311 | + if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 312 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 313 | + } | ||
| 314 | + if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){ | ||
| 315 | + if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){ | ||
| 316 | + this.topFixedHeight += 10 | ||
| 317 | + } | ||
| 318 | + this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22 | ||
| 319 | + } | ||
| 320 | + } | ||
| 321 | + this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14')) | ||
| 322 | + if (this.lineInNum <= 3) { | ||
| 323 | + this.topFixedHeight += (21 * this.lineInNum) | ||
| 324 | + this.topHeight = this.topFixedHeight | ||
| 325 | + }else { | ||
| 326 | + this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum ) | ||
| 327 | + } | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + private computeShowNum(count: number) { | ||
| 332 | + if(count >= 10000) { | ||
| 333 | + return `${(count/10000).toFixed(1)}万` | ||
| 334 | + } | ||
| 335 | + return `${count}` | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | +} |
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 | + @State 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 | +} |
sight_harmony/features/wdComponent/src/main/ets/components/search/SearchCreatorComponent.ets
0 → 100644
| 1 | +import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | ||
| 2 | + | ||
| 3 | +@Component | ||
| 4 | +export struct SearchCreatorComponent{ | ||
| 5 | + @ObjectLink item: SearchRmhDescription | ||
| 6 | + | ||
| 7 | + build() { | ||
| 8 | + Column(){ | ||
| 9 | + Image(this.item.headerPhotoUrl) | ||
| 10 | + .width('92lpx') | ||
| 11 | + .alt($r('app.media.default_head')) | ||
| 12 | + .height('92lpx') | ||
| 13 | + .margin({bottom:'15lpx'}) | ||
| 14 | + .borderRadius(50) | ||
| 15 | + Text(this.item.creatorName) | ||
| 16 | + .fontSize('25lpx') | ||
| 17 | + .fontWeight('400lpx') | ||
| 18 | + .lineHeight('35lpx') | ||
| 19 | + .constraintSize({maxWidth:'150lpx'}) | ||
| 20 | + .maxLines(1) | ||
| 21 | + .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 22 | + }.alignItems(HorizontalAlign.Center) | ||
| 23 | + .justifyContent(FlexAlign.Center) | ||
| 24 | + } | ||
| 25 | +} |
| 1 | import { ContentDTO, | 1 | import { ContentDTO, |
| 2 | contentListParams, | 2 | contentListParams, |
| 3 | - FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index' | 3 | + FullColumnImgUrlDTO, InteractDataDTO, |
| 4 | + Params, | ||
| 5 | + RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index' | ||
| 4 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' | 6 | import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO' |
| 5 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' | 7 | import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO' |
| 6 | -import { LazyDataSource, StringUtils, ToastUtils } from 'wdKit/Index' | 8 | +import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index' |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 8 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 10 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 9 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' | 11 | import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem' |
| @@ -12,6 +14,7 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | @@ -12,6 +14,7 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem' | ||
| 12 | import { CardParser } from '../CardParser' | 14 | import { CardParser } from '../CardParser' |
| 13 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' | 15 | import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI' |
| 14 | import { ActivityItemComponent } from './ActivityItemComponent' | 16 | import { ActivityItemComponent } from './ActivityItemComponent' |
| 17 | +import { SearchCreatorComponent } from './SearchCreatorComponent' | ||
| 15 | 18 | ||
| 16 | const TAG = "SearchResultContentComponent" | 19 | const TAG = "SearchResultContentComponent" |
| 17 | 20 | ||
| @@ -53,24 +56,30 @@ export struct SearchResultContentComponent{ | @@ -53,24 +56,30 @@ export struct SearchResultContentComponent{ | ||
| 53 | this.isLoading = false | 56 | this.isLoading = false |
| 54 | }else{ | 57 | }else{ |
| 55 | if(value.list[0].dataList!=null){ | 58 | if(value.list[0].dataList!=null){ |
| 56 | - this.data_rmh = value.list[0].dataList | 59 | + let data_temp: SearchRmhDescription[] = [] |
| 60 | + data_temp = value.list[0].dataList | ||
| 61 | + | ||
| 57 | //TODO 查询创作者详情接口 | 62 | //TODO 查询创作者详情接口 |
| 58 | let request = new CreatorDetailRequestItem() | 63 | let request = new CreatorDetailRequestItem() |
| 59 | 64 | ||
| 60 | - this.data_rmh .forEach((data)=>{ | 65 | + data_temp.forEach((data)=>{ |
| 61 | request.creatorIdList.push(data.creatorId) | 66 | request.creatorIdList.push(data.creatorId) |
| 62 | }) | 67 | }) |
| 63 | 68 | ||
| 64 | SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ | 69 | SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ |
| 65 | if(value!=null && value.length>0){ | 70 | if(value!=null && value.length>0){ |
| 66 | - this.data_rmh.forEach((data)=>{ | 71 | + data_temp.forEach((data)=>{ |
| 67 | value.forEach((item)=>{ | 72 | value.forEach((item)=>{ |
| 68 | if(data.creatorId == item.creatorId){ | 73 | if(data.creatorId == item.creatorId){ |
| 69 | - data.headerPhotoUrl = item.headPhotoUrl | 74 | + data.headerPhotoUrl = item.headPhotoUrl.split("?")[0] |
| 70 | } | 75 | } |
| 71 | }) | 76 | }) |
| 72 | }) | 77 | }) |
| 73 | } | 78 | } |
| 79 | + data_temp.forEach((data)=>{ | ||
| 80 | + this.data_rmh.push(data) | ||
| 81 | + }) | ||
| 82 | + | ||
| 74 | }).catch((err:Error)=>{ | 83 | }).catch((err:Error)=>{ |
| 75 | console.log(TAG,JSON.stringify(err)) | 84 | console.log(TAG,JSON.stringify(err)) |
| 76 | }) | 85 | }) |
| @@ -212,23 +221,7 @@ export struct SearchResultContentComponent{ | @@ -212,23 +221,7 @@ export struct SearchResultContentComponent{ | ||
| 212 | List({space:'8lpx'}) { | 221 | List({space:'8lpx'}) { |
| 213 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { | 222 | ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => { |
| 214 | ListItem() { | 223 | ListItem() { |
| 215 | - Column(){ | ||
| 216 | - Image(item.headerPhotoUrl) | ||
| 217 | - .width('92lpx') | ||
| 218 | - .alt($r('app.media.default_head')) | ||
| 219 | - .height('92lpx') | ||
| 220 | - .margin({bottom:'15lpx'}) | ||
| 221 | - .borderRadius(50) | ||
| 222 | - Text(item.creatorName) | ||
| 223 | - .fontSize('25lpx') | ||
| 224 | - .fontWeight('400lpx') | ||
| 225 | - .lineHeight('35lpx') | ||
| 226 | - .constraintSize({maxWidth:'150lpx'}) | ||
| 227 | - .maxLines(1) | ||
| 228 | - .textOverflow({ overflow: TextOverflow.Ellipsis }) | ||
| 229 | - }.alignItems(HorizontalAlign.Center) | ||
| 230 | - .justifyContent(FlexAlign.Center) | ||
| 231 | - | 224 | + SearchCreatorComponent({item:item}) |
| 232 | }.onClick(()=>{ | 225 | }.onClick(()=>{ |
| 233 | //TODO 跳转 | 226 | //TODO 跳转 |
| 234 | }) | 227 | }) |
| @@ -253,7 +246,10 @@ export struct SearchResultContentComponent{ | @@ -253,7 +246,10 @@ export struct SearchResultContentComponent{ | ||
| 253 | }.height('100%') | 246 | }.height('100%') |
| 254 | .margin({left:'23lpx'}) | 247 | .margin({left:'23lpx'}) |
| 255 | .onClick(()=>{ | 248 | .onClick(()=>{ |
| 256 | - WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage) | 249 | + let params: Params = { |
| 250 | + pageID: this.keywords | ||
| 251 | + } | ||
| 252 | + WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params) | ||
| 257 | }) | 253 | }) |
| 258 | } | 254 | } |
| 259 | .cachedCount(6) | 255 | .cachedCount(6) |
| @@ -36,7 +36,13 @@ export const enum WDViewDefaultType { | @@ -36,7 +36,13 @@ export const enum WDViewDefaultType { | ||
| 36 | ///该号主无法访问 | 36 | ///该号主无法访问 |
| 37 | WDViewDefaultType_NoVisitAccount, | 37 | WDViewDefaultType_NoVisitAccount, |
| 38 | ///暂无关注 | 38 | ///暂无关注 |
| 39 | - WDViewDefaultType_NoFollow | 39 | + WDViewDefaultType_NoFollow, |
| 40 | + ///直播结束 | ||
| 41 | + WDViewDefaultType_NoLiveEnd, | ||
| 42 | + /// 直播暂停 | ||
| 43 | + WDViewDefaultType_NoLiveSuspend, | ||
| 44 | + /// 视频加载失败 | ||
| 45 | + WDViewDefaultType_NoVideo, | ||
| 40 | } | 46 | } |
| 41 | 47 | ||
| 42 | /** | 48 | /** |
| @@ -120,6 +126,12 @@ export struct EmptyComponent { | @@ -120,6 +126,12 @@ export struct EmptyComponent { | ||
| 120 | contentString = '' // 前方拥堵,请耐心等待 | 126 | contentString = '' // 前方拥堵,请耐心等待 |
| 121 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { | 127 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { |
| 122 | contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待 | 128 | contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待 |
| 129 | + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 130 | + contentString = '直播已结束' // 前方拥堵,请耐心等待 | ||
| 131 | + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) { | ||
| 132 | + contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待 | ||
| 133 | + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | ||
| 134 | + contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待 | ||
| 123 | } | 135 | } |
| 124 | 136 | ||
| 125 | return contentString | 137 | return contentString |
| @@ -148,6 +160,10 @@ export struct EmptyComponent { | @@ -148,6 +160,10 @@ export struct EmptyComponent { | ||
| 148 | imageString = $r('app.media.icon_no_net') | 160 | imageString = $r('app.media.icon_no_net') |
| 149 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { | 161 | } else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) { |
| 150 | imageString = $r('app.media.icon_no_master1') | 162 | imageString = $r('app.media.icon_no_master1') |
| 163 | + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) { | ||
| 164 | + imageString = $r('app.media.icon_no_end') | ||
| 165 | + }else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) { | ||
| 166 | + imageString = $r('app.media.icon_no_content') | ||
| 151 | } | 167 | } |
| 152 | return imageString | 168 | return imageString |
| 153 | } | 169 | } |
| @@ -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 | } |
| @@ -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 | } |
| @@ -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 | } |
| 1 | +import { Params } from 'wdBean/Index'; | ||
| 1 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; | 2 | import { CustomTitleUI } from '../components/reusable/CustomTitleUI'; |
| 3 | +import { router } from '@kit.ArkUI'; | ||
| 4 | +import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem'; | ||
| 5 | +import { LazyDataSource } from 'wdKit/Index'; | ||
| 6 | +import SearcherAboutDataModel from '../model/SearcherAboutDataModel'; | ||
| 7 | +import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem'; | ||
| 8 | +import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem'; | ||
| 9 | +import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem'; | ||
| 10 | +import MinePageDatasModel from '../model/MinePageDatasModel'; | ||
| 11 | +import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI'; | ||
| 12 | +import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent'; | ||
| 13 | + | ||
| 14 | +const TAG = "SearchCreatorPage" | ||
| 2 | 15 | ||
| 3 | @Entry | 16 | @Entry |
| 4 | @Component | 17 | @Component |
| 5 | struct SearchCreatorPage { | 18 | struct SearchCreatorPage { |
| 19 | + @State params: Params = router.getParams() as Params; | ||
| 20 | + @State keyword: string = ''; | ||
| 21 | + @State searchType:string = "" | ||
| 22 | + @State data_temp: FollowListDetailItem[] = [] | ||
| 23 | + @State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource(); | ||
| 24 | + @State count: number = -1; | ||
| 25 | + @State isLoading: boolean = false | ||
| 26 | + @State hasMore: boolean = true | ||
| 27 | + curPageNum: number = 1; | ||
| 6 | 28 | ||
| 7 | - build() { | ||
| 8 | - Row() { | ||
| 9 | - Column() { | ||
| 10 | - CustomTitleUI({titleName:"全部结果"}) | 29 | + onPageShow() { |
| 30 | + this.keyword = this.params?.pageID; | ||
| 31 | + this.searchType = "onlyRmh" | ||
| 32 | + this.getNewPageData() | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + getNewPageData() { | ||
| 36 | + this.isLoading = true | ||
| 37 | + if (this.hasMore) { | ||
| 38 | + SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keyword,getContext(this)).then((result)=>{ | ||
| 39 | + if (!this.data || result.list.length == 0){ | ||
| 40 | + this.hasMore = false | ||
| 41 | + this.isLoading = false | ||
| 42 | + }else{ | ||
| 43 | + 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 | + }) | ||
| 46 | + | ||
| 47 | + let request = new CreatorDetailRequestItem() | ||
| 48 | + | ||
| 49 | + this.data_temp.forEach((data)=>{ | ||
| 50 | + request.creatorIdList.push(data.creatorId) | ||
| 51 | + }) | ||
| 52 | + | ||
| 53 | + SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{ | ||
| 54 | + if(value!=null && value.length>0){ | ||
| 55 | + this.data_temp.forEach((data)=>{ | ||
| 56 | + value.forEach((item)=>{ | ||
| 57 | + if(data.creatorId == item.creatorId){ | ||
| 58 | + data.headPhotoUrl = item.headPhotoUrl | ||
| 59 | + if(item.fansNum>10000){ | ||
| 60 | + let temp = (item.fansNum/10000)+"" | ||
| 61 | + let index = temp.indexOf('.') | ||
| 62 | + if(index != -1){ | ||
| 63 | + temp = temp.substring(0,index+2) | ||
| 64 | + }else{ | ||
| 65 | + temp = temp | ||
| 66 | + } | ||
| 67 | + data.cnFansNum = temp + "万" | ||
| 68 | + }else{ | ||
| 69 | + data.cnFansNum = item.fansNum + "" | ||
| 70 | + } | ||
| 71 | + data.introduction = item.introduction | ||
| 72 | + } | ||
| 73 | + }) | ||
| 74 | + }) | ||
| 75 | + this.getFollowListStatus(result.totalCount) | ||
| 76 | + } | ||
| 77 | + }).catch((err:Error)=>{ | ||
| 78 | + console.log(TAG,JSON.stringify(err)) | ||
| 79 | + this.isLoading = false | ||
| 80 | + this.count = this.count===-1?0:this.count | ||
| 81 | + }) | ||
| 82 | + } | ||
| 83 | + }).catch((err:Error)=>{ | ||
| 84 | + console.log(TAG,JSON.stringify(err)) | ||
| 85 | + this.isLoading = false | ||
| 86 | + this.count = this.count===-1?0:this.count | ||
| 87 | + }) | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + getFollowListStatus(totalCount:number){ | ||
| 92 | + let status = new FollowListStatusRequestItem() | ||
| 93 | + this.data_temp.forEach((item)=>{ | ||
| 94 | + status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) | ||
| 95 | + }) | ||
| 11 | 96 | ||
| 97 | + MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ | ||
| 98 | + newValue.forEach((item)=>{ | ||
| 99 | + this.data_temp.forEach((list)=>{ | ||
| 100 | + if (item.creatorId == list.creatorId) { | ||
| 101 | + list.status = item.status | ||
| 102 | + } | ||
| 103 | + }) | ||
| 104 | + }) | ||
| 105 | + | ||
| 106 | + 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)) | ||
| 108 | + }) | ||
| 109 | + | ||
| 110 | + this.data.notifyDataReload() | ||
| 111 | + | ||
| 112 | + this.count = this.data.totalCount() | ||
| 113 | + if (this.data.totalCount() < totalCount) { | ||
| 114 | + this.curPageNum++ | ||
| 115 | + }else { | ||
| 116 | + this.hasMore = false | ||
| 12 | } | 117 | } |
| 118 | + | ||
| 119 | + this.isLoading = false | ||
| 120 | + }).catch((err:Error)=>{ | ||
| 121 | + console.log(TAG,"请求失败") | ||
| 122 | + this.isLoading = false | ||
| 123 | + this.count = this.count===-1?0:this.count | ||
| 124 | + }) | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + build() { | ||
| 128 | + Column() { | ||
| 129 | + CustomTitleUI({ titleName: "全部结果" }) | ||
| 130 | + Divider() | ||
| 131 | + .width('100%') | ||
| 132 | + .height('1lpx') | ||
| 133 | + .color($r('app.color.color_F5F5F5')) | ||
| 134 | + .strokeWidth('1lpx') | ||
| 135 | + | ||
| 136 | + Column(){ | ||
| 137 | + if(this.count === 0){ | ||
| 138 | + ListHasNoMoreDataUI({style:2}) | ||
| 139 | + .height('100%') | ||
| 140 | + }else{ | ||
| 141 | + List({ space: 3 }) { | ||
| 142 | + LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => { | ||
| 143 | + ListItem() { | ||
| 144 | + FollowChildComponent({data: item,type:1}) | ||
| 145 | + } | ||
| 146 | + .onClick(() => { | ||
| 147 | + }) | ||
| 148 | + }, (item: FollowListDetailItem, index: number) => index.toString()) | ||
| 149 | + | ||
| 150 | + //没有更多数据 显示提示 | ||
| 151 | + if(!this.hasMore){ | ||
| 152 | + ListItem(){ | ||
| 153 | + ListHasNoMoreDataUI() | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + }.cachedCount(10) | ||
| 157 | + .padding({left:'31lpx',right:'31lpx'}) | ||
| 158 | + .layoutWeight(1) | ||
| 159 | + .scrollBar(BarState.Off) | ||
| 160 | + .onReachEnd(()=>{ | ||
| 161 | + console.log(TAG,"触底了"); | ||
| 162 | + if(!this.isLoading){ | ||
| 163 | + this.isLoading = true | ||
| 164 | + //加载分页数据 | ||
| 165 | + this.getNewPageData() | ||
| 166 | + } | ||
| 167 | + }) | ||
| 168 | + } | ||
| 169 | + }.layoutWeight(1) | ||
| 13 | .width('100%') | 170 | .width('100%') |
| 14 | } | 171 | } |
| 172 | + .width('100%') | ||
| 15 | .height('100%') | 173 | .height('100%') |
| 16 | } | 174 | } |
| 17 | } | 175 | } |
| @@ -4,6 +4,7 @@ import { Logger } from 'wdKit'; | @@ -4,6 +4,7 @@ import { Logger } from 'wdKit'; | ||
| 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; | 4 | import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils'; |
| 5 | import { WDRouterRule } from 'wdRouter'; | 5 | import { WDRouterRule } from 'wdRouter'; |
| 6 | import { ContentConstants } from '../constants/ContentConstants'; | 6 | import { ContentConstants } from '../constants/ContentConstants'; |
| 7 | +import { LiveModel } from '../viewmodel/LiveModel'; | ||
| 7 | 8 | ||
| 8 | const TAG = 'ProcessUtils'; | 9 | const TAG = 'ProcessUtils'; |
| 9 | 10 | ||
| @@ -42,12 +43,12 @@ export class ProcessUtils { | @@ -42,12 +43,12 @@ export class ProcessUtils { | ||
| 42 | // 图文详情,跳转h5 | 43 | // 图文详情,跳转h5 |
| 43 | ProcessUtils.gotoWeb(content); | 44 | ProcessUtils.gotoWeb(content); |
| 44 | break; | 45 | break; |
| 45 | - //图集详情页 | 46 | + //图集详情页 |
| 46 | case ContentConstants.TYPE_NINE: | 47 | case ContentConstants.TYPE_NINE: |
| 47 | ProcessUtils.gotoAtlasDetailPage(content); | 48 | ProcessUtils.gotoAtlasDetailPage(content); |
| 48 | break; | 49 | break; |
| 49 | case ContentConstants.TYPE_SPECIAL_TOPIC: | 50 | case ContentConstants.TYPE_SPECIAL_TOPIC: |
| 50 | - // 专题详情,跳转h5 | 51 | + // 专题详情,跳转h5 |
| 51 | ProcessUtils.gotoSpecialTopic(content); | 52 | ProcessUtils.gotoSpecialTopic(content); |
| 52 | break; | 53 | break; |
| 53 | //动态详情页(动态图文) | 54 | //动态详情页(动态图文) |
| @@ -71,7 +72,7 @@ export class ProcessUtils { | @@ -71,7 +72,7 @@ export class ProcessUtils { | ||
| 71 | params: { | 72 | params: { |
| 72 | detailPageType: 14, | 73 | detailPageType: 14, |
| 73 | contentID: content?.objectId, | 74 | contentID: content?.objectId, |
| 74 | - extra:{ | 75 | + extra: { |
| 75 | relType: content?.relType, | 76 | relType: content?.relType, |
| 76 | relId: content?.relId, | 77 | relId: content?.relId, |
| 77 | } as ExtraDTO | 78 | } as ExtraDTO |
| @@ -91,7 +92,7 @@ export class ProcessUtils { | @@ -91,7 +92,7 @@ export class ProcessUtils { | ||
| 91 | params: { | 92 | params: { |
| 92 | detailPageType: 17, | 93 | detailPageType: 17, |
| 93 | contentID: content?.objectId, | 94 | contentID: content?.objectId, |
| 94 | - extra:{ | 95 | + extra: { |
| 95 | relType: content?.relType, | 96 | relType: content?.relType, |
| 96 | relId: content?.relId, | 97 | relId: content?.relId, |
| 97 | } as ExtraDTO | 98 | } as ExtraDTO |
| @@ -111,6 +112,7 @@ export class ProcessUtils { | @@ -111,6 +112,7 @@ export class ProcessUtils { | ||
| 111 | }; | 112 | }; |
| 112 | WDRouterRule.jumpWithAction(taskAction) | 113 | WDRouterRule.jumpWithAction(taskAction) |
| 113 | } | 114 | } |
| 115 | + | ||
| 114 | private static gotoWeb(content: ContentDTO) { | 116 | private static gotoWeb(content: ContentDTO) { |
| 115 | // // topicId | 117 | // // topicId |
| 116 | // content.channelId; | 118 | // content.channelId; |
| @@ -126,7 +128,7 @@ export class ProcessUtils { | @@ -126,7 +128,7 @@ export class ProcessUtils { | ||
| 126 | params: { | 128 | params: { |
| 127 | contentID: content?.objectId, | 129 | contentID: content?.objectId, |
| 128 | pageID: 'IMAGE_TEXT_DETAIL', | 130 | pageID: 'IMAGE_TEXT_DETAIL', |
| 129 | - extra:{ | 131 | + extra: { |
| 130 | relType: content?.relType, | 132 | relType: content?.relType, |
| 131 | relId: content?.relId, | 133 | relId: content?.relId, |
| 132 | channelId: content?.channelId, | 134 | channelId: content?.channelId, |
| @@ -144,7 +146,7 @@ export class ProcessUtils { | @@ -144,7 +146,7 @@ export class ProcessUtils { | ||
| 144 | params: { | 146 | params: { |
| 145 | detailPageType: 7, | 147 | detailPageType: 7, |
| 146 | contentID: content?.objectId, | 148 | contentID: content?.objectId, |
| 147 | - extra:{ | 149 | + extra: { |
| 148 | relType: content?.relType, | 150 | relType: content?.relType, |
| 149 | relId: content?.relId, | 151 | relId: content?.relId, |
| 150 | } as ExtraDTO | 152 | } as ExtraDTO |
| @@ -153,13 +155,23 @@ export class ProcessUtils { | @@ -153,13 +155,23 @@ export class ProcessUtils { | ||
| 153 | WDRouterRule.jumpWithAction(taskAction) | 155 | WDRouterRule.jumpWithAction(taskAction) |
| 154 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); | 156 | Logger.debug(TAG, `gotoVod, ${content.objectId}`); |
| 155 | } | 157 | } |
| 156 | - private static gotoLive(content: ContentDTO) { | 158 | + |
| 159 | + private static async gotoLive(content: ContentDTO) { | ||
| 160 | + const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '') | ||
| 161 | + const liveStyle = liveDetail[0].liveInfo.liveStyle | ||
| 162 | + const liveState = liveDetail[0].liveInfo.liveState | ||
| 163 | + | ||
| 164 | + | ||
| 165 | + console.error('liveDetail===', liveDetail) | ||
| 166 | + | ||
| 167 | + | ||
| 157 | let taskAction: Action = { | 168 | let taskAction: Action = { |
| 158 | type: 'JUMP_DETAIL_PAGE', | 169 | type: 'JUMP_DETAIL_PAGE', |
| 159 | params: { | 170 | params: { |
| 160 | detailPageType: 2, | 171 | detailPageType: 2, |
| 161 | contentID: content?.objectId, | 172 | contentID: content?.objectId, |
| 162 | - extra:{ | 173 | + liveStyle: liveState === 'wait' ? 0 : liveStyle, |
| 174 | + extra: { | ||
| 163 | relType: content?.relType, | 175 | relType: content?.relType, |
| 164 | relId: content?.relId, | 176 | relId: content?.relId, |
| 165 | } as ExtraDTO | 177 | } as ExtraDTO |
| @@ -168,13 +180,14 @@ export class ProcessUtils { | @@ -168,13 +180,14 @@ export class ProcessUtils { | ||
| 168 | WDRouterRule.jumpWithAction(taskAction) | 180 | WDRouterRule.jumpWithAction(taskAction) |
| 169 | Logger.debug(TAG, `gotoLive, ${content.objectId}`); | 181 | Logger.debug(TAG, `gotoLive, ${content.objectId}`); |
| 170 | } | 182 | } |
| 183 | + | ||
| 171 | private static gotoAudio(content: ContentDTO) { | 184 | private static gotoAudio(content: ContentDTO) { |
| 172 | let taskAction: Action = { | 185 | let taskAction: Action = { |
| 173 | type: 'JUMP_DETAIL_PAGE', | 186 | type: 'JUMP_DETAIL_PAGE', |
| 174 | params: { | 187 | params: { |
| 175 | detailPageType: 13, | 188 | detailPageType: 13, |
| 176 | contentID: content?.objectId, | 189 | contentID: content?.objectId, |
| 177 | - extra:{ | 190 | + extra: { |
| 178 | relType: content?.relType, | 191 | relType: content?.relType, |
| 179 | relId: content?.relId, | 192 | relId: content?.relId, |
| 180 | } as ExtraDTO | 193 | } as ExtraDTO |
| @@ -183,5 +196,4 @@ export class ProcessUtils { | @@ -183,5 +196,4 @@ export class ProcessUtils { | ||
| 183 | WDRouterRule.jumpWithAction(taskAction) | 196 | WDRouterRule.jumpWithAction(taskAction) |
| 184 | Logger.debug(TAG, `gotoAudio, ${content.objectId}`); | 197 | Logger.debug(TAG, `gotoAudio, ${content.objectId}`); |
| 185 | } | 198 | } |
| 186 | - | ||
| 187 | } | 199 | } |
| @@ -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 | */ |
| @@ -63,7 +63,7 @@ | @@ -63,7 +63,7 @@ | ||
| 63 | export class FollowListDetailItem{ | 63 | export class FollowListDetailItem{ |
| 64 | headPhotoUrl:string //头像 | 64 | headPhotoUrl:string //头像 |
| 65 | cnUserName:string //昵称 | 65 | cnUserName:string //昵称 |
| 66 | - cnFansNum:number //粉丝数 | 66 | + cnFansNum:string //粉丝数 |
| 67 | introduction:string //介绍 | 67 | introduction:string //介绍 |
| 68 | status:string = "0" //是否已经关注 | 68 | status:string = "0" //是否已经关注 |
| 69 | creatorId:string = "" | 69 | creatorId:string = "" |
| @@ -80,7 +80,7 @@ export class FollowListDetailItem{ | @@ -80,7 +80,7 @@ export class FollowListDetailItem{ | ||
| 80 | fansNum :number = 0 | 80 | fansNum :number = 0 |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) { | 83 | + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) { |
| 84 | this.headPhotoUrl = headPhotoUrl | 84 | this.headPhotoUrl = headPhotoUrl |
| 85 | this.cnUserName = cnUserName | 85 | this.cnUserName = cnUserName |
| 86 | this.cnFansNum = cnFansNum | 86 | this.cnFansNum = cnFansNum |
| 1 | +import HashMap from '@ohos.util.HashMap'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | ||
| 3 | +import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | ||
| 4 | +import { Logger } from 'wdKit'; | ||
| 5 | +import { LiveDetailsBean } from 'wdBean/Index'; | ||
| 6 | + | ||
| 7 | +const TAG = 'LiveModel' | ||
| 8 | + | ||
| 9 | +export class LiveModel { | ||
| 10 | + /** | ||
| 11 | + * 直播内容详情 | ||
| 12 | + * @param contentId | ||
| 13 | + * @param relId 关系id | ||
| 14 | + * @param relType 关系类型;1.频道关系;2.专题关系; | ||
| 15 | + * @returns | ||
| 16 | + */ | ||
| 17 | + static getLiveDetails(contentId: string, relId: string, relType: string) { | ||
| 18 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 19 | + return new Promise<Array<LiveDetailsBean>>((success, fail) => { | ||
| 20 | + HttpRequest.get<ResponseDTO<Array<LiveDetailsBean>>>( | ||
| 21 | + HttpUrlUtils.getLiveDetailsUrl() + `?relId=${relId}&relType=${relType}&contentId=${contentId}`, | ||
| 22 | + headers).then((data: ResponseDTO<Array<LiveDetailsBean>>) => { | ||
| 23 | + if (!data || !data.data) { | ||
| 24 | + fail("数据为空") | ||
| 25 | + return | ||
| 26 | + } | ||
| 27 | + if (data.code != 0) { | ||
| 28 | + fail(data.message) | ||
| 29 | + return | ||
| 30 | + } | ||
| 31 | + success(data.data) | ||
| 32 | + }, (error: Error) => { | ||
| 33 | + fail(error.message) | ||
| 34 | + Logger.debug(TAG + ":error ", error.toString()) | ||
| 35 | + }) | ||
| 36 | + }) | ||
| 37 | + } | ||
| 38 | +} | ||
| 39 | + |
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PeopleShipHomePageDataModel.ets
0 → 100644
| 1 | +import { OtherUserDetailRequestItem } from './OtherUserDetailRequestItem'; | ||
| 2 | +import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | ||
| 3 | +import { PeopleShipUserDetailData, ArticleCountData, ArticleListData, InfluenceData } from 'wdBean'; | ||
| 4 | +import HashMap from '@ohos.util.HashMap'; | ||
| 5 | +import { Logger } from 'wdKit'; | ||
| 6 | +import { FollowListStatusRequestItem } from './FollowListStatusRequestItem'; | ||
| 7 | +import { QueryListIsFollowedItem } from './QueryListIsFollowedItem'; | ||
| 8 | + | ||
| 9 | +const TAG = 'PeopleShipHomePageDataModel'; | ||
| 10 | + | ||
| 11 | +export class PeopleShipHomePageDataModel { | ||
| 12 | + /*获取人民号主页详情*/ | ||
| 13 | + static fetchPeopleUserDetailData(item: OtherUserDetailRequestItem) { | ||
| 14 | + let url = HttpUrlUtils.getOtherUserDetailDataUrl() | ||
| 15 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 16 | + return WDHttp.post<ResponseDTO<PeopleShipUserDetailData>>(url, item, headers) | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + static async getPeopleShipHomePageDetailInfo(creatorId: string, userType: string, userId: string): Promise<PeopleShipUserDetailData> { | ||
| 20 | + let model = new OtherUserDetailRequestItem(creatorId, userType, userId) | ||
| 21 | + return new Promise<PeopleShipUserDetailData>((success, error) => { | ||
| 22 | + Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`); | ||
| 23 | + PeopleShipHomePageDataModel.fetchPeopleUserDetailData(model) | ||
| 24 | + .then((resDTO: ResponseDTO<PeopleShipUserDetailData>) => { | ||
| 25 | + if (!resDTO || !resDTO.data) { | ||
| 26 | + Logger.error(TAG, 'getPeopleShipHomePageDetailInfo then navResDTO is empty'); | ||
| 27 | + error('resDTO is empty'); | ||
| 28 | + return | ||
| 29 | + } | ||
| 30 | + if (resDTO.code != 0) { | ||
| 31 | + Logger.error(TAG, `getPeopleShipHomePageDetailInfo then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 32 | + error('resDTO Response Code is failure'); | ||
| 33 | + return | ||
| 34 | + } | ||
| 35 | + Logger.debug(TAG, "getPeopleShipHomePageDetailInfo then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 36 | + success(resDTO.data); | ||
| 37 | + }) | ||
| 38 | + .catch((err: Error) => { | ||
| 39 | + Logger.error(TAG, `getPeopleShipHomePageDetailInfo catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 40 | + error(err); | ||
| 41 | + }) | ||
| 42 | + }) | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + | ||
| 46 | + /*客户端 客态查询发布作品数量*/ | ||
| 47 | + static fetchArticleCountHotsData(includeLive: number, creatorId: string) { | ||
| 48 | + let url = HttpUrlUtils.getArticleCountHotsDataUrl() + `?includeLive=${includeLive}&creatorId=${creatorId}` | ||
| 49 | + // let url = 'https://pdapis.pdnews.cn/api/rmrb-content-search/zh/c/article/count' + `?includeLive=${includeLive}&creatorId=${creatorId}` | ||
| 50 | + Logger.debug(TAG, `${url}`); | ||
| 51 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 52 | + return WDHttp.get<ResponseDTO<ArticleCountData>>(url, headers) | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + static async getPeopleShipHomePageArticleCountData(includeLive: number, creatorId: string): Promise<ArticleCountData> { | ||
| 56 | + Logger.debug(TAG, `getPeopleShipHomePageArticleCountData start`); | ||
| 57 | + return new Promise<ArticleCountData>((success, error) => { | ||
| 58 | + Logger.debug(TAG, `getPeopleShipHomePageArticleCountData pageInfo start`); | ||
| 59 | + PeopleShipHomePageDataModel.fetchArticleCountHotsData(includeLive, creatorId) | ||
| 60 | + .then((resDTO: ResponseDTO<ArticleCountData>) => { | ||
| 61 | + if (!resDTO || !resDTO.data) { | ||
| 62 | + Logger.error(TAG, 'getPeopleShipHomePageArticleCountData then ArticleCountData is empty'); | ||
| 63 | + error('resDTO is empty'); | ||
| 64 | + return | ||
| 65 | + } | ||
| 66 | + if (resDTO.code != 0) { | ||
| 67 | + Logger.error(TAG, `getPeopleShipHomePageArticleCountData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 68 | + error(resDTO.message); | ||
| 69 | + return | ||
| 70 | + } | ||
| 71 | + Logger.debug(TAG, "getPeopleShipHomePageArticleCountData then,ArticleCountData.timestamp:" + resDTO.timestamp); | ||
| 72 | + success(resDTO.data); | ||
| 73 | + }) | ||
| 74 | + .catch((err: Error) => { | ||
| 75 | + Logger.error(TAG, `getPeopleShipHomePageArticleCountData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 76 | + error(err); | ||
| 77 | + }) | ||
| 78 | + }) | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + /*客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表*/ | ||
| 82 | + static fetchArticleListHotsData(creatorId: string, pageNum: number, pageSize: number, type?: number) { | ||
| 83 | + let url = HttpUrlUtils.getArticleListHotsDataUrl() + `?creatorId=${creatorId}&pageNum=${pageNum}&pageSize=${pageSize}` | ||
| 84 | + if (type) { | ||
| 85 | + url += `&type=${type}` | ||
| 86 | + } | ||
| 87 | + Logger.debug(TAG, `${url}`); | ||
| 88 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 89 | + return WDHttp.get<ResponseDTO<ArticleListData>>(url, headers) | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + static async getPeopleShipHomePageArticleListData(creatorId: string, pageNum: number, pageSize: number, type?: number): Promise<ArticleListData> { | ||
| 93 | + Logger.debug(TAG, `getPeopleShipHomePageArticleListData start`); | ||
| 94 | + return new Promise<ArticleListData>((success, error) => { | ||
| 95 | + Logger.debug(TAG, `getPeopleShipHomePageArticleListData pageInfo start`); | ||
| 96 | + PeopleShipHomePageDataModel.fetchArticleListHotsData(creatorId, pageNum, pageSize, type) | ||
| 97 | + .then((resDTO: ResponseDTO<ArticleListData>) => { | ||
| 98 | + if (!resDTO || !resDTO.data) { | ||
| 99 | + Logger.error(TAG, 'getPeopleShipHomePageArticleListData then ArticleCountData is empty'); | ||
| 100 | + error('resDTO is empty'); | ||
| 101 | + return | ||
| 102 | + } | ||
| 103 | + if (resDTO.code != 0) { | ||
| 104 | + Logger.error(TAG, `getPeopleShipHomePageArticleListData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 105 | + error(resDTO.message); | ||
| 106 | + return | ||
| 107 | + } | ||
| 108 | + Logger.debug(TAG, "getPeopleShipHomePageArticleListData then,ArticleCountData.timestamp:" + resDTO.timestamp); | ||
| 109 | + success(resDTO.data); | ||
| 110 | + }) | ||
| 111 | + .catch((err: Error) => { | ||
| 112 | + Logger.error(TAG, `getPeopleShipHomePageArticleListData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 113 | + error(err); | ||
| 114 | + }) | ||
| 115 | + }) | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + /*客户端 客态查询影响力*/ | ||
| 119 | + static fetchCreatorInfluenceInfoHotsData(creatorId: string) { | ||
| 120 | + let url = HttpUrlUtils.getCreatorInfluenceInfoHotsDataUrl() + `?creatorId=${creatorId}` | ||
| 121 | + Logger.debug(TAG, `${url}`); | ||
| 122 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 123 | + return WDHttp.get<ResponseDTO<InfluenceData>>(url, headers) | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + static async getCreatorInfluenceInfoData(creatorId: string): Promise<InfluenceData> { | ||
| 127 | + Logger.debug(TAG, `getCreatorInfluenceInfoData start`); | ||
| 128 | + return new Promise<InfluenceData>((success, error) => { | ||
| 129 | + Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`); | ||
| 130 | + PeopleShipHomePageDataModel.fetchCreatorInfluenceInfoHotsData(creatorId) | ||
| 131 | + .then((resDTO: ResponseDTO<InfluenceData>) => { | ||
| 132 | + if (!resDTO || !resDTO.data) { | ||
| 133 | + Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty'); | ||
| 134 | + error('resDTO is empty'); | ||
| 135 | + return | ||
| 136 | + } | ||
| 137 | + if (resDTO.code != 0) { | ||
| 138 | + Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 139 | + error(resDTO.message); | ||
| 140 | + return | ||
| 141 | + } | ||
| 142 | + Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp); | ||
| 143 | + success(resDTO.data); | ||
| 144 | + }) | ||
| 145 | + .catch((err: Error) => { | ||
| 146 | + Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 147 | + error(err); | ||
| 148 | + }) | ||
| 149 | + }) | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | + // 获取关注 | ||
| 153 | + static fetchHomePageFollowListStatusData(creatorId: string) { | ||
| 154 | + let url = HttpUrlUtils.getFollowListStatusDataUrl() | ||
| 155 | + let model = new QueryListIsFollowedItem(creatorId) | ||
| 156 | + let object = new FollowListStatusRequestItem() | ||
| 157 | + object.creatorIds = [model] | ||
| 158 | + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | ||
| 159 | + return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers) | ||
| 160 | + }; | ||
| 161 | + | ||
| 162 | + static async getHomePageFollowListStatusData(creatorId: string): Promise<QueryListIsFollowedItem[]> { | ||
| 163 | + Logger.debug(TAG, `getCreatorInfluenceInfoData start`); | ||
| 164 | + return new Promise<QueryListIsFollowedItem[]>((success, error) => { | ||
| 165 | + Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`); | ||
| 166 | + PeopleShipHomePageDataModel.fetchHomePageFollowListStatusData(creatorId) | ||
| 167 | + .then((resDTO: ResponseDTO<QueryListIsFollowedItem[]>) => { | ||
| 168 | + if (!resDTO || !resDTO.data) { | ||
| 169 | + Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty'); | ||
| 170 | + error('resDTO is empty'); | ||
| 171 | + return | ||
| 172 | + } | ||
| 173 | + if (resDTO.code != 0) { | ||
| 174 | + Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 175 | + error(resDTO.message); | ||
| 176 | + return | ||
| 177 | + } | ||
| 178 | + Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp); | ||
| 179 | + success(resDTO.data); | ||
| 180 | + }) | ||
| 181 | + .catch((err: Error) => { | ||
| 182 | + Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 183 | + error(err); | ||
| 184 | + }) | ||
| 185 | + }) | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + | ||
| 189 | + | ||
| 190 | +} | ||
| 191 | + |
| @@ -181,6 +181,7 @@ class SearchDescription{ | @@ -181,6 +181,7 @@ class SearchDescription{ | ||
| 181 | 181 | ||
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | +@Observed | ||
| 184 | export class SearchRmhDescription{ | 185 | export class SearchRmhDescription{ |
| 185 | likeEnable: string= "" | 186 | likeEnable: string= "" |
| 186 | previewUri: string= "" | 187 | previewUri: string= "" |
| @@ -231,6 +231,18 @@ | @@ -231,6 +231,18 @@ | ||
| 231 | { | 231 | { |
| 232 | "name": "margin_116", | 232 | "name": "margin_116", |
| 233 | "value": "116vp" | 233 | "value": "116vp" |
| 234 | + }, | ||
| 235 | + { | ||
| 236 | + "name": "vp_11", | ||
| 237 | + "value": "11vp" | ||
| 238 | + }, | ||
| 239 | + { | ||
| 240 | + "name": "vp_22", | ||
| 241 | + "value": "22vp" | ||
| 242 | + }, | ||
| 243 | + { | ||
| 244 | + "name": "vp_14", | ||
| 245 | + "value": "14vp" | ||
| 234 | } | 246 | } |
| 235 | ] | 247 | ] |
| 236 | } | 248 | } |
467 Bytes
1.31 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/home_attention_no_left.png
0 → 100644
1.31 KB
12.8 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/home_page_header_authority.png
0 → 100644
5.05 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/home_share_right_icon.png
0 → 100644
1.34 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/iv_live_comment_collect_un.png
0 → 100644
3.21 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/iv_live_comment_hert_light.png
0 → 100644
1.45 KB
sight_harmony/features/wdComponent/src/main/resources/base/media/iv_live_comment_hert_num.png
0 → 100644
670 Bytes
sight_harmony/features/wdComponent/src/main/resources/base/media/iv_live_comment_share.png
0 → 100644
2.65 KB
| @@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
| 14 | "components/page/MyCollectionListPage", | 14 | "components/page/MyCollectionListPage", |
| 15 | "pages/OtherNormalUserHomePage", | 15 | "pages/OtherNormalUserHomePage", |
| 16 | "pages/SearchPage", | 16 | "pages/SearchPage", |
| 17 | - "pages/SearchCreatorPage" | 17 | + "pages/SearchCreatorPage", |
| 18 | + "components/page/PeopleShipHomePage" | ||
| 18 | ] | 19 | ] |
| 19 | } | 20 | } |
sight_harmony/features/wdDetailPlayLive/src/main/ets/pages/DetailPlayHLivePage.ets
deleted
100644 → 0
| 1 | -import { BottomComponent } from '../widgets/details/BottomComponent'; | ||
| 2 | -import { TabComponent } from '../widgets/details/TabComponent'; | ||
| 3 | -import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | ||
| 4 | - | ||
| 5 | - | ||
| 6 | -@Component | ||
| 7 | -export struct DetailPlayHLivePage { | ||
| 8 | - aboutToAppear(): void { | ||
| 9 | - | ||
| 10 | - } | ||
| 11 | - | ||
| 12 | - build() { | ||
| 13 | - Column() { | ||
| 14 | - TopPlayComponent() | ||
| 15 | - TabComponent() | ||
| 16 | - BottomComponent() | ||
| 17 | - } | ||
| 18 | - .height('100%') | ||
| 19 | - .width('100%') | ||
| 20 | - } | ||
| 21 | - | ||
| 22 | - onPageShow(): void { | ||
| 23 | - | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | - aboutToDisappear(): void { | ||
| 27 | - | ||
| 28 | - } | ||
| 29 | -} |
| 1 | import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'; | 1 | import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'; |
| 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; | 2 | import { LiveViewModel } from '../viewModel/LiveViewModel'; |
| 3 | -import { BottomComponent } from '../widgets/details/BottomComponent'; | ||
| 4 | import { TabComponent } from '../widgets/details/TabComponent'; | 3 | import { TabComponent } from '../widgets/details/TabComponent'; |
| 5 | import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | 4 | import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; |
| 6 | import router from '@ohos.router'; | 5 | import router from '@ohos.router'; |
| 6 | +import { DisplayDirection } from 'wdConstant/Index'; | ||
| 7 | +import mediaquery from '@ohos.mediaquery'; | ||
| 8 | +import { Logger, WindowModel } from 'wdKit/Index'; | ||
| 9 | +import { window } from '@kit.ArkUI'; | ||
| 10 | +import { devicePLSensorManager } from 'wdDetailPlayApi/Index'; | ||
| 11 | +import { LiveCommentComponent } from 'wdComponent/Index'; | ||
| 7 | 12 | ||
| 8 | @Entry | 13 | @Entry |
| 9 | @Component | 14 | @Component |
| 10 | export struct DetailPlayLivePage { | 15 | export struct DetailPlayLivePage { |
| 16 | + //横竖屏,默认竖屏 | ||
| 17 | + @Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL | ||
| 11 | TAG: string = 'DetailPlayLivePage'; | 18 | TAG: string = 'DetailPlayLivePage'; |
| 12 | liveViewModel: LiveViewModel = new LiveViewModel() | 19 | liveViewModel: LiveViewModel = new LiveViewModel() |
| 13 | @State relId: string = '' | 20 | @State relId: string = '' |
| @@ -18,7 +25,17 @@ export struct DetailPlayLivePage { | @@ -18,7 +25,17 @@ export struct DetailPlayLivePage { | ||
| 18 | @State tabs: string[] = ['直播间', '大家聊'] | 25 | @State tabs: string[] = ['直播间', '大家聊'] |
| 19 | 26 | ||
| 20 | aboutToAppear(): void { | 27 | aboutToAppear(): void { |
| 21 | - //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 | 28 | + //监听屏幕横竖屏变化 |
| 29 | + let listener = mediaquery.matchMediaSync('(orientation: landscape)'); | ||
| 30 | + listener.on("change", (mediaQueryResult) => { | ||
| 31 | + Logger.info(this.TAG, `change;${mediaQueryResult.matches}`) | ||
| 32 | + if (mediaQueryResult.matches) { | ||
| 33 | + this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL | ||
| 34 | + } else { | ||
| 35 | + this.displayDirection = DisplayDirection.VERTICAL | ||
| 36 | + } | ||
| 37 | + // WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL) | ||
| 38 | + }) | ||
| 22 | let par: Action = router.getParams() as Action; | 39 | let par: Action = router.getParams() as Action; |
| 23 | let params = par?.params; | 40 | let params = par?.params; |
| 24 | this.relId = params?.extra?.relId || ''; | 41 | this.relId = params?.extra?.relId || ''; |
| @@ -31,15 +48,24 @@ export struct DetailPlayLivePage { | @@ -31,15 +48,24 @@ export struct DetailPlayLivePage { | ||
| 31 | build() { | 48 | build() { |
| 32 | Column() { | 49 | Column() { |
| 33 | TopPlayComponent() | 50 | TopPlayComponent() |
| 51 | + .layoutWeight(211) | ||
| 34 | TabComponent({ tabs: this.tabs }) | 52 | TabComponent({ tabs: this.tabs }) |
| 35 | - BottomComponent() | 53 | + .layoutWeight(503) |
| 54 | + .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | ||
| 55 | + LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum }) | ||
| 56 | + .visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None) | ||
| 36 | } | 57 | } |
| 37 | .height('100%') | 58 | .height('100%') |
| 38 | .width('100%') | 59 | .width('100%') |
| 39 | } | 60 | } |
| 40 | 61 | ||
| 41 | onPageShow(): void { | 62 | onPageShow(): void { |
| 63 | + WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); | ||
| 64 | + } | ||
| 42 | 65 | ||
| 66 | + onPageHide(): void { | ||
| 67 | + devicePLSensorManager.devicePLSensorOff(); | ||
| 68 | + WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED); | ||
| 43 | } | 69 | } |
| 44 | 70 | ||
| 45 | getLiveDetails() { | 71 | getLiveDetails() { |
| @@ -72,4 +98,19 @@ export struct DetailPlayLivePage { | @@ -72,4 +98,19 @@ export struct DetailPlayLivePage { | ||
| 72 | aboutToDisappear(): void { | 98 | aboutToDisappear(): void { |
| 73 | 99 | ||
| 74 | } | 100 | } |
| 101 | + | ||
| 102 | + onBackPress(): boolean | void { | ||
| 103 | + if (this.displayDirection == DisplayDirection.VERTICAL) { | ||
| 104 | + router.back() | ||
| 105 | + } else { | ||
| 106 | + this.displayDirection = DisplayDirection.VERTICAL | ||
| 107 | + } | ||
| 108 | + WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 109 | + window.Orientation.PORTRAIT : | ||
| 110 | + window.Orientation.LANDSCAPE) | ||
| 111 | + devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 112 | + window.Orientation.PORTRAIT : | ||
| 113 | + window.Orientation.LANDSCAPE); | ||
| 114 | + return true | ||
| 115 | + } | ||
| 75 | } | 116 | } |
| 1 | -import { BottomComponent } from '../widgets/details/BottomComponent'; | ||
| 2 | -import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet'; | ||
| 3 | -import { TopPlayVComponent } from '../widgets/details/video/TopPlayVComponet'; | 1 | +import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'; |
| 2 | +import { LiveViewModel } from '../viewModel/LiveViewModel'; | ||
| 3 | +import router from '@ohos.router'; | ||
| 4 | +import { WindowModel } from 'wdKit/Index'; | ||
| 5 | +import { PlayerComponent } from '../widgets/vertical/PlayerComponent'; | ||
| 6 | +import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent'; | ||
| 7 | +import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 4 | 8 | ||
| 9 | +const storage = LocalStorage.getShared(); | ||
| 5 | 10 | ||
| 11 | +@Entry(storage) | ||
| 6 | @Component | 12 | @Component |
| 7 | export struct DetailPlayVLivePage { | 13 | export struct DetailPlayVLivePage { |
| 14 | + TAG: string = 'DetailPlayLivePage'; | ||
| 15 | + private liveViewModel: LiveViewModel = new LiveViewModel() | ||
| 16 | + private playerController: WDPlayerController = new WDPlayerController(); | ||
| 17 | + private swiperController: SwiperController = new SwiperController() | ||
| 18 | + @Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 19 | + @Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 20 | + @Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean | ||
| 21 | + @Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean | ||
| 22 | + @Provide isMenuVisible: boolean = false | ||
| 23 | + @State relId: string = '' | ||
| 24 | + @State contentId: string = '' | ||
| 25 | + @State relType: string = '' | ||
| 26 | + @State swiperIndex: number = 1 | ||
| 27 | + | ||
| 8 | aboutToAppear(): void { | 28 | aboutToAppear(): void { |
| 29 | + WindowModel.shared.setWindowLayoutFullScreen(true) | ||
| 30 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', }) | ||
| 31 | + | ||
| 32 | + //https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340 | ||
| 33 | + let par: Action = router.getParams() as Action; | ||
| 34 | + let params = par?.params; | ||
| 35 | + this.relId = params?.extra?.relId || ''; | ||
| 36 | + this.relType = params?.extra?.relType || ''; | ||
| 37 | + this.contentId = params?.contentID || ''; | ||
| 38 | + this.getLiveDetails() | ||
| 39 | + this.getLiveRoomData() | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + aboutToDisappear(): void { | ||
| 43 | + WindowModel.shared.setWindowLayoutFullScreen(false) | ||
| 44 | + WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', }) | ||
| 9 | 45 | ||
| 10 | } | 46 | } |
| 11 | 47 | ||
| 12 | build() { | 48 | build() { |
| 13 | Column() { | 49 | Column() { |
| 14 | - TopPlayVComponent() | ||
| 15 | - // TabComponent() | ||
| 16 | - BottomComponent() | 50 | + Stack() { |
| 51 | + PlayerComponent({ | ||
| 52 | + playerController: this.playerController | ||
| 53 | + }) | ||
| 54 | + .onClick(() => { | ||
| 55 | + this.isMenuVisible = !this.isMenuVisible | ||
| 56 | + }) | ||
| 57 | + | ||
| 58 | + PlayerInfoComponent({ | ||
| 59 | + playerController: this.playerController, | ||
| 60 | + swiperController: this.swiperController, | ||
| 61 | + swiperIndex: $swiperIndex | ||
| 62 | + }) | ||
| 63 | + | ||
| 64 | + Image($r('app.media.icon_live_more')) | ||
| 65 | + .width(40) | ||
| 66 | + .aspectRatio(1) | ||
| 67 | + .visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden) | ||
| 68 | + .animation({ duration: 500 }) | ||
| 69 | + .position({ x: '90%', y: '90%' }) | ||
| 70 | + .onClick(() => { | ||
| 71 | + this.swiperController.showNext() | ||
| 72 | + }) | ||
| 73 | + } | ||
| 74 | + .height('100%') | ||
| 75 | + .width('100%') | ||
| 76 | + | ||
| 17 | } | 77 | } |
| 18 | .height('100%') | 78 | .height('100%') |
| 19 | .width('100%') | 79 | .width('100%') |
| @@ -23,7 +83,29 @@ export struct DetailPlayVLivePage { | @@ -23,7 +83,29 @@ export struct DetailPlayVLivePage { | ||
| 23 | 83 | ||
| 24 | } | 84 | } |
| 25 | 85 | ||
| 26 | - aboutToDisappear(): void { | 86 | + getLiveDetails() { |
| 87 | + this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType) | ||
| 88 | + .then( | ||
| 89 | + (data) => { | ||
| 90 | + if (data.length > 0) { | ||
| 91 | + this.liveDetailsBean = data[0] | ||
| 92 | + console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean))) | ||
| 93 | + } | ||
| 94 | + }, | ||
| 95 | + () => { | ||
| 96 | + | ||
| 97 | + }) | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + getLiveRoomData() { | ||
| 101 | + this.liveViewModel.getLiveRoomData(this.contentId) | ||
| 102 | + .then( | ||
| 103 | + (data) => { | ||
| 104 | + this.liveRoomDataBean = data | ||
| 105 | + }, | ||
| 106 | + () => { | ||
| 27 | 107 | ||
| 108 | + }) | ||
| 28 | } | 109 | } |
| 29 | -} | ||
| 110 | +} | ||
| 111 | + |
| 1 | import { window } from '@kit.ArkUI' | 1 | import { window } from '@kit.ArkUI' |
| 2 | import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' | 2 | import { NumberFormatterUtils, WindowModel } from 'wdKit/Index' |
| 3 | - | ||
| 4 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index' | 3 | import { devicePLSensorManager } from 'wdDetailPlayApi/Index' |
| 5 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' | 4 | import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index' |
| 6 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | 5 | import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' |
| 6 | +import { DisplayDirection } from 'wdConstant/Index' | ||
| 7 | 7 | ||
| 8 | -@Entry | ||
| 9 | @Component | 8 | @Component |
| 10 | export struct PlayUIComponent { | 9 | export struct PlayUIComponent { |
| 11 | playerController: WDPlayerController = new WDPlayerController(); | 10 | playerController: WDPlayerController = new WDPlayerController(); |
| 12 | //菜单键是否可见 | 11 | //菜单键是否可见 |
| 13 | @State isMenuVisible: boolean = true | 12 | @State isMenuVisible: boolean = true |
| 14 | - @State isFullScreen: boolean = false | ||
| 15 | @Consume liveDetailsBean: LiveDetailsBean | 13 | @Consume liveDetailsBean: LiveDetailsBean |
| 16 | @Consume liveRoomDataBean: LiveRoomDataBean | 14 | @Consume liveRoomDataBean: LiveRoomDataBean |
| 17 | @State currentTime: string = '' | 15 | @State currentTime: string = '' |
| @@ -19,6 +17,7 @@ export struct PlayUIComponent { | @@ -19,6 +17,7 @@ export struct PlayUIComponent { | ||
| 19 | @State progressVal: number = 0; | 17 | @State progressVal: number = 0; |
| 20 | //是否处于播放状态中 | 18 | //是否处于播放状态中 |
| 21 | @State isPlayStatus: boolean = true | 19 | @State isPlayStatus: boolean = true |
| 20 | + @Consume displayDirection: DisplayDirection | ||
| 22 | 21 | ||
| 23 | aboutToAppear(): void { | 22 | aboutToAppear(): void { |
| 24 | //播放进度监听 | 23 | //播放进度监听 |
| @@ -47,10 +46,19 @@ export struct PlayUIComponent { | @@ -47,10 +46,19 @@ export struct PlayUIComponent { | ||
| 47 | Image($r('app.media.icon_arrow_left_white')) | 46 | Image($r('app.media.icon_arrow_left_white')) |
| 48 | .width(24) | 47 | .width(24) |
| 49 | .aspectRatio(1) | 48 | .aspectRatio(1) |
| 50 | - .visibility(Visibility.None) | 49 | + .visibility(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? Visibility.Visible : Visibility.None) |
| 51 | .margin({ | 50 | .margin({ |
| 52 | right: 10 | 51 | right: 10 |
| 53 | }) | 52 | }) |
| 53 | + .onClick(() => { | ||
| 54 | + this.displayDirection = DisplayDirection.VERTICAL | ||
| 55 | + WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 56 | + window.Orientation.PORTRAIT : | ||
| 57 | + window.Orientation.LANDSCAPE) | ||
| 58 | + devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 59 | + window.Orientation.PORTRAIT : | ||
| 60 | + window.Orientation.LANDSCAPE); | ||
| 61 | + }) | ||
| 54 | if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { | 62 | if (this.liveDetailsBean.liveInfo?.liveState != 'wait') { |
| 55 | Text(this.liveDetailsBean.newsTitle) | 63 | Text(this.liveDetailsBean.newsTitle) |
| 56 | .maxLines(1) | 64 | .maxLines(1) |
| @@ -66,7 +74,7 @@ export struct PlayUIComponent { | @@ -66,7 +74,7 @@ export struct PlayUIComponent { | ||
| 66 | Image($r('app.media.icon_share')) | 74 | Image($r('app.media.icon_share')) |
| 67 | .width(24) | 75 | .width(24) |
| 68 | .aspectRatio(1) | 76 | .aspectRatio(1) |
| 69 | - .visibility(Visibility.None) | 77 | + .visibility(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? Visibility.Visible : Visibility.None) |
| 70 | } | 78 | } |
| 71 | .width('100%') | 79 | .width('100%') |
| 72 | .alignItems(VerticalAlign.Center) | 80 | .alignItems(VerticalAlign.Center) |
| @@ -196,9 +204,13 @@ export struct PlayUIComponent { | @@ -196,9 +204,13 @@ export struct PlayUIComponent { | ||
| 196 | .width(24) | 204 | .width(24) |
| 197 | .height(24) | 205 | .height(24) |
| 198 | .onClick(() => { | 206 | .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); | 207 | + this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL |
| 208 | + WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 209 | + window.Orientation.PORTRAIT : | ||
| 210 | + window.Orientation.LANDSCAPE) | ||
| 211 | + devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ? | ||
| 212 | + window.Orientation.PORTRAIT : | ||
| 213 | + window.Orientation.LANDSCAPE); | ||
| 202 | }) | 214 | }) |
| 203 | } | 215 | } |
| 204 | .alignItems(VerticalAlign.Center) | 216 | .alignItems(VerticalAlign.Center) |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/details/video/PlayVUIComponent.ets
0 → 100644
| 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 | +} |
| @@ -47,7 +47,6 @@ export struct TopPlayComponent { | @@ -47,7 +47,6 @@ export struct TopPlayComponent { | ||
| 47 | .visibility(this.isWait ? Visibility.Visible : Visibility.None) | 47 | .visibility(this.isWait ? Visibility.Visible : Visibility.None) |
| 48 | PlayUIComponent({ playerController: this.playerController }) | 48 | PlayUIComponent({ playerController: this.playerController }) |
| 49 | } | 49 | } |
| 50 | - .height(211) | ||
| 51 | .width('100%') | 50 | .width('100%') |
| 52 | } | 51 | } |
| 53 | 52 |
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 | + Image(this.item.senderUserAvatarUrl) | ||
| 13 | + .borderRadius(90) | ||
| 14 | + .width(24) | ||
| 15 | + .height(24) | ||
| 16 | + Text() { | ||
| 17 | + Span(this.item.senderUserName + ': ') | ||
| 18 | + .fontColor('#666666') | ||
| 19 | + Span(this.item.text) | ||
| 20 | + .fontColor('#222222') | ||
| 21 | + } | ||
| 22 | + .margin({ left: 8 }) | ||
| 23 | + .lineHeight(20) | ||
| 24 | + .layoutWeight(1) | ||
| 25 | + .fontSize('14fp') | ||
| 26 | + .fontWeight(400) | ||
| 27 | + } | ||
| 28 | + .alignItems(VerticalAlign.Top) | ||
| 29 | + .padding({ | ||
| 30 | + left: 15, | ||
| 31 | + top: 15, | ||
| 32 | + right: 15 | ||
| 33 | + }) | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + aboutToDisappear(): void { | ||
| 37 | + | ||
| 38 | + } | ||
| 39 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerCommentComponent.ets
0 → 100644
| 1 | +import { LiveDetailsBean, LiveRoomItemBean } from 'wdBean/Index' | ||
| 2 | +import { EmptyComponent, ErrorComponent, ListHasNoMoreDataUI } from 'wdComponent/Index' | ||
| 3 | +import CustomRefreshLoadLayout from 'wdComponent/src/main/ets/components/page/CustomRefreshLoadLayout' | ||
| 4 | +import LoadMoreLayout from 'wdComponent/src/main/ets/components/page/LoadMoreLayout' | ||
| 5 | +import RefreshLayout from 'wdComponent/src/main/ets/components/page/RefreshLayout' | ||
| 6 | +import { RefreshLayoutBean } from 'wdComponent/src/main/ets/components/page/RefreshLayoutBean' | ||
| 7 | +import PageModel from 'wdComponent/src/main/ets/viewmodel/PageModel' | ||
| 8 | +import { ViewType } from 'wdConstant/Index' | ||
| 9 | +import { LiveViewModel } from '../../viewModel/LiveViewModel' | ||
| 10 | +import { TabChatItemComponent } from '../details/TabChatItemComponent' | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +@Component | ||
| 14 | +export struct PlayerCommentComponent { | ||
| 15 | + liveViewModel: LiveViewModel = new LiveViewModel() | ||
| 16 | + @Consume liveDetailsBean: LiveDetailsBean | ||
| 17 | + @State private pageModel: PageModel = new PageModel() | ||
| 18 | + @State liveChatList: Array<LiveRoomItemBean> = [] | ||
| 19 | + | ||
| 20 | + aboutToAppear(): void { | ||
| 21 | + this.getLiveChatList() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + getLiveChatList() { | ||
| 25 | + this.pageModel.currentPage = 1 | ||
| 26 | + this.liveViewModel.getLiveChatList( | ||
| 27 | + 1, | ||
| 28 | + this.liveDetailsBean?.liveInfo?.mlive?.mliveId, | ||
| 29 | + this.liveDetailsBean?.newsId, | ||
| 30 | + 20,) | ||
| 31 | + .then( | ||
| 32 | + (data) => { | ||
| 33 | + if (data.barrageResponses && data.barrageResponses.length > 0) { | ||
| 34 | + this.pageModel.viewType = ViewType.LOADED; | ||
| 35 | + this.liveChatList.push(...data.barrageResponses) | ||
| 36 | + if (data.barrageResponses.length === this.pageModel.pageSize) { | ||
| 37 | + this.pageModel.currentPage++; | ||
| 38 | + this.pageModel.hasMore = true; | ||
| 39 | + } else { | ||
| 40 | + this.pageModel.hasMore = false; | ||
| 41 | + } | ||
| 42 | + } else { | ||
| 43 | + this.pageModel.viewType = ViewType.EMPTY; | ||
| 44 | + } | ||
| 45 | + }, | ||
| 46 | + () => { | ||
| 47 | + | ||
| 48 | + }) | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + build() { | ||
| 52 | + Stack() { | ||
| 53 | + if (this.pageModel.viewType == ViewType.LOADING) { | ||
| 54 | + this.LoadingLayout() | ||
| 55 | + } else if (this.pageModel.viewType == ViewType.ERROR) { | ||
| 56 | + ErrorComponent() | ||
| 57 | + } else if (this.pageModel.viewType == ViewType.EMPTY) { | ||
| 58 | + EmptyComponent() | ||
| 59 | + } else { | ||
| 60 | + this.ListLayout() | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + .align(Alignment.Top) | ||
| 64 | + // .backgroundColor('#F5F5F5') | ||
| 65 | + .height('100%') | ||
| 66 | + .width('100%') | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Builder | ||
| 70 | + LoadingLayout() { | ||
| 71 | + CustomRefreshLoadLayout({ | ||
| 72 | + refreshBean: new RefreshLayoutBean(true, | ||
| 73 | + $r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.pageModel.pullDownRefreshHeight) | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Builder | ||
| 78 | + ListLayout() { | ||
| 79 | + List() { | ||
| 80 | + ListItem() { | ||
| 81 | + // 下拉刷新 | ||
| 82 | + RefreshLayout({ | ||
| 83 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullDown, this.pageModel.pullDownRefreshImage, | ||
| 84 | + this.pageModel.pullDownRefreshText, this.pageModel.pullDownRefreshHeight) | ||
| 85 | + }) | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + ForEach(this.liveChatList, (item: LiveRoomItemBean) => { | ||
| 89 | + ListItem() { | ||
| 90 | + TabChatItemComponent({ item: item }) | ||
| 91 | + } | ||
| 92 | + }) | ||
| 93 | + // 加载更多 | ||
| 94 | + ListItem() { | ||
| 95 | + if (this.pageModel.hasMore) { | ||
| 96 | + LoadMoreLayout({ | ||
| 97 | + refreshBean: new RefreshLayoutBean(this.pageModel.isVisiblePullUpLoad, this.pageModel.pullUpLoadImage, | ||
| 98 | + this.pageModel.pullUpLoadText, this.pageModel.pullUpLoadHeight) | ||
| 99 | + }) | ||
| 100 | + } else { | ||
| 101 | + ListHasNoMoreDataUI() | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerComponent.ets
0 → 100644
| 1 | +import { LiveDetailsBean } from 'wdBean/Index'; | ||
| 2 | +import { WDPlayerController, WDPlayerRenderVLiveView, WDPlayerRenderView } from 'wdPlayer/Index'; | ||
| 3 | +import componentUtils from '@ohos.arkui.componentUtils'; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct PlayerComponent { | ||
| 8 | + private playerController?: WDPlayerController; | ||
| 9 | + // playerController: WDPlayerController = new WDPlayerController(); | ||
| 10 | + @Consume @Watch('updateData') liveDetailsBean: LiveDetailsBean | ||
| 11 | + @State bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0 | ||
| 12 | + @State topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0 | ||
| 13 | + @State imgUrl: string = '' | ||
| 14 | + @State isWait: boolean = false | ||
| 15 | + @State liveStreamType: number | null = -1 | ||
| 16 | + | ||
| 17 | + aboutToAppear(): void { | ||
| 18 | + if (this.playerController) { | ||
| 19 | + this.playerController.onCanplay = () => { | ||
| 20 | + console.log('可以播放了') | ||
| 21 | + this.playerController?.play() | ||
| 22 | + // this.playerController.selfSize | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + aboutToDisappear(): void { | ||
| 29 | + this.playerController?.pause() | ||
| 30 | + this.playerController?.stop() | ||
| 31 | + this.playerController?.release() | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + updateData() { | ||
| 35 | + console.error('updateData=============') | ||
| 36 | + //直播新闻-直播状态 wait待开播running直播中end已结束cancel已取消paused暂停 | ||
| 37 | + if (this.liveDetailsBean.fullColumnImgUrls && this.liveDetailsBean.fullColumnImgUrls.length > 0) { | ||
| 38 | + this.imgUrl = this.liveDetailsBean.fullColumnImgUrls[0].url | ||
| 39 | + } | ||
| 40 | + this.isWait = this.liveDetailsBean?.liveInfo?.liveState == 'wait' | ||
| 41 | + if (this.liveDetailsBean.liveInfo && this.liveDetailsBean.liveInfo.vlive.length > 0) { | ||
| 42 | + let playUrl = '' | ||
| 43 | + let liveStreamType: number | null = null | ||
| 44 | + if (this.liveDetailsBean.liveInfo.liveState == 'running') { | ||
| 45 | + playUrl = this.liveDetailsBean.liveInfo.vlive[0].liveUrl | ||
| 46 | + liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType | ||
| 47 | + } else if (this.liveDetailsBean.liveInfo.liveState == 'end') { | ||
| 48 | + playUrl = this.liveDetailsBean.liveInfo.vlive[0].replayUri | ||
| 49 | + liveStreamType = this.liveDetailsBean.liveInfo.vlive[0].liveStreamType | ||
| 50 | + } | ||
| 51 | + this.liveStreamType = liveStreamType | ||
| 52 | + this.playerController?.firstPlay(playUrl); | ||
| 53 | + } | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + build() { | ||
| 57 | + Column() { | ||
| 58 | + Stack() { | ||
| 59 | + Image(this.imgUrl) | ||
| 60 | + .height('100%') | ||
| 61 | + .width('100%') | ||
| 62 | + .blur(100) | ||
| 63 | + | ||
| 64 | + // TODO:判断横竖屏,liveStreamType=1竖屏铺满屏幕,liveStreamType=0横屏正常展示 | ||
| 65 | + if (this.liveStreamType == null) { | ||
| 66 | + WDPlayerRenderVLiveView({ | ||
| 67 | + playerController: this.playerController, | ||
| 68 | + onLoad: () => { | ||
| 69 | + } | ||
| 70 | + }).height('100%') | ||
| 71 | + .width('100%') | ||
| 72 | + } else if (this.liveStreamType == 0) { | ||
| 73 | + WDPlayerRenderView({ | ||
| 74 | + playerController: this.playerController, | ||
| 75 | + onLoad: () => { | ||
| 76 | + } | ||
| 77 | + }).padding({ top: 195 }) | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + .height('100%') | ||
| 81 | + .width('100%') | ||
| 82 | + .align(Alignment.Top) | ||
| 83 | + .alignContent(Alignment.Top) | ||
| 84 | + } | ||
| 85 | + .height('100%') | ||
| 86 | + .width('100%') | ||
| 87 | + } | ||
| 88 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerInfoComponent.ets
0 → 100644
| 1 | +import { WDPlayerController } from 'wdPlayer/Index' | ||
| 2 | +import { PlayerUIComponent } from './PlayerUIComponent' | ||
| 3 | + | ||
| 4 | +@Component | ||
| 5 | +export struct PlayerInfoComponent { | ||
| 6 | + swiperController?: SwiperController | ||
| 7 | + private playerController?: WDPlayerController | ||
| 8 | + @Consume bottomSafeHeight: number | ||
| 9 | + @Consume topSafeHeight: number | ||
| 10 | + @Link swiperIndex: number | ||
| 11 | + | ||
| 12 | + build() { | ||
| 13 | + Column() { | ||
| 14 | + Swiper(this.swiperController) { | ||
| 15 | + Text('') | ||
| 16 | + PlayerUIComponent({ playerController: this.playerController }).margin({ | ||
| 17 | + bottom: this.bottomSafeHeight + 'px', | ||
| 18 | + top: this.topSafeHeight + 'px' | ||
| 19 | + }) | ||
| 20 | + | ||
| 21 | + } | ||
| 22 | + .cachedCount(2) | ||
| 23 | + .indicator(false) | ||
| 24 | + .loop(false) | ||
| 25 | + .width('100%') | ||
| 26 | + .height('100%') | ||
| 27 | + .index(this.swiperIndex) | ||
| 28 | + .onChange((index) => { | ||
| 29 | + this.swiperIndex = index | ||
| 30 | + }) | ||
| 31 | + } | ||
| 32 | + .height('100%') | ||
| 33 | + .width('100%') | ||
| 34 | + } | ||
| 35 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerTitleComponent.ets
0 → 100644
| 1 | +import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index' | ||
| 2 | +import { NumberFormatterUtils } from 'wdKit/Index' | ||
| 3 | + | ||
| 4 | +@Preview | ||
| 5 | +@Component | ||
| 6 | +export struct PlayerTitleComponent { | ||
| 7 | + @Consume liveDetailsBean: LiveDetailsBean | ||
| 8 | + @Consume liveRoomDataBean: LiveRoomDataBean | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Column() { | ||
| 12 | + Row() { | ||
| 13 | + Text(this.liveDetailsBean.newsTitle || '') | ||
| 14 | + .maxLines(2) | ||
| 15 | + .fontSize(16) | ||
| 16 | + .fontWeight(500) | ||
| 17 | + .fontColor(Color.White) | ||
| 18 | + }.margin({ bottom: 10 }) | ||
| 19 | + | ||
| 20 | + Row() { | ||
| 21 | + this.getLiveStatusView() | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + } | ||
| 25 | + .width('100%') | ||
| 26 | + .alignItems(HorizontalAlign.Start) | ||
| 27 | + .padding({ | ||
| 28 | + top: 12, | ||
| 29 | + left: 16 | ||
| 30 | + }) | ||
| 31 | + | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Builder | ||
| 35 | + getLiveStatusView() { | ||
| 36 | + Row() { | ||
| 37 | + Image(this.liveDetailsBean.rmhInfo?.rmhHeadUrl || '') | ||
| 38 | + .width(24) | ||
| 39 | + .aspectRatio(1) | ||
| 40 | + .borderRadius('50%') | ||
| 41 | + .fillColor(Color.Transparent) | ||
| 42 | + Text(this.liveDetailsBean.rmhInfo?.rmhName || '') | ||
| 43 | + .fontSize(12) | ||
| 44 | + .fontWeight(500) | ||
| 45 | + .fontColor(Color.White) | ||
| 46 | + .padding({ | ||
| 47 | + top: 2, | ||
| 48 | + right: 8, | ||
| 49 | + left: 4, | ||
| 50 | + bottom: 2 | ||
| 51 | + }) | ||
| 52 | + } | ||
| 53 | + .backgroundColor('#4D000000') | ||
| 54 | + .borderRadius(2) | ||
| 55 | + .margin({ right: 8 }) | ||
| 56 | + | ||
| 57 | + Row() { | ||
| 58 | + if (this.liveDetailsBean.liveInfo?.liveState == 'running') { | ||
| 59 | + Image($r('app.media.icon_live_status_running')) | ||
| 60 | + .width(22) | ||
| 61 | + .height(18) | ||
| 62 | + .margin({ right: 1 }) | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + Text(this.liveDetailsBean.liveInfo?.liveState == 'running' ? '直播中' : '回看') | ||
| 66 | + .fontSize(11) | ||
| 67 | + .fontWeight(400) | ||
| 68 | + .fontColor(Color.White) | ||
| 69 | + Image($r('app.media.icon_live_player_status_end')) | ||
| 70 | + .width(12) | ||
| 71 | + .height(12) | ||
| 72 | + Text(`${NumberFormatterUtils.formatNumberWithWan(this.liveRoomDataBean.pv)}人参与`) | ||
| 73 | + .fontSize('11fp') | ||
| 74 | + .fontWeight(400) | ||
| 75 | + .fontColor(Color.White) | ||
| 76 | + } | ||
| 77 | + .backgroundColor('#4D000000') | ||
| 78 | + .borderRadius(2) | ||
| 79 | + .padding(this.liveDetailsBean.liveInfo?.liveState == 'running' ? { left: 0, right: 4, top: 0, bottom: 0 } : 4) | ||
| 80 | + } | ||
| 81 | +} |
sight_harmony/features/wdDetailPlayLive/src/main/ets/widgets/vertical/PlayerUIComponent.ets
0 → 100644
| 1 | +import { WDPlayerController } from 'wdPlayer/Index'; | ||
| 2 | +import { PlayerCommentComponent } from './PlayerCommentComponent'; | ||
| 3 | +import { PlayerTitleComponent } from './PlayerTitleComponent'; | ||
| 4 | +import { PlayerVideoControlComponent } from './PlayerVideoControlComponent'; | ||
| 5 | + | ||
| 6 | +@Component | ||
| 7 | +export struct PlayerUIComponent { | ||
| 8 | + private playerController?: WDPlayerController | ||
| 9 | + | ||
| 10 | + build() { | ||
| 11 | + Column() { | ||
| 12 | + PlayerTitleComponent() | ||
| 13 | + Blank() | ||
| 14 | + // PlayerCommentComponent().layoutWeight(1) | ||
| 15 | + PlayerVideoControlComponent({ playerController: this.playerController }) | ||
| 16 | + } | ||
| 17 | + .height('100%') | ||
| 18 | + .width('100%') | ||
| 19 | + | ||
| 20 | + } | ||
| 21 | +} |
| 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 | + | ||
| 9 | +@Component | ||
| 10 | +export struct PlayerVideoControlComponent { | ||
| 11 | + private playerController?: WDPlayerController | ||
| 12 | + @Consume liveDetailsBean: LiveDetailsBean | ||
| 13 | + @Consume liveRoomDataBean: LiveRoomDataBean | ||
| 14 | + //菜单键是否可见 | ||
| 15 | + @State isMenuVisible: boolean = true | ||
| 16 | + @State isFullScreen: boolean = false | ||
| 17 | + @State currentTime: string = '' | ||
| 18 | + @State totalTime: string = '' | ||
| 19 | + @State progressVal: number = 0; | ||
| 20 | + //是否处于播放状态中 | ||
| 21 | + @State isPlayStatus: boolean = true | ||
| 22 | + | ||
| 23 | + aboutToAppear(): void { | ||
| 24 | + if (this.playerController) { | ||
| 25 | + //播放进度监听 | ||
| 26 | + this.playerController.onTimeUpdate = (position: number, duration: number) => { | ||
| 27 | + console.log('onTimeUpdate===', position, duration) | ||
| 28 | + this.currentTime = DateFormatUtil.secondToTime(Math.floor(position / 1000)); | ||
| 29 | + this.totalTime = DateFormatUtil.secondToTime(Math.floor(duration / 1000)); | ||
| 30 | + this.progressVal = Math.floor(position * 100 / duration); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + build() { | ||
| 37 | + Row() { | ||
| 38 | + this.getBottomUIComponent() | ||
| 39 | + } | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @Builder | ||
| 43 | + getBottomUIComponent() { | ||
| 44 | + Row() { | ||
| 45 | + if (this.liveDetailsBean?.liveInfo?.liveState == 'end') { | ||
| 46 | + this.playOrPauseBtn() | ||
| 47 | + Text(this.currentTime) | ||
| 48 | + .fontColor(Color.White) | ||
| 49 | + .fontWeight(600) | ||
| 50 | + .fontSize('12fp') | ||
| 51 | + .margin({ | ||
| 52 | + left: 16 | ||
| 53 | + }) | ||
| 54 | + | ||
| 55 | + this.playProgressView() | ||
| 56 | + | ||
| 57 | + Text(this.totalTime) | ||
| 58 | + .fontColor(Color.White) | ||
| 59 | + .fontWeight(600) | ||
| 60 | + .fontSize('12fp') | ||
| 61 | + .margin({ | ||
| 62 | + right: 16 | ||
| 63 | + }) | ||
| 64 | + } else { | ||
| 65 | + Blank() | ||
| 66 | + } | ||
| 67 | + Image($r('app.media.icon_live_player_full_screen')) | ||
| 68 | + .width(24) | ||
| 69 | + .height(24) | ||
| 70 | + .onClick(() => { | ||
| 71 | + this.isFullScreen = !this.isFullScreen | ||
| 72 | + WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 73 | + devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT); | ||
| 74 | + }) | ||
| 75 | + } | ||
| 76 | + .alignItems(VerticalAlign.Center) | ||
| 77 | + .linearGradient({ angle: 0, colors: [['#99000000', 0], ['#00000000', 1]] }) | ||
| 78 | + .width('100%') | ||
| 79 | + .padding({ | ||
| 80 | + left: 10, | ||
| 81 | + right: 10, | ||
| 82 | + top: 15, | ||
| 83 | + bottom: 15 | ||
| 84 | + }) | ||
| 85 | + .visibility(this.isMenuVisible ? Visibility.Visible : Visibility.None) | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @Builder | ||
| 89 | + playOrPauseBtn() { | ||
| 90 | + //暂停、播放 | ||
| 91 | + Image(this.isPlayStatus ? $r('app.media.icon_live_player_pause') : $r('app.media.player_play_ic')) | ||
| 92 | + .width(24) | ||
| 93 | + .height(24) | ||
| 94 | + .onClick(() => { | ||
| 95 | + if (this.isPlayStatus) { | ||
| 96 | + this.isPlayStatus = false | ||
| 97 | + this.playerController?.pause() | ||
| 98 | + } else { | ||
| 99 | + this.isPlayStatus = true | ||
| 100 | + this.playerController?.play() | ||
| 101 | + } | ||
| 102 | + }) | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + @Builder | ||
| 106 | + playProgressView() { | ||
| 107 | + Slider({ | ||
| 108 | + value: this.progressVal, | ||
| 109 | + step: 1, | ||
| 110 | + style: SliderStyle.OutSet | ||
| 111 | + }) | ||
| 112 | + .blockSize({ | ||
| 113 | + width: 18, | ||
| 114 | + height: 12 | ||
| 115 | + }) | ||
| 116 | + .trackColor('#4DFFFFFF') | ||
| 117 | + .selectedColor('#FFED2800') | ||
| 118 | + .trackThickness(2) | ||
| 119 | + .blockStyle({ | ||
| 120 | + type: SliderBlockType.IMAGE, | ||
| 121 | + image: $r('app.media.ic_player_block') | ||
| 122 | + }) | ||
| 123 | + .blockSize({ width: 18, height: 12 }) | ||
| 124 | + .height(14) | ||
| 125 | + .layoutWeight(1) | ||
| 126 | + .margin({ | ||
| 127 | + left: 8, | ||
| 128 | + right: 8 | ||
| 129 | + }) | ||
| 130 | + .onChange((value: number, mode: SliderChangeMode) => { | ||
| 131 | + this.playerController?.setSeekTime(value, mode); | ||
| 132 | + }) | ||
| 133 | + } | ||
| 134 | +} |
3.65 KB
| @@ -179,7 +179,6 @@ export struct DetailPlayShortVideoPage { | @@ -179,7 +179,6 @@ export struct DetailPlayShortVideoPage { | ||
| 179 | }) | 179 | }) |
| 180 | .height('100%') | 180 | .height('100%') |
| 181 | .width('100%') | 181 | .width('100%') |
| 182 | - .margin({ top: this.contentDetailData?.videoInfo[0]?.videoLandScape === 1 ? 218 : 0 }) | ||
| 183 | .onClick(() => { | 182 | .onClick(() => { |
| 184 | console.error('WDPlayerRenderView=== onClick') | 183 | console.error('WDPlayerRenderView=== onClick') |
| 185 | this.playerController?.switchPlayOrPause(); | 184 | this.playerController?.switchPlayOrPause(); |
| @@ -166,8 +166,7 @@ export struct DetailVideoListPage { | @@ -166,8 +166,7 @@ export struct DetailVideoListPage { | ||
| 166 | }) | 166 | }) |
| 167 | }.width('100%') | 167 | }.width('100%') |
| 168 | .height('100%') | 168 | .height('100%') |
| 169 | - // 扩展至所有非安全区域 | ||
| 170 | - .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) | 169 | + |
| 171 | }, (item: ContentDetailDTO) => item.newsId + '') | 170 | }, (item: ContentDetailDTO) => item.newsId + '') |
| 172 | } | 171 | } |
| 173 | .clip(false) | 172 | .clip(false) |
| @@ -61,32 +61,35 @@ export struct PlayerDetailContainer { | @@ -61,32 +61,35 @@ export struct PlayerDetailContainer { | ||
| 61 | 61 | ||
| 62 | build() { | 62 | build() { |
| 63 | RelativeContainer() { | 63 | RelativeContainer() { |
| 64 | - Stack() { | ||
| 65 | - Row() { | ||
| 66 | - this.playerView() | ||
| 67 | - } | ||
| 68 | - .height('100%') | ||
| 69 | - .width('100%') | ||
| 70 | - .zIndex(0) | 64 | + Row() { |
| 65 | + Stack() { | ||
| 66 | + Row() { | ||
| 67 | + this.playerView() | ||
| 68 | + } | ||
| 69 | + .height('100%') | ||
| 70 | + .width('100%') | ||
| 71 | + .zIndex(0) | ||
| 72 | + .margin({ top: this.videoLandScape === 1 ? 218 : 0 }) | ||
| 71 | 73 | ||
| 72 | - Row() { | ||
| 73 | - this.playControlView() | 74 | + Row() { |
| 75 | + this.playControlView() | ||
| 76 | + } | ||
| 77 | + .height('100%') | ||
| 78 | + .width('100%') | ||
| 79 | + .zIndex(1) | ||
| 74 | } | 80 | } |
| 75 | - .height('100%') | ||
| 76 | .width('100%') | 81 | .width('100%') |
| 77 | - .zIndex(1) | ||
| 78 | - } | ||
| 79 | - .width('100%') | ||
| 80 | - .height('100%') | ||
| 81 | - // .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大 | ||
| 82 | - // .height(this.isFullScreen ? '100%' : this.buildVideoHeight()) | ||
| 83 | - // .margin({ top: this.isFullScreen ? 0 : this.buildVideoTo() }) | ||
| 84 | - // .margin({ bottom: this.isFullScreen ? 0 : this.buildVideoBottom() }) | ||
| 85 | - .alignRules({ | ||
| 86 | - top: { anchor: '__container__', align: VerticalAlign.Top }, | ||
| 87 | - // middle: { anchor: '__container__', align: HorizontalAlign.Center } | ||
| 88 | - }) | ||
| 89 | - .id('stk_player_container') | 82 | + .height('100%') |
| 83 | + // .aspectRatio(this.isFullScreen ? 0.1 : 16 / 9.0) // 若width值确定,当aspectRatio值越小,则height值越大 | ||
| 84 | + // .height(this.isFullScreen ? '100%' : this.buildVideoHeight()) | ||
| 85 | + // .margin({ top: this.isFullScreen ? 0 : this.buildVideoTo() }) | ||
| 86 | + // .margin({ bottom: this.isFullScreen ? 0 : this.buildVideoBottom() }) | ||
| 87 | + .alignRules({ | ||
| 88 | + top: { anchor: '__container__', align: VerticalAlign.Top }, | ||
| 89 | + // middle: { anchor: '__container__', align: HorizontalAlign.Center } | ||
| 90 | + }) | ||
| 91 | + .id('stk_player_container') | ||
| 92 | + }.height('100%').layoutWeight(1) | ||
| 90 | 93 | ||
| 91 | if (this.isShowBottomView()) { | 94 | if (this.isShowBottomView()) { |
| 92 | Row() { | 95 | Row() { |
| @@ -200,36 +200,15 @@ export class LoginModel { | @@ -200,36 +200,15 @@ export class LoginModel { | ||
| 200 | bean['tempToken'] = tempToken; | 200 | bean['tempToken'] = tempToken; |
| 201 | 201 | ||
| 202 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 202 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| 203 | - // let JwtToken = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, '') as string; | ||
| 204 | - // headers.set('JwtToken',(JwtToken)); | ||
| 205 | - // headers.set('rmrb-x-token',(JwtToken)); | ||
| 206 | - // headers.set('cookie', 'RMRB-X-TOKEN=' + JwtToken) | ||
| 207 | 203 | ||
| 208 | - | ||
| 209 | -// let obj: Record<string, string> = {}; | ||
| 210 | -// headers.forEach((value, key) =>{ | ||
| 211 | -// if(key != undefined && key != null && value != undefined && value != null) { | ||
| 212 | -// obj[key as string] = value; | ||
| 213 | -// } | ||
| 214 | -// }) | ||
| 215 | -// let headerString = JSON.stringify(obj); | ||
| 216 | -// let beanString = JSON.stringify(bean); | ||
| 217 | -// AlertDialog.show({ | ||
| 218 | -// message:headerString + beanString | ||
| 219 | -// }) | ||
| 220 | - | ||
| 221 | - return new Promise<string>((success, fail) => { | ||
| 222 | - HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getForgetPasswordUrl(), bean, headers).then((data: ResponseDTO<string>) => { | 204 | + return new Promise<object>((success, fail) => { |
| 205 | + HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.getForgetPasswordUrl(), bean, headers).then((data: ResponseDTO<object>) => { | ||
| 223 | 206 | ||
| 224 | if (data.code != 0) { | 207 | if (data.code != 0) { |
| 225 | fail(data.message) | 208 | fail(data.message) |
| 226 | return | 209 | return |
| 227 | } | 210 | } |
| 228 | - if (!data || !data.data) { | ||
| 229 | - fail("数据为空") | ||
| 230 | - return | ||
| 231 | - } | ||
| 232 | - success(data.data) | 211 | + success(data) |
| 233 | }, (error: Error) => { | 212 | }, (error: Error) => { |
| 234 | fail(error.message) | 213 | fail(error.message) |
| 235 | Logger.debug("LoginViewModel:error ", error.toString()) | 214 | Logger.debug("LoginViewModel:error ", error.toString()) |
| @@ -331,7 +331,7 @@ struct LoginPage { | @@ -331,7 +331,7 @@ struct LoginPage { | ||
| 331 | router.back({ | 331 | router.back({ |
| 332 | params: { userName: data.userName, | 332 | params: { userName: data.userName, |
| 333 | userId:data.id}, | 333 | userId:data.id}, |
| 334 | - url: 'pages/MainPage' | 334 | + url: `${WDRouterPage.getBundleInfo()}` |
| 335 | }) | 335 | }) |
| 336 | }).catch((value: string) => { | 336 | }).catch((value: string) => { |
| 337 | promptAction.showToast({ message: value }) | 337 | promptAction.showToast({ message: value }) |
| @@ -95,7 +95,7 @@ export class LoginViewModel { | @@ -95,7 +95,7 @@ export class LoginViewModel { | ||
| 95 | return new Promise<CheckVerifyBean>((success, reject) => { | 95 | return new Promise<CheckVerifyBean>((success, reject) => { |
| 96 | this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => { | 96 | this.loginModel.checkVerifyCode(phone, verifyCode).then((data: CheckVerifyBean) => { |
| 97 | //todo 保存数据 | 97 | //todo 保存数据 |
| 98 | - SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.temToken) | 98 | + SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken) |
| 99 | SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 99 | SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) |
| 100 | success(data) | 100 | success(data) |
| 101 | 101 | ||
| @@ -108,7 +108,7 @@ export class LoginViewModel { | @@ -108,7 +108,7 @@ export class LoginViewModel { | ||
| 108 | return new Promise<CheckVerifyBean>((success, reject) => { | 108 | return new Promise<CheckVerifyBean>((success, reject) => { |
| 109 | this.loginModel.checkVerifyCodeByToken(verifyCode).then((data: CheckVerifyBean) => { | 109 | this.loginModel.checkVerifyCodeByToken(verifyCode).then((data: CheckVerifyBean) => { |
| 110 | //todo 保存数据 | 110 | //todo 保存数据 |
| 111 | - SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.temToken) | 111 | + SPHelper.default.save(SpConstants.USER_TEMP_TOKEN, data.tempToken) |
| 112 | SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) | 112 | SPHelper.default.save(SpConstants.USER_JWT_TOKEN, data.jwtToken) |
| 113 | success(data) | 113 | success(data) |
| 114 | 114 | ||
| @@ -134,7 +134,7 @@ export class LoginViewModel { | @@ -134,7 +134,7 @@ export class LoginViewModel { | ||
| 134 | 134 | ||
| 135 | //忘记密码 | 135 | //忘记密码 |
| 136 | forgotPassword(password: string, tempToken: string) { | 136 | forgotPassword(password: string, tempToken: string) { |
| 137 | - return new Promise<string>(async (success, fail) => { | 137 | + return new Promise<object>(async (success, fail) => { |
| 138 | let passwordNew = await encryptMessage(password) | 138 | let passwordNew = await encryptMessage(password) |
| 139 | this.loginModel.forgotPassword(passwordNew, tempToken).then((data) => { | 139 | this.loginModel.forgotPassword(passwordNew, tempToken).then((data) => { |
| 140 | success(data) | 140 | success(data) |
| @@ -3,7 +3,7 @@ import promptAction from '@ohos.promptAction'; | @@ -3,7 +3,7 @@ import promptAction from '@ohos.promptAction'; | ||
| 3 | import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; | 3 | import { Params } from '../../../../../../../commons/wdRouter/oh_modules/wdBean/Index'; |
| 4 | import router from '@ohos.router'; | 4 | import router from '@ohos.router'; |
| 5 | import { LoginViewModel } from './LoginViewModel'; | 5 | import { LoginViewModel } from './LoginViewModel'; |
| 6 | -import { Logger, SPHelper } from 'wdKit'; | 6 | +import { Logger, SPHelper, ToastUtils } from 'wdKit'; |
| 7 | import { | 7 | import { |
| 8 | SpConstants | 8 | SpConstants |
| 9 | } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | 9 | } from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' |
| @@ -303,7 +303,7 @@ export struct SettingPasswordLayout { | @@ -303,7 +303,7 @@ export struct SettingPasswordLayout { | ||
| 303 | 303 | ||
| 304 | /***************************** 事件处理 ******************************************/ | 304 | /***************************** 事件处理 ******************************************/ |
| 305 | // 提交按钮点击事件 | 305 | // 提交按钮点击事件 |
| 306 | - buttonClick() { | 306 | + async buttonClick() { |
| 307 | if (this.btnStatus) { | 307 | if (this.btnStatus) { |
| 308 | // 需要+手机号校验 | 308 | // 需要+手机号校验 |
| 309 | if (this.password01.length < 6 || this.password01.length > 20) { | 309 | if (this.password01.length < 6 || this.password01.length > 20) { |
| @@ -315,18 +315,27 @@ export struct SettingPasswordLayout { | @@ -315,18 +315,27 @@ export struct SettingPasswordLayout { | ||
| 315 | return | 315 | return |
| 316 | } | 316 | } |
| 317 | if(this.pageId == 1){ //设置密码 | 317 | if(this.pageId == 1){ //设置密码 |
| 318 | - SPHelper.default.get(SpConstants.USER_JWT_TOKEN, '').then((str) => { | 318 | + SPHelper.default.get(SpConstants.USER_TEMP_TOKEN, '').then((str) => { |
| 319 | this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ | 319 | this.loginViewModel.forgotPassword(this.password01, str.toString()).then((data =>{ |
| 320 | if (this.pageType == 0) {//登录页 | 320 | if (this.pageType == 0) {//登录页 |
| 321 | - WDRouterRule.jumpWithPage(WDRouterPage.loginPage); | 321 | + ToastUtils.shortToast("修改成功") |
| 322 | + router.back({ | ||
| 323 | + url: `${WDRouterPage.getLoginBundleInfo()}` | ||
| 324 | + }) | ||
| 322 | }else if(this.pageType == 1){//设置 | 325 | }else if(this.pageType == 1){//设置 |
| 323 | let params: Params = { | 326 | let params: Params = { |
| 324 | pageID: 'AccountAndSecurityLayout' | 327 | pageID: 'AccountAndSecurityLayout' |
| 325 | } | 328 | } |
| 326 | - WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | 329 | + ToastUtils.shortToast("修改成功") |
| 330 | + router.back({ | ||
| 331 | + params:params, | ||
| 332 | + url: `${WDRouterPage.getSettingBundleInfo()}` | ||
| 333 | + }) | ||
| 334 | + // WDRouterRule.jumpWithPage(WDRouterPage.settingPage, params) | ||
| 327 | } | 335 | } |
| 328 | })) | 336 | })) |
| 329 | - }).catch((err: Error) => { | 337 | + }).catch((err: string) => { |
| 338 | + ToastUtils.shortToast(err) | ||
| 330 | Logger.error(TAG, 'catch err:' + JSON.stringify(err)); | 339 | Logger.error(TAG, 'catch err:' + JSON.stringify(err)); |
| 331 | }); | 340 | }); |
| 332 | } | 341 | } |
| @@ -4,6 +4,8 @@ export { WDPlayerRenderView } from "./src/main/ets/pages/WDPlayerRenderView" | @@ -4,6 +4,8 @@ export { WDPlayerRenderView } from "./src/main/ets/pages/WDPlayerRenderView" | ||
| 4 | 4 | ||
| 5 | export { WDPlayerRenderLiveView } from "./src/main/ets/pages/WDPlayerRenderLiveView" | 5 | export { WDPlayerRenderLiveView } from "./src/main/ets/pages/WDPlayerRenderLiveView" |
| 6 | 6 | ||
| 7 | +export { WDPlayerRenderVLiveView } from "./src/main/ets/pages/WDPlayerRenderVLiveView" | ||
| 8 | + | ||
| 7 | export { PlayerConstants } from "./src/main/ets/constants/PlayerConstants" | 9 | export { PlayerConstants } from "./src/main/ets/constants/PlayerConstants" |
| 8 | 10 | ||
| 9 | export { SpeedBean } from "./src/main/ets/bean/SpeedBean" | 11 | export { SpeedBean } from "./src/main/ets/bean/SpeedBean" |
| @@ -45,7 +45,7 @@ export struct WDPlayerRenderLiveView { | @@ -45,7 +45,7 @@ export struct WDPlayerRenderLiveView { | ||
| 45 | videoWidth: number = 0 | 45 | videoWidth: number = 0 |
| 46 | videoHeight: number = 0 | 46 | videoHeight: number = 0 |
| 47 | @State selfSize: Size = new Size('100%', '100%'); | 47 | @State selfSize: Size = new Size('100%', '100%'); |
| 48 | - private insId: string = "WDPlayRenderView" + insIndex; | 48 | + private insId: string = "WDPlayerRenderLiveView" + insIndex; |
| 49 | 49 | ||
| 50 | aboutToAppear() { | 50 | aboutToAppear() { |
| 51 | MGPlayRenderViewIns.add(); | 51 | MGPlayRenderViewIns.add(); |
| @@ -97,7 +97,7 @@ export struct WDPlayerRenderLiveView { | @@ -97,7 +97,7 @@ export struct WDPlayerRenderLiveView { | ||
| 97 | } | 97 | } |
| 98 | .id(this.insId) | 98 | .id(this.insId) |
| 99 | .onAreaChange(() => { | 99 | .onAreaChange(() => { |
| 100 | - // this.updateLayout() | 100 | + this.updateLayout() |
| 101 | }) | 101 | }) |
| 102 | .backgroundColor("#000000") | 102 | .backgroundColor("#000000") |
| 103 | .justifyContent(FlexAlign.Center) | 103 | .justifyContent(FlexAlign.Center) |
| 1 | +import componentUtils from '@ohos.arkui.componentUtils'; | ||
| 2 | +import { WDPlayerController } from '../controller/WDPlayerController' | ||
| 3 | +import { WindowModel } from 'wdKit'; | ||
| 4 | +import { Logger } from '../utils/Logger'; | ||
| 5 | + | ||
| 6 | +class Size { | ||
| 7 | + width: Length = "100%"; | ||
| 8 | + height: Length = "100%"; | ||
| 9 | + | ||
| 10 | + constructor(width: Length, height: Length) { | ||
| 11 | + this.width = width; | ||
| 12 | + this.height = height; | ||
| 13 | + } | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +let insIndex: number = 0; | ||
| 17 | +const TAG = 'WDPlayerRenderView' | ||
| 18 | + | ||
| 19 | +class MGPlayRenderViewIns { | ||
| 20 | + static intCount: number = 0; | ||
| 21 | + | ||
| 22 | + static add() { | ||
| 23 | + MGPlayRenderViewIns.intCount++; | ||
| 24 | + WindowModel.shared.setWindowKeepScreenOn(true); | ||
| 25 | + console.log("add-- +1") | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + static del() { | ||
| 29 | + console.log("del-- -1") | ||
| 30 | + MGPlayRenderViewIns.intCount--; | ||
| 31 | + if (MGPlayRenderViewIns.intCount <= 0) { | ||
| 32 | + WindowModel.shared.setWindowKeepScreenOn(false); | ||
| 33 | + } | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +/** | ||
| 38 | + * 播放窗口组件 | ||
| 39 | + */ | ||
| 40 | +@Component | ||
| 41 | +export struct WDPlayerRenderVLiveView { | ||
| 42 | + private playerController?: WDPlayerController; | ||
| 43 | + private xComponentController: XComponentController = new XComponentController(); | ||
| 44 | + private insId: string = "WDPlayRenderView" + insIndex; | ||
| 45 | + onLoad?: ((event?: object) => void); | ||
| 46 | + @State videoWidth: number = 0 | ||
| 47 | + @State videoHeight: number = 0 | ||
| 48 | + @State selfSize: Size = new Size('100%', '100%'); | ||
| 49 | + | ||
| 50 | + aboutToAppear() { | ||
| 51 | + MGPlayRenderViewIns.add(); | ||
| 52 | + | ||
| 53 | + insIndex++; | ||
| 54 | + if (!this.playerController) { | ||
| 55 | + return | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + this.playerController.onVideoSizeChange = (width: number, height: number) => { | ||
| 59 | + // console.log(`WDPlayerRenderView onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 60 | + Logger.info(TAG, ` onVideoSizeChange width:${width} videoTop:${height}`) | ||
| 61 | + this.videoWidth = width; | ||
| 62 | + this.videoHeight = height; | ||
| 63 | + this.updateLayout() | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + aboutToDisappear() { | ||
| 68 | + Logger.info(TAG, `aboutToDisappear`) | ||
| 69 | + MGPlayRenderViewIns.del(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + build() { | ||
| 73 | + Row() { | ||
| 74 | + // 设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。 | ||
| 75 | + XComponent({ | ||
| 76 | + id: 'xComponentId', | ||
| 77 | + type: 'surface', | ||
| 78 | + controller: this.xComponentController | ||
| 79 | + }) | ||
| 80 | + .onLoad(async (event) => { | ||
| 81 | + Logger.info(TAG, 'onLoad') | ||
| 82 | + // const surfaceId = this.xComponentController.getXComponentSurfaceId() | ||
| 83 | + this.xComponentController.setXComponentSurfaceSize({ | ||
| 84 | + surfaceWidth: 1920, | ||
| 85 | + surfaceHeight: 1080 | ||
| 86 | + }); | ||
| 87 | + this.playerController?.setXComponentController(this.xComponentController) | ||
| 88 | + if (this.onLoad) { | ||
| 89 | + this.onLoad(event) | ||
| 90 | + } | ||
| 91 | + })// .width(this.selfSize.width) | ||
| 92 | + // .height(this.selfSize.height) | ||
| 93 | + .height('100%') | ||
| 94 | + .width('100%') | ||
| 95 | + } | ||
| 96 | + .id(this.insId) | ||
| 97 | + .onAreaChange(() => { | ||
| 98 | + // this.updateLayout() | ||
| 99 | + }) | ||
| 100 | + .backgroundColor("#000000") | ||
| 101 | + .height('100%') | ||
| 102 | + .width('100%') | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + updateLayout() { | ||
| 106 | + let info = componentUtils.getRectangleById(this.insId); | ||
| 107 | + if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { | ||
| 108 | + if (info.size.width / info.size.height > this.videoWidth / this.videoHeight) { | ||
| 109 | + let scale = info.size.height / this.videoHeight; | ||
| 110 | + this.selfSize = new Size((this.videoWidth * scale / info.size.width) * 100 + "%", '100%'); | ||
| 111 | + } else { | ||
| 112 | + let scale = info.size.width / this.videoWidth; | ||
| 113 | + this.selfSize = new Size('100%', (this.videoHeight * scale / info.size.height) * 100 + "%"); | ||
| 114 | + } | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | +} |
| @@ -97,8 +97,11 @@ export struct WDPlayerRenderView { | @@ -97,8 +97,11 @@ export struct WDPlayerRenderView { | ||
| 97 | // this.updateLayout() | 97 | // this.updateLayout() |
| 98 | }) | 98 | }) |
| 99 | .backgroundColor("#000000") | 99 | .backgroundColor("#000000") |
| 100 | + | ||
| 101 | + // .height('100%') | ||
| 102 | + // .width('100%') | ||
| 100 | } | 103 | } |
| 101 | - | 104 | + |
| 102 | updateLayout() { | 105 | updateLayout() { |
| 103 | let info = componentUtils.getRectangleById(this.insId); | 106 | let info = componentUtils.getRectangleById(this.insId); |
| 104 | if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { | 107 | if (info.size.width > 0 && info.size.height > 0 && this.videoHeight > 0 && this.videoWidth > 0) { |
| @@ -5,7 +5,8 @@ | @@ -5,7 +5,8 @@ | ||
| 5 | "lockfileVersion": 3, | 5 | "lockfileVersion": 3, |
| 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | 6 | "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |
| 7 | "specifiers": { | 7 | "specifiers": { |
| 8 | - "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16" | 8 | + "@ohos/hypium@1.0.16": "@ohos/hypium@1.0.16", |
| 9 | + "@ohos/pulltorefresh@^2.0.5": "@ohos/pulltorefresh@2.0.5" | ||
| 9 | }, | 10 | }, |
| 10 | "packages": { | 11 | "packages": { |
| 11 | "@ohos/hypium@1.0.16": { | 12 | "@ohos/hypium@1.0.16": { |
| @@ -13,6 +14,12 @@ | @@ -13,6 +14,12 @@ | ||
| 13 | "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", | 14 | "integrity": "sha512-PC3jpwKERg68V+4dmKU+SLjNps9i5JcQH57rQriaTsh62NBgVZs4SceMmNOtrIOyldbEJ5mXSwoZwiG/nkRmTw==", |
| 14 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.16.har", | 15 | "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.16.har", |
| 15 | "registryType": "ohpm" | 16 | "registryType": "ohpm" |
| 17 | + }, | ||
| 18 | + "@ohos/pulltorefresh@2.0.5": { | ||
| 19 | + "name": "@ohos/pulltorefresh", | ||
| 20 | + "integrity": "sha512-mgBvJ6Ga70LmAoPKTOEPLFJluHUEAaBt2+7wF7R6223Vw6UEbZrof1MyvVOLEHk8Uc64ASIMW/TNQ8AHraTV5A==", | ||
| 21 | + "resolved": "https://repo.harmonyos.com/ohpm/@ohos/pulltorefresh/-/pulltorefresh-2.0.5.har", | ||
| 22 | + "registryType": "ohpm" | ||
| 16 | } | 23 | } |
| 17 | } | 24 | } |
| 18 | } | 25 | } |
| @@ -8,5 +8,8 @@ | @@ -8,5 +8,8 @@ | ||
| 8 | "description": "Please describe the basic information.", | 8 | "description": "Please describe the basic information.", |
| 9 | "main": "", | 9 | "main": "", |
| 10 | "version": "1.0.0", | 10 | "version": "1.0.0", |
| 11 | - "dependencies": {} | ||
| 12 | -} | 11 | + "dependencies": { |
| 12 | + "@ohos/pulltorefresh": "^2.0.5" | ||
| 13 | + }, | ||
| 14 | + "dynamicDependencies": {} | ||
| 15 | +} |
| @@ -33,7 +33,7 @@ struct DefaultWebPage { | @@ -33,7 +33,7 @@ struct DefaultWebPage { | ||
| 33 | webUrl: this.url, | 33 | webUrl: this.url, |
| 34 | backVisibility: false, | 34 | backVisibility: false, |
| 35 | reload: this.reload, | 35 | reload: this.reload, |
| 36 | - isPageEnd:this.isPageEnd | 36 | + isPageEnd:$isPageEnd |
| 37 | }) | 37 | }) |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | "pages/MorningEveningPaperPage", | 7 | "pages/MorningEveningPaperPage", |
| 8 | "pages/detail/AudioDetail", | 8 | "pages/detail/AudioDetail", |
| 9 | "pages/detail/MultiPictureDetailPage", | 9 | "pages/detail/MultiPictureDetailPage", |
| 10 | + "pages/detail/DynamicDetailPage", | ||
| 10 | "pages/launchPage/PrivacyPage", | 11 | "pages/launchPage/PrivacyPage", |
| 11 | "pages/launchPage/LaunchPage", | 12 | "pages/launchPage/LaunchPage", |
| 12 | "pages/launchPage/LaunchAdvertisingPage", | 13 | "pages/launchPage/LaunchAdvertisingPage", |
-
Please register or login to post a comment