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 { export interface Setting_SendEmail {
recieveQA: boolean recieveQA: boolean
recieveQAReply: boolean recieveQAReply: boolean
receiveOrder: boolean
} }
export enum SaftyLevels { export enum SaftyLevels {
Disabled, Disabled,

View File

@@ -116,12 +116,12 @@ const orderColumn: DataTableColumns<ResponsePointOrder2UserModel | ResponsePoint
text: true, text: true,
type: 'primary', type: 'primary',
tag: 'a', tag: 'a',
href: 'https://space.bilibili.com/' + row.customer.userId + '', href: 'https://space.bilibili.com/' + row.customer?.userId + '',
target: '_blank', 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(); updateMenuOptions();
// 异步获取 B 站信息(不阻塞主流程) // 异步获取 B 站信息(不阻塞主流程)
await RequestBiliUserData(); RequestBiliUserData();
} }
} catch (error) { } catch (error) {
console.error("获取用户信息时出错:", error); console.error("获取用户信息时出错:", error);
@@ -218,7 +218,6 @@
}, },
{ immediate: true } // 关键: 组件挂载时立即执行一次 watcher触发初始数据加载 { immediate: true } // 关键: 组件挂载时立即执行一次 watcher触发初始数据加载
); );
// --- 组件模板 --- // --- 组件模板 ---
</script> </script>

View File

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

View File

@@ -138,6 +138,27 @@ async function deleteGift(name: string) {
async function updateGift() { async function updateGift() {
return await updateSettings() 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> </script>
<template> <template>
@@ -175,6 +196,21 @@ async function updateGift() {
vertical vertical
:gap="12" :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 <NFlex
align="center" align="center"

View File

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