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
636a6a0e
Commit
636a6a0e
authored
Jan 18, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了评论功能
parent
b4833a23
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
136 deletions
+100
-136
List.vue
pages/components/article/List.vue
+4
-10
index.vue
pages/tab/index.vue
+2
-2
articleDetail.vue
pagesArticle/articleDetail.vue
+94
-124
No files found.
pages/components/article/List.vue
View file @
636a6a0e
...
...
@@ -12,7 +12,7 @@
'top': '210rpx',
'width': '447rpx',
'height': '375rpx'
}" v-model="dataList" @query="queryList" :fixed="false"
@onRefresh="onRefresh"
auto-show-back-to-top="true">
}" v-model="dataList" @query="queryList" :fixed="false" auto-show-back-to-top="true">
<view
v-if=
"currentIndex == '2'"
>
<u-tabs
ref=
"tabs"
:list=
"topicList"
font-size=
"30"
:current=
"current"
@
click=
"tabClick"
:activeStyle=
"
{
...
...
@@ -106,14 +106,6 @@
},
},
methods
:
{
// 下拉刷新被触发
onRefresh
()
{
// 告知z-paging下拉刷新结束,这样才可以开始下一次的下拉刷新
setTimeout
(()
=>
{
// 1.5秒之后停止刷新动画
this
.
reload
()
},
1500
)
},
//tab标签点击
tabClick
({
id
})
{
this
.
topicId
=
id
...
...
@@ -129,6 +121,8 @@
name
:
item
.
topicName
};
});
//初始化话题id 锁到第一个话题
this
.
topicId
=
this
.
topicList
[
0
].
id
})
},
// 接收父组件传过来的刷新列表要求
...
...
@@ -138,7 +132,7 @@
this
.
$refs
.
paging
&&
this
.
$refs
.
paging
.
reload
();
})
},
//分页查询方法
//分页查询方法
下拉刷新或滚动到底部
queryList
(
pageNo
,
pageSize
)
{
const
params
=
{
page
:
pageNo
,
...
...
pages/tab/index.vue
View file @
636a6a0e
...
...
@@ -5,8 +5,8 @@
<!-- 左上角搜索-->
<u-navbar
bgColor=
"white"
:placeholder=
"true"
>
<view
class=
"u-nav-slot"
slot=
"left"
@
click=
"screen"
>
<image
:src=
"baseUrl+'/index/screen.png'"
class=
"img"
mode=
"aspectFill"
></image
>
<view
class=
"text"
>
搜索
</view
>
<!--
<image
:src=
"baseUrl+'/index/screen.png'"
class=
"img"
mode=
"aspectFill"
></image>
--
>
<!--
<view
class=
"text"
>
搜索
</view>
--
>
</view>
</u-navbar>
...
...
pagesArticle/articleDetail.vue
View file @
636a6a0e
...
...
@@ -18,143 +18,81 @@
<div
class=
"c-left"
>
<image
:src=
"info.avatarUrl"
></image>
</div>
<div
class=
"c-right"
>
<div
class=
"c-right"
@
click=
"()=>reply(info)"
>
<div
class=
"c-name"
>
{{
info
.
memNickName
}}
</div>
<div
class=
"c-comment"
>
{{
info
.
content
}}
</div>
<div
class=
"c-actions"
>
<div
class=
"c-time"
>
{{
info
.
createDate
}}
</div>
<!--
<div
class=
"action-item"
>
--
>
<!--
<image-->
<!-- :src="baseUrl+'/article/104.png'"-->
<!-- @click="btnComment(info)"-->
<!-- >
</image>
--
>
<!--
<text>
--
>
<!--
{{
info
.
replyCount
}}
-->
<!--
</text>
--
>
<!--
</div>
--
>
<!--
<div
class=
"action-item"
>
--
>
<!--
<image-->
<!-- @click="btnPrarse(info)"-->
<!-- :src="info.isLike == '0'-->
<!-- ? baseUrl+'/article/105.png'-->
<!-- : baseUrl+'/article/105-no.png'-->
<!-- "-->
<!-- >
</image>
--
>
<!--
{{
info
.
likeCount
}}
-->
<!--
</div>
--
>
<div
class=
"action-item"
>
<image
:src=
"baseUrl+'/article/104.png'"
@
click=
"btnComment(info)"
></image
>
<text
>
{{
info
.
commentCount
}}
</text
>
</div
>
<div
class=
"action-item"
>
<image
@
click=
"btnPrarse(info)"
:src=
"info.isLike == '0'
? baseUrl+'/article/105.png'
: baseUrl+'/article/105-no.png'
"
></image
>
{{
info
.
likeCount
}}
</div
>
</div>
<!--
<div
v-if=
"info.childrenCommentInfos.length > 0"
>
-->
<!--
<div
v-if=
"info.contentAll"
>
-->
<!--
<view
class=
"comment"
>
-->
<!--
<div
class=
"c-left"
>
-->
<!--
<image
:src=
"info.childrenCommentInfos[0].avatar"
></image>
-->
<!--
</div>
-->
<!--
<div
class=
"c-right"
>
-->
<!--
<div
class=
"c-name"
>
-->
<!--
{{
info
.
childrenCommentInfos
[
0
].
nickName
}}
-->
<!--
<div
style=
"color: #333; margin-top: 10rpx"
>
-->
<!-- 回复-->
<!--
<text
class=
"replyer"
>
-->
<!--
{{
info
.
childrenCommentInfos
[
0
].
beRepliedName
}}
:-->
<!--
</text>
-->
<!--
<text
class=
"c-comment"
>
-->
<!--
{{
info
.
childrenCommentInfos
[
0
].
content
}}
-->
<!--
</text>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
<div
class=
"c-actions"
>
-->
<!--
<div
class=
"c-time"
>
-->
<!--
{{
info
.
childrenCommentInfos
[
0
].
createTime
}}
-->
<!--
</div>
-->
<!--
<div
class=
"action-item"
>
-->
<!--
<image-->
<!-- @click="btnPrarse(info.childrenCommentInfos[0])"-->
<!-- :src="-->
<!-- children.praise-->
<!-- ? baseUrl+'/article/105.png'-->
<!-- : baseUrl+'/article/105-no.png'-->
<!-- "-->
<!-- >
</image>
-->
<!--
{{
info
.
childrenCommentInfos
[
0
].
likesNumber
}}
-->
<!--
</div>
-->
<!--
<div
class=
"action-item"
>
-->
<!--
<image-->
<!-- :src="baseUrl+'/article/104.png'"-->
<!-- @click="btnComment(info.childrenCommentInfos[0])"-->
<!-- >
</image>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</view>
-->
<!--
</div>
-->
<view>
<view
class=
"comment"
v-for=
"(children, index) in info.childrenCommentList"
:key=
"children.businessId"
>
<view
class=
"c-left"
>
<image
:src=
"children.avatarUrl"
></image>
</view>
<!--
<div
v-else
>
-->
<!--
<view-->
<!-- class="comment"-->
<!-- v-for="children in info.childrenCommentInfos"-->
<!-- :key="children.id"-->
<!-- >-->
<!--
<div
class=
"c-left"
>
-->
<!--
<image
:src=
"children.avatar"
></image>
-->
<!--
</div>
-->
<!--
<div
class=
"c-right"
>
-->
<!--
<div
class=
"c-name"
>
-->
<!--
{{
children
.
nickName
}}
-->
<!--
<div
style=
"color: #333; margin-top: 10rpx"
>
-->
<!-- 回复-->
<!--
<text
class=
"replyer"
>
{{
children
.
beRepliedName
}}
:
</text>
-->
<!--
<text
class=
"c-comment"
>
{{
children
.
content
}}
</text>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
<div
class=
"c-actions"
>
-->
<!--
<div
class=
"c-time"
>
{{
children
.
createTime
}}
</div>
-->
<!--
<div
class=
"action-item"
>
-->
<!--
<image-->
<!-- @click="btnPrarse(children)"-->
<!-- :src="-->
<!-- children.praise-->
<!-- ? baseUrl+'/article/105.png'-->
<!-- : baseUrl+'/article/105-no.png'-->
<!-- "-->
<!-- >
</image>
-->
<!--
{{
children
.
likesNumber
}}
-->
<!--
</div>
-->
<!--
<div
class=
"action-item"
>
-->
<view
class=
"c-right"
@
click=
"()=>reply(children)"
>
<view
class=
"c-name"
>
{{
children
.
memNickName
}}
<view
style=
"color: #333; margin-top: 10rpx"
>
回复
<text
class=
"replyer"
>
{{
children
.
commentedMemNickName
}}
:
</text>
<text
class=
"c-comment"
>
{{
children
.
content
}}
</text>
</view>
</view>
<view
class=
"c-actions"
>
<view
class=
"c-time"
>
{{
children
.
createDate
}}
</view>
<view
class=
"action-item"
>
<!--
<image-->
<!-- :src="baseUrl+'/article/104.png'"-->
<!-- @click="btnComment(children)"-->
<!-- >
</image>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</div>
-->
<!--
</view>
-->
<!--
</div>
-->
<!--<!–
<div
class=
"more"
>
–>
-->
<!--<!–
<div
&
ndash
;&
gt
;
--
>
<!--<!– style="color: #b6ea7a"–>-->
<!--<!– v-show="info.contentAll"–>-->
<!--<!– @click="changeAllFun(info)"–>-->
<!--<!– >–>-->
<!--<!– 展开剩余
{{
info
.
childrenCommentInfos
.
length
-
1
}}
条回复
–>
-->
<!--<!–
</div>
–>
-->
<!--<!–
<div
v-show=
"!info.contentAll"
></div>
–>
-->
<!--<!–
<div
&
ndash
;&
gt
;
--
>
<!--<!– v-show="!info.contentAll"–>-->
<!--<!– style="color: #b6ea7a"–>-->
<!--<!– @click="changeAllFun(info)"–>-->
<!--<!– >–>-->
<!--<!– 收起–>-->
<!--<!–
</div>
–>
-->
<!--<!–
</div>
–>
-->
<!--
</div>
-->
<!--
{{
children
.
replyCount
}}
-->
</view>
<view
class=
"action-item"
>
<image
@
click=
"btnPrarse(children)"
:src=
"
children.praise
? baseUrl+'/article/105.png'
: baseUrl+'/article/105-no.png'
"
></image>
{{
children
.
likeCount
}}
</view>
</view>
</view>
</view>
</view>
</div>
</view>
<view
class=
"bottom"
>
<u--input
placeholder=
"走心,说点好听的.....
"
:placeholder=
"commentPlaceholder
"
border=
"surround"
v-model=
"commentValue"
@
confirm=
"handleEnter"
...
...
@@ -200,6 +138,8 @@ export default{
},
data
()
{
return
{
//评论输入框提示
commentPlaceholder
:
'走心,说点好听的.....'
,
//图片路径
baseUrl
:
this
.
$IMG_URL
,
//评论值
...
...
@@ -207,7 +147,11 @@ export default{
//动态id
articleId
:
''
,
//动态详情
articleInfo
:{}
articleInfo
:{},
//被评论人
commentedUserId
:
null
,
//上级评论ID
parentId
:
null
,
}
},
onLoad
(
params
){
...
...
@@ -215,6 +159,19 @@ export default{
this
.
getArticleDetail
()
},
methods
:
{
reply
(
value
){
this
.
commentPlaceholder
=
'回复 '
+
value
.
memNickName
+
':'
//设置被评论人id
this
.
commentedUserId
=
value
.
commentedUserId
//设置上级评论id 加这个逻辑是为了保证永远只有两层结构
if
(
value
.
parentId
==
null
){
//点击的第一层评论
this
.
parentId
=
value
.
businessId
}
else
{
//点击的第二层评论
this
.
parentId
=
value
.
parentId
}
},
//评论回车事件
handleEnter
(
value
){
const
token
=
uni
.
getStorageSync
(
"token"
)
...
...
@@ -234,8 +191,10 @@ export default{
}
this
.
commentValue
=
''
const
params
=
{
articleId
:
this
.
articleInfo
.
businessId
,
commentContent
:
value
articleId
:
this
.
articleInfo
.
businessId
,
//动态id
commentContent
:
value
,
//评论内容
commentedUserId
:
this
.
commentedUserId
,
//被评论人ID
parentId
:
this
.
parentId
//上级评论ID
}
comment
(
params
).
then
(
res
=>
{
if
(
res
.
data
.
code
==
200
){
...
...
@@ -249,6 +208,9 @@ export default{
icon
:
'none'
})
})
this
.
commentPlaceholder
=
'走心,说点好听的.....'
this
.
commentedUserId
=
null
this
.
parentId
=
null
},
getArticleDetail
(){
articleDetail
(
this
.
articleId
).
then
(
res
=>
{
...
...
@@ -293,6 +255,14 @@ export default{
getOssUrl
(
item
.
avatarId
).
then
(
res
=>
{
item
.
avatarUrl
=
res
.
data
.
data
})
//处理子评论头像
if
(
item
.
childrenCommentList
.
length
>
0
){
item
.
childrenCommentList
.
forEach
(
children
=>
{
getOssUrl
(
children
.
avatarId
).
then
(
resp
=>
{
children
.
avatarUrl
=
resp
.
data
.
data
})
})
}
})
}
})
...
...
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