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-10 17:17:42 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
c44b3d87e9e24634d18b1f8110054c56f8356809
c44b3d87
2 parents
6d8f6d63
5cf15830
Merge remote-tracking branch 'origin/main'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
50 deletions
sight_harmony/features/wdComponent/src/main/ets/components/CarderInteraction.ets
sight_harmony/features/wdComponent/src/main/ets/components/setting/MineSettingComponent.ets
sight_harmony/features/wdComponent/src/main/ets/components/view/LikeComponent.ets
sight_harmony/features/wdComponent/src/main/resources/base/media/back_icon.png
sight_harmony/features/wdComponent/src/main/ets/components/CarderInteraction.ets
View file @
c44b3d8
...
...
@@ -6,6 +6,7 @@ import { batchLikeAndCollectParams } from 'wdDetailPlayApi/src/main/ets/request/
import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel';
import { SpConstants } from 'wdConstant/Index';
import { WDShare } from 'wdShare/Index';
import {LikeComponent} from './view/LikeComponent'
const TAG = 'CarderInteraction'
/**
* 卡片 分享、评论、点赞公用组件
...
...
@@ -16,6 +17,17 @@ export struct CarderInteraction {
@State contentId: string = ''
@State contentDetailData: ContentDetailDTO = {} as ContentDetailDTO
@State newsStatusOfUser: batchLikeAndCollectResult = {} as batchLikeAndCollectResult// 点赞、收藏状态
@State likeBean: Record<string, string> = {}
async aboutToAppear() {
await this.getContentDetailData()
// 点赞需要数据
this.likeBean['contentId'] = this.contentDetailData.newsId + ''
this.likeBean['userName'] = this.contentDetailData.userInfo?.userName + ''
this.likeBean['contentType'] = this.contentDetailData.newsType + ''
this.likeBean['title'] = this.contentDetailData.newsTitle + ''
this.likeBean['userHeaderUrl'] = this.contentDetailData.userInfo?.headPhotoUrl + ''
this.likeBean['channelId'] = this.contentDetailData.reLInfo?.channelId + ''
}
build() {
Row(){
Row(){
...
...
@@ -29,7 +41,7 @@ export struct CarderInteraction {
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.getContentDetailData(
)
WDShare.shareContent(this.contentDetailData
)
})
Row(){
Image($r('app.media.CarderInteraction_comment'))
...
...
@@ -44,20 +56,7 @@ export struct CarderInteraction {
.onClick(()=>{
ProcessUtils.processPage(this.contentDTO)
})
Row(){
Image($r('app.media.CarderInteraction_like'))
.width(18)
.height(18)
Text('点赞')
.margin({left:4})
.fontSize(14)
.fontColor('#666666')
}
.justifyContent(FlexAlign.Center)
.onClick(()=>{
ProcessUtils.processPage(this.contentDTO)
// ToastUtils.showToast('点赞为公共方法,待开发', 1000)
})
this.builderLike()
}
.width('100%')
.margin({top:11})
...
...
@@ -69,6 +68,22 @@ export struct CarderInteraction {
.alignItems(VerticalAlign.Center)
}
/**
* 点赞组件
*/
@Builder
builderLike() {
Row(){
if (this.likeBean?.contentId) {
LikeComponent({
data: this.likeBean,
componentType: 3
})
}
}
.width(42)
}
/**
* 请求(动态)详情页数据
* */
private async getContentDetailData() {
...
...
@@ -76,36 +91,9 @@ export struct CarderInteraction {
let data = await MultiPictureDetailViewModel.getDetailData(this.contentDTO.relId, this.contentDTO.objectId, this.contentDTO.relType)
this.contentDetailData = data[0];
console.log('动态详情',JSON.stringify(this.contentDetailData))
WDShare.shareContent(this.contentDetailData)
} catch (exception) {
console.log('请求失败',JSON.stringify(exception))
}
this.getInteractDataStatus()
}
// 已登录->查询用户对作品点赞、收藏状态
private async getInteractDataStatus() {
// 未登录,跳转登录
const user_id = await SPHelper.default.get(SpConstants.USER_ID, '')
if (!user_id) {
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))
}
}
}
...
...
sight_harmony/features/wdComponent/src/main/ets/components/setting/MineSettingComponent.ets
View file @
c44b3d8
...
...
@@ -259,10 +259,11 @@ export struct MineSettingComponent {
Text((item.itemType=='clear_cache') ? this.cacheSize.toFixed(2) + 'M' : '')
.fontColor('#999999')
.maxLines(1)
Image($r('app.media.mine_user_arrow'))
Image($r('app.media.mine_user_arrow
_2
'))
.width('27lpx')
.height('27lpx')
.objectFit(ImageFit.Auto)
.interpolation(ImageInterpolation.High)
Column().width('29lpx')
}.width('40%')
.margin({ right: '29lpx' })
...
...
sight_harmony/features/wdComponent/src/main/ets/components/view/LikeComponent.ets
View file @
c44b3d8
...
...
@@ -13,7 +13,7 @@ export struct LikeComponent {
viewModel: LikeViewModel = new LikeViewModel()
@Prop data: Record<string, string>
enableBtn = true
componentType : number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式
componentType : number = 1 //1: 底部栏目样式 2: 新闻页中间位置样式
3:动态Tab内容下的互动入口
styleType : number = 1 //1: 白色背景(图文底部栏) 2: 黑色背景(图集底部栏)
@State likeCount: number = 0 //点赞数
...
...
@@ -69,17 +69,27 @@ export struct LikeComponent {
.borderRadius(20)
.borderWidth(1)
.onClick(()=>{
this.clickButtonEvent()
})
}
.width(154)
.height(40)
}else {
}else if(this.componentType == 3){
Row(){
Image(this.likeStatus ? $r('app.media.icon_like_select') : this.styleType == 1 ? $r('app.media.CarderInteraction_like') :
$r('app.media.icon_like_default_white'))
.width(18)
.height(18)
Text(this.likeCount >0?this.likeCount.toString(): '点赞')
.margin({left:4})
.fontSize(14)
.fontColor(this.likeStatus ? '#ED2800' : '#666666')
}
.justifyContent(FlexAlign.Center)
.onClick(() => {
this.clickButtonEvent()
})
}else{
//1: 底部栏目样式 默认样式
Column() {
// Image(this.likeStatus ? $r('app.media.icon_like_select') : $r('app.media.icon_like_default'))
...
...
sight_harmony/features/wdComponent/src/main/resources/base/media/back_icon.png
View file @
c44b3d8
307 Bytes
|
W:
|
H:
431 Bytes
|
W:
|
H:
2-up
Swipe
Onion skin
Please
register
or
login
to post a comment