Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-app
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李伟
cust-app
Commits
792b0dce
Commit
792b0dce
authored
Jan 20, 2025
by
罗林杰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改评论点赞
parent
5fd4e229
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
23 deletions
+34
-23
index.js
api/article/index.js
+10
-1
articleDetail.vue
pagesArticle/articleDetail.vue
+24
-22
No files found.
api/article/index.js
View file @
792b0dce
...
@@ -19,7 +19,7 @@ export function publishArticle(data) {
...
@@ -19,7 +19,7 @@ export function publishArticle(data) {
})
})
}
}
// 点赞
//
动态
点赞
export
function
like
(
data
)
{
export
function
like
(
data
)
{
return
request
({
return
request
({
url
:
'/app/opmArticle/like?articleId='
+
data
.
id
+
'&praiseType='
+
data
.
praiseType
,
url
:
'/app/opmArticle/like?articleId='
+
data
.
id
+
'&praiseType='
+
data
.
praiseType
,
...
@@ -28,6 +28,15 @@ export function like(data) {
...
@@ -28,6 +28,15 @@ export function like(data) {
})
})
}
}
// 评论点赞
export
function
likeComment
(
data
)
{
return
request
({
url
:
'/app/opmArticle/likeComment?articleId='
+
data
.
id
+
'&praiseType='
+
data
.
praiseType
,
data
:
{},
method
:
'POST'
,
})
}
// oss查询图片路径
// oss查询图片路径
export
function
getOssUrl
(
id
)
{
export
function
getOssUrl
(
id
)
{
return
request
({
return
request
({
...
...
pagesArticle/articleDetail.vue
View file @
792b0dce
<
template
>
<
template
>
<view
style=
"margin-bottom: 150rpx"
>
<view
style=
"margin-bottom: 150rpx"
>
<view>
<view>
<ArticleItem
@
delete=
"deleteFn"
:info=
"articleInfo"
@
praise=
"praise"
<ArticleItem
@
delete=
"deleteFn"
:info=
"articleInfo"
@
close=
"close"
@
open=
"open"
/>
@
close=
"close"
@
open=
"open"
/>
</view>
</view>
<view
class=
"commentTitle"
>
<view
class=
"commentTitle"
>
<view>
<view>
...
@@ -26,22 +25,13 @@
...
@@ -26,22 +25,13 @@
<div
class=
"c-actions"
>
<div
class=
"c-actions"
>
<div
class=
"c-time"
>
{{
info
.
createDate
}}
</div>
<div
class=
"c-time"
>
{{
info
.
createDate
}}
</div>
<div
class=
"action-item"
>
<div
class=
"action-item"
>
<image
<image
:src=
"baseUrl+'/article/104.png'"
@
click=
"btnComment(info)"
></image>
:src=
"baseUrl+'/article/104.png'"
@
click=
"btnComment(info)"
></image>
<text>
<text>
{{
info
.
commentCount
}}
{{
info
.
commentCount
}}
</text>
</text>
</div>
</div>
<div
class=
"action-item"
>
<div
class=
"action-item"
>
<image
<image
@
click=
"()=>praise(info)"
:src=
"info.isLike == '0'? baseUrl+'/article/105.png': baseUrl+'/article/105-no.png'"
></image>
@
click=
"btnPrarse(info)"
:src=
"info.isLike == '0'
? baseUrl+'/article/105.png'
: baseUrl+'/article/105-no.png'
"
></image>
{{
info
.
likeCount
}}
{{
info
.
likeCount
}}
</div>
</div>
</div>
</div>
...
@@ -74,14 +64,7 @@
...
@@ -74,14 +64,7 @@
<!--
{{
children
.
replyCount
}}
-->
<!--
{{
children
.
replyCount
}}
-->
</view>
</view>
<view
class=
"action-item"
>
<view
class=
"action-item"
>
<image
<image
@
click=
"()=>praise(children)"
:src=
"children.isLike == '0'? baseUrl+'/article/105.png': baseUrl+'/article/105-no.png'"
></image>
@
click=
"btnPrarse(children)"
:src=
"
children.praise
? baseUrl+'/article/105.png'
: baseUrl+'/article/105-no.png'
"
></image>
{{
children
.
likeCount
}}
{{
children
.
likeCount
}}
</view>
</view>
</view>
</view>
...
@@ -129,7 +112,7 @@
...
@@ -129,7 +112,7 @@
<
script
>
<
script
>
import
ArticleItem
from
'./components/articleItem.vue'
import
ArticleItem
from
'./components/articleItem.vue'
import
{
articleDetail
,
comment
,
getOssUrl
}
from
'../api/article/index'
import
{
articleDetail
,
comment
,
getOssUrl
,
likeComment
}
from
'../api/article/index'
import
{
getCity
,
getValue
}
from
"../common/options"
;
import
{
getCity
,
getValue
}
from
"../common/options"
;
import
{
calculateAge
,
parseDate
}
from
"../common"
;
import
{
calculateAge
,
parseDate
}
from
"../common"
;
export
default
{
export
default
{
...
@@ -172,6 +155,25 @@ export default{
...
@@ -172,6 +155,25 @@ export default{
this
.
parentId
=
value
.
parentId
this
.
parentId
=
value
.
parentId
}
}
},
},
// 点赞
praise
(
item
)
{
console
.
log
(
'1111111'
,
item
)
var
type
=
''
if
(
item
.
isLike
==
'1'
)
{
//取消点赞
type
=
'cancel'
}
else
{
//点赞
type
=
'praise'
}
const
params
=
{
id
:
item
.
businessId
,
praiseType
:
type
}
likeComment
(
params
).
then
(
res
=>
{
this
.
getArticleDetail
()
})
},
//评论回车事件
//评论回车事件
handleEnter
(
value
){
handleEnter
(
value
){
const
token
=
uni
.
getStorageSync
(
"token"
)
const
token
=
uni
.
getStorageSync
(
"token"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment