mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
add question delete
This commit is contained in:
@@ -99,6 +99,22 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
||||
isLoading.value = false
|
||||
})
|
||||
}
|
||||
async function DelQA(id: number) {
|
||||
await QueryGetAPI(QUESTION_API_URL + 'del', {
|
||||
id: id,
|
||||
})
|
||||
.then((data) => {
|
||||
if (data.code == 200) {
|
||||
message.success('删除成功')
|
||||
recieveQuestions.value = recieveQuestions.value.filter((q) => q.id != id)
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
message.error('发生错误: ' + err)
|
||||
})
|
||||
}
|
||||
async function GetTags() {
|
||||
isLoading.value = true
|
||||
await QueryGetAPI<QATagInfo[]>(QUESTION_API_URL + 'get-tags', {
|
||||
@@ -296,8 +312,8 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
||||
message.error('拉黑失败: ' + err)
|
||||
})
|
||||
}
|
||||
async function setCurrentQuestion(item: QAInfo) {
|
||||
const isCurrent = displayQuestion.value?.id == item.id
|
||||
async function setCurrentQuestion(item: QAInfo | undefined) {
|
||||
const isCurrent = displayQuestion.value?.id == item?.id
|
||||
if (!isCurrent) {
|
||||
displayQuestion.value = item
|
||||
} else {
|
||||
@@ -306,7 +322,7 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
||||
try {
|
||||
const data = await QueryGetAPI(
|
||||
QUESTION_API_URL + 'set-current',
|
||||
isCurrent
|
||||
isCurrent || !item
|
||||
? null
|
||||
: {
|
||||
id: item.id,
|
||||
@@ -339,6 +355,7 @@ export const useQuestionBox = defineStore('QuestionBox', () => {
|
||||
displayTag,
|
||||
GetRecieveQAInfo,
|
||||
GetSendQAInfo,
|
||||
DelQA,
|
||||
GetTags,
|
||||
addTag,
|
||||
delTag,
|
||||
|
||||
@@ -44,7 +44,7 @@ import QrcodeVue from 'qrcode.vue'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import QuestionItem from '@/components/QuestionItems.vue'
|
||||
import { ArrowCircleRight12Filled, Delete24Regular, Eye24Filled, EyeOff24Filled, Info24Filled } from '@vicons/fluent'
|
||||
import { Delete24Filled, Delete24Regular, Eye24Filled, EyeOff24Filled, Info24Filled, } from '@vicons/fluent'
|
||||
import { useQuestionBox } from '@/store/useQuestionBox'
|
||||
|
||||
const accountInfo = useAccount()
|
||||
@@ -218,13 +218,24 @@ onMounted(() => {
|
||||
</template>
|
||||
收藏
|
||||
</NButton>
|
||||
<NPopconfirm @positive-click="useQB.DelQA(item.id)">
|
||||
<template #trigger>
|
||||
<NButton size="small" type="error">
|
||||
<template #icon>
|
||||
<NIcon :component="Delete24Filled"/>
|
||||
</template>
|
||||
删除
|
||||
</NButton>
|
||||
</template>
|
||||
确认删除这条提问?
|
||||
</NPopconfirm>
|
||||
<!-- <NTooltip>
|
||||
<template #trigger>
|
||||
<NButton size="small"> 举报 </NButton>
|
||||
</template>
|
||||
暂时还没写
|
||||
</NTooltip> -->
|
||||
<NButton size="small" @click="useQB.blacklist(item)"> 拉黑 </NButton>
|
||||
<NButton size="small" @click="useQB.blacklist(item)" type="warning"> 拉黑 </NButton>
|
||||
</NSpace>
|
||||
</template>
|
||||
<template #header-extra="{ item }">
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
TextAlignLeft16Filled,
|
||||
TextAlignRight16Filled,
|
||||
} from '@vicons/fluent'
|
||||
import { Heart, HeartOutline } from '@vicons/ionicons5'
|
||||
import { Heart, HeartOutline, Delete24Filled } from '@vicons/ionicons5'
|
||||
import { useDebounceFn, useElementSize, useStorage } from '@vueuse/core'
|
||||
import {
|
||||
NButton,
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
NInputGroupLabel,
|
||||
NInputNumber,
|
||||
NModal,
|
||||
NPopconfirm,
|
||||
NRadioButton,
|
||||
NRadioGroup,
|
||||
NScrollbar,
|
||||
|
||||
Reference in New Issue
Block a user