feat: 添加积分兑换通知功能;优化通知处理逻辑;更新设置以支持新通知类型

This commit is contained in:
2025-04-09 12:45:30 +08:00
parent 6687888c97
commit 655b92081e
5 changed files with 113 additions and 47 deletions

View File

@@ -1,19 +1,21 @@
<script setup lang="ts">
import { isPermissionGranted, onAction, sendNotification } from '@tauri-apps/plugin-notification';
import { NSwitch } from 'naive-ui';
import { useSettings } from './store/useSettings';
import { onReceivedQuestion } from './data/notification';
import { QAInfo } from '@/api/api-models';
const setting = useSettings()
async function testNotification() {
let permissionGranted = await isPermissionGranted();
if (permissionGranted) {
sendNotification({
title: "测试通知",
body: "这是一个测试通知",
silent: false,
extra: { type: 'test' },
});
onAction((event) => {
console.log('Notification clicked:', event);
});
}
onReceivedQuestion({
id: 1,
question: {
message: '这是一条测试问题',
},
tag: '测试标签',
sender: { name: '测试用户', id: 1, isBiliAuthed: false },
isPublic: true,
} as QAInfo);
}
</script>
@@ -26,6 +28,12 @@ async function testNotification() {
>
测试通知
</NButton>
<LabelItem label="关闭弹幕客户端">
<NSwitch
v-model:value="setting.settings.dev_disableDanmakuClient"
@update:value="setting.save()"
/>
</LabelItem>
</NFlex>
</div>
</template>