no message
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
讨论
|
||||
<span class="comment-amount">{{ commentComments || "" }}</span>
|
||||
</div>
|
||||
<div class="post-comment flexacenter">
|
||||
<div class="post-comment flexacenter" @click="loginJudgment()">
|
||||
<textarea class="post-input flex1" placeholder="说说你的想法或疑问…" v-model="commentInputTop"></textarea>
|
||||
<div class="post-ok flexcenter" @click="submitAnswerComments()">发送</div>
|
||||
</div>
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="comments-username" @click="openAvatarPopover(index)">{{ item["nickname"] }}</div>
|
||||
<div class="comments-time">{{ handleDate(item["timestamp"]) }}</div>
|
||||
<div class="comments-identity" v-if="item['isauthor']">作者</div>
|
||||
<img class="comments-title" v-if="item['groupid'] == 14" src="@/assets/img/title.png" />
|
||||
<img class="comments-title" v-if="item['groupid'] === 14" src="@/assets/img/title.png" />
|
||||
</div>
|
||||
<div class="comment-header-right flexacenter">
|
||||
<div class="menu-box flexacenter">
|
||||
@@ -132,11 +132,12 @@
|
||||
|
||||
<script setup>
|
||||
import { ElMessage } from "element-plus"
|
||||
import { isEmpty } from "element-plus/es/utils"
|
||||
|
||||
let isNeedLogin = inject("isNeedLogin")
|
||||
const goLogin = inject("goLogin")
|
||||
const props = defineProps({
|
||||
token: String,
|
||||
})
|
||||
|
||||
const props = defineProps({ token: String })
|
||||
|
||||
watch(
|
||||
() => props.token,
|
||||
@@ -187,6 +188,11 @@ const getCommentList = () => {
|
||||
|
||||
// 评论点赞
|
||||
const commentLike = (index, i) => {
|
||||
if (isNeedLogin.value) {
|
||||
goLogin()
|
||||
return
|
||||
}
|
||||
|
||||
const targetCommentList = [...commentList.value]
|
||||
|
||||
let token = ""
|
||||
@@ -211,15 +217,20 @@ const commentLike = (index, i) => {
|
||||
|
||||
// 打开 回答-评论 的子评论
|
||||
const openAnswerCommentsChild = (index, i) => {
|
||||
closeAnswerCommentsChild()
|
||||
if (isNeedLogin.value) {
|
||||
goLogin()
|
||||
return
|
||||
}
|
||||
closeAnswerCommentsChild(false)
|
||||
if (i == null) commentList.value[index]["childState"] = true
|
||||
else commentList.value[index]["child"][i]["childState"] = true
|
||||
commentInput.value = ""
|
||||
// commentInput.value = ""
|
||||
}
|
||||
|
||||
// 关闭 回答-评论 的子评论
|
||||
const closeAnswerCommentsChild = () => {
|
||||
commentInput.value = ""
|
||||
// 关闭 回答-评论 的子评论 isempty 是否需要清空输入框 默认需要清空
|
||||
const closeAnswerCommentsChild = (isempty = true) => {
|
||||
console.log("isempty", isempty)
|
||||
if (isempty) commentInput.value = ""
|
||||
commentList.value.forEach(ele => {
|
||||
ele["childState"] = false
|
||||
if (ele["child"] && ele["child"].length != 0) ele["child"].forEach(el => (el["childState"] = false))
|
||||
@@ -308,6 +319,10 @@ const submitAnswerComments = (index, i) => {
|
||||
|
||||
// 获取剩下的子评论
|
||||
const alsoCommentsData = (index, ind) => {
|
||||
if (isNeedLogin.value) {
|
||||
goLogin()
|
||||
return
|
||||
}
|
||||
let targetCommentItem = { ...commentList.value[index] }
|
||||
const token = targetCommentItem["token"]
|
||||
const parentid = targetCommentItem["id"]
|
||||
@@ -357,6 +372,10 @@ const report = token => {
|
||||
|
||||
// 打开评论的 信息框
|
||||
const openAvatarPopover = (index, i) => {
|
||||
if (isNeedLogin.value) {
|
||||
goLogin()
|
||||
return
|
||||
}
|
||||
if (i != null) commentList.value[index]["child"][i]["popoverState"] = true
|
||||
else commentList.value[index]["popoverState"] = true
|
||||
}
|
||||
@@ -373,6 +392,35 @@ const handleScroll = () => {
|
||||
}
|
||||
|
||||
provide("reportAlertShow", reportAlertShow)
|
||||
|
||||
// 登录判断
|
||||
const loginJudgment = () => {
|
||||
if (isNeedLogin.value) goLogin()
|
||||
}
|
||||
|
||||
// 修改投票的值
|
||||
const changeCommentVoteoption = voteoption => {
|
||||
const uin = window["userInfoWin"]["uin"]
|
||||
commentList.value.forEach(element => {
|
||||
if (uin == element["uin"]) element["voteoption"] = voteoption
|
||||
element.child.forEach(el => {
|
||||
if (uin == element["uin"]) el["voteoption"] = voteoption
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 修改投票的值
|
||||
const wipeCommentVoteoption = () => {
|
||||
const uin = window["userInfoWin"]["uin"]
|
||||
commentList.value.forEach(element => {
|
||||
if (uin == element["uin"]) element["voteoption"] = null
|
||||
element.child.forEach(el => {
|
||||
if (uin == element["uin"]) el["voteoption"] = null
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ changeCommentVoteoption, wipeCommentVoteoption })
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
Reference in New Issue
Block a user