zhenghy
Showing 60 changed files with 2277 additions and 140 deletions
... ... @@ -20,3 +20,5 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum';
export { ScreenType } from './src/main/ets/enum/ScreenType';
export { SpConstants } from './src/main/ets/constants/SpConstants';
export { DisplayDirection } from './src/main/ets/constants/VideoConstants';
... ...
export enum DisplayDirection {
VERTICAL,
VIDEO_HORIZONTAL
}
\ No newline at end of file
... ...
import { Action } from './Action';
interface dataObject {
operateType?: string
webViewHeight?: string
dataJson?: string
}
... ...
... ... @@ -101,4 +101,9 @@ export class SPHelper {
// preferences.clearSync()
// preferences.flush()
// }
public getPreferences(){
let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename);
return preferences;
}
}
\ No newline at end of file
... ...
... ... @@ -235,6 +235,25 @@ export class HttpUrlUtils {
static readonly SEARCH_RESULT_LIST_DATA_PATH: string = "/api/rmrb-search-api/zh/c/search";
/**
* 创作者详情接口
*/
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";
/**
* 早晚报列表
* 根据页面id获取页面楼层列表
* https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/pageInfo?pageId=28927
... ... @@ -717,6 +736,26 @@ export class HttpUrlUtils {
return url
}
static getCreatorDetailListDataUrl() {
let url = HttpUrlUtils._hostUrl + HttpUrlUtils.CREATOR_DETAIL_LIST_DATA_PATH
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>()
//
... ...
... ... @@ -97,4 +97,8 @@ export class WDRouterPage {
static broadcastPage = new WDRouterPage("phone", "ets/pages/broadcast/BroadcastPage");
//搜索主页
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");
}
... ...
... ... @@ -41,6 +41,7 @@ export function performJSCallNative(data: Message, call: Callback) {
class AppInfo {
plat: string = ''
system: string = ''
networkStatus: number = 1
// TODO 完善
}
... ... @@ -52,6 +53,7 @@ function getAppPublicInfo(): string {
info.plat = 'Phone'
// 直接用Android,后续适配再新增鸿蒙
info.system = 'Android'
info.networkStatus = 1
let result = JSON.stringify(info)
return result;
}
... ...
... ... @@ -83,7 +83,7 @@ export struct WdWebLocalComponent {
//webview 高度设置
private setCurrentPageOperate: (data: Message) => void = (data) => {
console.log("setCurrentPageOperate", JSON.stringify(data))
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate) {
if (data.handlerName === H5CallNativeType.jsCall_currentPageOperate && data?.data?.operateType === '8') {
if (typeof this.webHeight === 'number') {
if (Number(data?.data?.webViewHeight) > this.webHeight) {
this.webHeight = Number(data?.data?.webViewHeight)
... ...
... ... @@ -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 H5ReceiveDataExtraBean {
creatorId: string;
isLogin: string;
networkStatus: number;
loadImageOnlyWifiSwitch: string
}
\ No newline at end of file
... ...
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
... ...
... ... @@ -55,7 +55,13 @@ export struct ImageAndTextWebComponent {
}
// TODO 对接user信息、登录情况
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = { creatorId: '', isLogin: '0' } as H5ReceiveDataExtraBean
let h5ReceiveDataExtraBean: H5ReceiveDataExtraBean = {
creatorId: '',
isLogin: '0',
networkStatus: 1,
loadImageOnlyWifiSwitch: '2',
} as H5ReceiveDataExtraBean
let h5ReceiveDataJsonBean: H5ReceiveDataJsonBean = {
contentId: contentId,
contentType: contentType
... ... @@ -86,7 +92,7 @@ export struct ImageAndTextWebComponent {
webResource: $rawfile('apph5/index.html'),
backVisibility: false,
onWebPrepared: this.onWebPrepared.bind(this),
isPageEnd:$isPageEnd
isPageEnd: $isPageEnd
})
}
... ...
... ... @@ -16,7 +16,7 @@ export default struct MinePageMoreFunctionUI {
.fontColor($r('app.color.color_666666'))
.fontSize('29lpx')
.margin({ left: "31lpx" })
.fontWeight(600)
.fontWeight('600lpx')
}.height('92lpx')
.width('100%')
.justifyContent(FlexAlign.Center)
... ...
import { WDRouterRule, WDRouterPage } from 'wdRouter'
import MinePagePersonalFunctionsItem from '../../viewmodel/MinePagePersonalFunctionsItem'
import router from '@ohos.router'
@Component
export default struct MinePagePersonFunctionUI {
@Link personalData:MinePagePersonalFunctionsItem[]
@Prop isLogin:boolean
@Consume('isLogin')@Watch('loginChange') loginState:Record<string,string>
loginChange(){
if(this.loginState){
this.isLogin=true
}
}
build() {
Grid(){
... ...
import { Logger, UserDataLocal } from 'wdKit'
import { Logger, StringUtils, UserDataLocal } from 'wdKit'
import { WDRouterPage, WDRouterRule } from 'wdRouter'
import MinePageDatasModel from '../../model/MinePageDatasModel'
const TAG = "MinePageUserSimpleInfoUI"
... ... @@ -12,18 +12,13 @@ export default struct MinePageUserSimpleInfoUI {
@State levelHead:string = ""
@State levelId:number = 0
@Consume('isLogin') @Watch('loginChange') loginState:Record<string,string>
loginChange(){
Logger.debug("isLogin",'MinePageUserSimpleInfoUI')
if(this.loginState){
this.isLogin=true
}
}
loginStateChange(){
if(this.isLogin){
this.getUserInfo()
this.getUserLevel()
}else{
this.headPhotoUrl = ""
this.levelHead = ""
}
}
... ... @@ -31,17 +26,20 @@ export default struct MinePageUserSimpleInfoUI {
Row(){
//头像
Stack(){
Image(this.headPhotoUrl)
Image(this.headPhotoUrl==""?$r('app.media.default_head'):this.headPhotoUrl)
.alt($r('app.media.default_head'))
.width('100lpx')
.height('100lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
if(StringUtils.isNotEmpty(this.levelHead)){
Image(this.levelHead)
.width('130lpx')
.height('130lpx')
.objectFit(ImageFit.Cover)
.borderRadius(50)
}
}.width('130lpx')
.height('130lpx')
.alignContent(Alignment.Center)
... ...
... ... @@ -4,11 +4,10 @@ import MinePageMoreFunctionModel from '../../viewmodel/MinePageMoreFunctionModel
import MinePageDatasModel from '../../model/MinePageDatasModel'
import MinePageUserSimpleInfoUI from '../mine/MinePageUserSimpleInfoUI'
import MinePagePersonFunctionUI from '../mine/MinePagePersonFunctionUI'
import MinePageCardUI from '../mine/MinePageCardUI'
import MinePageCreatorFunctionUI from '../mine/MinePageCreatorFunctionUI'
import MinePageMoreFunctionUI from '../mine/MinePageMoreFunctionUI'
import { SPHelper, StringUtils } from 'wdKit'
import { SpConstants } from 'wdConstant'
import dataPreferences from '@ohos.data.preferences';
const TAG = 'MinePageComponent';
... ... @@ -24,12 +23,29 @@ export struct MinePageComponent {
@State creatorData:MinePageCreatorFunctionsItem[] = []
@State moreData:MinePageMoreFunctionModel[] = []
scroller: Scroller = new Scroller()
preferences: dataPreferences.Preferences | null = null;
aboutToAppear(){
this.getUserLogin()
this.getFunctionData()
this.addLoginStatusObserver()
}
async addLoginStatusObserver(){
this.preferences = await SPHelper.default.getPreferences();
let observer = (key: string) => {
if(key == SpConstants.USER_ID){
if(StringUtils.isEmpty(SPHelper.default.getSync(SpConstants.USER_ID,""))){
this.isLogin = false
}else {
this.isLogin = true
}
}
}
this.preferences.on('change', observer);
}
getFunctionData(){
//个人功能数据
this.personalData = MinePageDatasModel.getPersonalFunctionsData()
... ...
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 { ContentDTO } from 'wdBean/Index';
@Component
export struct ActivityItemComponent {
@State contentDTO: ContentDTO = {} as ContentDTO;
build() {
Row() {
Stack(){
Image(this.contentDTO.coverUrl)
.width('207lpx')
.height('276lpx')
.objectFit(ImageFit.Auto)
.borderRadius('7lpx')
Row(){
Image(this.contentDTO.programType+"" === "1" ? $r('app.media.activity_is_start_icon') :$r('app.media.activity_not_begin_icon'))
.width('42lpx')
.height('35lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.Medium)
Text(this.contentDTO.programType+"" === "1" ? "进行中" :"未开始")
.fontColor($r('app.color.white'))
.fontSize('21lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
}.margin({right:'19lpx',bottom:'13lpx'})
}.alignContent(Alignment.BottomEnd)
Column() {
Row(){
// Text(){
// // backgroundColor 不生效
// Span(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
// .fontColor($r('app.color.main_red'))
// .fontSize('23lpx')
// .fontWeight('400lpx')
// .lineHeight('31lpx')
// .padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
// .backgroundColor( "#FF0"/*$r('app.color.color_ED2800')*/)
// .borderRadius('10lpx')
// .margin({ right: '10lpx' })
//
// Span(this.contentDTO.newsTitle)
// .fontColor($r('app.color.color_222222'))
// .fontSize('33lpx')
// .fontWeight('400lpx')
// .lineHeight('48lpx')
// }.textAlign(TextAlign.Start)
// .maxLines(2)
// .textOverflow({ overflow: TextOverflow.Ellipsis })
//TODO 这里的样式(objectType) 只写了两个,其他的需要扩展
Text(this.contentDTO.objectType == "new_collect" ? "征稿" : this.contentDTO.objectType == "vote" ? "投票":"")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
.textAlign(TextAlign.Center)
.padding({left:'10lpx',right:'10lpx',top:'6lpx',bottom:'6lpx'})
.backgroundColor( $r('app.color.color_ED2800'))
.borderRadius('10lpx')
.margin({ right: '10lpx' })
Text(this.contentDTO.newsTitle)
.fontColor($r('app.color.color_222222'))
.fontSize('33lpx')
.fontWeight('400lpx')
.lineHeight('48lpx')
.textAlign(TextAlign.Start)
.maxLines(2)
.layoutWeight(1)
}
.margin({ bottom: '15lpx' })
.alignItems(VerticalAlign.Top)
.width('100%')
Row() {
Image($r('app.media.time_icon'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.margin({ right: '4lpx' })
.interpolation(ImageInterpolation.Medium)
Text("时间:" + this.contentDTO.startTime.split(" ")[0] + "~" + this.contentDTO.endTime.split(" ")[0])
.fontColor($r('app.color.color_999999'))
.fontSize('23lpx')
.fontWeight('400lpx')
.lineHeight('31lpx')
}
Blank()
Text(this.contentDTO.programType+"" === "1" ? "立即参与" : "立即查看")
.fontColor($r('app.color.white'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('38lpx')
.width('154lpx')
.height('54lpx')
.textAlign(TextAlign.Center)
.backgroundColor(this.contentDTO.programType+"" == "1" ? $r('app.color.color_ED2800') : $r('app.color.color_F07E47'))
.borderRadius('6lpx')
}.alignItems(HorizontalAlign.Start)
.width('428lpx')
.height('276lpx')
}.height('330lpx')
.justifyContent(FlexAlign.SpaceBetween)
.width('100%')
.padding({left:'31lpx',right:'31lpx'})
}
}
\ No newline at end of file
... ...
... ... @@ -253,7 +253,8 @@ export struct SearchComponent {
if(StringUtils.isNotEmpty(this.searchText)){
SearcherAboutDataModel.putSearchHistoryData(this.searchText)
this.getSearchHistoryData()
ToastUtils.shortToast("插入一条搜索记录")
this.getSearchHotResData(this.searchText)
}
}else{
router.back()
... ...
... ... @@ -3,12 +3,15 @@ import { ContentDTO,
FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
import { LiveInfoDTO } from 'wdBean/src/main/ets/bean/detail/LiveInfoDTO'
import { VoiceInfoDTO } from 'wdBean/src/main/ets/bean/detail/VoiceInfoDTO'
import { LazyDataSource, StringUtils } from 'wdKit/Index'
import { LazyDataSource, StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
import { SearchResultContentData } from '../../viewmodel/SearchResultContentData'
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -18,7 +21,7 @@ export struct SearchResultContentComponent{
@State searchType:string = ""
@State data: LazyDataSource<ContentDTO> = new LazyDataSource();
@State data_rmh: SearchRmhDescription[] = []
@State count:number = 0;
@State count:number = -1;
@State isLoading:boolean = false
@State hasMore:boolean = true
curPageNum:number = 1;
... ... @@ -52,13 +55,32 @@ export struct SearchResultContentComponent{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
this.data_rmh .forEach((data)=>{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
this.data_rmh.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headerPhotoUrl = item.headPhotoUrl
}
})
})
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
}
this.getInteractData(value)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
}
... ... @@ -105,7 +127,7 @@ export struct SearchResultContentComponent{
cityCode: value.data.cityCode,
coverSize: "",
coverType: -1,
coverUrl: value.data.appStyleImages.split("&&")[0],
coverUrl: this.searchType=="activity"?value.data.zhChannelPageImg:value.data.appStyleImages.split("&&")[0],
description: value.data.description,
districtCode: value.data.districtCode,
endTime: value.data.endTime,
... ... @@ -122,7 +144,7 @@ export struct SearchResultContentComponent{
programId: "",
programName: "",
programSource: -1,
programType: -1,
programType: Number.parseInt(value.data.status),
provinceCode: value.data.provinceCode,
showTitleEd: value.data.showTitleEd,
showTitleIng: value.data.showTitleIng,
... ... @@ -134,7 +156,7 @@ export struct SearchResultContentComponent{
vImageUrl: "",
screenType: "",
source: StringUtils.isEmpty(value.data.creatorName) ? value.data.sourceName : value.data.creatorName,
objectId: "",
objectId: value.data.id,
objectType: value.data.type,
channelId: value.data.channelId,
relId: value.data.relId,
... ... @@ -175,6 +197,7 @@ export struct SearchResultContentComponent{
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
... ... @@ -186,42 +209,76 @@ export struct SearchResultContentComponent{
Column(){
if (this.data_rmh!=null && this.data_rmh.length > 0) {
//List
List() {
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image($r('app.media.default_head'))
.width('84lpx')
.height('84lpx')
Image(item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
Text(item.creatorName)
.fontSize('20lpx')
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'150lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}.onClick(()=>{
//TODO 跳转
})
.width('150lpx')
.height('100%')
})
ListItem(){
Column(){
Text("查看更多")
.width('19lpx')
.fontSize('19lpx')
.fontWeight('400lpx')
.lineHeight('27lpx')
.fontColor($r('app.color.color_9E9E9E'))
}.borderRadius({topLeft:'4lpx',bottomLeft:'4lpx'})
.height('180lpx')
.width('77lpx')
.backgroundColor($r('app.color.color_EDEDED'))
.justifyContent(FlexAlign.Center)
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage)
})
}
.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.edgeEffect(EdgeEffect.Spring)
.scrollBar(BarState.Off)
.listDirection(Axis.Horizontal)
.width('100%')
.height('150lpx')
.onReachEnd(()=>{
if(!this.isLoading){
//进入更多关注页
}
})
.height('219lpx')
Divider()
.width('100%')
.height('12lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('12lpx')
}
//List
List({ space: '6lpx' }) {
LazyForEach(this.data, (item: ContentDTO, index: number) => {
ListItem() {
Column(){
if(this.searchType == "activity"){
ActivityItemComponent({contentDTO:item})
}else{
CardParser({contentDTO:item})
}
if(index != this.data.totalCount()-1 ){
Divider()
.width('100%')
... ... @@ -245,7 +302,6 @@ export struct SearchResultContentComponent{
}.cachedCount(6)
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
.margin({top:'23lpx',left:'23lpx',right:'23lpx'})
.layoutWeight(1)
.onReachEnd(()=>{
console.log(TAG,"触底了");
... ...
... ... @@ -7,6 +7,8 @@ import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
import { SearchResultContentData } from '../viewmodel/SearchResultContentData';
import { contentListParams, InteractDataDTO } from 'wdBean/Index';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { CreatorDetailResponseItem } from '../viewmodel/CreatorDetailResponseItem';
const TAG = "SearcherAboutDataModel"
... ... @@ -320,6 +322,37 @@ class SearcherAboutDataModel{
}
/**
* 获取关注详情 列表
*/
getCreatorDetailListData(object:CreatorDetailRequestItem): Promise<CreatorDetailResponseItem[]> {
return new Promise<CreatorDetailResponseItem[]>((success, error) => {
Logger.info(TAG, `getCreatorDetailListData start`);
this.fetchCreatorDetailListData(object).then((navResDTO: ResponseDTO<CreatorDetailResponseItem[]>) => {
if (!navResDTO || navResDTO.code != 0) {
success([])
return
}
Logger.info(TAG, "getCreatorDetailListData then,SearchResultListResDTO.timeStamp:" + navResDTO.timestamp);
let navigationBean = navResDTO.data as CreatorDetailResponseItem[]
success(navigationBean);
}).catch((err: Error) => {
Logger.error(TAG, `getCreatorDetailListData catch, error.name : ${err.name}, error.message:${err.message}`);
success([])
})
})
}
fetchCreatorDetailListData(object:CreatorDetailRequestItem) {
let url = HttpUrlUtils.getCreatorDetailListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<CreatorDetailResponseItem[]>>(url,object, headers)
};
}
const searcherAboutDataModel = SearcherAboutDataModel.getInstance()
... ...
... ... @@ -2,7 +2,6 @@ import router from '@ohos.router'
import { Params } from 'wdBean';
import { StringUtils } from 'wdKit';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { CardParser } from '../components/CardParser';
import { HomePageBottomComponent } from '../components/mine/home/HomePageBottomComponent';
import MinePageDatasModel from '../model/MinePageDatasModel';
... ... @@ -183,37 +182,14 @@ struct MineHomePage {
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
HomePageBottomComponent({style:0})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
HomePageBottomComponent({style:1})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -221,8 +197,6 @@ struct MineHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -232,8 +206,8 @@ struct MineHomePage {
}
}.width('100%')
.layoutWeight(1)
}
}
@Builder MineHomeTitleTransparent() {
RelativeContainer() {
//标题栏目
... ... @@ -368,9 +342,9 @@ struct MineHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
/**
... ...
... ... @@ -172,42 +172,17 @@ struct OtherNormalUserHomePage {
.width('100%')
.backgroundColor($r('app.color.white'))
}
//间隔符
Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
Column(){
Column() {
// 页签
Row({ space: 7 }) {
Scroll() {
Row() {
this.TabBuilder(0,"评论")
this.TabBuilder(1,"关注")
}
.justifyContent(FlexAlign.Start)
}
.align(Alignment.Start)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.width('90%')
.padding({left:'31lpx'})
}
.alignItems(VerticalAlign.Bottom)
.width('100%')
}
.backgroundColor($r('app.color.white'))
.alignItems(HorizontalAlign.Start)
.width('100%')
//tab 页面
Tabs({controller: this.controller}) {
TabContent() {
OtherHomePageBottomCommentComponent({curUserId:this.curUserId,levelHead:this.levelHead,commentNum:$commentNum})
}
}.tabBar(this.TabBuilder(0,"评论"))
TabContent() {
OtherHomePageBottomFollowComponent({curUserId:this.curUserId})
}
}.tabBar(this.TabBuilder(1,"关注"))
}
.backgroundColor($r('app.color.white'))
.animationDuration(0)
... ... @@ -215,8 +190,6 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
})
.vertical(false)
.barHeight(0)
}
}.width("100%")
}
.edgeEffect(EdgeEffect.None)
... ... @@ -327,9 +300,9 @@ struct OtherNormalUserHomePage {
this.currentIndex = index
this.controller.changeIndex(this.currentIndex)
})
.height('77lpx')
.width('70lpx')
.margin({right:'29lpx'})
.height('100%')
.width('100%')
.margin({right:'9lpx'})
}
... ...
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
@Entry
@Component
struct SearchCreatorPage {
build() {
Row() {
Column() {
CustomTitleUI({titleName:"全部结果"})
}
.width('100%')
}
.height('100%')
}
}
\ No newline at end of file
... ...
export class CreatorDetailRequestItem{
creatorIdList:string[] = []
}
\ No newline at end of file
... ...
export class CreatorDetailResponseItem{
articleCreation: number = 0
attentionNum: number = 0
authIcon: string = ""
authId: number = 0
authPersonal: string = ""
authTitle: string = ""
banControl: number = 0
categoryAuth: string = ""
city: string = ""
cnContentPublish: number = 0
cnIsComment: number = 0
cnIsLike: number = 0
cnLiveCommentControl: number = 0
cnLiveGiftControl: number = 0
cnLiveLikeControl: number = 0
cnLivePublish: number = 0
cnLiveShareControl: number = 0
cnShareControl: number = 0
collectNum: number = 0
commentNum: number = 0
contentPublish: number = 0
creatorId: string = ""
district: string = ""
dynamicControl: number = 0
dynamicCreation: number = 0
fansNum: number = 0
headPhotoUrl: string = ""
honoraryIcon: string = ""
honoraryTitle: string = ""
introduction: string = ""
isAttention: number = 0
isComment: number = 0
isLike: number = 0
likeNum: number = 0
liveCommentControl: number = 0
liveGiftControl: number = 0
liveLikeControl: number = 0
livePublish: number = 0
liveShareControl: number = 0
liveSwitch: number = 0
mainControl: number = 0
pictureCollectionCreation: number = 0
posterShareControl: number = 0
province: string = ""
region: string = ""
registTime: number = 0
shareControl: number = 0
shareNum: number = 0
subjectType: number = 0
userId: string = ""
userName: string = ""
userType: string = ""
videoCollectionCreation: number = 0
videoCreation: number = 0
}
\ 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);
})
})
}
}
... ...
... ... @@ -139,6 +139,14 @@
{
"name": "color_000000",
"value": "#000000"
},
{
"name": "color_F07E47",
"value": "#F07E47"
},
{
"name": "color_9E9E9E",
"value": "#9E9E9E"
}
]
}
\ No newline at end of file
... ...
... ... @@ -231,6 +231,18 @@
{
"name": "margin_116",
"value": "116vp"
},
{
"name": "vp_11",
"value": "11vp"
},
{
"name": "vp_22",
"value": "22vp"
},
{
"name": "vp_14",
"value": "14vp"
}
]
}
... ...
... ... @@ -13,6 +13,8 @@
"components/page/BrowsingHistoryPage",
"components/page/MyCollectionListPage",
"pages/OtherNormalUserHomePage",
"pages/SearchPage"
"pages/SearchPage",
"pages/SearchCreatorPage",
"components/page/PeopleShipHomePage"
]
}
\ No newline at end of file
... ...
... ... @@ -4,10 +4,17 @@ import { BottomComponent } from '../widgets/details/BottomComponent';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import router from '@ohos.router';
import { DisplayDirection } from 'wdConstant/Index';
import mediaquery from '@ohos.mediaquery';
import { Logger, WindowModel } from 'wdKit/Index';
import { window } from '@kit.ArkUI';
import { devicePLSensorManager } from 'wdDetailPlayApi/Index';
@Entry
@Component
export struct DetailPlayLivePage {
//横竖屏,默认竖屏
@Provide displayDirection: DisplayDirection = DisplayDirection.VERTICAL
TAG: string = 'DetailPlayLivePage';
liveViewModel: LiveViewModel = new LiveViewModel()
@State relId: string = ''
... ... @@ -18,7 +25,17 @@ export struct DetailPlayLivePage {
@State tabs: string[] = ['直播间', '大家聊']
aboutToAppear(): void {
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
//监听屏幕横竖屏变化
let listener = mediaquery.matchMediaSync('(orientation: landscape)');
listener.on("change", (mediaQueryResult) => {
Logger.info(this.TAG,`change;${mediaQueryResult.matches}`)
if (mediaQueryResult.matches) {
this.displayDirection = DisplayDirection.VIDEO_HORIZONTAL
} else {
this.displayDirection = DisplayDirection.VERTICAL
}
// WindowModel.shared.setMainWindowFullScreen(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL)
})
let par: Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
... ... @@ -31,15 +48,24 @@ export struct DetailPlayLivePage {
build() {
Column() {
TopPlayComponent()
.layoutWeight(211)
TabComponent({ tabs: this.tabs })
.layoutWeight(503)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
BottomComponent()
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
}
.height('100%')
.width('100%')
}
onPageShow(): void {
WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
}
onPageHide(): void {
devicePLSensorManager.devicePLSensorOff();
WindowModel.shared.setPreferredOrientation(window.Orientation.AUTO_ROTATION_RESTRICTED);
}
getLiveDetails() {
... ... @@ -72,4 +98,19 @@ export struct DetailPlayLivePage {
aboutToDisappear(): void {
}
onBackPress(): boolean | void {
if (this.displayDirection == DisplayDirection.VERTICAL) {
router.back()
} else {
this.displayDirection = DisplayDirection.VERTICAL
}
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
return true
}
}
\ No newline at end of file
... ...
import { window } from '@kit.ArkUI'
import { NumberFormatterUtils, WindowModel } from 'wdKit/Index'
import { devicePLSensorManager } from 'wdDetailPlayApi/Index'
import { DateFormatUtil, WDPlayerController } from 'wdPlayer/Index'
import { LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index'
import { DisplayDirection } from 'wdConstant/Index'
@Entry
@Component
export struct PlayUIComponent {
playerController: WDPlayerController = new WDPlayerController();
//菜单键是否可见
@State isMenuVisible: boolean = true
@State isFullScreen: boolean = false
@Consume liveDetailsBean: LiveDetailsBean
@Consume liveRoomDataBean: LiveRoomDataBean
@State currentTime: string = ''
... ... @@ -19,6 +17,7 @@ export struct PlayUIComponent {
@State progressVal: number = 0;
//是否处于播放状态中
@State isPlayStatus: boolean = true
@Consume displayDirection: DisplayDirection
aboutToAppear(): void {
//播放进度监听
... ... @@ -47,10 +46,19 @@ export struct PlayUIComponent {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.aspectRatio(1)
.visibility(Visibility.None)
.visibility(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? Visibility.Visible : Visibility.None)
.margin({
right: 10
})
.onClick(() => {
this.displayDirection = DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
})
if (this.liveDetailsBean.liveInfo?.liveState != 'wait') {
Text(this.liveDetailsBean.newsTitle)
.maxLines(1)
... ... @@ -66,7 +74,7 @@ export struct PlayUIComponent {
Image($r('app.media.icon_share'))
.width(24)
.aspectRatio(1)
.visibility(Visibility.None)
.visibility(this.displayDirection == DisplayDirection.VIDEO_HORIZONTAL ? Visibility.Visible : Visibility.None)
}
.width('100%')
.alignItems(VerticalAlign.Center)
... ... @@ -196,9 +204,13 @@ export struct PlayUIComponent {
.width(24)
.height(24)
.onClick(() => {
this.isFullScreen = !this.isFullScreen
WindowModel.shared.setPreferredOrientation(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT);
devicePLSensorManager.devicePLSensorOn(this.isFullScreen ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT);
this.displayDirection = this.displayDirection == DisplayDirection.VERTICAL ? DisplayDirection.VIDEO_HORIZONTAL : DisplayDirection.VERTICAL
WindowModel.shared.setPreferredOrientation(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE)
devicePLSensorManager.devicePLSensorOn(this.displayDirection == DisplayDirection.VERTICAL ?
window.Orientation.PORTRAIT :
window.Orientation.LANDSCAPE);
})
}
.alignItems(VerticalAlign.Center)
... ...
... ... @@ -47,7 +47,6 @@ export struct TopPlayComponent {
.visibility(this.isWait ? Visibility.Visible : Visibility.None)
PlayUIComponent({ playerController: this.playerController })
}
.height(211)
.width('100%')
}
... ...
import { Logger } from 'wdKit'
import { SpConstants } from 'wdConstant/Index'
import { Logger, SPHelper } from 'wdKit'
@Component
export struct LoginInputComponent {
... ... @@ -16,15 +17,16 @@ export struct LoginInputComponent {
}.width('100%').padding({ left: 25, right: 25 })
}
aboutToAppear(){
async aboutToAppear(){
if (this.pageType == 1) {
this.phoneContent = '18655957611';
this.phoneContent = await SPHelper.default.get(SpConstants.USER_PHONE,"") as string;
Logger.debug("ddd")
}
}
@Builder
addCodeLayout() {
if (this.pageType == 1){
TextInput({ placeholder: this.securityPhone('18655957611') })
TextInput({ placeholder: this.securityPhone(this.phoneContent) })
.fontSize(16)
.height(48)
.maxLength(11)
... ...
... ... @@ -45,7 +45,7 @@ export struct WDPlayerRenderLiveView {
videoWidth: number = 0
videoHeight: number = 0
@State selfSize: Size = new Size('100%', '100%');
private insId: string = "WDPlayRenderView" + insIndex;
private insId: string = "WDPlayerRenderLiveView" + insIndex;
aboutToAppear() {
MGPlayRenderViewIns.add();
... ... @@ -97,7 +97,7 @@ export struct WDPlayerRenderLiveView {
}
.id(this.insId)
.onAreaChange(() => {
// this.updateLayout()
this.updateLayout()
})
.backgroundColor("#000000")
.justifyContent(FlexAlign.Center)
... ...
... ... @@ -11,7 +11,6 @@ const TAG = 'MainPage';
@Entry
@Component
struct MainPage {
@Provide('isLogin') isLogin:Record<string,string>={}
private breakpointSystem: BreakpointSystem = new BreakpointSystem()
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
... ... @@ -34,11 +33,6 @@ struct MainPage {
Logger.info(TAG, 'aboutToDisappear');
}
onPageShow() {
Logger.info(TAG, 'onPageShow');
let params=router.getParams() as Record<string,string>
this.isLogin=params
}
onPageHide() {
Logger.info(TAG, 'onPageHide');
... ...
... ... @@ -10,7 +10,7 @@ const TAG = 'DefaultWebPage';
struct DefaultWebPage {
private url?: string;
@State reload: number = 0;
@State isPageEnd : boolean = false
aboutToAppear() {
let action: Action = router.getParams() as Action
if (action) {
... ... @@ -32,7 +32,8 @@ struct DefaultWebPage {
WdWebComponent({
webUrl: this.url,
backVisibility: false,
reload: this.reload
reload: this.reload,
isPageEnd:$isPageEnd
})
}
}
... ...