新讨论测试修改

This commit is contained in:
A1300399510 2025-02-18 19:05:50 +08:00
parent 740ec94346
commit 4250086957
2 changed files with 35 additions and 12 deletions

View File

@ -129,7 +129,7 @@
</div>
</div>
<!-- shutAnswerCommentsChild openAnswerCommentsChild -->
<div class="comment-text" @click="!item['childState'] ? openAnswerCommentsChild(index) : closeAnswerCommentsChild()">{{ item["content"] }}</div>
<div class="comment-text" v-if="item['content']" @click="!item['childState'] ? openAnswerCommentsChild(index) : closeAnswerCommentsChild()">{{ item["content"] }}</div>
<img class="comments-img" @click="handleAnswerText" :src="item.image?.base64 || item.image?.url" v-if="item.image?.url" />
<div class="alreadyVoted" v-if="item.voteoption">已投{{ item.voteoption }}</div>
<div class="input-box" v-if="item['childState']">
@ -214,7 +214,7 @@
</div>
</div>
</div>
<div class="comment-text" @click="!ite['childState'] ? openAnswerCommentsChild(index, i) : closeAnswerCommentsChild()">
<div class="comment-text" v-if="ite['content']" @click="!ite['childState'] ? openAnswerCommentsChild(index, i) : closeAnswerCommentsChild()">
<div class="comments-reply" v-if="ite?.reply?.nickname">@{{ ite?.reply?.nickname }}</div>
{{ ite["content"] }}
</div>
@ -293,6 +293,16 @@
<img class="detail-img" :src="dialogSrc" />
</div>
</div>
<el-dialog v-model="dialogVisible" title="提示" width="500">
<span>确定删除该讨论吗</span>
<template #footer>
<div class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="confirmCommentDelete"> </el-button>
</div>
</template>
</el-dialog>
</template>
<script setup>
@ -319,8 +329,8 @@ let permissions = ref([])
onMounted(() => {
setTimeout(() => {
// permissions.value = window["permissions"] || []
permissions.value = ["comment.edit", "comment.delete"]
permissions.value = window["permissions"] || []
// permissions.value = ["comment.edit", "comment.delete"]
}, 1000)
})
@ -858,26 +868,39 @@ const handleKeydown = event => {
window.removeEventListener("keydown", handleKeydown) //
}
let dialogVisible = ref(false)
let commemtDelete = {}
//
const commentDelete = (token, index, i) => {
commentDeleteHttp({
commemtDelete = {
token,
index,
i,
}
dialogVisible.value = true
}
const confirmCommentDelete = () => {
commentDeleteHttp({
token: commemtDelete.token,
}).then(res => {
if (res.code != 200) {
ElMessage.error(res.message)
return
}
if (i >= 0) {
commentList.value[index].child.splice(i, 1)
commentList.value[index].childnum -= 1
console.log("childnum", commentList.value[index])
if (commemtDelete.i >= 0) {
commentList.value[commemtDelete.index].child.splice(commemtDelete.i, 1)
commentList.value[commemtDelete.index].childnum -= 1
} else {
commentComments.value -= commentList.value[index].childnum
commentList.value.splice(index, 1)
commentComments.value -= commentList.value[commemtDelete.index].childnum
commentList.value.splice(commemtDelete.index, 1)
}
commentComments.value -= 1
dialogVisible.value = false
ElMessage.success(res.message || "操作成功")
})
}

View File

@ -10,7 +10,7 @@ axios.defaults.withCredentials = true
axios.interceptors.request.use( //响应拦截
async config => {
// 开发时登录用的,可以直接替换小程序的 authorization
config['headers']['authorization'] = process.env.NODE_ENV !== "production" && "c1fb97e6994539d87922b1b60c09d43c"
config['headers']['authorization'] = process.env.NODE_ENV !== "production" && "287ad69d214c091fe46fbe995b6a8fc5"
return config;
},
error => {