新讨论测试
This commit is contained in:
parent
6af52632ba
commit
740ec94346
@ -2,6 +2,54 @@
|
|||||||
padding-top: 22px;
|
padding-top: 22px;
|
||||||
padding-left: 42px;
|
padding-left: 42px;
|
||||||
}
|
}
|
||||||
|
.comment-box .edit-comment {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 12;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box {
|
||||||
|
width: 650px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px 15px;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .text {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 650;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .input-box {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .input-box .bottom {
|
||||||
|
border-top: 1px solid #ebebeb;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .btn-list {
|
||||||
|
padding: 15px 0;
|
||||||
|
justify-content: flex-end;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .btn-list .btn {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
width: 80px;
|
||||||
|
height: 28px;
|
||||||
|
line-height: 28px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 43px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #ebebeb;
|
||||||
|
margin-left: 20px;
|
||||||
|
}
|
||||||
|
.comment-box .edit-comment .box .btn-list .btn.send {
|
||||||
|
background-color: #fddf6d;
|
||||||
|
border: 1px solid #fddf6d;
|
||||||
|
}
|
||||||
.comment-title {
|
.comment-title {
|
||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
|
@ -1,6 +1,60 @@
|
|||||||
.comment-box {
|
.comment-box {
|
||||||
padding-top: 22px;
|
padding-top: 22px;
|
||||||
padding-left: 42px;
|
padding-left: 42px;
|
||||||
|
.edit-comment {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
background-color: rgba(0, 0, 0, 0.5);
|
||||||
|
z-index: 12;
|
||||||
|
.box {
|
||||||
|
width: 650px;
|
||||||
|
// height: 500px;
|
||||||
|
border-radius: 10px;
|
||||||
|
background: #fff;
|
||||||
|
padding: 20px 15px;
|
||||||
|
|
||||||
|
.text {
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: 650;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-box {
|
||||||
|
margin-right: 0;
|
||||||
|
.bottom {
|
||||||
|
border-top: 1px solid #ebebeb;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-list {
|
||||||
|
padding: 15px 0;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
width: 80px;
|
||||||
|
height: 28px;
|
||||||
|
line-height: 28px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 43px;
|
||||||
|
cursor: pointer;
|
||||||
|
background-color: #fff;
|
||||||
|
border: 1px solid #ebebeb;
|
||||||
|
margin-left: 20px;
|
||||||
|
|
||||||
|
&.send {
|
||||||
|
background-color: #fddf6d;
|
||||||
|
border: 1px solid #fddf6d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.comment-title {
|
.comment-title {
|
||||||
font-weight: 650;
|
font-weight: 650;
|
||||||
|
@ -1,5 +1,43 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="comment-box">
|
<div class="comment-box">
|
||||||
|
<!-- 编辑评论 -->
|
||||||
|
<div v-if="editCommentState" class="edit-comment flexcenter">
|
||||||
|
<div class="box">
|
||||||
|
<div class="text">编辑评论</div>
|
||||||
|
<div class="input-box">
|
||||||
|
<div class="top flexflex">
|
||||||
|
<textarea ref="editInputRef" class="input-textarea flex1" maxlength="500" v-model="editInput" @focus="judgeLogin" @input="autoResize" @paste="handleInputPaste" placeholder="说说你的想法或疑问…"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="picture-box" v-if="editPicture.url">
|
||||||
|
<div class="picture">
|
||||||
|
<img class="close" @click="closeEditFileUpload()" src="@/assets/img/close-icon.png" />
|
||||||
|
<img class="img" @click="handleAnswerText" :src="editPicture.base64 || editPicture.url" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="bottom flexacenter">
|
||||||
|
<div class="operate flexacenter">
|
||||||
|
<div class="item" :class="{ 'pitch': editEmojiState }">
|
||||||
|
<img class="icon" src="@/assets/img/smiling-face.png" @click="openEditEmoji()" alt="" />
|
||||||
|
<div class="emoji-box">
|
||||||
|
<div class="emoji-icon" v-for="item in emojiData" :key="item" @click="selectEditEmoji(item)">{{ item }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="item flexacenter" @click="judgeLogin()">
|
||||||
|
<input class="file" type="file" @change="handleFileUpload($event)" accept=".png, .jpg, .jpeg" />
|
||||||
|
<img class="icon" style="border-radius: 0;" src="@/assets/img/picture-icon.png" alt="" />
|
||||||
|
<span class="file-hint">最多可上传1张图片,支持在输入框中直接粘贴图片。</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="btn-list flexacenter">
|
||||||
|
<div class="btn" @click="closeEdit()">取消</div>
|
||||||
|
<div class="btn send" @click="postEditComment()">发送</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="comment-title flexacenter">
|
<div class="comment-title flexacenter">
|
||||||
讨论
|
讨论
|
||||||
<span class="comment-amount">{{ commentComments || "" }}</span>
|
<span class="comment-amount">{{ commentComments || "" }}</span>
|
||||||
@ -13,10 +51,10 @@
|
|||||||
<div class="post-ok flexcenter" @click="submitAnswerComments(commentInputTop)">发送</div>
|
<div class="post-ok flexcenter" @click="submitAnswerComments(commentInputTop)">发送</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
<div class="input-box" v-if="true">
|
<div class="input-box">
|
||||||
<div class="top flexflex">
|
<div class="top flexflex">
|
||||||
<img class="avatar" v-if="userInfoWin.avatar" :src="userInfoWin.avatar" />
|
<img class="avatar" v-if="userInfoWin.avatar" :src="userInfoWin.avatar" />
|
||||||
<textarea class="input-textarea flex1" maxlength="500" v-model="commentInputTop" @input="autoResize" @paste="handleInputPaste" placeholder="说说你的想法或疑问…"></textarea>
|
<textarea class="input-textarea flex1" maxlength="500" v-model="commentInputTop" @focus="judgeLogin" @input="autoResize" @paste="handleInputPaste" placeholder="说说你的想法或疑问…"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div class="picture-box" v-if="picture.url">
|
<div class="picture-box" v-if="picture.url">
|
||||||
<div class="picture">
|
<div class="picture">
|
||||||
@ -32,7 +70,7 @@
|
|||||||
<div class="emoji-icon" v-for="item in emojiData" :key="item" @click="selectEmoji(item)">{{ item }}</div>
|
<div class="emoji-icon" v-for="item in emojiData" :key="item" @click="selectEmoji(item)">{{ item }}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="item flexacenter">
|
<div class="item flexacenter" @click="judgeLogin()">
|
||||||
<input class="file" type="file" @change="handleFileUpload($event)" accept=".png, .jpg, .jpeg" />
|
<input class="file" type="file" @change="handleFileUpload($event)" accept=".png, .jpg, .jpeg" />
|
||||||
<img class="icon" src="@/assets/img/picture-icon.png" alt="" />
|
<img class="icon" src="@/assets/img/picture-icon.png" alt="" />
|
||||||
<span class="file-hint">最多可上传1张图片,支持在输入框中直接粘贴图片。</span>
|
<span class="file-hint">最多可上传1张图片,支持在输入框中直接粘贴图片。</span>
|
||||||
@ -77,8 +115,8 @@
|
|||||||
<img class="menu-icon" src="@/assets/img/menu-icon-gray.svg" />
|
<img class="menu-icon" src="@/assets/img/menu-icon-gray.svg" />
|
||||||
<div class="operate-box">
|
<div class="operate-box">
|
||||||
<div class="item flexcenter" @click="report(item['token'])">举报</div>
|
<div class="item flexcenter" @click="report(item['token'])">举报</div>
|
||||||
<div class="item flexcenter" @click="report(item['token'])">编辑</div>
|
<div class="item flexcenter" v-if="permissions.includes('comment.edit')" @click="openEdit(item['token'], index)">编辑</div>
|
||||||
<div class="item flexcenter" @click="commentDelete(item['token'], index)">删除</div>
|
<div class="item flexcenter" v-if="permissions.includes('comment.delete')" @click="commentDelete(item['token'], index)">删除</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <img class="comment-icon" title="回复" @click="openAnswerCommentsChild(index)" src="@/assets/img/comment-icon-gray.svg" /> -->
|
<!-- <img class="comment-icon" title="回复" @click="openAnswerCommentsChild(index)" src="@/assets/img/comment-icon-gray.svg" /> -->
|
||||||
@ -164,10 +202,9 @@
|
|||||||
<img class="menu-icon" src="@/assets/img/menu-icon-gray.svg" />
|
<img class="menu-icon" src="@/assets/img/menu-icon-gray.svg" />
|
||||||
<div class="operate-box">
|
<div class="operate-box">
|
||||||
<div class="item flexcenter" @click="report(ite['token'])">举报</div>
|
<div class="item flexcenter" @click="report(ite['token'])">举报</div>
|
||||||
<div class="item flexcenter" @click="report(ite['token'])">编辑</div>
|
<div class="item flexcenter" v-if="permissions.includes('comment.edit')" @click="openEdit(ite['token'], index, i)">编辑</div>
|
||||||
<div class="item flexcenter" @click="commentDelete(ite['token'], index, i)">删除</div>
|
<div class="item flexcenter" v-if="permissions.includes('comment.delete')" @click="commentDelete(ite['token'], index, i)">删除</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="report-box flexcenter" @click="report(ite['token'])">举报</div> -->
|
|
||||||
</div>
|
</div>
|
||||||
<img class="comment-icon" title="回复" @click="!ite['childState'] ? openAnswerCommentsChild(index, i) : closeAnswerCommentsChild()" src="@/assets/img/comment-icon-gray.svg" />
|
<img class="comment-icon" title="回复" @click="!ite['childState'] ? openAnswerCommentsChild(index, i) : closeAnswerCommentsChild()" src="@/assets/img/comment-icon-gray.svg" />
|
||||||
<div class="flexacenter like-box" @click="commentLike(index, i)">
|
<div class="flexacenter like-box" @click="commentLike(index, i)">
|
||||||
@ -278,7 +315,14 @@ watch(
|
|||||||
|
|
||||||
onMounted(() => window.addEventListener("scroll", handleScroll))
|
onMounted(() => window.addEventListener("scroll", handleScroll))
|
||||||
|
|
||||||
onMounted(() => {})
|
let permissions = ref([])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
setTimeout(() => {
|
||||||
|
// permissions.value = window["permissions"] || []
|
||||||
|
permissions.value = ["comment.edit", "comment.delete"]
|
||||||
|
}, 1000)
|
||||||
|
})
|
||||||
|
|
||||||
const sendMessage = inject("sendMessage")
|
const sendMessage = inject("sendMessage")
|
||||||
const TAHomePage = inject("TAHomePage")
|
const TAHomePage = inject("TAHomePage")
|
||||||
@ -634,6 +678,10 @@ const emojiData = ["😀", "😁", "😆", "😅", "😂", "😉", "😍", "🥰
|
|||||||
|
|
||||||
// 打开 Emoji
|
// 打开 Emoji
|
||||||
const openEmoji = (index, i) => {
|
const openEmoji = (index, i) => {
|
||||||
|
if (isNeedLogin.value) {
|
||||||
|
goLogin()
|
||||||
|
return
|
||||||
|
}
|
||||||
if (i != undefined) commentList.value[index].child[i]["emojiState"] = true
|
if (i != undefined) commentList.value[index].child[i]["emojiState"] = true
|
||||||
else if (index != undefined) commentList.value[index]["emojiState"] = true
|
else if (index != undefined) commentList.value[index]["emojiState"] = true
|
||||||
else {
|
else {
|
||||||
@ -658,6 +706,7 @@ const closeEmoji = (index, i) => {
|
|||||||
|
|
||||||
emojiState.value = false
|
emojiState.value = false
|
||||||
emojiMaskState.value = false
|
emojiMaskState.value = false
|
||||||
|
editEmojiState.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 选择 Emoji
|
// 选择 Emoji
|
||||||
@ -708,9 +757,14 @@ const handleInputPaste = (event, index, ii) => {
|
|||||||
base64,
|
base64,
|
||||||
...res,
|
...res,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (editCommentState.value) editPicture.value = obj
|
||||||
|
else {
|
||||||
if (ii != undefined) commentList.value[index].child[ii]["picture"] = obj
|
if (ii != undefined) commentList.value[index].child[ii]["picture"] = obj
|
||||||
else if (index != undefined) commentList.value[index]["picture"] = obj
|
else if (index != undefined) commentList.value[index]["picture"] = obj
|
||||||
else picture.value = obj
|
else picture.value = obj
|
||||||
|
}
|
||||||
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
@ -744,13 +798,12 @@ const handleFileUpload = (event, index, i) => {
|
|||||||
base64,
|
base64,
|
||||||
...res,
|
...res,
|
||||||
}
|
}
|
||||||
|
if (editCommentState.value) editPicture.value = obj
|
||||||
if (i != undefined) {
|
else {
|
||||||
commentList.value[index].child[i]["picture"] = obj
|
if (i != undefined) commentList.value[index].child[i]["picture"] = obj
|
||||||
} else if (index != undefined) {
|
else if (index != undefined) commentList.value[index]["picture"] = obj
|
||||||
commentList.value[index]["picture"] = obj
|
else picture.value = obj
|
||||||
} else picture.value = obj
|
}
|
||||||
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: "上传成功",
|
message: "上传成功",
|
||||||
type: "success",
|
type: "success",
|
||||||
@ -828,6 +881,98 @@ const commentDelete = (token, index, i) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const judgeLogin = () => {
|
||||||
|
if (isNeedLogin.value) goLogin()
|
||||||
|
}
|
||||||
|
|
||||||
|
let editCommentState = ref(false)
|
||||||
|
let editToken = ""
|
||||||
|
let editPicture = ref({})
|
||||||
|
let editInput = ref("")
|
||||||
|
let editEmojiState = ref(false)
|
||||||
|
const editInputRef = ref(null)
|
||||||
|
|
||||||
|
const openEdit = (token, index, i) => {
|
||||||
|
const list = JSON.parse(JSON.stringify(commentList.value))
|
||||||
|
let target = {}
|
||||||
|
if (i != null) target = list[index]["child"][i]
|
||||||
|
else target = list[index]
|
||||||
|
console.log(token, index, i, target)
|
||||||
|
editToken = target.token || ""
|
||||||
|
editInput.value = target.content || ""
|
||||||
|
editPicture.value = target.image || {}
|
||||||
|
|
||||||
|
editCommentState.value = true
|
||||||
|
|
||||||
|
nextTick(() => {
|
||||||
|
console.log("editInput.value", editInputRef.value)
|
||||||
|
editInputRef.value.style.height = `${editInputRef.value.scrollHeight}px`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeEdit = () => {
|
||||||
|
editPicture.value = {}
|
||||||
|
editToken = ""
|
||||||
|
editInput.value = ""
|
||||||
|
editCommentState.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 打开 Emoji
|
||||||
|
const openEditEmoji = (index, i) => {
|
||||||
|
if (isNeedLogin.value) {
|
||||||
|
goLogin()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
editEmojiState.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectEditEmoji = key => {
|
||||||
|
closeEmoji()
|
||||||
|
editInput.value += key
|
||||||
|
}
|
||||||
|
|
||||||
|
const postEditComment = () => {
|
||||||
|
if (isNeedLogin.value) {
|
||||||
|
goLogin()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const image = editPicture.value
|
||||||
|
|
||||||
|
commentsEditSubmit({
|
||||||
|
content: editInput.value,
|
||||||
|
token: editToken,
|
||||||
|
image: image ? { aid: image.aid, url: image.url } : null,
|
||||||
|
}).then(res => {
|
||||||
|
if (res.code != 200) {
|
||||||
|
ElMessage.error(res.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
commentList.value.forEach(element => {
|
||||||
|
if (element.token == editToken) {
|
||||||
|
element["content"] = editInput.value
|
||||||
|
element["image"] = image
|
||||||
|
}
|
||||||
|
element.child &&
|
||||||
|
element.child.forEach(ele => {
|
||||||
|
if (ele.token == editToken) {
|
||||||
|
ele["content"] = editInput.value
|
||||||
|
ele["image"] = image
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
editPicture.value = {}
|
||||||
|
editToken = ""
|
||||||
|
editCommentState.value = false
|
||||||
|
editEmojiState.value = false
|
||||||
|
ElMessage.success(res.message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const closeEditFileUpload = () => (editPicture.value = {})
|
||||||
|
|
||||||
defineExpose({ changeCommentVoteoption, wipeCommentVoteoption, reviewsComment, bottomNavigationBar, closeAnswerCommentsChild })
|
defineExpose({ changeCommentVoteoption, wipeCommentVoteoption, reviewsComment, bottomNavigationBar, closeAnswerCommentsChild })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Http from "@/utils/http";
|
import Http from "@/utils/http"
|
||||||
// 投票, 数据列表 - 列表
|
// 投票, 数据列表 - 列表
|
||||||
export const getListHttp = params => {
|
export const getListHttp = params => {
|
||||||
return Http.post("/api/lists", params)
|
return Http.post("/api/lists", params)
|
||||||
@ -29,6 +29,11 @@ export const detailsSubmitommentListHttp = query => {
|
|||||||
return Http.post("/api/comment/submit", query)
|
return Http.post("/api/comment/submit", query)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 详情数据 - 提交评论
|
||||||
|
export const commentsEditSubmit = query => {
|
||||||
|
return Http.post("/api/comment/commentsEditSubmit", query)
|
||||||
|
}
|
||||||
|
|
||||||
// 发布相关 - 发布问题初始化,编辑
|
// 发布相关 - 发布问题初始化,编辑
|
||||||
export const publishInitHttp = query => {
|
export const publishInitHttp = query => {
|
||||||
return Http.post("/api/publish", query)
|
return Http.post("/api/publish", query)
|
||||||
|
@ -39,9 +39,9 @@
|
|||||||
<div class="vote-data-right flexacenter">
|
<div class="vote-data-right flexacenter">
|
||||||
<div class="vote-data-item flexacenter"><img class="vote-data-icon" src="@/assets/img/eye-icon.svg" /> {{ item.views }}</div>
|
<div class="vote-data-item flexacenter"><img class="vote-data-icon" src="@/assets/img/eye-icon.svg" /> {{ item.views }}</div>
|
||||||
<div class="vote-data-item flexacenter" @click.stop.prevent="handleLike(item['token'], index)">
|
<div class="vote-data-item flexacenter" @click.stop.prevent="handleLike(item['token'], index)">
|
||||||
<!-- <img v-if="item['islike'] == 0" class="vote-data-icon" src="@/assets/img/expression-icon.svg" />
|
<img v-if="item['islike'] == 0" class="vote-data-icon" src="@/assets/img/like-icon-gray.png" />
|
||||||
<img v-else class="vote-data-icon" src="@/assets/img/like-yes.png" /> {{ item["likes"] }} -->
|
<img v-else class="vote-data-icon" src="@/assets/img/like-yes.png" /> {{ item["likes"] }}
|
||||||
<img class="vote-data-icon" src="@/assets/img/expression-icon.png" /> {{ item["ripostes"] }}
|
<!-- <img class="vote-data-icon" src="@/assets/img/expression-icon.png" /> {{ item["ripostes"] }} -->
|
||||||
</div>
|
</div>
|
||||||
<div class="vote-data-item flexacenter"><img class="vote-data-icon" src="@/assets/img/comment-icon.svg" /> {{ item["comments"] }}</div>
|
<div class="vote-data-item flexacenter"><img class="vote-data-icon" src="@/assets/img/comment-icon.svg" /> {{ item["comments"] }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user