feat: 更新设置和组件,增强用户通知功能, 修复用户订单记录渲染

- 在 Setting_SendEmail 接口中新增 receiveOrder 字段,支持积分礼物兑换通知。
- 优化 PointOrderCard 组件,处理用户信息时增加安全性。
- 更新 ViewerLayout 组件,异步获取用户数据逻辑简化。
- 在 SettingsManageView 中新增积分礼物兑换邮件通知选项。
- 增强 PointSettings 组件,添加通知设置保存功能。
- 更新 QuestionBoxView 组件样式,提升视觉效果。
This commit is contained in:
2025-04-25 09:27:22 +08:00
parent 07948e6777
commit e48b3df236
6 changed files with 57 additions and 6 deletions

View File

@@ -108,6 +108,7 @@ export enum BiliAuthCodeStatusType {
export interface Setting_SendEmail {
recieveQA: boolean
recieveQAReply: boolean
receiveOrder: boolean
}
export enum SaftyLevels {
Disabled,

View File

@@ -116,12 +116,12 @@ const orderColumn: DataTableColumns<ResponsePointOrder2UserModel | ResponsePoint
text: true,
type: 'primary',
tag: 'a',
href: 'https://space.bilibili.com/' + row.customer.userId + '',
href: 'https://space.bilibili.com/' + row.customer?.userId + '',
target: '_blank',
},
{ default: () => row.customer.name },
{ default: () => row.customer?.name || '未知用户' },
),
default: () => row.customer.userId,
default: () => row.customer?.userId || '未知ID',
})
},
},

View File

@@ -177,7 +177,7 @@
// 基于新的用户信息更新菜单
updateMenuOptions();
// 异步获取 B 站信息(不阻塞主流程)
await RequestBiliUserData();
RequestBiliUserData();
}
} catch (error) {
console.error("获取用户信息时出错:", error);
@@ -218,7 +218,6 @@
},
{ immediate: true } // 关键: 组件挂载时立即执行一次 watcher触发初始数据加载
);
// --- 组件模板 ---
</script>

View File

@@ -655,6 +655,12 @@
>
提问收到回复时发送邮件
</NCheckbox>
<NCheckbox
v-model:checked="accountInfo.settings.sendEmail.receiveOrder"
@update:checked="SaveComboSetting"
>
积分礼物有新用户兑换时发送邮件
</NCheckbox>
</NSpace>
<NDivider> 提问箱 </NDivider>

View File

@@ -138,6 +138,27 @@ async function deleteGift(name: string) {
async function updateGift() {
return await updateSettings()
}
// 更新账户通知设置
async function SaveComboSetting() {
if (!accountInfo.value) return false
isLoading.value = true
try {
const msg = await SaveSetting('SendEmail', accountInfo.value.settings.sendEmail)
if (msg) {
message.success('已保存')
return true
} else {
message.error('保存失败: ' + msg)
}
} catch (err) {
message.error('修改失败: ' + err)
} finally {
isLoading.value = false
}
return false
}
</script>
<template>
@@ -175,6 +196,21 @@ async function updateGift() {
vertical
:gap="12"
>
<!-- 通知设置 -->
<NFlex
align="center"
:gap="12"
>
<span>通知设置:</span>
<NCheckbox
v-model:checked="accountInfo.settings.sendEmail.receiveOrder"
:disabled="!canEdit"
@update:checked="SaveComboSetting"
>
积分礼物有新用户兑换时发送邮件
</NCheckbox>
</NFlex>
<!-- 积分来源设置 -->
<NFlex
align="center"

View File

@@ -207,7 +207,7 @@ onUnmounted(() => {
<template>
<div
style="max-width: 700px; margin: 0 auto"
class="question-box-container"
title="提问"
>
<!-- 提问表单 -->
@@ -401,3 +401,12 @@ onUnmounted(() => {
<NDivider />
</div>
</template>
<style scoped>
.question-box-container {
max-width: 700px;
margin: 0 auto;
position: relative;
width: 100%;
}
</style>