no message

This commit is contained in:
A1300399510
2024-01-18 17:25:40 +08:00
parent e01ac5326b
commit 7390c2fc72
11 changed files with 273 additions and 67 deletions

View File

@@ -85,6 +85,7 @@ let islike = inject("islike")
let iscollection = inject("iscollection")
let qrcode = inject("qrcode")
let token = inject("token")
const topHeadRef = inject("topHeadRef")
// 获取完整 url
const getFullUrl = () => {
@@ -127,7 +128,7 @@ const handleCollect = () => {
return
}
// topHeadRef.value.count = {}
topHeadRef.value.count = {}
operateCollectHttp({ token: token.value }).then(res => {
if (res.code != 200) {
@@ -149,6 +150,16 @@ const isBrowser = computed(() => {
// 点赞
const handleLike = () => {
if (isNeedLogin.value) {
goLogin()
return
}
if (islike.value) {
ElMessage.error("不可取消点赞")
return
}
operateLikeHttp({ token: token.value }).then(res => {
if (res.code != 200) {
ElMessage.error(res.message)

View File

@@ -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">

View File

@@ -9,11 +9,12 @@
</div>
</div>
<!-- <div class="empty-box flexcenter" v-loading="true" v-if="(MyPopupState == 'collect' && collectLoading) || (MyPopupState == 'mj' && publisloading)"></div> -->
<div class="empty-box flexcenter" v-loading="true" v-if="(MyPopupState == 'collect' && collectLoading) || (MyPopupState == 'takevote' && takevoteloading) || (MyPopupState == 'publish' && publisloading)"></div>
<div class="empty-box flexcenter" v-if="showList.length == 0">
<Empty></Empty>
</div>
<el-scrollbar v-else height="479px">
<!-- <el-scrollbar v-else height="40px"> -->
<div class="content" @scroll="handleListScroll">
<div class="item flexflex" v-for="(item, index) in showList" :key="item.uniqid" @click="goDetails(item['uniqid'] || item?.data?.uniqid)">
<div class="left flexflex">
@@ -115,7 +116,7 @@ const getPublish = () => {
if (publisPage == 0 && !publisloading.value) return
publisloading.value = true
MyUserPublishHttp({ page: publisPage })
MyUserPublishHttp({ limit: 1, page: publisPage })
.then(res => {
if (res.code != 200) return
let data = res.data
@@ -151,6 +152,12 @@ const cutMy = (key, isEmpty) => {
collectList = []
collectPage = 1
collectCount.value = 0
takevoteList = []
takevotePage = 1
publishList = []
publisPage = 1
}
if (key == "collect" && collectList.length == 0) getCollect()
@@ -238,6 +245,7 @@ const closeDialog = () => {
// const emit = defineEmits(["cutMy"]);
const unbookmarkSamePage = inject("unbookmarkSamePage")
const unbookmark = inject("unbookmark")
// 处理取消收藏
const cancelCollection = (token, index, uniqid) => {
@@ -281,7 +289,7 @@ const deleteVote = () => {
publishList.splice(deleteobj["index"], 1)
showList.value = [...publishList]
if (id == deleteobj["uniqid"]) unbookmarkSamePage()
if (id == deleteobj["uniqid"]) unbookmark()
ElMessage.success(res.message)
deleteobj = {}

View File

@@ -141,8 +141,6 @@ const handleUser = async key => {
return
}
console.log("key", key)
if (Object.keys(count.value).length === 0) {
await getUser()
MyPopupRef.value.cutMy(key, true)