yanlu

人民号主页

Showing 28 changed files with 1812 additions and 10 deletions
... ... @@ -238,6 +238,20 @@ export class HttpUrlUtils {
* 创作者详情接口
*/
static readonly CREATOR_DETAIL_LIST_DATA_PATH: string = "/api/rmrb-contact/contact/zh/c/master/detailList";
/**
* 客态查询发布作品数量
*/
static readonly ARTICLE_COUNT_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/count";
/**
* 客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
*/
static readonly ARTICLE_LIST_HOTS_DATA_PATH: string = "/api/rmrb-content-search/zh/c/article/articleList";
/**
* 客户端 客态主页页面-获取影响力
*/
static readonly CREATOR_INFLUENCE_HOTS_DATA_PATH: string = "/api/rmrb-bigdata-bi/zh/c/stats/creator/influence/info";
/**
* 早晚报列表
... ... @@ -727,6 +741,21 @@ export class HttpUrlUtils {
return url
}
static getArticleCountHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_COUNT_HOTS_DATA_PATH
return url
}
static getArticleListHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.ARTICLE_LIST_HOTS_DATA_PATH
return url
}
static getCreatorInfluenceInfoHotsDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_INFLUENCE_HOTS_DATA_PATH
return url
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
... ...
... ... @@ -99,4 +99,6 @@ export class WDRouterPage {
static searchPage = new WDRouterPage("wdComponent", "ets/pages/SearchPage");
//搜索人民号主页
static searchCreatorPage = new WDRouterPage("wdComponent", "ets/pages/SearchCreatorPage");
//人民号主页
static peopleShipHomePage = new WDRouterPage("wdComponent", "ets/components/page/PeopleShipHomePage");
}
... ...
... ... @@ -37,7 +37,8 @@ export {
postExecuteCollectRecordParams,
contentListParams,
postInteractAccentionOperateParams,
postRecommendListParams
postRecommendListParams,
contentListItem
} from './src/main/ets/bean/detail/MultiPictureDetailPageDTO';
export { InteractParam, ContentBean } from './src/main/ets/bean/content/InteractParam';
... ... @@ -122,3 +123,21 @@ export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoom
export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean';
export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO';
export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO';
export { contentVideosDTO } from './src/main/ets/bean/content/contentVideosDTO';
export { ContentExtDTO } from './src/main/ets/bean/peoples/ContentExtDTO';
export { ContentShareDTO } from './src/main/ets/bean/peoples/ContentShareDTO';
export {
PeopleShipUserDetailData,
ArticleCountData,
ArticleTypeData,
ArticleListData,
InfluenceData
} from './src/main/ets/bean/peoples/PeopleShipUserDetailData';
... ...
... ... @@ -6,9 +6,14 @@
*/
import { appStyleImagesDTO } from '../content/appStyleImagesDTO'
import {contentVideosDTO} from '../content/contentVideosDTO'
import { VlivesDTO } from '../peoples/VlivesDTO'
import { LiveDTO } from '../peoples/LiveDTO'
import { ContentExtDTO } from '../peoples/ContentExtDTO'
import { ContentShareDTO } from '../peoples/ContentShareDTO'
export interface ArticleListDTO {
listTitle: string;
mainPicCount: string;
mainPicCount: number;
videosCount: string;
voicesCount: string;
landscape: number;
... ... @@ -20,7 +25,7 @@ export interface ArticleListDTO {
id: string;
serialsId: string;
oldContentId: string;
type: string;
type: number;
tenancy: string;
clientPubFlag: string;
grayScale: string;
... ... @@ -62,11 +67,12 @@ export interface ArticleListDTO {
joinActivity: string;
userType: string;
content: object;
contentShare: [];
contentShare: ContentShareDTO[];
contentLinkData: string;
contentExt: [];
contentExt: ContentExtDTO[];
contentVideos: contentVideosDTO[];
contentPictures: [];
appStyleVideos: contentVideosDTO[];
contentPictures: appStyleImagesDTO[];
contentPayments: string;
contentPaymentStaffs: string;
contentTxt: [];
... ... @@ -78,7 +84,7 @@ export interface ArticleListDTO {
contentStatistics: string;
topicExistHeadImage: string;
topicComps: string;
live: string;
live: LiveDTO;
statusInfo: string;
askInfo: string;
askAttachmentList: string;
... ... @@ -87,5 +93,5 @@ export interface ArticleListDTO {
ttopicInteracts: string;
ttopic: string;
mlive: string;
vlives: string
vlives: VlivesDTO[];
}
\ No newline at end of file
... ...
... ... @@ -21,6 +21,7 @@ export interface ContentDTO {
lengthTime?: object;
linkUrl: string;
openLikes: number;
openComment?: number;
openUrl: string;
pageId: string;
// playUrls: any[];
... ...
... ... @@ -160,7 +160,7 @@ export interface postExecuteCollectRecordParams {
contentList: postExecuteCollectRecordParamsItem[]
}
interface contentListItem {
export interface contentListItem {
contentId: string;
contentType: number;
}
... ...
export interface ContentExtDTO {
id: number;
contentId: number;
openLikes: number;
openComment: number;
openDownload: number;
likesStyle: number;
top: number;
joinActivity: number;
hotFlag: number;
preCommentFlag: number;
currentPoliticsFlag: number;
appStyle: number;
tenancy: number;
downloadFlag: number;
publishType: number;
payment: number;
deleted: number;
createUser: string;
createTime: string;
updateUser: string;
updateTime: string;
keyArticle: number;
toExamine: number;
bestNoticer: number;
commentDisplay: number;
imageQuality: number;
haveAdver: number;
openAudio: number;
withdrawNum: number;
menuShow: string;
recommendShow: string;
recommendSelf: string;
concentration: string;
objectPosId: string;
articleExistVote: number;
zhExpireTimeAi: number;
zhTagsAi: string;
appReadCountShow: number;
}
\ No newline at end of file
... ...
export interface ContentShareDTO {
id?: number;
shareSwitch: number;
contentId?: number;
sharePicture: string;
fullUrl: string;
shareTitle: string;
shareDescription: string;
}
\ No newline at end of file
... ...
export interface LiveDTO {
status: string;
previewType: number;
planStartTime: number;
tplId: number;
startTime: number;
endTime: number;
userOrigin: string;
liveStyle: number;
liveWay: number;
liveStreamType: number;
liveExperienceSwitch: boolean;
liveExperienceTime: number;
handAngleSwitch: boolean;
likeStyle: string;
liveType: string;
preDisplay: number;
playbackSwitch: boolean;
originalAddress: string;
provinceName: string;
liveRemindSwitch: boolean;
recordUrlFlag: number;
vr: number;
landscape: string;
recordUrl: string;
uri: string;
}
\ No newline at end of file
... ...
import { ArticleListDTO } from '../component/ArticleListDTO'
/**
* http://192.168.1.3:3300/project/3796/interface/api/188629
* 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
* 接口路径:/contact/zh/c/master/detail
* 人民号-主页详情页面数据
*/
export interface PeopleShipUserDetailData {
articleCreation: number;
attentionNum: number;
authIcon: string;
authId: number;
authPersonal: string;
authTitle: string;
avatarFrame: string;
banControl: number;
browseNum: number;
categoryAuth: string;
city: string;
cnContentPublish: number;
cnIsComment: number;
cnIsLike: number;
cnLiveCommentControl: number;
cnLiveGiftControl: number;
cnLiveLikeControl: number;
cnLivePublish: number;
cnLiveShareControl: number;
cnShareControl: number;
contentPublish: number;
creatorId: string;
district: string;
dynamicControl: number;
dynamicCreation: number;
fansNum: number;
headPhotoUrl: string;
honoraryIcon: string;
honoraryTitle: string;
introduction: string;
isAttention: number;
isComment: number;
isLike: number;
liveCommentControl: number;
liveGiftControl: number;
liveLikeControl: number;
livePublish: number;
liveShareControl: number;
liveSwitch: number;
mainControl: number;
originUserId: string;
pictureCollectionCreation: number;
posterShareControl: number;
province: string;
region: string;
registTime: number;
shareControl: number;
shareUrl: string;
subjectType: number;
userId: string;
userName: string;
userType: string;
videoCollectionCreation: number;
videoCreation: number;
}
//article/count
/*
* 客户端 客态查询发布作品数量
* http://192.168.1.3:3300/project/3856/interface/api/190579
* 接口路径:/zh/c/article/count
* */
export interface ArticleCountData {
zbCount: number; //直播数量 (直播)
dtCount: number; //动态数量 (动态)
twCount: number; //图文数量 (文章)
ztCount: number; //组图数量 (图集)
spCount: number; // 视频数量 (视频)
publishCount: number; // 发布数量
serialsCount: number; //
}
export class ArticleTypeData {
name?: string; //名称
type?: number; // 类型
constructor(name?: string, type?: number) {
this.name = name;
this.type = type;
}
}
export interface ArticleListData {
totalCount: number;
pageNum: number;
pageSize: number;
list: ArticleListDTO[];
}
// 影响力
export interface InfluenceData {
creatorId: string;
influence: number;
influenceTotal: number;
}
\ No newline at end of file
... ...
export interface VlivesDTO {
id: number;
type: string;
// definition?: any;
// streamAppName?: any;
// streamName?: any;
pullStreamUrl: string;
// streamStatus?: any;
// shiftEnable?: any;
// clipEnable?: any;
// recordEnable?: any;
status: string;
liveId: number;
name: string;
// serialNum?: any;
streamWH: string;
recordUrl: string;
// playPreviewImageUri?: any;
// playPreviewImageFullUrl?: any;
// playPreviewImageBucket?: any;
showPad: boolean;
// liveStreamManagerId?: any;
// recordBucket?: any;
// recordUri?: any;
}
\ No newline at end of file
... ...
import router from '@ohos.router'
import { PeopleShipHomePageNavComponent } from '../peopleShipHomePage/PeopleShipHomeNavComponent'
import { PeopleShipHomePageTopComponent } from '../peopleShipHomePage/PeopleShipHomePageTopComponent'
import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { PeopleShipHomeListComponent } from '../peopleShipHomePage/PeopleShipHomeListComponent'
import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem'
import { HttpUrlUtils } from 'wdNetwork/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import { PageRepository } from '../../repository/PageRepository'
import {
postInteractAccentionOperateParams,
PeopleShipUserDetailData,
ArticleCountData
} from 'wdBean'
@Entry
@Component
struct PeopleShipHomePage {
// Todo 传入数据 后续在修改
creatorId: string = (router.getParams() as Record<string, string>)['creatorId'];
@State arr: number[] = []
// 页面详情数据
@Provide detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
// 每个分类数量
@State articleModel: ArticleCountData = {} as ArticleCountData
// 总滑动空间
scroller: Scroller = new Scroller()
// 顶部透明度
@State topOpacity: number = 0
//发布数量
@State publishCount: number = 0
// 是否关注
@Provide isAttention: string = '0'
// 是否开始更新关注
@Provide @Watch('handleChangeAttentionStata') isLoadingAttention: boolean = false
//关注显示
@Prop attentionOpacity: boolean = false
@Provide topHeight: number = 400
build() {
Stack({ alignContent: Alignment.TopStart }) {
// 头部返回
PeopleShipHomePageNavComponent({
attentionOpacity: this.attentionOpacity,
topOpacity: this.topOpacity,
detailModel: this.detailModel
})
.height($r('app.float.top_bar_height'))
.zIndex(100)
.backgroundColor(Color.Transparent)
if (this.detailModel && this.detailModel.userName) {
Scroll(this.scroller) {
Column() {
// 顶部相关
PeopleShipHomePageTopComponent({
creatorId: this.creatorId,
detailModel: this.detailModel,
publishCount: this.publishCount,
topHeight: this.topHeight
})
.width("100%")
.height(this.topHeight)
.backgroundColor(Color.White)
// 列表
PeopleShipHomeListComponent({
publishCount: this.publishCount,
creatorId: this.creatorId
})
}
.width("100%")
.justifyContent(FlexAlign.Start)
// .height(this.publishCount == 0 ? '100%' : '')
}
.edgeEffect(EdgeEffect.None)
.friction(0.6)
.backgroundColor(Color.White)
.scrollBar(BarState.Off)
.width('100%')
.height('100%')
.onScroll(() => {
// this.topOpacity = yOffset / (this.getDeviceHeight() * 0.2)
this.topOpacity = this.scroller.currentOffset().yOffset / 100
if (this.scroller.currentOffset().yOffset >= this.topHeight - 66) {
this.attentionOpacity = true
} else {
this.attentionOpacity = false
}
console.log(`全局请求失败拦截,message:${this.topOpacity}`)
// System.out.println("输出高度:"+ AttrHelper.vp2px(height,this));
})
}
}
}
async aboutToAppear() {
try {
// 获取页面信息
this.detailModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageDetailInfo(this.creatorId, '', '')
Logger.debug('PeopleShipHomePage', '获取页面信息', `${JSON.stringify(this.detailModel)}`)
// 获取关注
let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId)
Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`)
this.findFollowStata(followList)
} catch (exception) {
}
}
findFollowStata(followList: QueryListIsFollowedItem[]) {
if (followList.length > 0) {
let item: QueryListIsFollowedItem = followList[0]
Logger.debug('PeopleShipHomePage', '关注', `${JSON.stringify(item.status)}`)
this.isAttention = item.status
}
}
handleChangeAttentionStata() {
if (!this.isLoadingAttention) {
return
}
// 未登录,跳转登录
if (!HttpUrlUtils.getUserId()) {
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}
let status = 0
if (this.isAttention == '0') {
status = 1
}
const params: postInteractAccentionOperateParams = {
attentionUserType: this.detailModel.userType || '', //被关注用户类型(1 普通用户 2 视频号 3 矩阵号)
attentionUserId: this.detailModel.userId || '', // 被关注用户号主id
attentionCreatorId: this.creatorId || '', // 被关注用户号主id
// userType: 1,
// userId: HttpUrlUtils.getUserId(),
status: status,
}
PageRepository.postInteractAccentionOperate(params).then(res => {
if (this.isAttention == '1') {
this.isAttention = '0'
} else {
this.isAttention = '1'
}
this.isLoadingAttention = false
})
.catch(() => {
this.isLoadingAttention = false
})
}
}
... ...
import { Logger, DisplayUtils} from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import {
ContentDTO,
ArticleListDTO,
LiveDTO,
LiveInfoDTO,
FullColumnImgUrlDTO,
VideoInfoDTO,
RmhInfoDTO,
contentListParams,
InteractDataDTO,
ArticleTypeData,
ArticleListData,
PeopleShipUserDetailData
} from 'wdBean'
import { CardParser } from '../CardParser'
import { PageRepository } from '../../repository/PageRepository'
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { ErrorComponent } from '../view/ErrorComponent';
import NoMoreLayout from '../page/NoMoreLayout';
import { LazyDataSource } from 'wdKit';
const TAG = 'PeopleShipHomeArticleListComponent';
@Component
export struct PeopleShipHomeArticleListComponent {
// @State arr: ContentDTO[] = []
@State arr: LazyDataSource<ContentDTO> = new LazyDataSource();
@State typeModel: ArticleTypeData = new ArticleTypeData()
@State creatorId: string = ''
@Consume detailModel: PeopleShipUserDetailData
@State private viewType: number = 1;
currentIndex: number = 0
@Link @Watch('onChange') currentTopSelectedIndex: number
@State private hasMore: boolean = true
@State currentPage: number = 1
@State private isLoading: boolean = false
@Consume topHeight: number
build() {
if (this.viewType == 1) {
// LoadingComponent()
this.LoadingLayout()
} else if (this.viewType == 2) {
ErrorComponent()
} else {
this.ListLayout()
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), 20)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder
ListLayout() {
List() {
// 下拉刷新
LazyForEach(this.arr, (item: ContentDTO) => {
ListItem() {
CardParser({ contentDTO: item })
}.width("100%")
.backgroundColor(Color.Transparent)
}, (item: ContentDTO, index: number) => item.objectId + index.toString())
// 加载更多
ListItem() {
if (!this.hasMore) {
NoMoreLayout()
}
}
}
.width("100%")
.height("100%")
.edgeEffect(EdgeEffect.Spring)
.nestedScroll({
scrollForward: NestedScrollMode.PARENT_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
.onReachEnd(() => {
if(!this.isLoading && this.hasMore){
//加载分页数据
this.getPeopleShipPageArticleList()
}
})
}
aboutToAppear() {
if (this.currentIndex == this.currentTopSelectedIndex) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
onChange() {
if (this.currentIndex == this.currentTopSelectedIndex) {
this.currentPage = 1
this.getPeopleShipPageArticleList()
}
}
private async getPeopleShipPageArticleList() {
Logger.info(`获取页面信息PeopleShipHomeArticleListComponent${this.typeModel.type}`)
if (this.isLoading) {
return
}
try {
this.isLoading = true
let listData: ArticleListData = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleListData(this.creatorId, this.currentPage, 20, this.typeModel.type)
Logger.debug(TAG, `获取页面信息, ${listData.list.length}`);
if (listData && listData.list && listData.list.length > 0) {
this.viewType = 3;
if (listData.list.length === 20) {
this.currentPage++;
this.hasMore = true;
} else {
this.hasMore = false;
}
} else {
this.viewType = 1;
}
this.queryArticleContentInteractCount(listData)
Logger.debug(TAG, '展示的总数', `${this.arr.totalCount()}`)
}catch (exception) {
this.isLoading = false
if (this.arr.totalCount() == 0) {
this.viewType = 2
}
}
}
/**
* 查询点赞、收藏数量
*/
private queryArticleContentInteractCount(listData: ArticleListData) {
if (listData && listData.list && listData.list.length > 0) {
const params: contentListParams = {
contentList: []
}
listData.list.map((item: ArticleListDTO) => {
params.contentList.push({
contentId: item.id,
contentType: item.type
})
});
PageRepository.getContentInteract(params).then(res => {
this.articleListDTOChangeContentDTO(listData, res.data ?? [])
}).catch(() => {
this.articleListDTOChangeContentDTO(listData, [])
})
}
}
private articleListDTOChangeContentDTO(listData: ArticleListData, listCom: InteractDataDTO[]) {
this.isLoading = false
if (listData.list.length) {
for (const element of listData.list) {
let contentDTO = {} as ContentDTO
contentDTO.appStyle = this.changeCommon(element.appStyle)
contentDTO.newsTitle = element.title;
contentDTO.newsSummary = element.description;
contentDTO.objectId = element.id;
// 评论数
const comModel = listCom.find((item) => {
return item.contentId == element.id
})
if (comModel) {
contentDTO.interactData = comModel
}
//1:小图卡,2:大图卡,3:无图卡(全标题),
// 4:三图卡,5:头图卡,6:小视频卡,7:作者卡,8:财经快讯卡,
// 9:时间轴卡,10:大专题卡,
// 11.无图卡(标题缩略),12.无图卡(标题缩略)-人民号,
// 13.单图卡,14.单图卡-人民号,
// 15.大图卡-人民号,16.三图卡-人民号,17.图集卡,18.图集卡-人民号,
// 19.动态图文卡-人民号,20.动态视频卡-人民号,
// 21 小视频卡-人民号
contentDTO.objectType = `${element.type}`;
// contentDTO.productNum = element.productCount;
// if (master) {
// contentDTO.customWorkStatus = element.workStatus;
// }
// contentDTO.customSchedulePublishTime = element.contentPublishTasks.firstObject.schedulePublishTime;
contentDTO.fullColumnImgUrls = this.fullColumnImgUrls(element);
let rmhInfo = this.convertToRmhInfoWithAccountModel()
if (rmhInfo) {
contentDTO.rmhInfo = rmhInfo;
}
let liveInfo = this.convertToProgramLiveInfoModel(element.live);
if (liveInfo) {
contentDTO.liveInfo = liveInfo;
if (element.vlives && element.vlives.length > 0) {
let vlivesModel = element.vlives[0]
if (vlivesModel.recordUrl && vlivesModel.recordUrl.length > 0) {
contentDTO.liveInfo.replayUri = vlivesModel.recordUrl
}
}
}
let videInfo1 = this.convertToVideoInfo(element);
if (videInfo1) {
contentDTO.videoInfo = videInfo1
}
// contentDTO.shareInfo = [self.contentShare.firstObject convertToShareInfo];
// contentDTO.shareInfo.shareUrl = self.shareUrl;
if (element.createTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.createTime);
} else if (element.updateTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.updateTime);
} else if (element.firstPublishTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.firstPublishTime);
} else if (element.publishTime.length > 0) {
contentDTO.publishTime = this.convertPublishTimeWith(element.publishTime);
}
//图集数量
contentDTO.photoNum = element.mainPicCount;
if (element.contentExt && element.contentExt.length > 0) {
let extModel = element.contentExt[0];
contentDTO.openLikes = extModel.openLikes;
contentDTO.openComment = extModel.openComment;
}
// 页面
if (contentDTO.appStyle == '2' || contentDTO.appStyle == '13' || contentDTO.appStyle == '20') {
if (element.appStyleImages && element.appStyleImages.length > 0) {
contentDTO.coverUrl = element.appStyleImages[0].fullUrl
} else if (element.contentPictures && element.contentPictures.length > 0) {
contentDTO.coverUrl = element.contentPictures[0].fullUrl
}
}
// infoModel.api_isFollowListDataSource = YES;
// //infoModel.topicTemplate = [self.topicTemplate integerValue];
// //infoModel.objectLevel = self.topicType;
// //infoModel.pageId = self.pageId;
contentDTO.source = this.detailModel.userName;
// infoModel.opusAllowEdit = master && !([self.workStatus isEqualToString:@"2"] ||
// [self.workStatus isEqualToString:@"6"] ||
// [self.workStatus isEqualToString:@"5"] ||
// [self.workStatus isEqualToString:@"8"] ||
// !self.workStatus);
// infoModel.newsTag = [self convertNewsTagIsMaster:master];
// if (isSerial) {
// contentDTO.coverUrl = element.fullUrl;
// }
this.arr.push(contentDTO)
}
}
// this.arr = listData.list
}
//人民号主页
private convertToRmhInfoWithAccountModel() {
if (this.detailModel) {
let rmhInfo = {} as RmhInfoDTO
rmhInfo.rmhHeadUrl = this.detailModel.headPhotoUrl;
rmhInfo.rmhName = this.detailModel.userName;
rmhInfo.rmhId = this.detailModel.creatorId;
rmhInfo.userId = this.detailModel.userId;
rmhInfo.userType = this.detailModel.userType
rmhInfo.rmhDesc = this.detailModel.introduction;
rmhInfo.cnIsAttention = 0;
rmhInfo.cnIsComment = this.detailModel.isComment;
rmhInfo.cnIsLike = this.detailModel.cnIsLike;
rmhInfo.cnMainControl = this.detailModel.mainControl;
rmhInfo.cnShareControl = this.detailModel.shareControl;
rmhInfo.authIcon = this.detailModel.authIcon;
rmhInfo.authTitle = this.detailModel.authTitle;
// rmhInfo.honoraryIcon = this.detailModel.honoraryIcon;
// rmhInfo.honoraryTitle = this.detailModel.honoraryTitle;
rmhInfo.banControl = this.detailModel.banControl;
return rmhInfo
}
return null
}
//视频信息转换
private convertToVideoInfo(model: ArticleListDTO) {
if (model.appStyleVideos && model.appStyleVideos.length > 0) {
let firstModel = model.appStyleVideos[0]
let videoInfo: VideoInfoDTO = {} as VideoInfoDTO
videoInfo.videoDuration = firstModel.duration
videoInfo.videoUrl = firstModel.url
videoInfo.videoLandscape = firstModel.landscape
videoInfo.firstFrameImageUri = firstModel.fullUrl
return videoInfo
}
else if (model.contentVideos && model.contentVideos.length > 0) {
let firstModel = model.contentVideos[0]
let videoInfo: VideoInfoDTO = {} as VideoInfoDTO
videoInfo.videoDuration = firstModel.duration
videoInfo.videoUrl = firstModel.url
videoInfo.videoLandscape = firstModel.landscape
videoInfo.firstFrameImageUri = firstModel.fullUrl
return videoInfo
}
return null
}
// 直播信息转换
private convertToProgramLiveInfoModel(model: LiveDTO): LiveInfoDTO | null {
if (model) {
let liveInfo = {} as LiveInfoDTO
liveInfo.vrType = model.vr
liveInfo.liveState = model.status
liveInfo.liveLandscape = model.landscape
if (model.recordUrl && model.recordUrl.length > 0) {
liveInfo.replayUri = model.recordUrl
} else if (model.uri && model.uri.length > 0) {
liveInfo.replayUri = model.uri
}
return liveInfo
}
return null
}
// 图片转换
private fullColumnImgUrls(model: ArticleListDTO) {
let imagesList: FullColumnImgUrlDTO[] = [] as FullColumnImgUrlDTO[]
if (model.appStyleImages && model.appStyleImages.length > 0) {
for (const element of model.appStyleImages) {
let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO
imgUrl.format = element.format
imgUrl.height = element.height
imgUrl.weight = element.weight
imgUrl.size = element.size
imgUrl.landscape = element.landscape
imgUrl.url = element.fullUrl
imgUrl.fullUrl = element.fullUrl
imagesList.push(imgUrl)
}
}
else if (model.contentPictures && model.contentPictures.length > 0) {
for (const element of model.contentPictures) {
let imgUrl: FullColumnImgUrlDTO = {} as FullColumnImgUrlDTO
imgUrl.format = element.format
imgUrl.height = element.height
imgUrl.weight = element.weight
imgUrl.size = element.size
imgUrl.landscape = element.landscape
imgUrl.url = element.fullUrl
imgUrl.fullUrl = element.fullUrl
imagesList.push(imgUrl)
}
}
return imagesList
}
//时间转时间戳
private convertPublishTimeWith(time: string): string {
if (time.length) {
return `${new Date(time).getTime()}`
}
return `${new Date().getTime()}`
}
private changeCommon(appStyle: number): string {
if (appStyle == 12) {
return '11'
}
if (appStyle == 14) {
return '13'
}
if (appStyle == 15) {
return '2'
}
if (appStyle == 16) {
return '4'
}
if (appStyle == 18) {
return '17'
}
if (appStyle == 21) {
return '6'
}
return `${appStyle}`
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomeAttentionComponent {
@Consume isAttention: string
@Consume isLoadingAttention: boolean
build() {
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Button({type: ButtonType.Normal, stateEffect: false } ) {
Stack() {
Image(this.isAttention == '0'? $r('app.media.home_attention_no_left') : $r('app.media.home_attention_left'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
Row() {
if(this.isAttention == '0') {
if(this.isLoadingAttention) {
LoadingProgress()
.width(20)
.height(20)
.color($r('app.color.color_fff'))
}else {
Text('+ 关注')
.fontColor(Color.White)
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
.margin({
right: '10vp'
})
}
}else {
if(this.isLoadingAttention) {
LoadingProgress()
.width(20)
.height(20)
.color( $r('app.color.color_CCCCCC'))
}else {
Text('已关注')
.fontSize($r('app.float.vp_14'))
.fontWeight(500)
.fontColor($r('app.color.color_CCCCCC'))
.margin({
right: '10vp'
})
}
}
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
.backgroundColor(Color.Transparent)
.width(176)
.height(36)
.padding(0)
.fontColor(Color.Black)
.margin({
right: '-5vp'
})
.onClick(() => {
if(this.isLoadingAttention) {
return
}
this.isLoadingAttention = true
})
Button({type: ButtonType.Normal, stateEffect: false}) {
Stack() {
Image($r('app.media.home_share_right_icon'))
.width('100%')
.height('100%')
.objectFit(ImageFit.Cover)
Row() {
Image($r('app.media.QR_code_icon'))
.width(16)
.height(16)
.objectFit(ImageFit.Cover)
.margin({
left: '10vp'
})
Text('分享名片')
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.margin({ left: 5 })
}
.justifyContent(FlexAlign.Center)
.alignItems(VerticalAlign.Center)
.width('100%')
.height('100%')
}
.width('100%')
.height('100%')
}
.backgroundColor(Color.Transparent)
.width(176)
.height(36)
.padding(0)
.fontColor(Color.White)
.margin({
left: '-5vp'
})
.onClick(() => {
})
}
}
}
\ No newline at end of file
... ...
import { DisplayUtils, Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { PeopleShipHomeArticleListComponent } from './PeopleShipHomeArticleListComponent'
import { ArticleCountData, ArticleTypeData } from 'wdBean'
import CustomRefreshLoadLayout from '../page/CustomRefreshLoadLayout'
import { EmptyComponent } from '../view/EmptyComponent';
import { RefreshLayoutBean } from '../page/RefreshLayoutBean'
@Component
export struct PeopleShipHomeListComponent {
private controller: TabsController = new TabsController()
@State tabArr: ArticleTypeData[] = []
@State creatorId: string = ''
// 发布数量
@Link publishCount: number
@State currentIndex: number = 0
@State private isLoading: boolean = false
@Consume topHeight: number
build() {
if (this.isLoading) {
this.LoadingLayout()
}
// 列表
else if(this.publishCount == 0) {
// 无数据展示
EmptyComponent().height(DisplayUtils.getDeviceHeight() - this.topHeight)
} else {
Tabs({ barPosition: BarPosition.Start, controller: this.controller}) {
ForEach(this.tabArr, (item: ArticleTypeData, index: number) => {
TabContent() {
PeopleShipHomeArticleListComponent({
typeModel: item,
creatorId: this.creatorId,
currentTopSelectedIndex: this.currentIndex,
currentIndex: index
})
}.tabBar(this.tabBuilder(index, item.name ?? ''))
})
}
.backgroundColor(Color.White)
.barWidth('100%')
.barHeight('44vp')
.vertical(false)
.height(DisplayUtils.getDeviceHeight() - 100)
.animationDuration(0)
.divider({
strokeWidth: '0.5vp',
color: $r('app.color.color_F5F5F5'),
startMargin: 0,
endMargin: 0
})
.onChange((index: number) => {
this.currentIndex = index
})
}
}
@Builder
LoadingLayout() {
CustomRefreshLoadLayout({
refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), DisplayUtils.getDeviceHeight() - this.topHeight)
}).height(DisplayUtils.getDeviceHeight() - this.topHeight)
}
@Builder tabBuilder(index: number, name: string) {
Column() {
Text(name)
.fontColor(this.currentIndex === index ? $r('app.color.color_222222') : $r('app.color.color_666666') )
.fontSize(18)
.fontWeight(this.currentIndex === index ? 500 : 400)
.lineHeight(22)
.height(22)
.margin({ top: 11, bottom: 1 })
Divider()
.width('15vp')
.strokeWidth(2)
.color('#CB0000')
.opacity(this.currentIndex === index ? 1 : 0)
}.width('100%')
}
async aboutToAppear() {
try {
this.isLoading = true
// 1:点播(视频),2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件 13:音频 14:动态图文 15:动态视频
let articleModel = await PeopleShipHomePageDataModel.getPeopleShipHomePageArticleCountData(1, this.creatorId)
Logger.debug('PeopleShipHomeListComponent', '获取页面信息', `${JSON.stringify(articleModel)}`)
this.updateTopBarData(articleModel)
this.isLoading = false
} catch (exception) {
this.isLoading = false
}
}
// 设置顶部数据
updateTopBarData(articleModel: ArticleCountData) {
if (articleModel) {
this.publishCount = articleModel.publishCount
this.tabArr = []
if (articleModel.publishCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('全部')
this.tabArr.push(model)
}
if (articleModel.twCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('文章', 8)
this.tabArr.push(model)
}
if (articleModel.spCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('视频', 1)
this.tabArr.push(model)
}
if (articleModel.zbCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('直播', 2)
this.tabArr.push(model)
}
if (articleModel.dtCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('动态', 4)
this.tabArr.push(model)
}
if (articleModel.ztCount != 0) {
let model: ArticleTypeData = new ArticleTypeData('图集', 9)
this.tabArr.push(model)
}
}
}
}
\ No newline at end of file
... ...
import router from '@ohos.router'
import { PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
@Component
export struct PeopleShipHomePageNavComponent {
@Prop topOpacity: number
@Consume isAttention: string
@Consume isLoadingAttention: boolean
@Prop attentionOpacity: boolean
// 页面详情数据
@Prop detailModel: PeopleShipUserDetailData = {} as PeopleShipUserDetailData
build() {
Row() {
Stack({ alignContent: Alignment.TopStart }) {
Row()
.width('100%')
.height('100%')
.backgroundColor($r('app.color.white'))
.opacity(this.topOpacity)
Row() {
Row() {
// 返回
Image((this.topOpacity > 0.5 ? $r('app.media.icon_arrow_left') : $r('app.media.icon_arrow_left_white')))
.width('24vp')
.height('24vp')
.objectFit(ImageFit.Auto)
.margin({ left: '10vp' })
.onClick(() => {
router.back()
})
// 头像
PeopleShipHomePageHeadComponent({
diameter: 30,
iconDiameter: 10,
headPhotoUrl: this.detailModel.headPhotoUrl,
authIcon: this.detailModel.authIcon
})
.margin({
left: '10vp',
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
// 文字
Text(this.detailModel.userName)
.height('46vp')
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.margin({
left: '6vp'
})
.visibility((this.topOpacity > 0.5 ? Visibility.Visible : Visibility.Hidden))
if (this.isAttention == '0') {
// 关注
Button('+关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_ED2800'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor(Color.White)
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
} else {
Button('已关注', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(4)
.backgroundColor($r('app.color.color_F5F5F5'))
.width('54vp')
.height('24vp')
.onClick(() => {
if (this.isLoadingAttention){
return
}
this.isLoadingAttention = true
})
.margin({
left: '12vp',
})
.padding(0)
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.visibility((this.attentionOpacity ? Visibility.Visible : Visibility.Hidden))
}
}
.height('100%')
Blank()
// 分享
Image((this.topOpacity > 0.5 ? $r('app.media.icon_forward') : $r('app.media.icon_share')))
.width('24vp')
.height('24vp')
.objectFit(ImageFit.Auto)
.margin({ right: '10vp' })
.onClick(() => {
})
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Center)
.justifyContent(FlexAlign.SpaceBetween)
}
.zIndex(1000)
.width('100%')
.height('100%')
}
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomePageAttestationComponent {
@Prop name: string
@Prop content: string
build() {
Row() {
Text(this.name)
.lineHeight('16vp')
.fontColor($r('app.color.color_ED2800'))
.fontSize($r('app.float.vp_11'))
.backgroundColor($r('app.color.color_1AED2800'))
.textAlign(TextAlign.Center)
.borderRadius('2vp')
.margin({
right: '4vp',
left: '16vp',
})
.padding({
top: '3vp',
bottom: '3vp',
right: '6vp',
left: '6vp'
})
Text(this.content)
.lineHeight('22vp')
.fontSize($r('app.float.vp_12'))
.layoutWeight(1)
.fontColor($r('app.color.color_222222'))
.textAlign(TextAlign.Start)
.margin({
right: '16vp'
})
}
.width('100%')
.alignItems(VerticalAlign.Top)
}
}
\ No newline at end of file
... ...
@Component
export struct PeopleShipHomePageHeadComponent {
@State diameter: number = 30
@State iconDiameter: number = 10
@Prop headPhotoUrl: string = ''
@Prop authIcon: string = ''
build() {
Stack({ alignContent: Alignment.BottomEnd }) {
// 头像
Image( this.headPhotoUrl.length > 0 ? this.headPhotoUrl : $r('app.media.home_page_header_authority') )
.width(this.diameter)
.height(this.diameter)
.borderRadius(this.diameter/2)
.borderWidth('1vp')
.borderStyle(BorderStyle.Solid)
.borderColor(Color.White)
.objectFit(ImageFit.Auto)
if(this.authIcon.length > 0 ) {
Image( this.authIcon )
.width(this.iconDiameter)
.height(this.iconDiameter)
.borderRadius(this.iconDiameter/2)
.objectFit(ImageFit.Auto)
.margin({
right: '-3vp'
})
}
}
}
}
\ No newline at end of file
... ...
import measure from '@ohos.measure'
import { DisplayUtils } from 'wdKit'
import { PeopleShipHomePageHeadComponent } from './PeopleShipHomePageHeadComponent'
import { PeopleShipHomePageAttestationComponent } from './PeopleShipHomePageAttestationComponent'
import { Logger } from 'wdKit'
import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel'
import { InfluenceData, PeopleShipUserDetailData } from 'wdBean'
import { PeopleShipHomeAttentionComponent } from './PeopleShipHomeAttentionComponent'
@Component
export struct PeopleShipHomePageTopComponent {
@State creatorId: string = ''
// 是否关注
// @Prop isAttention: string
@State introductionType: number = 0
@State heightComponent: number = 0
// 页面详情数据
@Prop @Watch('onIntroductionUpdated') detailModel: PeopleShipUserDetailData
@Prop publishCount: number
// 影响力
@State influenceTotal: number = 0
// 简介是否可以展开
@State isCollapse: boolean = true
@State maxLines: number = Infinity
@State collapseTxt: string = '…展开';
private subTxt: string = '';
@State content: string = ''
@State topFixedHeight: number = 320
@State lineInNum: number = 1
@Link topHeight: number
build() {
Column() {
Stack({ alignContent: Alignment.TopStart}) {
// 顶部图片
Image($r('app.media.home_page_bg'))
.width('100%')
.height('120vp')
.objectFit(ImageFit.Fill)
.backgroundColor(Color.Black)
// 头像和名称
Row() {
// 头像
PeopleShipHomePageHeadComponent({
diameter: 80,
iconDiameter: 20,
headPhotoUrl: this.detailModel.headPhotoUrl,
authIcon: this.detailModel.authIcon
}).margin({
left: '10vp',
bottom: '20vp'
})
// 文字
Text(this.detailModel.userName)
.height('50vp')
.fontSize($r('app.float.vp_22'))
.fontColor($r('app.color.color_222222'))
.fontWeight(500)
.textAlign(TextAlign.Start)
.textOverflow({overflow: TextOverflow.Ellipsis})
.maxLines(2)
.layoutWeight(1)
.margin({
left: '12vp',
bottom: '10vp',
right: '12vp'
})
}
.width('100%')
.height('100%')
.alignItems(VerticalAlign.Bottom)
}
.width('100%')
.height('180vp')
.backgroundColor(Color.Transparent)
// 认证id:1蓝2黄,蓝v 只有官方认证,黄v有领域和身份认证
// 官方认证
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
PeopleShipHomePageAttestationComponent({name: '官方认证', content: this.detailModel.categoryAuth})
.margin({
top: '10vp',
bottom: '10vp'
})
}
if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '领域认证', content: this.detailModel.authTitle})
.margin({
top: '10vp',
bottom: '10vp'
})
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
PeopleShipHomePageAttestationComponent({name: '身份认证', content: this.detailModel.authPersonal})
.margin({
top: '10vp',
bottom: '10vp'
})
}
}
// 简介
if(this.lineInNum > 3) {
Row() {
Text() {
Span(this.content)
.fontColor($r('app.color.color_222222'))
Span(this.collapseTxt)
.onClick(()=>{
if(this.isCollapse){
this.maxLines = Infinity;
this.content = `简介:${this.detailModel.introduction}`
this.isCollapse = false;
this.collapseTxt = '收起';
this.topHeight = this.topFixedHeight + 21 * this.lineInNum
}else{
this.isCollapse = true;
this.collapseTxt = '…展开';
this.content = this.subTxt;
this.topHeight = this.topFixedHeight + 21 * 3
}
})
.fontColor($r('app.color.color_B0B0B0'))
}
.lineHeight('21vp')
.maxLines(this.maxLines)
.textOverflow({overflow: TextOverflow.Ellipsis})
.fontSize($r('app.float.vp_14'))
.key('home_page_introduction')
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}else {
Row() {
Text(`简介:${this.detailModel.introduction}`)
.fontSize($r('app.float.vp_14'))
.fontColor($r('app.color.color_222222'))
.lineHeight('21vp')
.maxLines(3)
.textOverflow({overflow: TextOverflow.Ellipsis})
.margin({
left: '16vp',
right: '16vp',
bottom: '10vp'
})
}.width('100%')
.alignItems(VerticalAlign.Top)
}
// IP归属地
Text(`IP归属地:${this.detailModel.region}`)
.lineHeight('18vp')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_999999'))
.textAlign(TextAlign.Start)
.width('100%')
.alignSelf(ItemAlign.Start)
.margin({
right: '16vp',
left: '16vp',
})
// 发布, 粉丝, 影响力
Row() {
// 发布
Text(this.computeShowNum(this.publishCount))
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.lineHeight('22vp')
.textAlign(TextAlign.Center)
.fontWeight(600)
.margin({
right: '4vp',
left: '16vp'
})
Text('发布')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.align(Alignment.Center)
.height('22vp')
// 粉丝
Text(this.computeShowNum(this.detailModel.fansNum))
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.lineHeight('22vp')
.fontWeight(600)
.textAlign(TextAlign.Center)
.margin({
right: '4vp',
left: '12vp'
})
Text('粉丝')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.height('22vp')
.align(Alignment.Center)
//影响力
Text(this.computeShowNum(this.influenceTotal))
.lineHeight('22vp')
.fontSize($r('app.float.vp_20'))
.fontColor($r('app.color.color_222222'))
.fontWeight(600)
.height('22vp')
.margin({
right: '4vp',
left: '12vp'
})
Text('影响力')
.fontSize($r('app.float.vp_12'))
.fontColor($r('app.color.color_666666'))
.height('22vp')
.align(Alignment.Center)
}
.alignItems(VerticalAlign.Center)
.backgroundColor(Color.Transparent)
.width('100%')
.margin({
top: '16vp'
})
// 分享-关注
PeopleShipHomeAttentionComponent()
.width('100%')
.margin({
top: '10vp',
bottom: '16vp'
})
Row()
.backgroundColor($r('app.color.color_F5F5F5'))
.width('100%')
.height('6vp')
}
.width('100%')
.height('100%')
}
async aboutToAppear() {
try {
// 获取影响力
let infData: InfluenceData = await PeopleShipHomePageDataModel.getCreatorInfluenceInfoData(this.creatorId)
Logger.debug('PeopleShipHomePageTopComponent', '获取获取影响力信息', `${JSON.stringify(infData)}`)
this.influenceTotal = infData.influenceTotal
} catch (exception) {
}
if (this.content.length == 0) {
this.onIntroductionUpdated()
}
}
// 不听减去2个字-一直到时3行
private compIntroductionTextHeights() {
let introduction = `简介:${this.detailModel.introduction}`
let lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
while (lineInNum1 > 3 ) {
introduction = introduction.substring(0, introduction.length - 2);
lineInNum1 = this.getTextLineNum(introduction, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
}
introduction = introduction.substring(0, introduction.length - 3);
Logger.debug('PeopleShipHomePageTopComponent', '3行简介:', `${introduction}`)
this.subTxt = introduction;
}
// 获取文本几行
private getTextLineNum(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
let size = this.topMeasureText(text, constraintWidth, lineHeight, fontSize)
let height: number = Number(size.height)
return Math.ceil(px2vp(height)/lineHeight)
}
private topMeasureText(text: string, constraintWidth: number, lineHeight: number, fontSize: number | string | Resource) {
return measure.measureTextSize({
textContent: text,
fontSize: fontSize,
lineHeight: lineHeight,
constraintWidth: constraintWidth,
})
}
onIntroductionUpdated() {
if (this.content.length == 0 && this.detailModel.introduction ) {
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum > 3) {
this.compIntroductionTextHeights()
this.content = this.subTxt
}
}
if (this.detailModel) {
this.topFixedHeight = 336
if(this.detailModel.authId == 1 && this.detailModel.categoryAuth.length > 0) {
this.topFixedHeight += this.getTextLineNum(this.detailModel.categoryAuth, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
else if(this.detailModel.authId == 2) {
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += this.getTextLineNum(this.detailModel.authTitle, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
if (this.detailModel.authPersonal && this.detailModel.authPersonal.length > 0 ){
if (this.detailModel.authTitle && this.detailModel.authTitle.length > 0 ){
this.topFixedHeight += 10
}
this.topFixedHeight += this.getTextLineNum(this.detailModel.authPersonal, DisplayUtils.getDeviceWidth() - 90, 22, $r('app.float.vp_12'))*22
}
}
this.lineInNum = this.getTextLineNum(`简介:${this.detailModel.introduction}`, DisplayUtils.getDeviceWidth() - 32, 21, $r('app.float.vp_14'))
if (this.lineInNum <= 3) {
this.topFixedHeight += (21 * this.lineInNum)
this.topHeight = this.topFixedHeight
}else {
this.topHeight = this.topFixedHeight + (this.isCollapse ? 21*3 : 21 * this.lineInNum )
}
}
}
private computeShowNum(count: number) {
if(count >= 10000) {
return `${(count/10000).toFixed(1)}万`
}
return `${count}`
}
}
\ No newline at end of file
... ...
import { OtherUserDetailRequestItem } from './OtherUserDetailRequestItem';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { PeopleShipUserDetailData, ArticleCountData, ArticleListData, InfluenceData } from 'wdBean';
import HashMap from '@ohos.util.HashMap';
import { Logger } from 'wdKit';
import { FollowListStatusRequestItem } from './FollowListStatusRequestItem';
import { QueryListIsFollowedItem } from './QueryListIsFollowedItem';
const TAG = 'PeopleShipHomePageDataModel';
export class PeopleShipHomePageDataModel {
/*获取人民号主页详情*/
static fetchPeopleUserDetailData(item: OtherUserDetailRequestItem) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<PeopleShipUserDetailData>>(url, item, headers)
}
static async getPeopleShipHomePageDetailInfo(creatorId: string, userType: string, userId: string): Promise<PeopleShipUserDetailData> {
let model = new OtherUserDetailRequestItem(creatorId, userType, userId)
return new Promise<PeopleShipUserDetailData>((success, error) => {
Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`);
PeopleShipHomePageDataModel.fetchPeopleUserDetailData(model)
.then((resDTO: ResponseDTO<PeopleShipUserDetailData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageDetailInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageDetailInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.debug(TAG, "getPeopleShipHomePageDetailInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageDetailInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态查询发布作品数量*/
static fetchArticleCountHotsData(includeLive: number, creatorId: string) {
let url = HttpUrlUtils.getArticleCountHotsDataUrl() + `?includeLive=${includeLive}&creatorId=${creatorId}`
// let url = 'https://pdapis.pdnews.cn/api/rmrb-content-search/zh/c/article/count' + `?includeLive=${includeLive}&creatorId=${creatorId}`
Logger.debug(TAG, `${url}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ArticleCountData>>(url, headers)
}
static async getPeopleShipHomePageArticleCountData(includeLive: number, creatorId: string): Promise<ArticleCountData> {
Logger.debug(TAG, `getPeopleShipHomePageArticleCountData start`);
return new Promise<ArticleCountData>((success, error) => {
Logger.debug(TAG, `getPeopleShipHomePageArticleCountData pageInfo start`);
PeopleShipHomePageDataModel.fetchArticleCountHotsData(includeLive, creatorId)
.then((resDTO: ResponseDTO<ArticleCountData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageArticleCountData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageArticleCountData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getPeopleShipHomePageArticleCountData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageArticleCountData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表*/
static fetchArticleListHotsData(creatorId: string, pageNum: number, pageSize: number, type?: number) {
let url = HttpUrlUtils.getArticleListHotsDataUrl() + `?creatorId=${creatorId}&pageNum=${pageNum}&pageSize=${pageSize}`
if (type) {
url += `&type=${type}`
}
Logger.debug(TAG, `${url}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ArticleListData>>(url, headers)
}
static async getPeopleShipHomePageArticleListData(creatorId: string, pageNum: number, pageSize: number, type?: number): Promise<ArticleListData> {
Logger.debug(TAG, `getPeopleShipHomePageArticleListData start`);
return new Promise<ArticleListData>((success, error) => {
Logger.debug(TAG, `getPeopleShipHomePageArticleListData pageInfo start`);
PeopleShipHomePageDataModel.fetchArticleListHotsData(creatorId, pageNum, pageSize, type)
.then((resDTO: ResponseDTO<ArticleListData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageArticleListData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageArticleListData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getPeopleShipHomePageArticleListData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageArticleListData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态查询影响力*/
static fetchCreatorInfluenceInfoHotsData(creatorId: string) {
let url = HttpUrlUtils.getCreatorInfluenceInfoHotsDataUrl() + `?creatorId=${creatorId}`
Logger.debug(TAG, `${url}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<InfluenceData>>(url, headers)
}
static async getCreatorInfluenceInfoData(creatorId: string): Promise<InfluenceData> {
Logger.debug(TAG, `getCreatorInfluenceInfoData start`);
return new Promise<InfluenceData>((success, error) => {
Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`);
PeopleShipHomePageDataModel.fetchCreatorInfluenceInfoHotsData(creatorId)
.then((resDTO: ResponseDTO<InfluenceData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
// 获取关注
static fetchHomePageFollowListStatusData(creatorId: string) {
let url = HttpUrlUtils.getFollowListStatusDataUrl()
let model = new QueryListIsFollowedItem(creatorId)
let object = new FollowListStatusRequestItem()
object.creatorIds = [model]
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers)
};
static async getHomePageFollowListStatusData(creatorId: string): Promise<QueryListIsFollowedItem[]> {
Logger.debug(TAG, `getCreatorInfluenceInfoData start`);
return new Promise<QueryListIsFollowedItem[]>((success, error) => {
Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`);
PeopleShipHomePageDataModel.fetchHomePageFollowListStatusData(creatorId)
.then((resDTO: ResponseDTO<QueryListIsFollowedItem[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}
... ...
... ... @@ -231,6 +231,18 @@
{
"name": "margin_116",
"value": "116vp"
},
{
"name": "vp_11",
"value": "11vp"
},
{
"name": "vp_22",
"value": "22vp"
},
{
"name": "vp_14",
"value": "14vp"
}
]
}
... ...
... ... @@ -14,6 +14,7 @@
"components/page/MyCollectionListPage",
"pages/OtherNormalUserHomePage",
"pages/SearchPage",
"pages/SearchCreatorPage"
"pages/SearchCreatorPage",
"components/page/PeopleShipHomePage"
]
}
\ No newline at end of file
... ...