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
daijian_wd
2024-04-28 15:28:04 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
78cde63b79df2fba9686c006d27543278fa99d23
78cde63b
1 parent
5bb67e7a
稿件底部评论点赞组件封装完善2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
25 deletions
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
sight_harmony/features/wdBean/src/main/ets/bean/content/InteractDataDTO.ets
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
sight_harmony/commons/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
78cde63
...
...
@@ -46,10 +46,6 @@ export class HttpUrlUtils {
*/
static readonly INTERACT_EXECUTELIKE: string = "/api/rmrb-interact/interact/zh/c/like/executeLike";
/**
* 收藏、取消收藏
*/
static readonly INTERACT_EXECUTECOLLECTRECORD: string = "/api/rmrb-interact/interact/zh/c/collect/executeCollcetRecord";
/**
* 关注号主
*/
static readonly INTERACT_ACCENTION_OPERATION: string = "/api/rmrb-interact/interact/zh/c/attention/operation";
...
...
sight_harmony/features/wdBean/src/main/ets/bean/content/InteractDataDTO.ets
View file @
78cde63
...
...
@@ -2,11 +2,11 @@
* 批查接口查询互动相关数据,返回数据bean
*/
export interface InteractDataDTO {
collectNum: number | String;
commentNum: number | String;
collectNum: number | string;
commentNum: number | string;
contentId: string;
contentType: number;
likeNum: number |
S
tring;
likeNum: number |
s
tring;
readNum: number;
shareNum: number;
}
\ No newline at end of file
...
...
sight_harmony/features/wdComponent/src/main/ets/components/ImageAndTextPageComponent.ets
View file @
78cde63
...
...
@@ -38,7 +38,7 @@ export struct ImageAndTextPageComponent {
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State isPageEnd: boolean = false
@State publishTime: string = ''
@State publishCommentModel: publishCommentModel =
{} as publishCommentModel
@State publishCommentModel: publishCommentModel =
new publishCommentModel()
build() {
Column() {
...
...
@@ -142,7 +142,10 @@ export struct ImageAndTextPageComponent {
//底部交互区
if (this.contentDetailData?.length) {
OperRowListView({ contentDetailData: this.contentDetailData[0] })
OperRowListView({
contentDetailData: this.contentDetailData[0],
publishCommentModel: this.publishCommentModel
})
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/OperRowListView.ets
View file @
78cde63
...
...
@@ -30,21 +30,21 @@ const TAG = 'OperRowListView';
* comment--评论;like--点赞;collect--收藏;share--分享;
*
* 传值示例:
OperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'share']
})
OperRowListView({
contentDetailData: this.contentDetailData[0],
operationButtonList: ['comment', 'like', 'collect', 'share']
})
*/
@Preview
@Component
export struct OperRowListView {
@Prop contentDetailData: ContentDetailDTO // 稿件详情
@State operationButtonList: string[] = ['comment', 'like', 'collect', 'share'] // 组件展示条件
@Prop publishCommentModel: publishCommentModel
// @State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State interactData: InteractDataDTO = {} as InteractDataDTO
@State newsStatusOfUser: batchLikeAndCollectResult | undefined = undefined // 点赞、收藏状态
@State likeBean: Record<string, string> = {}
@State publishCommentModel: publishCommentModel = new publishCommentModel()
async aboutToAppear() {
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
...
...
@@ -62,13 +62,13 @@ export struct OperRowListView {
console.info(TAG, 'contentDetailData----', JSON.stringify(this.contentDetailData))
console.info(TAG, 'likeBean----', JSON.stringify(this.likeBean))
// 评论需要数据
this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
this.publishCommentModel.targetType = this.contentDetailData.newsType + ''
/* this.publishCommentModel.targetId = this.contentDetailData.newsId + ''
this.publishCommentModel.targetRelId = this.contentDetailData.reLInfo?.relId + ''
this.publishCommentModel.targetTitle = this.contentDetailData.newsTitle + ''
this.publishCommentModel.targetRelType = this.contentDetailData.reLInfo?.relType + ''
this.publishCommentModel.targetRelObjectId = this.contentDetailData.reLInfo?.relObjectId + ''
this.publishCommentModel.keyArticle = this.contentDetailData.keyArticle + ''
this.publishCommentModel.targetType = this.contentDetailData.newsType + ''*/
}
build() {
...
...
@@ -232,7 +232,6 @@ export struct OperRowListView {
}
PageRepository.postExecuteCollectRecord(params).then(res => {
// console.log(TAG, '收藏、取消收藏', 'toggleLikeStatus==',)
if (this.newsStatusOfUser) {
this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
this.queryContentInteractCount()
...
...
@@ -258,7 +257,9 @@ export struct OperRowListView {
this.interactData.collectNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.collectNum)
this.interactData.commentNum = NumberFormatterUtils.formatNumberWithWan(res.data[0]?.commentNum)
// 评论组件需要数据
this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0'
if (Number.parseInt(this.interactData.commentNum) > Number.parseInt(this.publishCommentModel.totalCommentNumer)) {
this.publishCommentModel.totalCommentNumer = this.interactData.commentNum + '' || '0'
}
}
// console.log(TAG, '获取互动点赞等数据===', JSON.stringify(res))
console.log(TAG, 'this.interactData', JSON.stringify(this.interactData))
...
...
sight_harmony/features/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
78cde63
...
...
@@ -283,7 +283,7 @@ export class PageRepository {
* @returns
*/
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.get
Host() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let url = HttpUrlUtils.get
ExecuteCollcetUrl()
return WDHttp.post(url, params)
}
...
...
sight_harmony/features/wdDetailPlayApi/src/main/ets/request/ContentDetailRequest.ets
View file @
78cde63
...
...
@@ -288,7 +288,7 @@ export class ContentDetailRequest {
* @returns
*/
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.get
Host() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let url = HttpUrlUtils.get
ExecuteCollcetUrl()
return WDHttp.post(url, params)
}
...
...
Please
register
or
login
to post a comment