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
yanlu
2024-05-09 18:30:16 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ce98291dbae937a61305974f341dc8bd912bfc7d
ce98291d
1 parent
5b23c2fb
fix:早晚报评论数
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
20 deletions
sight_harmony/features/wdBean/src/main/ets/bean/morningevening/CompList.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/SingleColumn999Component.ets
sight_harmony/features/wdComponent/src/main/ets/components/page/CardView.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
sight_harmony/features/wdBean/src/main/ets/bean/morningevening/CompList.ets
View file @
ce98291
import { AudioDataList } from './AudioDataList';
import {
OperDataList } from './OperDataList
';
import {
ContentDTO } from '../content/ContentDTO
';
export interface CompList {
audioDataList: AudioDataList[];
...
...
@@ -36,7 +36,7 @@ export interface CompList {
// openComment?: any;
// openLikes?: any;
operDataList:
OperDataList
[];
operDataList:
ContentDTO
[];
pageId: string;
// position?: any;
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/MorningEveningPaperComponent.ets
View file @
ce98291
// import { FrontLinkObject, MorningEveningPaperDTO, PageInfoBean } from 'wdBean';
import { CompList, PageInfoBean } from 'wdBean';
import {
CompList,
PageInfoBean,
ContentDTO,
contentListParams,
InteractDataDTO
} from 'wdBean';
import { DateTimeUtils, Logger, SPHelper, WindowModel } from 'wdKit/Index';
import { PaperReaderSimpleDialog } from '../../dialog/PaperReaderDialog';
import { MorningEveningViewModel } from '../../viewmodel/MorningEveningViewModel';
...
...
@@ -13,6 +19,7 @@ import { image } from '@kit.ImageKit';
import { getPicture, imageNet2PixelMap } from '../../utils/ImageUtils';
import { effectKit } from '@kit.ArkGraphics2D';
import { window } from '@kit.ArkUI';
import { PeopleShipMainViewModel } from '../../viewmodel/PeopleShipMainViewModel';
const TAG = 'MorningEveningPaperComponent';
...
...
@@ -22,6 +29,7 @@ export struct MorningEveningPaperComponent {
@State pageInfoBean: PageInfoBean = {} as PageInfoBean
// @State compInfoBean: CompInfoBean = {} as CompInfoBean
@State compListItem: CompList = {} as CompList
@Provide commentList: InteractDataDTO[] = []
@State audioPlayUrl: string = ""
// @Consume dailyPaperTopicPageId: number
// @Provide compListItem: CompList = {} as CompList
...
...
@@ -128,6 +136,10 @@ export struct MorningEveningPaperComponent {
// this.compInfoBean = compInfoBean
if (compInfoBean?.compList[0]) {
this.compListItem = compInfoBean?.compList[0]
Logger.debug(TAG, '获取评论数据' + `${this.compListItem.operDataList.length}`)
if (this.compListItem.operDataList && this.compListItem.operDataList.length > 0) {
this.getAllContentInteractData(this.compListItem.operDataList)
}
if (compInfoBean?.compList[0].audioDataList) {
this.audioPlayUrl = compInfoBean?.compList[0].audioDataList[0].audioUrl
this.audioTitle = compInfoBean?.compList[0].audioDataList[0].title
...
...
@@ -145,6 +157,29 @@ export struct MorningEveningPaperComponent {
}
}
// 批量查询内容当前用户点赞、收藏状态评论个数
private async getAllContentInteractData(list: ContentDTO[]) {
try {
// 获取列表数据
const params: contentListParams = {
contentList: []
}
list.forEach((item: ContentDTO) => {
params.contentList.push({
contentId: item.objectId,
contentType: Number(item.objectType ?? '1')
})
})
Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(params)}`)
this.commentList = await PeopleShipMainViewModel.getContentInteractInfo(params)
Logger.debug(TAG, '获取评论数据' + `${JSON.stringify(this.commentList)}`)
} catch (exception) {
}
}
async setComponentBgColor(imageUrl: string) {
// 图片转换为PixelMap对象
...
...
@@ -203,7 +238,9 @@ export struct MorningEveningPaperComponent {
}
ListItem() {
SingleColumn999Component({ compListItem: this.compListItem })
SingleColumn999Component({
compListItem: this.compListItem,
})
.margin({
top: this.pageInfoBean?.topicInfo?.frontLinkObject ? 10 : 44
})
...
...
sight_harmony/features/wdComponent/src/main/ets/components/MorningEveningPaper/SingleColumn999Component.ets
View file @
ce98291
import { CompList, ContentDTO } from 'wdBean';
import { it } from '@ohos/hypium';
import { CompList, ContentDTO, InteractDataDTO} from 'wdBean';
import { BreakpointConstants } from 'wdConstant';
import { Logger } from 'wdKit';
import { PaperSingleColumn999CardView } from '../page/CardView';
...
...
@@ -13,6 +14,7 @@ const TAG = 'SingleColumn999Component';
export struct SingleColumn999Component {
// @Consume compListItem?: CompList
@Prop compListItem?: CompList
@StorageLink('currentBreakpoint') @Watch('watchCurrentBreakpoint') currentBreakpoint: string = BreakpointConstants.BREAKPOINT_XS;
// @State compDTO: CompDTO = {
...
...
@@ -122,8 +124,6 @@ export struct SingleColumn999Component {
this.buildPaperItem(item, index)
}
}, (item: ContentDTO, index: number) => JSON.stringify(item))
// }
// .divider({ strokeWidth: 1, color: '#EFEFEF' }) // 每行之间的分界线
ListItem() {
Text("已显示全部内容")
...
...
@@ -170,7 +170,7 @@ export struct SingleColumn999Component {
buildPaperItem(item: ContentDTO, index: number) {
PaperSingleColumn999CardView({
item: item,
index: index
index: index
,
})
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/page/CardView.ets
View file @
ce98291
import { Action, ContentDTO, Params } from 'wdBean';
import { Action, ContentDTO, Params
, InteractDataDTO
} from 'wdBean';
import { CommonConstants, ConfigConstants, ScreenType } from 'wdConstant';
import { Logger, ToastUtils, DateTimeUtils } from 'wdKit';
import { CompUtils } from '../../utils/CompUtils';
...
...
@@ -389,6 +389,8 @@ export struct MasonryLayout01CardView {
export struct PaperSingleColumn999CardView {
private item: ContentDTO = {} as ContentDTO;
private index: number = -1;
@State interactData: InteractDataDTO = {} as InteractDataDTO;
@Consume @Watch('onChangeCommentList') commentList: InteractDataDTO[]
getPublishTime(): string {
const publishTimestamp = parseInt(this.item?.publishTime)
...
...
@@ -471,7 +473,7 @@ export struct PaperSingleColumn999CardView {
.textOverflow({ overflow: TextOverflow.Ellipsis })// 超出的部分显示省略号。
.margin({ left: 22, right: 22 })
}
if (this.item
?.visitorComment
) {
if (this.item) {
Row() {
Row() {
Text(this.item?.source)
...
...
@@ -485,10 +487,17 @@ export struct PaperSingleColumn999CardView {
Text(this.getPublishTime())
.fontSize(12)
.fontColor(Color.Gray)
Text(this.item?.visitorComment + "评")
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 6 })
if (this.interactData && this.interactData.commentNum) {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 6 })
}else if (this.commentList && this.commentList.length) {
Text(this.interactData.commentNum + "评")
.fontSize(12)
.fontColor(Color.Gray)
.margin({ left: 6 })
}
}
.justifyContent(FlexAlign.Start)
...
...
@@ -514,4 +523,22 @@ export struct PaperSingleColumn999CardView {
ProcessUtils.processPage(this.item)
})
}
aboutToAppear(): void {
this.onChangeCommentList()
}
onChangeCommentList() {
// 获取评论
if (this.commentList && this.commentList.length > 0 && this.item && this.item.objectId) {
const objc = this.commentList.find((interactModel: InteractDataDTO) => {
return this.item.objectId == interactModel.contentId
})
if (objc) {
this.interactData = objc
}
}
}
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipMainComponent.ets
View file @
ce98291
...
...
@@ -63,12 +63,10 @@ export struct PeopleShipMainComponent {
this.LoadingLayout()
} else if (this.viewType == ViewType.ERROR) {
ErrorComponent()
.onTouch((event: TouchEvent | undefined) => {
if (event) {
.onTouch(() => {
if (this.viewType === ViewType.ERROR) {
this.getData()
}
}
})
} else if (this.viewType == ViewType.EMPTY) {
EmptyComponent()
...
...
sight_harmony/features/wdComponent/src/main/ets/components/peopleShip/PeopleShipRecommendComponent.ets
View file @
ce98291
import { PeopleShipRecommendHeadComponent } from './PeopleShipRecommendHeadComponent'
import { RmhRecommendDTO } from 'wdBean';
import { PeopleShipNoMoreData } from '../reusable/PeopleShipNoMoreData';
@Component
export struct PeopleShipRecommendComponent {
...
...
@@ -103,8 +102,6 @@ export struct PeopleShipRecommendComponent {
this.oneKeyFollow = true
}
})
// 没有更多
PeopleShipNoMoreData()
}
.width('100%')
}
...
...
Please
register
or
login
to post a comment