Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张善主
2024-05-22 15:23:00 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
50be3510a238013e9c44c143cb2ca3a1e7002a9f
50be3510
2 parents
fb140cc9
7b846cd8
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
196 additions
and
87 deletions
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/model/CommentModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
sight_harmony/features/wdComponent/src/main/ets/components/CardParser.ets
View file @
50be351
...
...
@@ -5,7 +5,6 @@ import { Card3Component } from './cardview/Card3Component';
import { Card4Component } from './cardview/Card4Component';
import { Card5Component } from './cardview/Card5Component';
import { Card6Component } from './cardview/Card6Component';
import { Card9Component } from './cardview/Card9Component';
import { Card10Component } from './cardview/Card10Component';
import { Card11Component } from './cardview/Card11Component';
import { Card12Component } from './cardview/Card12Component';
...
...
@@ -48,8 +47,6 @@ export struct CardParser {
} else if (contentDTO.appStyle === CompStyle.Card_06 || contentDTO.appStyle === CompStyle
.Card_13) {
Card6Component({ compDTO: this.compDTO, contentDTO: this.contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_09) {
Card9Component({ contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_10) {
Card10Component({ compDTO: this.compDTO, contentDTO })
} else if (contentDTO.appStyle === CompStyle.Card_11) {
...
...
sight_harmony/features/wdComponent/src/main/ets/components/CompParser.ets
View file @
50be351
import { CompDTO } from 'wdBean';
import { CompDTO
, ContentDTO
} from 'wdBean';
import { CommonConstants, CompStyle } from 'wdConstant/Index';
import { WDRouterPage, WDRouterRule } from 'wdRouter/Index';
import PageModel from '../viewmodel/PageModel';
import { CardParser } from './CardParser';
import { Card2Component } from './cardview/Card2Component';
import { Card9Component } from './cardview/Card9Component';
import { Card5Component } from './cardview/Card5Component';
import { AdvCardParser } from './cardViewAdv/AdvCardParser';
import { ZhCarouselLayout01 } from './compview/ZhCarouselLayout01';
...
...
@@ -35,10 +36,20 @@ export struct CompParser {
@ObjectLink compDTO: CompDTO
@State compIndex: number = 0;
@State private pageModel: PageModel = new PageModel();
@State audioItems: ContentDTO[] = [];
@State noneAudioItems: ContentDTO[] = [];
aboutToAppear(): void {
// 轮播图屏蔽音频类型稿件
if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
this.audioItems = this.compDTO.operDataList.filter(item => item.appStyle === '13')
this.noneAudioItems = this.compDTO.operDataList.filter(item => item.appStyle !== '13')
this.compDTO.operDataList = this.noneAudioItems;
}
}
build() {
Column() {
this.componentBuilder();
}
}
...
...
@@ -50,73 +61,80 @@ export struct CompParser {
if (this.compDTO.operDataList[0]?.objectType !== '3' &&
this.compDTO.operDataList[0]?.objectType !== '13') { //暂时屏蔽活动和音频详情入口
if (this.compDTO.compStyle === CompStyle.Label_03) {
LabelComponent({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Carousel_Layout_01) {
ZhCarouselLayout01({ compDTO: this.compDTO })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
if (this.compDTO.operDataList.length > this.audioItems.length) {
ZhCarouselLayout01({ compDTO: this.compDTO })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
}
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 &&
this.compDTO.imageScale === 2) { // && compDTO.name ==="横划卡"
LiveHorizontalCardComponent({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_01 && this.compDTO.imageScale === 3) {
if (this.compDTO.operDataList.length > 1) {
HorizontalStrokeCardThreeTwoRadioForMoreComponent({ compDTO: this.compDTO })
} else {
HorizontalStrokeCardThreeTwoRadioForOneComponent({ compDTO: this.compDTO })
}
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_02) {
ZhSingleRow02({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_03) {
ZhSingleRow03({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_02) { //双列流小视频,一行两图卡 ->标题
//ZhGridLayout02({ compDTO: this.compDTO })
CompNormalTitle({ compDTO: this.compDTO })
// Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
// Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Zh_Grid_Layout_02) { //双列流小视频,一行两图卡
ZhGridLayout02NewsContent({ compDTO: this.compDTO, operDataList: this.compDTO.operDataList })
} else if (this.compDTO.compStyle === CompStyle.Zh_Grid_Layout_03) {
ZhGridLayout03({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_04) {
ZhSingleRow04({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_05) {
// ZhSingleRow05({ compDTO })
// Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
// Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Row_06) {
ZhSingleRow06({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_02) {
//头图卡 和comStyle 2相同,
Card5Component({ contentDTO: this.compDTO.operDataList[0], titleShowPolicy: this.compDTO.titleShowPolicy })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_03) {
// 大图卡
Card2Component({ compDTO: this.compDTO, contentDTO: this.compDTO.operDataList[0] })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Card_09) {
//时间链卡
Card9Component({ contentDTO:this.compDTO.operDataList[0] })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_04) {
ZhSingleColumn04({ compDTO: this.compDTO })
Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_05) {
// ZhSingleColumn05({ compDTO: compDTO })
// Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
// Divider().strokeWidth(
5).color('#f5f5f5').padding({ left: 0, right: 0
})
} else if (this.compDTO.compStyle === CompStyle.Zh_Single_Column_09) {
Divider().strokeWidth(3).color('#ffffff').padding({ left:
16, right: 16
}).margin({ top: -3 })
Divider().strokeWidth(3).color('#ffffff').padding({ left:
0, right: 0
}).margin({ top: -3 })
Divider().strokeWidth(6).color('#f5f5f5')
ZhSingleColumn09({ compDTO: this.compDTO })
Divider().strokeWidth(6).color('#f5f5f5')
} else if (this.compDTO.compStyle === CompStyle.Card_Comp_Adv) { // 广告
AdvCardParser({ pageModel: this.pageModel, compDTO: this.compDTO })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 16, right: 16 })
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
//Text(`compIndex = ${compIndex}`).width('100%').fontSize('12fp').fontColor(Color.Red).padding({ left: 0, right: 0 })
Divider().strokeWidth(5).color('#f5f5f5').padding({ left: 0, right: 0 })
} else if (!Number.isNaN(Number(this.compDTO.compStyle))) {
CardParser({ contentDTO: this.compDTO.operDataList[0], compDTO: this.compDTO });
Divider().strokeWidth(1).color('#f5f5f5').padding({ left: 16, right: 16 })
...
...
@@ -129,7 +147,7 @@ export struct CompParser {
// WDRouterRule.jumpWithPage(WDRouterPage.QualityCommentsPage)
// }
// })
// Divider().strokeWidth(
1).color('#f5f5f5').padding({ left: 16, right: 16
})
// Divider().strokeWidth(
8).color('#f5f5f5').padding({ left: 0, right: 0
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/model/CommentModel.ets
View file @
50be351
...
...
@@ -114,7 +114,7 @@ export class commentItemModel {
/*评论点赞状态 0-未点赞 1-已点赞*/
api_status: boolean = false;
api_level: string = '';
api_levelHead: string = '
http
';
api_levelHead: string = '';
api_userId: string = '';
api_creatorId: string = '';
api_userType: string = '';
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/view/CommentComponent.ets
View file @
50be351
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource } from 'wdKit/Index';
import { DateTimeUtils, EmitterEventId, EmitterUtils, LazyDataSource
, StringUtils
} from 'wdKit/Index';
import { commentItemModel, WDPublicUserType } from '../model/CommentModel';
import commentViewModel from '../viewmodel/CommentViewModel';
import { CommentText } from './CommentText';
...
...
@@ -303,34 +303,7 @@ struct ChildCommentItem {
Column() {
Row() {
//头像
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width('24')
.height('24')
.objectFit(ImageFit.Cover)
.borderRadius(16)
Image(this.item.api_levelHead)
.width('36')
.height('36')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
.width(48)
.height(48)
.margin({ left: 47 })
.alignContent(Alignment.Center)
.onClick(() => {
// TODO 跳转个人详情
// 跳转到号主页
if (this.contentDetailData.rmhInfo?.cnMainControl === 1) {
const params: Params = {
creatorId: this.contentDetailData.rmhInfo.rmhId,
pageID: ''
}
WDRouterRule.jumpWithPage(WDRouterPage.peopleShipHomePage, params)
}
})
this.headerView()
//昵称
Text() {
...
...
@@ -354,7 +327,7 @@ struct ChildCommentItem {
/// 人民号>置顶>作者
//人民号
if (this.item.fromUserType
=== WDPublicUserType.WDPublicUserType_Matrix
) {
if (this.item.fromUserType
!== 1
) {
Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
}
//置顶
...
...
@@ -400,6 +373,53 @@ struct ChildCommentItem {
.width('100%')
}
@Builder headerView() {
Stack() {
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width(24)
.height(24)
.objectFit(ImageFit.Cover)
.borderRadius(16)
if (this.item.api_authIcon && this.item.api_authIcon.length) {
Image(this.item.api_authIcon) // 加v
.width(14).height(14)
.objectFit(ImageFit.Cover)
}
}.width(24).height(24)
.alignContent(Alignment.BottomEnd)
if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0)
&& this.item.fromUserType === 1
&& ((this.item.api_levelHead && this.item.api_levelHead.length > 0)
|| (this.item.avatarFrame && this.item.avatarFrame.length > 0))) {
Image(this.customBorderIconURL())
.width('36')
.height('36')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
}
.width(48).height(48)
.margin({ left: 47 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
}
customBorderIconURL() : string {
if (this.item.avatarFrame.length > 0) {
return this.item.avatarFrame
}
if (this.item.fromUserType === 1) {
return this.item.api_levelHead
}
return ""
}
replyComment() {
if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复
this.publishCommentModel.rootCommentId = this.item.rootCommentId
...
...
@@ -498,26 +518,7 @@ struct commentHeaderView {
Column() {
Row() {
//头像
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width('32')
.height('32')
.objectFit(ImageFit.Cover)
.borderRadius(16)
Image(this.item.api_levelHead)
.width('48')
.height('48')
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
.width(48)
.height(48)
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
this.headerView()
//昵称
Text(this.item.fromUserName)
...
...
@@ -531,7 +532,7 @@ struct commentHeaderView {
/// 人民号>置顶>作者
//人民号
if (this.item.fromUserType
=== WDPublicUserType.WDPublicUserType_Matrix
) {
if (this.item.fromUserType
!== 1
) {
Image($r('app.media.comment_rmh_tag')).width(20).height(20).margin({ left: 5 });
}
//置顶
...
...
@@ -573,6 +574,53 @@ struct commentHeaderView {
.padding({bottom: 8})
}
@Builder headerView() {
Stack() {
Stack() {
Image(this.item.fromUserHeader)
.alt($r('app.media.default_head'))
.width(32)
.height(32)
.objectFit(ImageFit.Cover)
.borderRadius(16)
if (this.item.api_authIcon && this.item.api_authIcon.length > 0) {
Image(this.item.api_authIcon) // 加v
.width(14).height(14)
.objectFit(ImageFit.Cover)
}
}.width(32).height(32)
.alignContent(Alignment.BottomEnd)
if ((!this.item.api_authIcon || this.item.api_authIcon.length == 0)
&& this.item.fromUserType === 1
&& ((this.item.api_levelHead && this.item.api_levelHead.length > 0)
|| (this.item.avatarFrame && this.item.avatarFrame.length > 0))) {
Image(this.customBorderIconURL())
.width(48)
.height(48)
.objectFit(ImageFit.Cover)
.borderRadius(24)
}
}
.width(48).height(48)
.margin({ left: 8 })
.alignContent(Alignment.Center)
.onClick(() => {
commentViewModel.jumpToAccountPage(this.item)
})
}
customBorderIconURL() : string {
if (this.item.avatarFrame.length > 0) {
return this.item.avatarFrame
}
if (this.item.fromUserType === 1) {
return this.item.api_levelHead
}
return ""
}
replyComment() {
if (this.item.id && this.item.checkStatus == '2') { // 审核通过的才显示回复
this.publishCommentModel.rootCommentId = this.item.rootCommentId
...
...
@@ -596,7 +644,7 @@ struct commentFooterView {
Row() {
Row({ space: 6 }) {
Text(this.item.region ? (this.item.region + '网友') : '人民日报客户端网友')
Text(this.item.region
.length > 0
? (this.item.region + '网友') : '人民日报客户端网友')
.fontColor($r('app.color.color_B0B0B0'))
.fontSize(12);
Image($r('app.media.comment_hyphen'))
...
...
sight_harmony/features/wdComponent/src/main/ets/components/comment/viewmodel/CommentViewModel.ets
View file @
50be351
...
...
@@ -419,7 +419,7 @@ class CommentViewModel {
newModel.fromUserHeader = model.fromUserHeader
newModel.fromUserId = model.fromUserId
newModel.fromUserName = model.fromUserName
if (model.
toUserType != null
) {
if (model.
fromUserType
) {
newModel.fromUserType = model.fromUserType
}
newModel.id = model.id
...
...
@@ -443,7 +443,7 @@ class CommentViewModel {
// newModel.isLoading = model.isLoading
if (model.toUserType
!= null
) {
if (model.toUserType) {
newModel.toUserType = model.toUserType.toString()
}
newModel.topFlag = model.topFlag
...
...
sight_harmony/features/wdComponent/src/main/ets/components/mine/follow/FollowListDetailUI.ets
View file @
50be351
...
...
@@ -154,7 +154,12 @@ export struct FollowListDetailUI {
} else {
fansNumString = fansNum + ""
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, value.introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl, value.authIcon))
let introduction = value.introduction
if(value.introduction.indexOf("\n") != -1){
let regex:RegExp = new RegExp('\n','g')
introduction = value.introduction.replace(regex,'')
}
this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl, value.attentionUserName, fansNumString, introduction, value.attentionCreatorId, "1", value.attentionUserId, value.attentionUserType, value.attentionUserId, value.mainControl, value.banControl, value.authIcon))
})
this.data.notifyDataReload()
this.count = this.data.totalCount()
...
...
@@ -272,7 +277,12 @@ export struct FollowListDetailUI {
})
result.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, item.mainControl, item.banControl, item.authIcon))
let introduction = item.introduction
if(item.introduction.indexOf("\n") != -1){
let regex:RegExp = new RegExp('\n','g')
introduction = item.introduction.replace(regex,'')
}
this.data.push(new FollowListDetailItem(item.headPhotoUrl, item.cnUserName, item.cnFansNum, introduction, item.creatorId, item.status, item.attentionUserId, item.cnUserType, item.cnUserId, item.mainControl, item.banControl, item.authIcon))
})
this.data.notifyDataReload()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
50be351
...
...
@@ -148,10 +148,9 @@ export struct OperRowListView {
// 视频详情页
Column() {
Image($r('app.media.ic_news_detail_division'))
.width('100%')
.height($r('app.float.margin_1'))
// .margin({bottom: -2})
if(this.styleType != 3) {
Divider().strokeWidth(1).color(this.styleType == 1 ? '#F5F5F5' : this.styleType == 2 ? '#262626' : 'rgba(0,0,0,0)')
}
Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) {
// AudioDialog()
...
...
sight_harmony/features/wdComponent/src/main/ets/viewmodel/PageHelper.ets
View file @
50be351
...
...
@@ -25,6 +25,7 @@ const Normal_Page_Size = 20 // 常规每页数量
const Rec_Page_Size = 10 // 推荐每页数量
const SpecialComp: string[] = [CompStyle.Zh_Single_Column_03.toString()]
/**
* 处理返回后的数据
...
...
@@ -379,7 +380,8 @@ export class PageHelper {
*/
private factoryCompArray(compList: CompDTO[]): ArrayList<CompDTO> {
let pageCompList: ArrayList<CompDTO> = new ArrayList() // 收集页面组件、稿件和本地组件容器
compList.forEach((element: CompDTO) => {
let newCompList = this.createSpecialComp(compList)
newCompList.forEach((element: CompDTO) => {
let contentInfo: ContentDTO = CollectionUtils.getElement(element.operDataList, 0);
//移除音频 和 活动
if (contentInfo && (contentInfo.objectType === '13' || contentInfo.objectType === '3')) {
...
...
@@ -402,6 +404,41 @@ export class PageHelper {
}
/**
* 竖直方向list,将数据拆出来,组装成comp
*/
private createSpecialComp(compList: CompDTO[]): CompDTO[]{
if (!compList) {
return compList
}
let tmpList: CompDTO[] = []
compList.forEach((value, index) => {
if (SpecialComp.includes(value.compStyle)) {
let list = value.operDataList
if (list) {
if (list.length == 1) {
tmpList.push(value)
} else {
list.forEach((content) => {
let newComp = CompDTO.createNewsBean(value)
newComp.operDataList = []
// 特殊样式,comp只保留一个content,多余的一一拆成新的comp
newComp.operDataList.push(content)
tmpList.push(newComp)
})
}
} else {
tmpList.push(value)
}
} else {
tmpList.push(value)
}
})
// 重新赋值,将contentList拆出来了。
return tmpList
}
/**
* 信息流页面,所有稿件需要参与批查,如 批查评论、批查关注状态等接口
* @param compList
* @param pageModel
...
...
Please
register
or
login
to post a comment