Files
JayuCloud/Frontend/src/views/SettingsView.vue
T

275 lines
5.5 KiB
Vue

<template>
<div class="mobile-container">
<!-- 头部区域 -->
<header class="header">
<a-button class="back-btn" type="text" @click="handleBackClick">
<LeftOutlined :style="{ fontSize: '20px' }" />
</a-button>
<h1>设置</h1>
<div class="empty"></div>
</header>
<!-- 设置菜单 -->
<div class="settings-menu">
<a-card :bordered="false" class="settings-card">
<a-list :data-source="settingsSections" :split="false">
<template #renderItem="{ item }">
<!-- 分组标题 -->
<a-list-item class="section-title" v-if="item.type === 'title'">
<span>{{ item.title }}</span>
</a-list-item>
<!-- 设置项 -->
<a-list-item
v-else
class="setting-item"
@click="handleSettingClick(item.key)"
>
<template #actions>
<component :is="item.actionComponent" v-if="item.actionComponent" :props="item.actionProps" />
<RightOutlined v-else />
</template>
<a-list-item-meta>
<template #avatar>
<div class="setting-icon" :style="{ backgroundColor: item.bgColor }">
<component :is="item.icon" />
</div>
</template>
<template #title>
<span>{{ item.title }}</span>
</template>
<template #description v-if="item.desc">
<span>{{ item.desc }}</span>
</template>
</a-list-item-meta>
</a-list-item>
</template>
</a-list>
</a-card>
</div>
<!-- 版本信息 -->
<div class="version-info">
<a-typography-text type="secondary">版本 1.0.0</a-typography-text>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import {
LeftOutlined,
RightOutlined,
LockOutlined,
BellOutlined,
SoundOutlined,
MessageOutlined,
ClearOutlined,
SafetyOutlined,
InfoCircleOutlined
} from '@ant-design/icons-vue'
import { message } from 'ant-design-vue'
const router = useRouter()
// 设置项数据
const settingsSections = ref([
// 账户与安全
{
type: 'title',
title: '账户与安全'
},
{
key: 'account',
title: '账号设置',
desc: '修改密码、绑定手机',
icon: LockOutlined,
bgColor: '#e6f7ff'
},
// 通知设置
{
type: 'title',
title: '通知设置'
},
{
key: 'notifications',
title: '消息通知',
icon: BellOutlined,
bgColor: '#f6ffed'
},
{
key: 'message-push',
title: '消息推送',
icon: MessageOutlined,
bgColor: '#fffbe6'
},
// 外观设置
{
type: 'title',
title: '外观设置'
},
{
key: 'theme',
title: '主题设置',
desc: '跟随系统',
icon: SoundOutlined,
bgColor: '#f9f0ff'
},
// 其他设置
{
type: 'title',
title: '其他设置'
},
{
key: 'clear-cache',
title: '清除缓存',
desc: '12.5 MB',
icon: ClearOutlined,
bgColor: '#fff2e8'
},
{
key: 'privacy',
title: '隐私政策',
icon: SafetyOutlined,
bgColor: '#e6f7ff'
},
{
key: 'about',
title: '关于我们',
icon: InfoCircleOutlined,
bgColor: '#f6ffed'
}
])
// 处理返回按钮点击
const handleBackClick = () => {
router.back()
}
// 处理设置项点击
const handleSettingClick = (key: string) => {
console.log('设置项被点击:', key)
switch (key) {
case 'account':
message.info('账号设置功能开发中...')
break
case 'notifications':
message.info('消息通知功能开发中...')
break
case 'message-push':
message.info('消息推送功能开发中...')
break
case 'theme':
message.info('主题设置功能开发中...')
break
case 'clear-cache':
message.success('缓存已清除')
break
case 'privacy':
message.info('隐私政策功能开发中...')
break
case 'about':
message.info('关于我们功能开发中...')
break
default:
break
}
}
</script>
<style scoped>
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 15px;
border-bottom: 1px solid #f0f0f0;
}
.header h1 {
font-size: 18px;
font-weight: bold;
margin: 0;
}
.back-btn,
.empty {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
}
.settings-menu {
padding: 15px;
}
.settings-card {
border-radius: 16px;
overflow: hidden;
}
.settings-card :deep(.ant-card-body) {
padding: 0;
}
.section-title {
padding: 12px 16px;
font-size: 13px;
color: #999;
background: #fafafa;
}
.setting-item {
padding: 16px;
cursor: pointer;
transition: background 0.3s;
border-bottom: 1px solid #f0f0f0;
}
.setting-item:hover {
background: #fafafa;
}
.setting-item:last-child {
border-bottom: none;
}
.setting-item :deep(.ant-list-item-action) {
margin-left: 8px;
color: #ccc;
}
.setting-icon {
width: 40px;
height: 40px;
border-radius: 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 18px;
}
.setting-item :deep(.ant-list-item-meta-title) {
font-size: 15px;
font-weight: 500;
color: #333;
}
.setting-item :deep(.ant-list-item-meta-description) {
font-size: 12px;
color: #999;
}
.version-info {
padding: 20px;
text-align: center;
}
</style>