All checks were successful
continuous-integration/drone/push Build is passing
227 lines
4.7 KiB
Vue
227 lines
4.7 KiB
Vue
<template>
|
|
<view class="about-page">
|
|
<!-- 自定义导航栏 -->
|
|
<view class="custom-nav" :style="{ paddingTop: statusBarHeight + 'px' }">
|
|
<view class="nav-inner">
|
|
<view class="nav-back" @click="goBack">
|
|
<image class="back-icon" src="/static/ic_back2.png" mode="aspectFit" />
|
|
</view>
|
|
<text class="nav-title">{{ t('about.title') }}</text>
|
|
<view class="nav-placeholder" />
|
|
</view>
|
|
</view>
|
|
|
|
<view class="page-body" :style="{ paddingTop: (statusBarHeight + 44) + 'px' }">
|
|
<!-- APP信息 -->
|
|
<view class="app-info">
|
|
<view class="logo-wrapper">
|
|
<image class="logo" src="/static/logo.png" mode="aspectFit" />
|
|
</view>
|
|
<text class="version">版本号 {{ appVersion }}</text>
|
|
</view>
|
|
|
|
<!-- 底部注销账号 -->
|
|
<view v-if="userStore.isLoggedIn" class="delete-section">
|
|
<text class="delete-text" @click="showDeleteConfirm = true">{{ t('about.deleteAccount') }}</text>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- 注销确认弹窗 -->
|
|
<view class="popup-mask" v-if="showDeleteConfirm" @click="showDeleteConfirm = false">
|
|
<view class="popup-content" @click.stop>
|
|
<text class="popup-title">{{ t('about.deleteConfirm') }}</text>
|
|
<view class="popup-actions">
|
|
<view class="btn cancel-btn" @click="showDeleteConfirm = false">
|
|
<text class="btn-text cancel-text">{{ t('common.cancel') }}</text>
|
|
</view>
|
|
<view class="btn confirm-btn" @click="handleDelete">
|
|
<text class="btn-text confirm-text">{{ t('common.confirm') }}</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { useUserStore } from '../../stores/user.js'
|
|
|
|
const { t } = useI18n()
|
|
const userStore = useUserStore()
|
|
|
|
// 状态栏高度
|
|
const statusBarHeight = ref(0)
|
|
try {
|
|
const sysInfo = uni.getSystemInfoSync()
|
|
statusBarHeight.value = sysInfo.statusBarHeight || 0
|
|
} catch (e) {}
|
|
|
|
function goBack() {
|
|
uni.navigateBack()
|
|
}
|
|
|
|
// 获取版本号
|
|
const appVersion = ref('1.0.0')
|
|
try {
|
|
const accountInfo = uni.getAccountInfoSync?.()
|
|
if (accountInfo?.miniProgram?.version) {
|
|
appVersion.value = accountInfo.miniProgram.version
|
|
}
|
|
} catch (e) {}
|
|
|
|
const showDeleteConfirm = ref(false)
|
|
|
|
// 注销账号
|
|
async function handleDelete() {
|
|
showDeleteConfirm.value = false
|
|
try {
|
|
await userStore.deleteAccount()
|
|
uni.showToast({ title: t('about.deleteSuccess'), icon: 'none' })
|
|
uni.switchTab({ url: '/pages/index/index' })
|
|
} catch (e) {
|
|
/* 错误已统一处理 */
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.about-page {
|
|
min-height: 100vh;
|
|
background-color: #ffffff;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
/* 导航栏 */
|
|
.custom-nav {
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0;
|
|
z-index: 100;
|
|
background-color: #ffffff;
|
|
border-bottom: 1rpx solid #e5e5e5;
|
|
}
|
|
.nav-inner {
|
|
height: 44px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 16rpx;
|
|
}
|
|
.nav-back {
|
|
width: 60rpx;
|
|
height: 44px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.back-icon {
|
|
width: 40rpx;
|
|
height: 40rpx;
|
|
}
|
|
.nav-title {
|
|
font-size: 34rpx;
|
|
font-weight: 600;
|
|
color: #333;
|
|
}
|
|
.nav-placeholder {
|
|
width: 60rpx;
|
|
}
|
|
|
|
/* 页面主体 */
|
|
.page-body {
|
|
flex: 1;
|
|
width: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
/* APP信息区域 */
|
|
.app-info {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding-top: 120rpx;
|
|
}
|
|
.logo-wrapper {
|
|
width: 200rpx;
|
|
height: 200rpx;
|
|
border: 2rpx solid #ccc;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-bottom: 30rpx;
|
|
}
|
|
.logo {
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
}
|
|
.version {
|
|
font-size: 28rpx;
|
|
color: #666;
|
|
}
|
|
|
|
/* 底部注销 */
|
|
.delete-section {
|
|
padding-bottom: 80rpx;
|
|
}
|
|
.delete-text {
|
|
font-size: 28rpx;
|
|
color: #333;
|
|
}
|
|
|
|
/* 弹窗样式 */
|
|
.popup-mask {
|
|
position: fixed;
|
|
top: 0; left: 0; right: 0; bottom: 0;
|
|
background-color: rgba(0, 0, 0, 0.5);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 999;
|
|
}
|
|
.popup-content {
|
|
width: 600rpx;
|
|
background-color: #ffffff;
|
|
border-radius: 24rpx;
|
|
padding: 40rpx;
|
|
}
|
|
.popup-title {
|
|
font-size: 32rpx;
|
|
color: #333;
|
|
text-align: center;
|
|
display: block;
|
|
margin-bottom: 40rpx;
|
|
}
|
|
.popup-actions {
|
|
display: flex;
|
|
gap: 20rpx;
|
|
}
|
|
.btn {
|
|
flex: 1;
|
|
height: 80rpx;
|
|
border-radius: 40rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.cancel-btn {
|
|
background-color: #f5f5f5;
|
|
}
|
|
.confirm-btn {
|
|
background-color: #ff3b30;
|
|
}
|
|
.btn-text {
|
|
font-size: 28rpx;
|
|
}
|
|
.cancel-text {
|
|
color: #666;
|
|
}
|
|
.confirm-text {
|
|
color: #ffffff;
|
|
}
|
|
</style>
|