mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
feat: 更新依赖项和配置,添加新通知类型
- 在 package.json 中添加了 @types/md5 和 @vueuse/integrations 依赖。 - 更新了 tsconfig.json 中的模块解析方式为 bundler。 - 在组件声明中移除了不再使用的 Naive UI 组件。 - 在弹幕窗口和设置中添加了启用动画的选项,并更新了相关样式。 - 实现了私信发送失败的通知功能,增强了用户体验。
This commit is contained in:
@@ -5,6 +5,7 @@ import { QueryGetAPI } from '@/api/query'
|
||||
import { POINT_API_URL } from '@/data/constants'
|
||||
import { objectsToCSV } from '@/Utils'
|
||||
import { Info24Filled } from '@vicons/fluent'
|
||||
import { Warning24Regular } from '@vicons/fluent'
|
||||
import { useStorage } from '@vueuse/core'
|
||||
import { format } from 'date-fns'
|
||||
import { saveAs } from 'file-saver'
|
||||
@@ -63,6 +64,7 @@ const ps = ref(25)
|
||||
// 弹窗控制
|
||||
const showModal = ref(false)
|
||||
const showGivePointModal = ref(false)
|
||||
const showResetAllPointsModal = ref(false)
|
||||
const isLoading = ref(true)
|
||||
|
||||
// 积分调整表单
|
||||
@@ -70,6 +72,10 @@ const addPointCount = ref(0)
|
||||
const addPointReason = ref<string>('')
|
||||
const addPointTarget = ref<number>()
|
||||
|
||||
// 重置所有积分确认
|
||||
const resetConfirmText = ref('')
|
||||
const RESET_CONFIRM_TEXT = '我确认删除'
|
||||
|
||||
// 用户数据
|
||||
const users = ref<ResponsePointUserModel[]>([])
|
||||
// 根据筛选条件过滤后的用户
|
||||
@@ -277,6 +283,37 @@ async function deleteUser(user: ResponsePointUserModel) {
|
||||
}
|
||||
}
|
||||
|
||||
// 重置所有用户积分
|
||||
async function resetAllPoints() {
|
||||
// 验证确认文本
|
||||
if (resetConfirmText.value !== RESET_CONFIRM_TEXT) {
|
||||
message.error(`请输入"${RESET_CONFIRM_TEXT}"以确认操作`)
|
||||
return
|
||||
}
|
||||
|
||||
isLoading.value = true
|
||||
try {
|
||||
const data = await QueryGetAPI(POINT_API_URL + 'reset')
|
||||
|
||||
if (data.code == 200) {
|
||||
message.success('已重置所有用户积分')
|
||||
resetConfirmText.value = ''
|
||||
showResetAllPointsModal.value = false
|
||||
|
||||
// 重新加载用户数据
|
||||
setTimeout(() => {
|
||||
refresh()
|
||||
}, 1500)
|
||||
} else {
|
||||
message.error('重置失败: ' + data.message)
|
||||
}
|
||||
} catch (err) {
|
||||
message.error('重置失败: ' + err)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 导出用户积分数据
|
||||
function exportData() {
|
||||
try {
|
||||
@@ -360,6 +397,12 @@ onMounted(async () => {
|
||||
>
|
||||
导出积分数据
|
||||
</NButton>
|
||||
<NButton
|
||||
type="error"
|
||||
@click="showResetAllPointsModal = true"
|
||||
>
|
||||
重置所有积分
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</template>
|
||||
|
||||
@@ -516,6 +559,46 @@ onMounted(async () => {
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</NModal>
|
||||
|
||||
<!-- 重置所有用户积分弹窗 -->
|
||||
<NModal
|
||||
v-model:show="showResetAllPointsModal"
|
||||
preset="card"
|
||||
style="max-width: 500px"
|
||||
title="重置所有用户积分"
|
||||
>
|
||||
<NFlex
|
||||
vertical
|
||||
:gap="16"
|
||||
>
|
||||
<NFlex
|
||||
align="center"
|
||||
:gap="8"
|
||||
>
|
||||
<NIcon
|
||||
:component="Warning24Regular"
|
||||
color="red"
|
||||
/>
|
||||
<NText type="error">
|
||||
警告:此操作将删除所有用户积分记录,不可恢复!
|
||||
</NText>
|
||||
</NFlex>
|
||||
<NText>请输入 <b>"{{ RESET_CONFIRM_TEXT }}"</b> 以确认操作</NText>
|
||||
<NInput
|
||||
v-model:value="resetConfirmText"
|
||||
placeholder="请输入确认文本"
|
||||
/>
|
||||
|
||||
<NButton
|
||||
type="error"
|
||||
:loading="isLoading"
|
||||
@click="resetAllPoints"
|
||||
:disabled="resetConfirmText !== RESET_CONFIRM_TEXT"
|
||||
>
|
||||
确认重置所有用户积分
|
||||
</NButton>
|
||||
</NFlex>
|
||||
</NModal>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user