wangyong_wd

新增:人民号动态图文卡

@@ -108,4 +108,8 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo'; @@ -108,4 +108,8 @@ export { ShareInfo } from './src/main/ets/bean/morningevening/ShareInfo';
108 108
109 export { slideShows } from './src/main/ets/bean/morningevening/slideShows'; 109 export { slideShows } from './src/main/ets/bean/morningevening/slideShows';
110 110
111 -export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean';  
  111 +export { LiveDetailsBean } from './src/main/ets/bean/live/LiveDetailsBean';
  112 +
  113 +export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
  114 +
  115 +export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO';
  1 +/**
  2 + * http://192.168.1.3:3300/project/3856/interface/api/190567
  3 + * 接口名称:客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表
  4 + * 接口路径:GET/zh/c/article/articleList
  5 + * 人民号-动态tab下列表数据
  6 + */
  7 +import { appStyleImagesDTO } from '../content/appStyleImagesDTO'
  8 +export interface ArticleListDTO {
  9 + listTitle: string;
  10 + mainPicCount: string;
  11 + videosCount: string;
  12 + voicesCount: string;
  13 + landscape: number;
  14 + sourceName: string;
  15 + finalStatus: string;
  16 + score: string;
  17 + shareUrl: string;
  18 + sortPosId: string;
  19 + id: string;
  20 + serialsId: string;
  21 + oldContentId: string;
  22 + type: string;
  23 + tenancy: string;
  24 + clientPubFlag: string;
  25 + grayScale: string;
  26 + title: string
  27 + publishType: string;
  28 + publishTime: string;
  29 + firstPublishTime: string;
  30 + onlineStatus: string;
  31 + auditingStatus: string;
  32 + zhOnlineStatus: string;
  33 + zhAuditingStatus: string;
  34 + selectedStatus: string;
  35 + qualityScore: string;
  36 + levelScore: number;
  37 + isOrg: string;
  38 + articlePayment: number;
  39 + appStyle: number;
  40 + appStyleImages: appStyleImagesDTO[];
  41 + description: string;
  42 + introduction: string;
  43 + deleted: string;
  44 + keyArticle: string;
  45 + updateTime: string;
  46 + createTime: string;
  47 + createUserId: string;
  48 + createUserName: string;
  49 + creatorId: number;
  50 + creatorName: string;
  51 + articleExistVote: string;
  52 + rmhPlatform: string;
  53 + objectPos: string;
  54 + objectPosPictures: string;
  55 + shareFlag: string;
  56 + firstPublish: string;
  57 + readNum: string;
  58 + readFlag: string;
  59 + creatorLevel: string;
  60 + creatorTag: string;
  61 + joinActivity: string;
  62 + userType: string;
  63 + content: object;
  64 + contentShare: [];
  65 + contentLinkData: string;
  66 + contentExt: [];
  67 + contentVideos: string;
  68 + contentPictures: [];
  69 + contentPayments: string;
  70 + contentPaymentStaffs: string;
  71 + contentTxt: [];
  72 + contentSource: object;
  73 + contentTags: string;
  74 + contentVoices: string;
  75 + contentAuthorLocals: string;
  76 + contentEpaperArticle: string;
  77 + contentStatistics: string;
  78 + topicExistHeadImage: string;
  79 + topicComps: string;
  80 + live: string;
  81 + statusInfo: string;
  82 + askInfo: string;
  83 + askAttachmentList: string;
  84 + askAnswerList: string;
  85 + askFeedbackList: string;
  86 + ttopicInteracts: string;
  87 + ttopic: string;
  88 + mlive: string;
  89 + vlives: string
  90 +}
  1 +export interface appStyleImagesDTO {
  2 + url: string;
  3 + bucket: string;
  4 + landscape: number;
  5 + sort: number;
  6 + height: number;
  7 + weight: number;
  8 + size: number;
  9 + format: number;
  10 + fullUrl: string
  11 +}
  1 +import { ArticleListDTO, appStyleImagesDTO } from 'wdBean';
  2 +import { rmhTitle } from './rmhTitle'
  3 +
  4 +const TAG = 'Card19Component';
  5 +
  6 +/**
  7 + * 人民号-动态---19:动态图文卡人民号; 从无图--9图
  8 + */
  9 +@Entry
  10 +@Component
  11 +export struct Card19Component {
  12 + @State articleListItem: ArticleListDTO = {} as ArticleListDTO
  13 +
  14 + aboutToAppear(): void {
  15 + }
  16 +
  17 + build() {
  18 + Column() {
  19 + // rmh信息
  20 + rmhTitle()
  21 + // 标题
  22 + if (this.articleListItem.title) {
  23 + Text(this.articleListItem.title)
  24 + .fontSize($r('app.float.font_size_17'))
  25 + .fontColor($r('app.color.color_222222'))
  26 + .textOverflowStyle(2)
  27 + .margin({ bottom: 8 })
  28 + }
  29 + // 图片-从无图到9图展示
  30 + createArticleListItem({ appStyleImages: this.articleListItem.appStyleImages })
  31 + //TODO 底部的:分享、评论、点赞 功能;需要引用一个公共组件
  32 + }
  33 + .padding({
  34 + left: $r('app.float.card_comp_pagePadding_lf'),
  35 + right: $r('app.float.card_comp_pagePadding_lf'),
  36 + top: $r('app.float.card_comp_pagePadding_tb'),
  37 + bottom: $r('app.float.card_comp_pagePadding_tb')
  38 + })
  39 + }
  40 +}
  41 +
  42 +@Component
  43 +struct createArticleListItem {
  44 + @Prop appStyleImages: appStyleImagesDTO[]
  45 +
  46 + build() {
  47 + if (this.appStyleImages.length === 1) {
  48 + Image(this.appStyleImages[0].fullUrl)
  49 + .width('66%')
  50 + .alignSelf(ItemAlign.Start)
  51 + } else if (this.appStyleImages.length > 4 || this.appStyleImages.length === 2 || this
  52 + .appStyleImages.length === 3) {
  53 + Flex({ wrap: FlexWrap.Wrap }) {
  54 + ForEach(this.appStyleImages, (item: appStyleImagesDTO, index: number) => {
  55 + Image(item.fullUrl)
  56 + .width('32%')
  57 + .aspectRatio(1)
  58 + .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 })
  59 + })
  60 + }
  61 + } else if (this.appStyleImages.length === 4) {
  62 + Flex({ wrap: FlexWrap.Wrap }) {
  63 + ForEach(this.appStyleImages.slice(0, 2), (item: appStyleImagesDTO, index: number) => {
  64 + Image(item.fullUrl)
  65 + .width('32%')
  66 + .aspectRatio(1)
  67 + .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 })
  68 + })
  69 + Rect()
  70 + .width('32%')
  71 + .aspectRatio(1)
  72 + .fill($r('app.color.color_transparent'))
  73 + ForEach(this.appStyleImages.slice(2, 4), (item: appStyleImagesDTO, index: number) => {
  74 + Image(item.fullUrl)
  75 + .width('32%')
  76 + .aspectRatio(1)
  77 + .margin({ right: (index + 1) % 3 === 0 ? 0 : 2, bottom: 2 })
  78 + })
  79 + }
  80 + }
  81 +
  82 + }
  83 +}
  84 +
  85 +
  86 +@Extend(Text)
  87 +function textOverflowStyle(maxLine: number) {
  88 + .maxLines(maxLine)
  89 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  90 +}
  1 +/**
  2 + * 这里是人民号动态中的顶部信息:人民号logo,名字,描述,关注等
  3 + */
  4 +import { RmhInfoDTO } from 'wdBean'
  5 +import { CommonConstants } from 'wdConstant/Index';
  6 +import { DateTimeUtils } from 'wdKit/Index';
  7 +
  8 +interface RmhInfo extends RmhInfoDTO {
  9 + isSelected: boolean;
  10 + headPhotoUrl: string;
  11 + introduction: string;
  12 + userName: string;
  13 + publishTime: string;
  14 +}
  15 +
  16 +@Entry
  17 +@Component
  18 +export struct rmhTitle {
  19 + // TODO 这里需要传入rmh信息及是否显示关注,是否已关注
  20 + @State isAttentionShow: Boolean = false
  21 + @State rmhInfo: RmhInfo = {
  22 + authIcon: "https://cdnjdphoto.aikan.pdnews.cn/creator-category/icon/auth/blue.png",
  23 + authTitle: "四川农业大学",
  24 + headPhotoUrl: "https://cdnjdphoto.aikan.pdnews.cn//upload/ueditor/image/20221208/a_785146000057561088.png?x-oss-process=image/resize,l_100/auto-orient,1/quality,q_90/format,jpg",
  25 + introduction: "四川农业四川",
  26 + userId: "554708665557894",
  27 + userName: "四川农业大学",
  28 + userType: "2",
  29 + publishTime: '1712912775606'
  30 + } as RmhInfo
  31 +
  32 + build() {
  33 + Row() {
  34 + Stack() {
  35 + Image(this.rmhInfo.headPhotoUrl)
  36 + .width(36)
  37 + .height(36).borderRadius(50)
  38 + Image(this.rmhInfo.authIcon)
  39 + .width(14)
  40 + .height(14)
  41 + .borderRadius(50)
  42 + }
  43 + .margin({ right: 8 })
  44 + .alignContent(Alignment.BottomEnd)
  45 + Column() {
  46 + Text(this.rmhInfo.userName)
  47 + .fontSize($r('app.float.font_size_13'))
  48 + .fontColor($r('app.color.color_222222'))
  49 + .fontWeight(600)
  50 + .alignSelf(ItemAlign.Start)
  51 + Row() {
  52 + Text(DateTimeUtils.formatDate(Number.parseFloat(this.rmhInfo.publishTime)))
  53 + .fontSize($r("app.float.font_size_12"))
  54 + .fontColor($r("app.color.color_B0B0B0"))
  55 + Image($r("app.media.point"))
  56 + .width(16)
  57 + .height(16)
  58 + Text(this.rmhInfo.introduction)
  59 + .fontSize($r("app.float.font_size_12"))
  60 + .fontColor($r("app.color.color_B0B0B0"))
  61 + .margin({ left: 6 })
  62 + .maxLines(1)
  63 + .textOverflow({overflow: TextOverflow.Ellipsis})
  64 + }
  65 + }
  66 + .align(Alignment.Start)
  67 + Blank()
  68 + if(this.isAttentionShow) {
  69 + Row(){
  70 + Image($r('app.media.rmh_follow'))
  71 + .width(16)
  72 + .height(16)
  73 + Text('关注')
  74 + .fontSize($r('app.float.font_size_13'))
  75 + .fontColor($r('app.color.color_ED2800'))
  76 + }
  77 + }
  78 + }
  79 + .width(CommonConstants.FULL_WIDTH)
  80 + .margin({bottom: 10})
  81 + }
  82 +}