yanlu

人民号主页

Showing 28 changed files with 1812 additions and 10 deletions
@@ -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 //
@@ -99,4 +99,6 @@ export class WDRouterPage { @@ -99,4 +99,6 @@ export class WDRouterPage {
99 static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage"); 99 static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
100 //搜索人民号主页 100 //搜索人民号主页
101 static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage"); 101 static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
  102 + //人民号主页
  103 + static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage");
102 } 104 }
@@ -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[];
@@ -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 }
  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 ContentShareDTO {
  2 + id?: number;
  3 + shareSwitch: number;
  4 + contentId?: number;
  5 + sharePicture: string;
  6 + fullUrl: string;
  7 + shareTitle: string;
  8 + shareDescription: string;
  9 +}
  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 +}
  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 +}
  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 +
@@ -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 }
@@ -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 }