Files
akmon/pages/mt/settings.uvue
2026-01-20 08:04:15 +08:00

50 lines
1.5 KiB
Plaintext

<template>
<view :class="['mt-settings', isLargeScreen ? 'large' : 'small']">
<text class="mt-title">{{ t('mt.settings.title') }}</text>
<view class="mt-setting-item">
<text>{{ t('mt.settings.language') }}</text>
<picker :range="languages" v-model="currentLang" @change="onLangChange" />
</view>
<view class="mt-setting-item">
<text>{{ t('mt.settings.theme') }}</text>
<switch v-model="isDark" @change="onThemeChange" />
</view>
<!-- admin入口 -->
<button v-if="isAdmin" @tap="goToAdmin">{{ t('mt.settings.admin') }}</button>
</view>
</template>
<script lang="uts">
import { ref } from 'uni-app'
import { t } from '@/i18n/mt'
import { isLargeScreen } from '@/utils/responsive'
import { getUserRole } from '@/composables/use-auth'
const languages = ref(['zh-CN', 'en', 'ja'])
const currentLang = ref('zh-CN')
const isDark = ref(false)
const isAdmin = ref(false)
onLoad(() => {
// 加载用户设置
isAdmin.value = getUserRole() === 'admin'
})
function onLangChange(e) {
// 切换语言逻辑
}
function onThemeChange(e) {
// 切换主题逻辑
}
function goToAdmin() {
uni.navigateTo({ url: '/pages/mt/admin.uvue' })
}
</script>
<style lang="scss">
.mt-settings {
padding: 32rpx;
&.large { max-width: 900rpx; margin: 0 auto; }
.mt-title { font-size: 40rpx; font-weight: bold; margin-bottom: 32rpx; }
.mt-setting-item { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24rpx; }
}
</style>