no message
This commit is contained in:
@@ -111,10 +111,10 @@
|
||||
<div class="comments-identity" v-if="ite['isauthor'] == 1">提问者</div>
|
||||
<div class="avatar-box flexflex" v-if="ite['avatarState']">
|
||||
<a class="avatar-item flexcenter" target="_blank">
|
||||
<img class="avatar-icon" src="@/img/send-messages-icon.png" />
|
||||
<img class="avatar-icon" src="@/img/send-messages-icon.png" @click.prevent="sendMessage(ite['uin'])" />
|
||||
发送信息
|
||||
</a>
|
||||
<a class="avatar-item flexcenter" target="_blank">
|
||||
<a class="avatar-item flexcenter" target="_blank" @click.prevent="TAHomePage(ite['uin'])">
|
||||
<img class="avatar-icon" src="@/img/homepage-icon.png" />
|
||||
TA的主页
|
||||
</a>
|
||||
@@ -182,6 +182,8 @@
|
||||
</div>
|
||||
</template>
|
||||
<script setup>
|
||||
import { tr } from "element-plus/es/locale"
|
||||
|
||||
const props = defineProps({
|
||||
token: String,
|
||||
})
|
||||
@@ -190,6 +192,9 @@ onMounted(() => {
|
||||
// getComment()
|
||||
})
|
||||
|
||||
const aaa = inject("TAHomePag")
|
||||
console.log("aaa", aaa)
|
||||
|
||||
const $ajax = inject("$ajax")
|
||||
const $ajaxGET = inject("$ajaxGET")
|
||||
const detailsToken = inject("detailsToken")
|
||||
@@ -200,6 +205,28 @@ const uploadImg = inject("uploadImg")
|
||||
const handleAnswerText = inject("handleAnswerText")
|
||||
const emojiMaskState = inject("emojiMaskState")
|
||||
const user = inject("user")
|
||||
const detailLoading = inject("detailLoading")
|
||||
|
||||
// 点击ta的主页
|
||||
const TAHomePage = uin => {
|
||||
redirectToExternalWebsite(`https://bbs.gter.net/home.php?mod=space&uid=${uin}`)
|
||||
}
|
||||
|
||||
// 点击发送信息
|
||||
const sendMessage = uin => {
|
||||
if (uin && typeof messagePrivateItem == "function") {
|
||||
messagePrivateItem({ uin: uin })
|
||||
return
|
||||
} else redirectToExternalWebsite(`https://bbs.gter.net/home.php?mod=space&showmsg=1&uid=${uin}`)
|
||||
}
|
||||
|
||||
// 跳转 url
|
||||
const redirectToExternalWebsite = url => {
|
||||
const link = document.createElement("a")
|
||||
link.href = url
|
||||
link.target = "_blank"
|
||||
link.click()
|
||||
}
|
||||
|
||||
const commentList = ref([])
|
||||
let commentCount = ref(0)
|
||||
@@ -263,7 +290,6 @@ const getComment = () => {
|
||||
|
||||
let picture = ref({})
|
||||
|
||||
|
||||
// 监听 detailsToken 的变化
|
||||
watch(
|
||||
detailsToken,
|
||||
@@ -278,7 +304,6 @@ watch(
|
||||
{ immediate: true }
|
||||
)
|
||||
|
||||
|
||||
const maxSize = 20 * 1024 * 1024 // 20MB
|
||||
|
||||
const handleFileUpload = (event, index, i) => {
|
||||
@@ -436,69 +461,75 @@ const submitAnswerComments = (index, i) => {
|
||||
image = picture.value
|
||||
}
|
||||
|
||||
detailLoading.value = true
|
||||
|
||||
$ajax("/api/comment/submit", {
|
||||
content,
|
||||
token,
|
||||
parentid,
|
||||
image: image ? { aid: image.aid, url: image.url } : null,
|
||||
}).then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data
|
||||
|
||||
if (i != null) {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
reply: {
|
||||
nickname: commentList.value[index]["child"][i]["nickname"],
|
||||
},
|
||||
...data,
|
||||
image,
|
||||
}
|
||||
|
||||
commentList.value[index]["child"].push(targetData)
|
||||
commentList.value[index]["childnum"]++
|
||||
} else if (index != null) {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
reply: [],
|
||||
...data,
|
||||
image,
|
||||
}
|
||||
commentList.value[index]["child"].unshift(targetData)
|
||||
commentList.value[index]["childnum"]++
|
||||
} else {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
...data,
|
||||
child: [],
|
||||
image,
|
||||
}
|
||||
commentList.value.unshift(targetData)
|
||||
// commentCount.value++
|
||||
inputTextarea.value = ""
|
||||
picture.value = {}
|
||||
}
|
||||
|
||||
commentTotalCount.value = data.count || 0
|
||||
|
||||
// targetAnswerList[index]["commentnum"] = data["count"]
|
||||
|
||||
closeAnswerCommentsChild()
|
||||
|
||||
handleMsg("success", res["message"] || "操作成功")
|
||||
})
|
||||
.then(res => {
|
||||
if (res.code != 200) return
|
||||
let data = res.data
|
||||
|
||||
if (i != null) {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
reply: {
|
||||
nickname: commentList.value[index]["child"][i]["nickname"],
|
||||
},
|
||||
...data,
|
||||
image,
|
||||
}
|
||||
|
||||
commentList.value[index]["child"].push(targetData)
|
||||
commentList.value[index]["childnum"]++
|
||||
} else if (index != null) {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
reply: [],
|
||||
...data,
|
||||
image,
|
||||
}
|
||||
commentList.value[index]["child"].unshift(targetData)
|
||||
commentList.value[index]["childnum"]++
|
||||
} else {
|
||||
let targetData = {
|
||||
id: data["commentid"],
|
||||
content,
|
||||
isauthor: 1,
|
||||
islike: 0,
|
||||
likenum: 0,
|
||||
...data,
|
||||
child: [],
|
||||
image,
|
||||
}
|
||||
commentList.value.unshift(targetData)
|
||||
// commentCount.value++
|
||||
inputTextarea.value = ""
|
||||
picture.value = {}
|
||||
}
|
||||
|
||||
commentTotalCount.value = data.count || 0
|
||||
|
||||
// targetAnswerList[index]["commentnum"] = data["count"]
|
||||
|
||||
closeAnswerCommentsChild()
|
||||
|
||||
handleMsg("success", res["message"] || "操作成功")
|
||||
})
|
||||
.finally(() => {
|
||||
detailLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
// 回答-评论 点赞
|
||||
@@ -545,9 +576,11 @@ const openAnswerCommentsChild = (index, i) => {
|
||||
const closeAnswerCommentsChild = () => {
|
||||
commentList.value.forEach(ele => {
|
||||
ele["childState"] = false
|
||||
ele["commentInput"] = "" // 删除原本输入值
|
||||
if (ele["child"] && ele["child"].length != 0) {
|
||||
ele["child"].forEach(el => {
|
||||
el["childState"] = false
|
||||
el["commentInput"] = ""
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user