王士厅
Showing 84 changed files with 3301 additions and 460 deletions

Too many changes to show.

To preserve performance only 84 of 84+ files are displayed.

... ... @@ -19,4 +19,6 @@ export { DurationEnum } from './src/main/ets/enum/DurationEnum';
export { ScreenType } from './src/main/ets/enum/ScreenType';
export { SpConstants } from './src/main/ets/constants/SpConstants';
\ No newline at end of file
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
... ...
... ... @@ -16,7 +16,7 @@ export const enum CompStyle {
Single_Column_05 = 'Single_Column-05', // 海报图卡:/
Single_Column_06 = 'Single_Column-06', // 留言板卡:/
Grid_Layout_01 = 'Grid_Layout-01', // 横屏宫格卡:视频、直播
Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡:视频、直播、榜单
Grid_Layout_02 = 'Grid_Layout-02', // 竖屏宫格卡 :视频、直播、榜单
Masonry_Layout_01 = 'Masonry_Layout-01', // 双列瀑布流/瀑布流卡:视频、直播、专题、活动
... ...
import { Action } from './Action';
interface dataObject {
operateType?: string
webViewHeight?: string
dataJson?: string
}
... ...
... ... @@ -26,6 +26,7 @@ export class Size {
export class WindowModel {
private windowStage?: window.WindowStage;
private windowClass?: window.Window;
private isFullScreen: boolean = false
static shared: WindowModel = new WindowModel()
static TAG = "WindowModel";
... ... @@ -129,7 +130,15 @@ export class WindowModel {
this.windowClass?.setWindowSystemBarProperties(systemBarProperties, (err: BusinessError) => {
callback && callback(err)
})
}
setWindowLayoutFullScreen(isFullScreen: boolean) {
this.isFullScreen = isFullScreen
this.windowClass?.setWindowLayoutFullScreen(isFullScreen)
}
getIsFullScreen(): boolean {
return this.isFullScreen
}
}
... ...
... ... @@ -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>()
//
... ...
... ... @@ -8,6 +8,7 @@
"version": "1.0.0",
"dependencies": {
"wdKit": "file:../wdKit",
"wdBean": "file:../../features/wdBean"
"wdBean": "file:../../features/wdBean",
"wdNetwork": "file:../../commons/wdNetwork"
}
}
}
\ No newline at end of file
... ...
... ... @@ -50,13 +50,17 @@ export function registerRouter() {
Action2Page.register("JUMP_DETAIL_PAGE", (action: Action) => {
if (action.params?.detailPageType == 2 || action.params?.detailPageType == 6) {
return WDRouterPage.detailPlayLivePage
if (action.params?.liveStyle === 0) {
return WDRouterPage.detailPlayLivePage
} else {
return WDRouterPage.detailPlayVLivePage
}
} else if (action.params?.detailPageType == 7 || action.params?.detailPageType == 8) {
return WDRouterPage.detailVideoListPage
}else if(action.params?.detailPageType == 9){
} else if (action.params?.detailPageType == 9) {
//图集详情页
return WDRouterPage.multiPictureDetailPage
}else if(action.params?.detailPageType == 14 || action.params?.detailPageType == 15){
} else if (action.params?.detailPageType == 14 || action.params?.detailPageType == 15) {
//动态详情页
return WDRouterPage.dynamicDetailPage
} else if (action.params?.detailPageType == 17) {
... ...
... ... @@ -14,6 +14,16 @@ export class WDRouterPage {
return `@bundle:${bundleInfo.name}/${"phone"}/${"ets/pages/MainPage"}`
}
static getLoginBundleInfo() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
return `@bundle:${bundleInfo.name}/${"wdLogin"}/${"ets/pages/login/LoginPage"}`
}
static getSettingBundleInfo() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
return `@bundle:${bundleInfo.name}/${"wdComponent"}/${"ets/components/page/SettingPage"}`
}
url() {
let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT)
... ... @@ -99,4 +109,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");
}
... ...
... ... @@ -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;
}
... ...
... ... @@ -82,8 +82,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
... ...
... ... @@ -12,4 +12,5 @@ export interface ExtraDTO extends ItemDTO {
sourcePage: string;
relId: string;
relType: string;
liveStreamType?: number
}
\ 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[];
... ...
... ... @@ -18,5 +18,6 @@ export interface Params {
// 8.专辑竖屏详情页
// 13.音频详情页
// 17.多图(图集)详情页
detailPageType?:number; // 详情页类型
detailPageType?: number; // 详情页类型
liveStyle?: number; // 直播类型:0横屏,1竖屏
}
... ...
... ... @@ -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
... ...
... ... @@ -164,6 +164,7 @@ export interface LiveDetailsBean {
//迁移id
oldNewsId: string
reLInfo: ReLInfo
rmhInfo: RmhInfo
}
export interface LiveInfo {
... ... @@ -189,8 +190,18 @@ export interface Vlive {
liveUrl: string
//直播回看地址,多路直播录制文件URL
replayUri: string
// 画面兼容 0-横屏流画面,1-竖屏流画面(仅竖屏直播使用)【前端使用, 可能竖屏模式但是直播流画面是横屏流,前端使用该字段】
liveStreamType: number | null
}
export interface ReLInfo {
relId: string
}
export interface RmhInfo {
rmhName: string;
rmhHeadUrl: string;
rmhId: string;
userId: string;
userType: 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
... ...
... ... @@ -64,5 +64,8 @@ export { SpacialTopicPageComponent } from './src/main/ets/components/SpacialTopi
export { LogoutViewModel } from "./src/main/ets/viewmodel/LogoutViewModel"
export { ImageSwiperComponent } from "./src/main/ets/components/ImageSwiperComponent"
export { newsSkeleton } from "./src/main/ets/components/skeleton/newsSkeleton"
export { LiveCommentComponent } from "./src/main/ets/components/comment/view/LiveCommentComponent"
... ...
... ... @@ -8,8 +8,11 @@ import { Card6Component } from './cardview/Card6Component';
import { Card9Component } from './cardview/Card9Component';
import { Card10Component } from './cardview/Card10Component';
import { Card11Component } from './cardview/Card11Component';
import { Card17Component } from './cardview/Card17Component';
import { Card12Component } from './cardview/Card12Component';
import { Card14Component } from './cardview/Card14Component';
import { Card15Component } from './cardview/Card15Component';
import { Card16Component } from './cardview/Card16Component';
import { Card17Component } from './cardview/Card17Component';
import { Card19Component } from './cardview/Card19Component';
import { Card20Component } from './cardview/Card20Component';
import { Card21Component } from './cardview/Card21Component';
... ... @@ -45,8 +48,14 @@ export struct CardParser {
Card10Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_11) {
Card11Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_12) {
Card12Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_14) {
Card14Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_15) {
Card15Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_16) {
Card16Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_17) {
Card17Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_19) {
... ...
... ... @@ -9,6 +9,7 @@ import {
import {
HorizontalStrokeCardThreeTwoRadioForOneComponent
} from './view/HorizontalStrokeCardThreeTwoRadioForOneComponent';
import { ZhSingleRow02 } from './compview/ZhSingleRow02';
import { ZhSingleRow04 } from './compview/ZhSingleRow04';
import { ZhSingleColumn04 } from './compview/ZhSingleColumn04';
import { ZhSingleColumn05 } from './compview/ZhSingleColumn05';
... ... @@ -29,7 +30,10 @@ export struct CompParser {
compIndex: number = 0;
build() {
this.componentBuilder(this.compDTO, this.compIndex);
Column(){
this.componentBuilder(this.compDTO, this.compIndex);
Divider().strokeWidth(1).color('#f5f5f5').padding({left:16,right:16})
}
}
@Builder
... ... @@ -46,6 +50,8 @@ export struct CompParser {
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: compDTO })
}
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
LiveHorizontalReservationComponent({ compDTO: compDTO })
} else if (compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) {
... ...
import { Logger } from 'wdKit';
import { AccountManagerUtils, Logger } from 'wdKit';
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { ContentDetailDTO } from 'wdBean';
import { ContentDetailDTO,batchLikeAndCollectResult,batchLikeAndCollectParams,postBatchAttentionStatusParams,
PhotoListBean,
ContentDTO, } from 'wdBean';
import media from '@ohos.multimedia.media';
import { OperRowListView } from './view/OperRowListView';
import { WDPlayerController } from 'wdPlayer/Index';
import { ContentConstants } from '../constants/ContentConstants';
import { ProcessUtils } from '../utils/ProcessUtils';
const TAG = 'DynamicDetailComponent'
@Preview
... ... @@ -19,8 +23,11 @@ export struct DynamicDetailComponent {
/**
* 默认未关注 点击去关注
*/
private followStatus: boolean = false;
private followStatus: String = '0';
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
//跳转
private mJumpInfo: ContentDTO = {} as ContentDTO;
async aboutToAppear() {
await this.getContentDetailData()
... ... @@ -85,7 +92,7 @@ export struct DynamicDetailComponent {
.fontWeight(FontWeight.Medium)
.margin({ left: $r('app.float.margin_5') })
}
if (!this.followStatus) {
if (this.followStatus == '0') {
Text('关注')
.width(60)
.height($r('app.float.margin_48'))
... ... @@ -121,6 +128,31 @@ export struct DynamicDetailComponent {
.margin({ top: $r('app.float.margin_6')
,left: $r('app.float.margin_16')
,right: $r('app.float.margin_16') })
if(this.contentDetailData.photoList!= null && this.contentDetailData.photoList.length>0){
//附件内容:图片/视频
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
GridRow({
columns: { sm: this.contentDetailData.photoList.length
, md: this.contentDetailData.photoList.length == 1?1:
this.contentDetailData.photoList.length == 4?2:
3 },
breakpoints: { value: ['320vp', '520vp', '840vp'] }
}) {
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
}
}else{
//附件内容:视频,只有一个
ForEach(this.contentDetailData.photoList, (item: PhotoListBean, index: number) => {
GridCol() {
this.buildItemCard(this.contentDetailData.photoList[index],this.contentDetailData.photoList.length, index);
}
})
}
}
//特别声明
Text("特别声明:本文为人民日报新媒体平台“人民号”作者上传并发布,仅代表作者观点。人民日报仅提供信息发布平台。")
.fontColor($r('app.color.color_CCCCCC'))
... ... @@ -160,17 +192,253 @@ export struct DynamicDetailComponent {
.margin({ left: $r('app.float.margin_2')})
}
//评论组件/底部组件
}
}
.backgroundColor('#FFFFFFFF')
}
/**
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
try {
let data = await MultiPictureDetailViewModel.getDetailData(this.relId, this.contentId, this.relType)
this.contentDetailData = data[0];
this.makeJumpInfo
console.log('动态详情',JSON.stringify(this.contentDetailData))
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getBatchAttentionStatus
this.getInteractDataStatus
}
// 查询当前登录用户点赞状态
private async getInteractDataStatus() {
//未登录
if(!AccountManagerUtils.isLoginSync() || this.contentDetailData?.openLikes != 1){
return
}
try {
const params: batchLikeAndCollectParams = {
contentList: [
{
contentId: this.contentDetailData?.newsId + '',
contentType: this.contentDetailData?.newsType + '',
}
]
}
console.error(TAG, JSON.stringify(this.contentDetailData))
let data = await MultiPictureDetailViewModel.getInteractDataStatus(params)
console.error(TAG, '查询用户对作品点赞、收藏状态', JSON.stringify(data))
this.newsStatusOfUser = data[0];
Logger.info(TAG, `newsStatusOfUser:${JSON.stringify(this.newsStatusOfUser)}`)
} catch (exception) {
console.error(TAG, JSON.stringify(exception))
}
}
/**
* 查询当前登录用户是否关注作品号主
* */
private async getBatchAttentionStatus() {
try {
const params: postBatchAttentionStatusParams = {
creatorIds: [{ creatorId: this.contentDetailData?.rmhInfo?.rmhId ?? '' }]
}
let data = await MultiPictureDetailViewModel.getBatchAttentionStatus(params)
this.followStatus = data[0]?.status;
Logger.info(TAG, `followStatus:${JSON.stringify(this.followStatus)}`)
} catch (exception) {
}
}
@Builder
setItemImageStyle(picPath: string,topLeft: number,topRight: number,bottomLeft: number,bottomRight: number){
//四角圆角
Image(picPath)
.width(44).aspectRatio(1 / 1).margin(16).borderRadius({topLeft: topLeft, topRight: topRight, bottomLeft: bottomLeft, bottomRight: bottomRight})
}
/**
* 组件项
*
* @param programmeBean item 组件项, 上面icon,下面标题
*/
@Builder
buildItemCard(item: PhotoListBean,len: number,index: number) {
Column() {
this.setItemImageRoundCorner(len, item, index)
Flex({ direction: FlexDirection.Row }) {
Image($r('app.media.icon_long_pic'))
.width(14)
.height(14)
.margin({right: 4})
Text('长图')
.fontSize(12)
.fontWeight(400)
.fontColor(0xffffff)
.fontFamily('PingFang SC')
}
.width(48)
.padding({bottom: 9})
}
.width('100%')
.onClick((event: ClickEvent) => {
if(this.contentDetailData.newsType+"" == ContentConstants.TYPE_FOURTEEN){
//fixme 跳转到查看图片页面(带页脚/下载按钮)
// this.mJumpInfo.objectType = ContentConstants.TYPE_
ProcessUtils.processPage(this.mJumpInfo)
}else{
//fixme 跳转到播放视频页面(点播)
this.mJumpInfo.objectType = ContentConstants.TYPE_VOD
ProcessUtils.processPage(this.mJumpInfo)
}
})
}
//创建跳转信息
makeJumpInfo(){
this.mJumpInfo.pageId = 'dynamicDetailPage';
// this.mJumpInfo.from = 'dynamicDetailPage';
this.mJumpInfo.objectId = this.contentDetailData.newsId+"";
this.mJumpInfo.relType = this.contentDetailData.reLInfo?.relType+"";
this.mJumpInfo.relId = this.contentDetailData.reLInfo?.relId+"";
}
//设置图片圆角
@Builder
setItemImageRoundCorner(len: number, item: PhotoListBean, index: number) {
if (len == 1) {
//四角圆角
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (len == 2) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (3 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (4 == len) {
if (index == 0) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else if (index == 1) {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
} else if (index = 2) {
//左边圆角
this.setItemImageStyle(item.picPath, 4, 0, 4, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 4, 0, 4);
}
} else if (5 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 4, 4, 4, 4);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (6 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
//右边圆角
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else if (7 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 4, 4);
}
} else if (8 == len) {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index = 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index = 5) {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
} else if (index = 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
} else {
if (index == 0) {
this.setItemImageStyle(item.picPath, 4, 0, 0, 0);
} else if (index == 1) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 2) {
this.setItemImageStyle(item.picPath, 0, 4, 0, 0);
} else if (index == 3) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 4) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 5) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else if (index == 6) {
this.setItemImageStyle(item.picPath, 0, 0, 4, 0);
} else if (index == 7) {
//直角
this.setItemImageStyle(item.picPath, 0, 0, 0, 0);
} else {
this.setItemImageStyle(item.picPath, 0, 0, 0, 4);
}
}
}
}
\ 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
})
}
... ...
import { abilityAccessCtrl, common, Permissions } from '@kit.AbilityKit';
import { http } from '@kit.NetworkKit';
import { BusinessError } from '@kit.BasicServicesKit';
import { promptAction } from '@kit.ArkUI';
import { image } from '@kit.ImageKit';
import { photoAccessHelper } from '@kit.MediaLibraryKit';
import fs from '@ohos.file.fs';
const PERMISSIONS: Array<Permissions> = [
'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA'
];
@Component
export struct ImageDownloadComponent {
@State image: PixelMap | undefined = undefined;
@State photoAccessHelper: photoAccessHelper.PhotoAccessHelper | undefined = undefined; // 相册模块管理实例
@State imageBuffer: ArrayBuffer | undefined = undefined; // 图片ArrayBuffer
url: string = ''
build() {
Column() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.rotate({ angle: -90 })
.onClick(async () => {
console.info(`cj2024 onClick ${this.imageBuffer}`)
if (this.imageBuffer !== undefined) {
await this.saveImage(this.imageBuffer);
promptAction.showToast({
message: $r('app.string.image_request_success'),
duration: 2000
})
}
})
}
}
async aboutToAppear(): Promise<void> {
console.info(`cj2024 图片下载 ${this.url}`)
const context = getContext(this) as common.UIAbilityContext;
const atManager = abilityAccessCtrl.createAtManager();
await atManager.requestPermissionsFromUser(context, PERMISSIONS);
this.getPicture();
}
/**
* 通过http的request方法从网络下载图片资源
*/
async getPicture() {
console.info(`cj2024 getPicture`)
http.createHttp()
.request(this.url,
(error: BusinessError, data: http.HttpResponse) => {
if (error) {
// 下载失败时弹窗提示检查网络,不执行后续逻辑
promptAction.showToast({
message: $r('app.string.image_request_fail'),
duration: 2000
})
return;
}
this.transcodePixelMap(data);
// 判断网络获取到的资源是否为ArrayBuffer类型
console.info(`cj2024 getPicture ${data.result}`)
if (data.result instanceof ArrayBuffer) {
console.info(`cj2024 getPicture 222`)
this.imageBuffer = data.result as ArrayBuffer;
}
}
)
}
/**
* 使用createPixelMap将ArrayBuffer类型的图片装换为PixelMap类型
* @param data:网络获取到的资源
*/
transcodePixelMap(data: http.HttpResponse) {
console.info(`cj2024 transcodePixelMap ${data.responseCode}`)
if (http.ResponseCode.OK === data.responseCode) {
const imageData: ArrayBuffer = data.result as ArrayBuffer;
// 通过ArrayBuffer创建图片源实例。
const imageSource: image.ImageSource = image.createImageSource(imageData);
const options: image.InitializationOptions = {
'alphaType': 0, // 透明度
'editable': false, // 是否可编辑
'pixelFormat': 3, // 像素格式
'scaleMode': 1, // 缩略值
'size': { height: 100, width: 100 }
}; // 创建图片大小
// 通过属性创建PixelMap
imageSource.createPixelMap(options).then((pixelMap: PixelMap) => {
this.image = pixelMap;
});
}
}
/**
* 保存ArrayBuffer到图库
* @param buffer:图片ArrayBuffer
* @returns
*/
async saveImage(buffer: ArrayBuffer | string): Promise<void> {
console.info(`cj2024 saveImage buffer ${buffer}`)
const context = getContext(this) as common.UIAbilityContext; // 获取getPhotoAccessHelper需要的context
const helper = photoAccessHelper.getPhotoAccessHelper(context); // 获取相册管理模块的实例
const uri = await helper.createAsset(photoAccessHelper.PhotoType.IMAGE, 'jpg'); // 指定待创建的文件类型、后缀和创建选项,创建图片或视频资源
console.info(`cj2024 saveImage uri ${uri}`)
const file = await fs.open(uri, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
await fs.write(file.fd, buffer);
await fs.close(file.fd);
}
}
\ No newline at end of file
... ...
import { PhotoListBean } from 'wdBean/Index';
import { Logger } from 'wdKit/Index';
import { MultiPictureDetailItemComponent } from './MultiPictureDetailItemComponent';
import { display } from '@kit.ArkUI';
import { display, router } from '@kit.ArkUI';
import { ImageDownloadComponent } from './ImageDownloadComponent';
const TAG = 'ImageSwiperComponent';
... ... @@ -35,6 +36,20 @@ export struct ImageSwiperComponent {
build() {
RelativeContainer() {
Image($r('app.media.icon_arrow_left_white'))
.width(24)
.height(24)
.aspectRatio(1)
.interpolation(ImageInterpolation.High)
.alignRules({
top: { anchor: "__container__", align: VerticalAlign.Top },
left: { anchor: "__container__", align: HorizontalAlign.Start }
})
.onClick(() => {
router.back();
})
.id("backImg")
if (this.photoList && this.photoList?.length > 0) {
Swiper(this.swiperController) {
ForEach(this.photoList, (item: PhotoListBean) => {
... ... @@ -96,6 +111,19 @@ export struct ImageSwiperComponent {
middle: { anchor: "__container__", align: HorizontalAlign.Center }
})
}
ImageDownloadComponent({ url: this.photoList[this.swiperIndex].picPath })
.alignRules({
bottom: { anchor: "__container__", align: VerticalAlign.Bottom },
right: { anchor: "__container__", align: HorizontalAlign.End }
})
.margin({
top: 8,
left: 18,
bottom: 24,
right: 18
})
.id("downloadImg")
}
.width('100%')
.height('100%')
... ...
... ... @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG = 'Card12Component';
... ... @@ -10,39 +11,7 @@ const TAG = 'Card12Component';
*/
@Component
export struct Card12Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
aboutToAppear(): void {
}
... ... @@ -50,7 +19,9 @@ export struct Card12Component {
build() {
Column() {
// rmh信息
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
if (this.contentDTO.rmhInfo) {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
}
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
... ... @@ -64,9 +35,6 @@ export struct Card12Component {
.fontFamily('PingFang SC-Regular')
}
// if (this.contentDTO.fullColumnImgUrls?.[0]) {
// createImg({ contentDTO: this.contentDTO })
// }
//TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
}
.padding({
... ... @@ -75,6 +43,9 @@ export struct Card12Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
... ... @@ -85,45 +56,6 @@ interface radiusType {
bottomRight: number | Resource;
}
@Component
struct createImg {
@Prop contentDTO: ContentDTO
build() {
GridRow() {
if (this.contentDTO.fullColumnImgUrls[0].landscape === 1) {
// 横屏
GridCol({
span: { xs: 12 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.aspectRatio(16 / 9)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
} else {
// 竖图显示,宽度占50%,高度自适应
GridCol({
span: { xs: 6 }
}) {
Stack() {
Image(this.contentDTO.coverUrl)
.width(CommonConstants.FULL_WIDTH)
.borderRadius($r('app.float.image_border_radius'))
CardMediaInfo({ contentDTO: this.contentDTO })
}
.align(Alignment.BottomEnd)
}
}
}
}
}
@Extend(Text)
function textOverflowStyle(maxLine: number) {
.maxLines(maxLine)
... ...
... ... @@ -2,6 +2,7 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG = 'Card14Component';
... ... @@ -11,37 +12,37 @@ const TAG = 'Card14Component';
@Component
export struct Card14Component {
@State contentDTO: ContentDTO = {
// appStyle: '20',
// coverType: 1,
// coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// fullColumnImgUrls: [
// {
// landscape: 1,
// size: 1,
// url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
// weight: 1600
// }
// ],
// newsTitle: '好玩!》10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhInfo: {
// authIcon:
// 'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
// authTitle: '10后音乐人王烁然个人人民号',
// authTitle2: '10后音乐人王烁然个人人民号',
// banControl: 0,
// cnIsAttention: 1,
// rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
// rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
// rmhName: '王烁然',
// userId: '522435359667845',
// userType: '2'
// },
// objectType: '1',
// videoInfo: {
// firstFrameImageUri: '',
// videoDuration: 37,
// videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
// }
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》好玩!》',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
} as ContentDTO;
aboutToAppear(): void {
... ... @@ -50,9 +51,11 @@ export struct Card14Component {
build() {
Column() {
// rmh信息
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
if (this.contentDTO.rmhInfo) {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
}
// 左标题,右图
Flex({ direction: FlexDirection.Row }) {
Flex({ direction: FlexDirection.Row, justifyContent: FlexAlign.SpaceBetween }) {
Text(this.contentDTO.newsTitle)
.fontSize($r('app.float.font_size_17'))
... ... @@ -61,12 +64,13 @@ export struct Card14Component {
.lineHeight(25)
.fontFamily('PingFang SC-Regular')
.textAlign(TextAlign.Start)
.flexBasis('auto')
// .flexBasis('auto')
.margin({right: 12})
.flexBasis(214)
Image(this.contentDTO.coverUrl)
.flexBasis(174)
.height(75)
.flexBasis(117)
.height(78)
.borderRadius($r('app.float.image_border_radius'))
// .flexBasis(160)
.backgroundImageSize(ImageSize.Auto)
... ... @@ -85,6 +89,9 @@ export struct Card14Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
... ...
... ... @@ -2,47 +2,21 @@ import { ContentDTO } from 'wdBean';
import { RmhTitle } from '../cardCommon/RmhTitle'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { CommonConstants } from 'wdConstant/Index';
import { ProcessUtils } from '../../utils/ProcessUtils';
const TAG = 'Card16Component';
interface fullColumnImgUrlItem {
url: string
}
/**
* 人民号-动态---16:人民号三图卡;
*/
@Component
export struct Card16Component {
@State contentDTO: ContentDTO = {
appStyle: '20',
coverType: 1,
coverUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90;https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
fullColumnImgUrls: [
{
landscape: 1,
size: 1,
url: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/default_image/202105/rmrb_default_image_4GdWrgSw1622451312.jpg?x-oss-process=image/resize,m_fill,h_480,w_360/quality,q_90',
weight: 1600
}
],
newsTitle: '好玩!》10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号10后音乐人王烁然个人人民号',
rmhInfo: {
authIcon:
'https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/yellow.png',
authTitle: '10后音乐人王烁然个人人民号',
authTitle2: '10后音乐人王烁然个人人民号',
banControl: 0,
cnIsAttention: 1,
rmhDesc: '10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人10后少年音乐人',
rmhHeadUrl: 'https://cdnjdphoto.aikan.pdnews.cn/image/creator/rmh/20221031/3d3419e86a.jpeg?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg',
rmhName: '王烁然',
userId: '522435359667845',
userType: '2'
},
objectType: '1',
videoInfo: {
firstFrameImageUri: '',
videoDuration: 37,
videoUrl: 'https://rmrbcmsonline.peopleapp.com/upload/user_app/gov_dynamic/video/mp4/202105/rmrb_GSNARt6P1622451310.mp4'
}
} as ContentDTO;
@State contentDTO: ContentDTO = {} as ContentDTO;
aboutToAppear(): void {
}
... ... @@ -50,7 +24,9 @@ export struct Card16Component {
build() {
Column() {
// rmh信息
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
if (this.contentDTO.rmhInfo) {
RmhTitle({ rmhInfo: this.contentDTO.rmhInfo })
}
// 标题
if (this.contentDTO.newsTitle) {
Text(this.contentDTO.newsTitle)
... ... @@ -61,10 +37,10 @@ export struct Card16Component {
.margin({ bottom: 8 })
.lineHeight(25)
}
if (this.contentDTO.coverUrl) {
if (this.contentDTO.fullColumnImgUrls?.length > 0) {
Flex() {
ForEach(this.contentDTO.coverUrl?.split(';'), (item: string) => {
Image(item).flexBasis(113).height(75).margin({right: 2})
ForEach(this.contentDTO.fullColumnImgUrls.slice(0, 3), (item: fullColumnImgUrlItem, index: number) => {
Image(item.url).flexBasis(113).height(75).margin({ right: index > 1 ? 0 : 2 })
})
}
}
... ... @@ -76,6 +52,9 @@ export struct Card16Component {
top: $r('app.float.card_comp_pagePadding_tb'),
bottom: $r('app.float.card_comp_pagePadding_tb')
})
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(this.contentDTO)
})
}
}
... ...
import { router } from '@kit.ArkUI'
import { NumberFormatterUtils, ToastUtils } from 'wdKit/Index'
@Component
export struct LiveCommentComponent {
public clickCollect?: (isCollect: boolean) => void
public clickHeart?: (isHeart: boolean) => void
@State isCollect: boolean = false
@State isLike: boolean = false
@State heartNum: number = 0
build() {
Row() {
Image($r('app.media.back_icon'))
.width(24)
.height(24)
.margin({
left: 16,
right: 12
})
.onClick(() => {
router.back()
})
Stack() {
Image($r('app.media.background_search'))
.interpolation(ImageInterpolation.High)
.width('100%')
.height(30)
TextArea({ placeholder: '说两句...' })
.backgroundColor(Color.Transparent)
.enabled(false)
.margin({
left: 5,
right: 20
})
}
.layoutWeight(1)
.onClick(() => {
ToastUtils.shortToast('依赖其它功能开发')
})
Image(this.isCollect ? $r('app.media.ic_collect_check') : $r('app.media.iv_live_comment_collect_un'))
.width(24)
.height(24)
.margin({
left: 20,
right: 24
})
.onClick(() => {
this.isCollect = !this.isCollect
})
Image($r('app.media.iv_live_comment_share'))
.width(24)
.height(24)
.onClick(() => {
ToastUtils.shortToast('依赖其它功能开发')
})
Stack() {
Text(NumberFormatterUtils.formatNumberWithWan(this.heartNum))
.height(12)
.fontSize('8fp')
.fontWeight(500)
.fontColor(Color.White)
.backgroundImage($r('app.media.iv_live_comment_hert_num'))
.backgroundImageSize(ImageSize.Cover)
.margin({
left: 6,
bottom: 33
})
.padding({
left: 6,
right: 2
})
Image(this.isLike ? $r('app.media.iv_live_comment_hert_light') : $r('app.media.comment_like_normal'))
.width(24)
.height(24)
.margin({
right: 20,
})
}
.width(44)
.height(56)
.margin({
left: 24
})
.onClick(() => {
this.isLike = !this.isLike
})
}
.height(56)
.width('100%')
.backgroundColor(Color.White)
}
}
\ No newline at end of file
... ...
... ... @@ -56,6 +56,9 @@ export struct ZhGridLayout03 {
.textOverflow({ overflow: TextOverflow.Ellipsis })
}
.width('100%')
.onClick((event: ClickEvent) => {
ProcessUtils.processPage(item)
})
}
}
... ...
... ... @@ -38,6 +38,15 @@ export default struct MinePagePersonFunctionUI {
}.onClick(()=>{
console.log(index+"")
switch (item.msg){
case "评论":{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
return
}else {
WDRouterRule.jumpWithPage(WDRouterPage.mineHomePage)
}
break;
}
case "预约":{
if(!this.isLogin){
WDRouterRule.jumpWithPage(WDRouterPage.loginPage)
... ...
import { StringUtils } from 'wdKit/Index'
import { HttpUrlUtils } from 'wdNetwork/Index'
import MinePageDatasModel from '../../../model/MinePageDatasModel'
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem'
@Component
export struct FollowChildComponent{
@ObjectLink data: FollowListDetailItem
@State type:number = 0
build() {
if(this.type == 0 ){
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
//跳转 人民号的 主页
})
}else if(this.type == 1 ){
Column(){
Column(){
Row() {
Row(){
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
.borderRadius(50)
.borderWidth('1lpx')
.borderColor($r('app.color.color_0D000000'))
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
.margin({bottom:'12lpx'})
Row(){
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
Image($r("app.media.point"))
.width('31lpx')
.height('31lpx')
.objectFit(ImageFit.Auto)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.layoutWeight(1)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.width('100%')
}
.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
}.layoutWeight(1)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.onClick(()=>{
this.followOperation()
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.onClick(()=>{
this.followOperation()
})
}
}
.width('100%')
.height('92lpx')
.justifyContent(FlexAlign.SpaceBetween)
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
})
Divider().width('100%')
.height('1lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.width('100%')
}
}
followOperation(){
let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
}
}
})
}
}
\ No newline at end of file
... ...
import { Params } from 'wdBean';
import { LazyDataSource, StringUtils } from 'wdKit';
import { HttpUrlUtils } from 'wdNetwork';
import { WDRouterPage, WDRouterRule } from 'wdRouter';
import { LazyDataSource } from 'wdKit';
import MinePageDatasModel from '../../../model/MinePageDatasModel';
import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem'
import { FollowListDetailRequestItem } from '../../../viewmodel/FollowListDetailRequestItem';
import { FollowListStatusRequestItem } from '../../../viewmodel/FollowListStatusRequestItem';
import { FollowOperationRequestItem } from '../../../viewmodel/FollowOperationRequestItem';
import { MineFollowListDetailItem } from '../../../viewmodel/MineFollowListDetailItem';
import { QueryListIsFollowedItem } from '../../../viewmodel/QueryListIsFollowedItem';
import { ListHasNoMoreDataUI } from '../../reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from './FollowChildComponent';
const TAG = "FollowListDetailUI"
@Component
export struct FollowListDetailUI{
@State creatorDirectoryId:number = -1;
@State type:number = 0
@State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State count:number = 0;
@State isLoading:boolean = false
... ... @@ -22,7 +20,6 @@ export struct FollowListDetailUI{
curPageNum:number = 1;
aboutToAppear(){
console.log("YCG","aboutToAppear==="+this.creatorDirectoryId);
this.getNewPageData()
}
... ... @@ -35,7 +32,7 @@ export struct FollowListDetailUI{
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
ChildComponent({data: item})
FollowChildComponent({data: item,type:this.type})
}
.onClick(() => {
})
... ... @@ -76,7 +73,8 @@ export struct FollowListDetailUI{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
... ... @@ -148,112 +146,4 @@ export struct FollowListDetailUI{
})
}
}
@Component
struct ChildComponent {
@ObjectLink data: FollowListDetailItem
build() {
Column(){
Blank().height('27lpx')
Row() {
Image(StringUtils.isEmpty(this.data.headPhotoUrl)?$r('app.media.default_head'):this.data.headPhotoUrl)
.objectFit(ImageFit.Auto)
.width('92lpx')
.height('92lpx')
.margin({right:'15lpx'})
Column(){
Text(this.data.cnUserName)
.fontWeight('400lpx')
.fontSize('31lpx')
.lineHeight('38lpx')
.fontColor($r('app.color.color_222222'))
.maxLines(1)
Text(`粉丝${this.data.cnFansNum}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(1)
Text(`${this.data.introduction}`)
.fontColor($r('app.color.color_B0B0B0'))
.fontSize('23lpx')
.maxLines(2)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.layoutWeight(1)
.alignItems(HorizontalAlign.Start)
if(this.data.status == "1"){
Row(){
Text(`已关注`)
.fontColor($r('app.color.color_CCCCCC'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.backgroundColor($r('app.color.color_F5F5F5'))
.borderRadius('6lpx')
.borderColor($r('app.color.color_F5F5F5'))
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "0"
})
}else{
Row(){
Image($r('app.media.follow_icon'))
.margin({right:'4lpx'})
.width('23lpx')
.height('23lpx')
Text(`关注`)
.fontColor($r('app.color.color_ED2800'))
.fontSize('23lpx')
.fontWeight('500lpx')
.lineHeight('35lpx')
}.borderColor($r('app.color.color_1AED2800'))
.borderRadius('6lpx')
.borderWidth('2lpx')
.justifyContent(FlexAlign.Center)
.width('100lpx')
.height('46lpx')
.margin({left:'4lpx',top:'23lpx'})
.onClick(()=>{
this.followOperation()
// this.data.status = "1"
})
}
}.alignItems(VerticalAlign.Top)
.width('100%')
.layoutWeight(1)
Divider().width('100%')
.height('2lpx')
.strokeWidth('1lpx')
.backgroundColor($r('app.color.color_EDEDED'))
}.height('146lpx')
.justifyContent(FlexAlign.Center)
.onClick(()=>{
//跳转 人民号的 主页
// let params: Params = {
// pageID: this.data.attentionUserId
// }
// WDRouterRule.jumpWithPage(WDRouterPage.otherNormalUserHomePagePage,params)
})
}
followOperation(){
let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0)
MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
if(value!=null){
if (value.code === 0 || value.code.toString() === "0") {
this.data.status = this.data.status ==="0"?"1":"0"
}
}
})
}
}
\ No newline at end of file
... ...
... ... @@ -23,7 +23,8 @@ export struct FollowSecondTabsComponent{
if(this.data != null){
if(this.data[this.firstIndex].children == null || this.data[this.firstIndex].children.length == 0){
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id}).layoutWeight(1)
FollowListDetailUI({creatorDirectoryId:this.data[this.firstIndex].id,type:1})
.layoutWeight(1)
}else{
this.FollowSecondUI()
}
... ...
... ... @@ -184,7 +184,7 @@ export struct HomePageBottomComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
... ...
... ... @@ -116,7 +116,7 @@ export struct OtherHomePageBottomFollowComponent{
this.hasMore = false
}else{
value.list.forEach((value)=>{
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum+"",value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
})
this.data_follow.notifyDataReload()
this.count = this.data_follow.totalCount()
... ...
... ... @@ -42,6 +42,8 @@ export struct BottomNavigationComponent {
let bottomNav = await PageViewModel.getBottomNavData(getContext(this))
if (bottomNav && bottomNav.bottomNavList != null) {
Logger.info(TAG, `aboutToAppear, bottomNav.length: ${bottomNav.bottomNavList.length}`);
// 使用filter方法移除name为'服务'的项
bottomNav.bottomNavList = bottomNav.bottomNavList.filter(item => item.name !== '服务');
this.bottomNavList = bottomNav.bottomNavList
}
}
... ...
... ... @@ -9,12 +9,13 @@ import { RefreshLayoutBean } from './RefreshLayoutBean';
import { CompDTO, ContentDTO } from 'wdBean'
import LoadMoreLayout from './LoadMoreLayout'
import NoMoreLayout from './NoMoreLayout'
import { CompParser } from '../CompParser'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
@Entry
@Component
struct BrowsingHistoryPage {
... ... @@ -25,6 +26,8 @@ struct BrowsingHistoryPage {
@State selectDatas :ContentDTO[] = [];
@Provide deleteNum :number = 0;
@Provide isAllSelect:boolean = false
private scroller: Scroller = new Scroller();
aboutToAppear(){
this.getData()
}
... ... @@ -37,15 +40,33 @@ struct BrowsingHistoryPage {
this.selectDatas = []
this.deleteNum = 0
}})
if (this.browSingModel.viewType == ViewType.LOADING){
this.LoadingLayout()
}else if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent()
}else {
this.ListLayout()
}
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.browSingModel.currentPage = 0
this.getData(resolve)
},
onLoadMore:(resolve)=> {
this.browSingModel.currentPage++
this.getData()
}
})
// if (this.browSingModel.viewType == ViewType.LOADING){
// this.LoadingLayout()
// }else if(this.browSingModel.viewType == ViewType.ERROR){
// ErrorComponent()
// }else if(this.browSingModel.viewType == ViewType.EMPTY){
// EmptyComponent()
// }else {
// this.ListLayout()
// }
if (this.isEditState){
CustomBottomFuctionUI({
... ... @@ -64,34 +85,27 @@ struct BrowsingHistoryPage {
}
@Builder ListLayout() {
List() {
List({scroller: this.scroller}) {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage,
this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight)
})
}
ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
ListItem() {
this.newCompParser(compDTO,compIndex)
}
})
// 加载更多
ListItem() {
if (this.browSingModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage,
this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight)
})
// LoadMoreLayout({
// refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage,
// this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight)
// })
} else {
NoMoreLayout()
}
}
}
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
@Builder
... ... @@ -117,9 +131,9 @@ struct BrowsingHistoryPage {
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
}
async getData() {
this.browSingModel.currentPage = 1
async getData(resolve?: (value: string | PromiseLike<string>) => void){
MyCollectionViewModel.fetchMyCollectList(2,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...collectionItem.list)
... ...
... ... @@ -4,17 +4,13 @@ import PageModel from '../../viewmodel/PageModel';
import { CommonConstants, ViewType } from 'wdConstant'
import { EmptyComponent,WDViewDefaultType } from '../view/EmptyComponent'
import { ErrorComponent } from '../view/ErrorComponent'
import RefreshLayout from './RefreshLayout'
import { RefreshLayoutBean } from './RefreshLayoutBean';
import { CompDTO, ContentDTO } from 'wdBean'
import LoadMoreLayout from './LoadMoreLayout'
import { ContentDTO } from 'wdBean'
import NoMoreLayout from './NoMoreLayout'
import { CompParser } from '../CompParser'
import CustomRefreshLoadLayout from './CustomRefreshLoadLayout';
import { CustomSelectUI } from '../view/CustomSelectUI';
import { CustomBottomFuctionUI } from '../view/CustomBottomFuctionUI';
import { BigPicCardComponent } from '../view/BigPicCardComponent';
import { contentListItemParams } from '../../model/MyCollectionModel';
import { CustomPullToRefresh } from '../reusable/CustomPullToRefresh';
@Entry
@Component
... ... @@ -26,6 +22,10 @@ struct MyCollectionListPage {
@State selectDatas :ContentDTO[] = [];
@Provide deleteNum :number = 0;
@Provide isAllSelect:boolean = false
@State currentPage: number = 1;
private scroller: Scroller = new Scroller();
aboutToAppear(){
this.getData()
}
... ... @@ -38,14 +38,31 @@ struct MyCollectionListPage {
this.selectDatas = []
this.deleteNum = 0
}})
if (this.browSingModel.viewType == ViewType.LOADING){
this.LoadingLayout()
}else if(this.browSingModel.viewType == ViewType.ERROR){
if(this.browSingModel.viewType == ViewType.ERROR){
ErrorComponent()
}else if(this.browSingModel.viewType == ViewType.EMPTY){
EmptyComponent({emptyType:WDViewDefaultType.WDViewDefaultType_NoCollection})
}else {
this.ListLayout()
CustomPullToRefresh({
alldata:this.allDatas,
scroller:this.scroller,
customList:()=>{
this.ListLayout()
},
onRefresh:(resolve)=>{
this.currentPage = 1
this.getData(resolve)
},
onLoadMore:(resolve)=> {
if (this.browSingModel.hasMore === false) {
if(resolve) resolve('')
return
}
this.currentPage++
this.getData(resolve)
}
})
}
if (this.isEditState){
... ... @@ -65,34 +82,19 @@ struct MyCollectionListPage {
}
@Builder ListLayout() {
List() {
// 下拉刷新
ListItem() {
RefreshLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullDown, this.browSingModel.pullDownRefreshImage,
this.browSingModel.pullDownRefreshText, this.browSingModel.pullDownRefreshHeight)
})
}
List({scroller: this.scroller}) {
ForEach(this.allDatas, (compDTO: ContentDTO, compIndex: number) => {
ListItem() {
this.newCompParser(compDTO,compIndex)
}
})
// 加载更多
ListItem() {
if (this.browSingModel.hasMore) {
LoadMoreLayout({
refreshBean: new RefreshLayoutBean(this.browSingModel.isVisiblePullUpLoad, this.browSingModel.pullUpLoadImage,
this.browSingModel.pullUpLoadText, this.browSingModel.pullUpLoadHeight)
})
} else {
NoMoreLayout()
}
if (this.browSingModel.hasMore === false) NoMoreLayout()
}
}
.height(CommonConstants.FULL_PARENT)
.edgeEffect(EdgeEffect.None) // 必须设置列表为滑动到边缘无效果
}
@Builder
... ... @@ -113,22 +115,16 @@ struct MyCollectionListPage {
}
}
@Builder LoadingLayout() {
CustomRefreshLoadLayout({ refreshBean: new RefreshLayoutBean(true,
$r('app.media.ic_pull_up_load'), $r('app.string.pull_up_load_text'), this.browSingModel.pullDownRefreshHeight) })
}
async getData() {
this.browSingModel.currentPage = 1
MyCollectionViewModel.fetchMyCollectList(1,'1',this.browSingModel.currentPage,getContext(this)).then(collectionItem => {
async getData(resolve?: (value: string | PromiseLike<string>) => void) {
MyCollectionViewModel.fetchMyCollectList(1,'1',this.currentPage,getContext(this)).then(collectionItem => {
if(resolve) resolve('刷新成功')
if (collectionItem && collectionItem.list && collectionItem.list.length > 0) {
this.browSingModel.viewType = ViewType.LOADED;
this.allDatas.push(...collectionItem.list)
if (collectionItem.list.length === this.browSingModel.pageSize) {
this.browSingModel.currentPage++;
this.browSingModel.hasMore = true;
} else {
if (this.currentPage === 1) this.allDatas = []
this.allDatas = this.allDatas.concat(...collectionItem.list)
if (collectionItem.totalCount === this.allDatas.length) {
this.browSingModel.hasMore = false;
} else {
this.browSingModel.hasMore = true;
}
} else {
this.browSingModel.viewType = ViewType.EMPTY;
... ...
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 { PullToRefresh, PullToRefreshConfigurator } from '@ohos/pulltorefresh';
@Component
export struct CustomPullToRefresh {
@Link alldata: Object[];
scroller: Scroller = new Scroller();
@BuilderParam customList: () => void;
onRefresh: (resolve?: (value: string | PromiseLike<string>) => void) => void = () => {
}
onLoadMore: (resolve?: (value: string | PromiseLike<string>) => void) => void = () => {
}
///是否存在上拉更多
@State hasMore: boolean = true
refreshConfigurator: PullToRefreshConfigurator = new PullToRefreshConfigurator().setHasLoadMore(this.hasMore);
build() {
Column(){
PullToRefresh({
data:this.alldata,
scroller:this.scroller,
refreshConfigurator:this.refreshConfigurator,
customList:()=>{
this.customList();
},
onRefresh:()=>{
return new Promise<string>((resolve, reject) => {
this.onRefresh(resolve)
});
},
onLoadMore:()=>{
return new Promise<string>((resolve, reject) => {
this.onLoadMore(resolve)
});
},
customLoad: null,
customRefresh: null,
})
}
}
}
\ No newline at end of file
... ...
import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
@Component
export struct SearchCreatorComponent{
@ObjectLink item: SearchRmhDescription
build() {
Column(){
Image(this.item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
Text(this.item.creatorName)
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'150lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
}
}
\ No newline at end of file
... ...
import { ContentDTO,
contentListParams,
FullColumnImgUrlDTO, InteractDataDTO, RmhInfoDTO, VideoInfoDTO } from 'wdBean/Index'
FullColumnImgUrlDTO, InteractDataDTO,
Params,
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, ToastUtils } from 'wdKit/Index'
import { LazyDataSource, Logger, StringUtils, ToastUtils } from 'wdKit/Index'
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'
import SearcherAboutDataModel from '../../model/SearcherAboutDataModel'
import { CreatorDetailRequestItem } from '../../viewmodel/CreatorDetailRequestItem'
... ... @@ -12,6 +14,7 @@ import { SearchRmhDescription } from '../../viewmodel/SearchResultContentItem'
import { CardParser } from '../CardParser'
import { ListHasNoMoreDataUI } from '../reusable/ListHasNoMoreDataUI'
import { ActivityItemComponent } from './ActivityItemComponent'
import { SearchCreatorComponent } from './SearchCreatorComponent'
const TAG = "SearchResultContentComponent"
... ... @@ -53,24 +56,30 @@ export struct SearchResultContentComponent{
this.isLoading = false
}else{
if(value.list[0].dataList!=null){
this.data_rmh = value.list[0].dataList
let data_temp: SearchRmhDescription[] = []
data_temp = value.list[0].dataList
//TODO 查询创作者详情接口
let request = new CreatorDetailRequestItem()
this.data_rmh .forEach((data)=>{
data_temp.forEach((data)=>{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
this.data_rmh.forEach((data)=>{
data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headerPhotoUrl = item.headPhotoUrl
data.headerPhotoUrl = item.headPhotoUrl.split("?")[0]
}
})
})
}
data_temp.forEach((data)=>{
this.data_rmh.push(data)
})
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
})
... ... @@ -212,23 +221,7 @@ export struct SearchResultContentComponent{
List({space:'8lpx'}) {
ForEach(this.data_rmh, (item: SearchRmhDescription, index: number) => {
ListItem() {
Column(){
Image(item.headerPhotoUrl)
.width('92lpx')
.alt($r('app.media.default_head'))
.height('92lpx')
.margin({bottom:'15lpx'})
.borderRadius(50)
Text(item.creatorName)
.fontSize('25lpx')
.fontWeight('400lpx')
.lineHeight('35lpx')
.constraintSize({maxWidth:'150lpx'})
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
}.alignItems(HorizontalAlign.Center)
.justifyContent(FlexAlign.Center)
SearchCreatorComponent({item:item})
}.onClick(()=>{
//TODO 跳转
})
... ... @@ -253,7 +246,10 @@ export struct SearchResultContentComponent{
}.height('100%')
.margin({left:'23lpx'})
.onClick(()=>{
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage)
let params: Params = {
pageID: this.keywords
}
WDRouterRule.jumpWithPage(WDRouterPage.searchCreatorPage,params)
})
}
.cachedCount(6)
... ...
... ... @@ -36,7 +36,13 @@ export const enum WDViewDefaultType {
///该号主无法访问
WDViewDefaultType_NoVisitAccount,
///暂无关注
WDViewDefaultType_NoFollow
WDViewDefaultType_NoFollow,
///直播结束
WDViewDefaultType_NoLiveEnd,
/// 直播暂停
WDViewDefaultType_NoLiveSuspend,
/// 视频加载失败
WDViewDefaultType_NoVideo,
}
/**
... ... @@ -120,6 +126,12 @@ export struct EmptyComponent {
contentString = '' // 前方拥堵,请耐心等待
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
contentString = '该号主暂时无法访问' // 前方拥堵,请耐心等待
}else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
contentString = '直播已结束' // 前方拥堵,请耐心等待
}else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveSuspend) {
contentString = '主播暂时离开,马上回来' // 前方拥堵,请耐心等待
}else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
contentString = '获取内容失败请重试' // 前方拥堵,请耐心等待
}
return contentString
... ... @@ -148,6 +160,10 @@ export struct EmptyComponent {
imageString = $r('app.media.icon_no_net')
} else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVisitAccount) {
imageString = $r('app.media.icon_no_master1')
}else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoLiveEnd) {
imageString = $r('app.media.icon_no_end')
}else if (this.emptyType === WDViewDefaultType.WDViewDefaultType_NoVideo) {
imageString = $r('app.media.icon_no_content')
}
return imageString
}
... ...
... ... @@ -2,10 +2,12 @@ import { Action, CompDTO, ContentDTO, Params } from 'wdBean'
import { WDRouterRule } from 'wdRouter/Index'
import { Logger } from 'wdKit/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { LiveModel } from '../../viewmodel/LiveModel'
@Component
export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
@State compDTO: CompDTO = {} as CompDTO
build() {
Column() {
Row() {
... ... @@ -30,7 +32,7 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
.height(14)
}
}.justifyContent(FlexAlign.SpaceBetween)
.margin({ top: 8 ,bottom: 8})
.margin({ top: 8, bottom: 8 })
.width('100%')
... ... @@ -45,12 +47,13 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
.fontColor($r("app.color.color_212228"))
.fontWeight(400)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.textAlign(TextAlign.Start)
.margin({ top: 8 })
.width('100%')
}.width("100%")
}
.width("100%")
.padding({
top: 14,
left: 16,
... ... @@ -59,16 +62,26 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
})
.backgroundColor($r("app.color.white"))
.margin({ bottom: 8 })
.onClick(()=>{
.onClick(() => {
this.gotoLive(this.compDTO?.operDataList[0])
})
}
gotoLive(content: ContentDTO) {
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
... ... @@ -76,6 +89,6 @@ export struct HorizontalStrokeCardThreeTwoRadioForOneComponent {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
// Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import { WDRouterRule } from 'wdRouter/Index'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { LiveModel } from '../../viewmodel/LiveModel'
@Component
export struct LiveHorizontalCardComponent {
... ... @@ -100,12 +101,22 @@ export struct LiveHorizontalCardComponent {
})
.backgroundColor($r("app.color.white"))
}
gotoLive(content: ContentDTO) {
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
... ... @@ -113,6 +124,6 @@ export struct LiveHorizontalCardComponent {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
// Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -6,6 +6,7 @@ import { Logger, StringUtils } from 'wdKit/Index'
import { CardMediaInfo } from '../cardCommon/CardMediaInfo'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { WDRouterRule } from 'wdRouter/Index'
import { LiveModel } from '../../viewmodel/LiveModel'
@Component
export struct LiveHorizontalReservationComponent {
... ... @@ -92,12 +93,21 @@ export struct LiveHorizontalReservationComponent {
.backgroundColor($r("app.color.white"))
}
gotoLive(content: ContentDTO) {
async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
... ... @@ -105,6 +115,6 @@ export struct LiveHorizontalReservationComponent {
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(`gotoLive, ${content.objectId}`);
// Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -30,10 +30,10 @@ export struct RecommendList {
ForEach(this.recommendList, (item: ContentDTO, index: number) => {
Row() {
CardParser({ contentDTO: item });
}.border({
width: { bottom: this.recommendList.length === index + 1 ? 0 : 1 },
color: '#f5f5f5'
})
}
if (this.recommendList.length !== index + 1) {
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
}
}, (item: ContentDTO) => JSON.stringify(item))
}.width('100%')
}
... ...
import { Params } from 'wdBean/Index';
import { CustomTitleUI } from '../components/reusable/CustomTitleUI';
import { router } from '@kit.ArkUI';
import { FollowListDetailItem } from '../viewmodel/FollowListDetailItem';
import { LazyDataSource } from 'wdKit/Index';
import SearcherAboutDataModel from '../model/SearcherAboutDataModel';
import { CreatorDetailRequestItem } from '../viewmodel/CreatorDetailRequestItem';
import { FollowListStatusRequestItem } from '../viewmodel/FollowListStatusRequestItem';
import { QueryListIsFollowedItem } from '../viewmodel/QueryListIsFollowedItem';
import MinePageDatasModel from '../model/MinePageDatasModel';
import { ListHasNoMoreDataUI } from '../components/reusable/ListHasNoMoreDataUI';
import { FollowChildComponent } from '../components/mine/follow/FollowChildComponent';
const TAG = "SearchCreatorPage"
@Entry
@Component
struct SearchCreatorPage {
@State params: Params = router.getParams() as Params;
@State keyword: string = '';
@State searchType:string = ""
@State data_temp: FollowListDetailItem[] = []
@State data: LazyDataSource<FollowListDetailItem> = new LazyDataSource();
@State count: number = -1;
@State isLoading: boolean = false
@State hasMore: boolean = true
curPageNum: number = 1;
build() {
Row() {
Column() {
CustomTitleUI({titleName:"全部结果"})
onPageShow() {
this.keyword = this.params?.pageID;
this.searchType = "onlyRmh"
this.getNewPageData()
}
getNewPageData() {
this.isLoading = true
if (this.hasMore) {
SearcherAboutDataModel.getSearchResultListData("20",`${this.curPageNum}`,this.searchType,this.keyword,getContext(this)).then((result)=>{
if (!this.data || result.list.length == 0){
this.hasMore = false
this.isLoading = false
}else{
result.list.forEach((data)=>{
this.data_temp.push(new FollowListDetailItem("",data.data.creatorName,"0","",data.data.id,"0",data.data.userId,data.data.userType,data.data.userId))
})
let request = new CreatorDetailRequestItem()
this.data_temp.forEach((data)=>{
request.creatorIdList.push(data.creatorId)
})
SearcherAboutDataModel.getCreatorDetailListData(request).then((value)=>{
if(value!=null && value.length>0){
this.data_temp.forEach((data)=>{
value.forEach((item)=>{
if(data.creatorId == item.creatorId){
data.headPhotoUrl = item.headPhotoUrl
if(item.fansNum>10000){
let temp = (item.fansNum/10000)+""
let index = temp.indexOf('.')
if(index != -1){
temp = temp.substring(0,index+2)
}else{
temp = temp
}
data.cnFansNum = temp + "万"
}else{
data.cnFansNum = item.fansNum + ""
}
data.introduction = item.introduction
}
})
})
this.getFollowListStatus(result.totalCount)
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
}).catch((err:Error)=>{
console.log(TAG,JSON.stringify(err))
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
}
getFollowListStatus(totalCount:number){
let status = new FollowListStatusRequestItem()
this.data_temp.forEach((item)=>{
status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
})
MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
newValue.forEach((item)=>{
this.data_temp.forEach((list)=>{
if (item.creatorId == list.creatorId) {
list.status = item.status
}
})
})
this.data_temp.forEach((item)=>{
this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
if (this.data.totalCount() < totalCount) {
this.curPageNum++
}else {
this.hasMore = false
}
this.isLoading = false
}).catch((err:Error)=>{
console.log(TAG,"请求失败")
this.isLoading = false
this.count = this.count===-1?0:this.count
})
}
build() {
Column() {
CustomTitleUI({ titleName: "全部结果" })
Divider()
.width('100%')
.height('1lpx')
.color($r('app.color.color_F5F5F5'))
.strokeWidth('1lpx')
Column(){
if(this.count === 0){
ListHasNoMoreDataUI({style:2})
.height('100%')
}else{
List({ space: 3 }) {
LazyForEach(this.data, (item: FollowListDetailItem, index: number = 0) => {
ListItem() {
FollowChildComponent({data: item,type:1})
}
.onClick(() => {
})
}, (item: FollowListDetailItem, index: number) => index.toString())
//没有更多数据 显示提示
if(!this.hasMore){
ListItem(){
ListHasNoMoreDataUI()
}
}
}.cachedCount(10)
.padding({left:'31lpx',right:'31lpx'})
.layoutWeight(1)
.scrollBar(BarState.Off)
.onReachEnd(()=>{
console.log(TAG,"触底了");
if(!this.isLoading){
this.isLoading = true
//加载分页数据
this.getNewPageData()
}
})
}
}.layoutWeight(1)
.width('100%')
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
... ...
... ... @@ -4,6 +4,7 @@ import { Logger } from 'wdKit';
import { StringUtils } from 'wdKit/src/main/ets/utils/StringUtils';
import { WDRouterRule } from 'wdRouter';
import { ContentConstants } from '../constants/ContentConstants';
import { LiveModel } from '../viewmodel/LiveModel';
const TAG = 'ProcessUtils';
... ... @@ -42,12 +43,12 @@ export class ProcessUtils {
// 图文详情,跳转h5
ProcessUtils.gotoWeb(content);
break;
//图集详情页
//图集详情页
case ContentConstants.TYPE_NINE:
ProcessUtils.gotoAtlasDetailPage(content);
break;
case ContentConstants.TYPE_SPECIAL_TOPIC:
// 专题详情,跳转h5
// 专题详情,跳转h5
ProcessUtils.gotoSpecialTopic(content);
break;
//动态详情页(动态图文)
... ... @@ -71,7 +72,7 @@ export class ProcessUtils {
params: {
detailPageType: 14,
contentID: content?.objectId,
extra:{
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
... ... @@ -91,7 +92,7 @@ export class ProcessUtils {
params: {
detailPageType: 17,
contentID: content?.objectId,
extra:{
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
... ... @@ -111,6 +112,7 @@ export class ProcessUtils {
};
WDRouterRule.jumpWithAction(taskAction)
}
private static gotoWeb(content: ContentDTO) {
// // topicId
// content.channelId;
... ... @@ -126,7 +128,7 @@ export class ProcessUtils {
params: {
contentID: content?.objectId,
pageID: 'IMAGE_TEXT_DETAIL',
extra:{
extra: {
relType: content?.relType,
relId: content?.relId,
channelId: content?.channelId,
... ... @@ -144,7 +146,7 @@ export class ProcessUtils {
params: {
detailPageType: 7,
contentID: content?.objectId,
extra:{
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
... ... @@ -153,13 +155,23 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoVod, ${content.objectId}`);
}
private static gotoLive(content: ContentDTO) {
private static async gotoLive(content: ContentDTO) {
const liveDetail = await LiveModel.getLiveDetails(content?.objectId || '', content?.relId || '', content?.relType || '')
const liveStyle = liveDetail[0].liveInfo.liveStyle
const liveState = liveDetail[0].liveInfo.liveState
console.error('liveDetail===', liveDetail)
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 2,
contentID: content?.objectId,
extra:{
liveStyle: liveState === 'wait' ? 0 : liveStyle,
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
... ... @@ -168,13 +180,14 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoLive, ${content.objectId}`);
}
private static gotoAudio(content: ContentDTO) {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: 13,
contentID: content?.objectId,
extra:{
extra: {
relType: content?.relType,
relId: content?.relId,
} as ExtraDTO
... ... @@ -183,5 +196,4 @@ export class ProcessUtils {
WDRouterRule.jumpWithAction(taskAction)
Logger.debug(TAG, `gotoAudio, ${content.objectId}`);
}
}
\ No newline at end of file
... ...
... ... @@ -34,7 +34,7 @@ export class RefreshConstants {
/**
* The refresh and load height.
*/
static readonly CUSTOM_LAYOUT_HEIGHT: number = 70;
static readonly CUSTOM_LAYOUT_HEIGHT: number = 90;
/**
* Full the width.
*/
... ...
... ... @@ -63,7 +63,7 @@
export class FollowListDetailItem{
headPhotoUrl:string //头像
cnUserName:string //昵称
cnFansNum:number //粉丝数
cnFansNum:string //粉丝数
introduction:string //介绍
status:string = "0" //是否已经关注
creatorId:string = ""
... ... @@ -80,7 +80,7 @@ export class FollowListDetailItem{
fansNum :number = 0
constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) {
constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:string,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) {
this.headPhotoUrl = headPhotoUrl
this.cnUserName = cnUserName
this.cnFansNum = cnFansNum
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger } from 'wdKit';
import { LiveDetailsBean } from 'wdBean/Index';
const TAG = 'LiveModel'
export class LiveModel {
/**
* 直播内容详情
* @param contentId
* @param relId 关系id
* @param relType 关系类型;1.频道关系;2.专题关系;
* @returns
*/
static getLiveDetails(contentId: string, relId: string, relType: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<Array<LiveDetailsBean>>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<LiveDetailsBean>>>(
HttpUrlUtils.getLiveDetailsUrl() + `?relId=${relId}&relType=${relType}&contentId=${contentId}`,
headers).then((data: ResponseDTO<Array<LiveDetailsBean>>) => {
if (!data || !data.data) {
fail("数据为空")
return
}
if (data.code != 0) {
fail(data.message)
return
}
success(data.data)
}, (error: Error) => {
fail(error.message)
Logger.debug(TAG + ":error ", error.toString())
})
})
}
}
... ...
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);
})
})
}
}
... ...
... ... @@ -181,6 +181,7 @@ class SearchDescription{
}
@Observed
export class SearchRmhDescription{
likeEnable: string= ""
previewUri: string= ""
... ...
... ... @@ -147,6 +147,10 @@
{
"name": "color_9E9E9E",
"value": "#9E9E9E"
},
{
"name": "color_0D000000",
"value": "#0D000000"
}
]
}
\ 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"
}
]
}
... ...
... ... @@ -14,6 +14,7 @@
"components/page/MyCollectionListPage",
"pages/OtherNormalUserHomePage",
"pages/SearchPage",
"pages/SearchCreatorPage"
"pages/SearchCreatorPage",
"components/page/PeopleShipHomePage"
]
}
\ No newline at end of file
... ...
import { BottomComponent } from '../widgets/details/BottomComponent';
import { TabComponent } from '../widgets/details/TabComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
@Component
export struct DetailPlayHLivePage {
aboutToAppear(): void {
}
build() {
Column() {
TopPlayComponent()
TabComponent()
BottomComponent()
}
.height('100%')
.width('100%')
}
onPageShow(): void {
}
aboutToDisappear(): void {
}
}
\ No newline at end of file
import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
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';
import { LiveCommentComponent } from 'wdComponent/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 })
BottomComponent()
.layoutWeight(503)
.visibility(this.displayDirection == DisplayDirection.VERTICAL ? Visibility.Visible : Visibility.None)
LiveCommentComponent({ heartNum: this.liveRoomDataBean.likeNum })
.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 { BottomComponent } from '../widgets/details/BottomComponent';
import { TopPlayComponent } from '../widgets/details/video/TopPlayComponet';
import { TopPlayVComponent } from '../widgets/details/video/TopPlayVComponet';
import { Action, LiveDetailsBean, LiveRoomDataBean } from 'wdBean/Index';
import { LiveViewModel } from '../viewModel/LiveViewModel';
import router from '@ohos.router';
import { WindowModel } from 'wdKit/Index';
import { PlayerComponent } from '../widgets/vertical/PlayerComponent';
import { PlayerInfoComponent } from '../widgets/vertical/PlayerInfoComponent';
import { WDPlayerController } from 'wdPlayer/Index';
const storage = LocalStorage.getShared();
@Entry(storage)
@Component
export struct DetailPlayVLivePage {
TAG: string = 'DetailPlayLivePage';
private liveViewModel: LiveViewModel = new LiveViewModel()
private playerController: WDPlayerController = new WDPlayerController();
private swiperController: SwiperController = new SwiperController()
@Provide bottomSafeHeight: number = AppStorage.get<number>('bottomSafeHeight') || 0
@Provide topSafeHeight: number = AppStorage.get<number>('topSafeHeight') || 0
@Provide liveDetailsBean: LiveDetailsBean = {} as LiveDetailsBean
@Provide liveRoomDataBean: LiveRoomDataBean = {} as LiveRoomDataBean
@Provide isMenuVisible: boolean = false
@State relId: string = ''
@State contentId: string = ''
@State relType: string = ''
@State swiperIndex: number = 1
aboutToAppear(): void {
WindowModel.shared.setWindowLayoutFullScreen(true)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#ffffff', })
//https://pdapis.pdnews.cn/api/rmrb-bff-display-zh/content/zh/c/content/detail?relId=500005302448&relType=1&contentId=20000016340
let par: Action = router.getParams() as Action;
let params = par?.params;
this.relId = params?.extra?.relId || '';
this.relType = params?.extra?.relType || '';
this.contentId = params?.contentID || '';
this.getLiveDetails()
this.getLiveRoomData()
}
aboutToDisappear(): void {
WindowModel.shared.setWindowLayoutFullScreen(false)
WindowModel.shared.setWindowSystemBarProperties({ statusBarContentColor: '#000000', })
}
build() {
Column() {
TopPlayVComponent()
// TabComponent()
BottomComponent()
Stack() {
PlayerComponent({
playerController: this.playerController
})
.onClick(() => {
this.isMenuVisible = !this.isMenuVisible
})
PlayerInfoComponent({
playerController: this.playerController,
swiperController: this.swiperController,
swiperIndex: $swiperIndex
})
Image($r('app.media.icon_live_more'))
.width(40)
.aspectRatio(1)
.visibility(this.swiperIndex === 0 ? Visibility.Visible : Visibility.Hidden)
.animation({ duration: 500 })
.position({ x: '90%', y: '90%' })
.onClick(() => {
this.swiperController.showNext()
})
}
.height('100%')
.width('100%')
}
.height('100%')
.width('100%')
... ... @@ -23,7 +83,29 @@ export struct DetailPlayVLivePage {
}
aboutToDisappear(): void {
getLiveDetails() {
this.liveViewModel.getLiveDetails(this.contentId, this.relId, this.relType)
.then(
(data) => {
if (data.length > 0) {
this.liveDetailsBean = data[0]
console.error('liveDetailsBean===', JSON.stringify((this.liveDetailsBean)))
}
},
() => {
})
}
getLiveRoomData() {
this.liveViewModel.getLiveRoomData(this.contentId)
.then(
(data) => {
this.liveRoomDataBean = data
},
() => {
})
}
}
\ No newline at end of file
}
... ...