| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <template>
- <view class="account-delete-page">
- <nav-bar title="账号注销" bgColor="#f7f8fa" color="#000"></nav-bar>
-
- <view class="form-container">
- <view class="warning-card">
- <view class="warning-icon">!</view>
- <text class="warning-title">账号注销须知</text>
- <text class="warning-text">注销账号后,以下数据将被永久删除且不可恢复:</text>
- <view class="warning-list">
- <text class="warning-item">• 个人信息</text>
- <text class="warning-item">• 账户余额</text>
- </view>
- </view>
- <view class="confirm-section">
- <view class="check-row">
- <checkbox-group @change="onCheckChange">
- <label class="check-label">
- <checkbox :checked="confirmed" color="#f44336" style="transform: scale(0.7);" />
- <text>我已了解上述风险,确认注销</text>
- </label>
- </checkbox-group>
- </view>
- <button class="delete-btn" :disabled="!confirmed" @click="onDelete">确认注销账号</button>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import navBar from '@/components/nav-bar/index.vue'
- import { cancelUser } from '@/api/system/user'
- const confirmed = ref(false)
- const onCheckChange = () => { confirmed.value = !confirmed.value }
- const onDelete = () => {
- uni.showModal({
- title: '最终确认',
- content: '账号注销后无法恢复,确定继续吗?',
- confirmColor: '#f44336',
- success: async (res) => {
- if (res.confirm) {
- try {
- await cancelUser()
- uni.showToast({ title: '账号已注销', icon: 'success' })
- uni.removeStorageSync('token')
- setTimeout(() => uni.reLaunch({ url: '/pages/login/index' }), 1500)
- } catch (error) {
- // 错误处理由 request.js 统一提示
- }
- }
- }
- })
- }
- </script>
- <style lang="scss" scoped>
- .account-delete-page {
- min-height: 100vh;
- background: #f7f8fa;
- padding: 0 32rpx;
- }
- .form-container {
- margin-top: 20rpx;
- }
- .warning-card {
- background: #fff;
- border-radius: 24rpx;
- padding: 48rpx 32rpx;
- display: flex;
- flex-direction: column;
- align-items: flex-start;
- text-align: left;
- box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
- }
- .warning-icon {
- width: 80rpx;
- height: 80rpx;
- line-height: 80rpx;
- text-align: center;
- border-radius: 50%;
- background: #fff3e0;
- color: #ff9800;
- font-size: 48rpx;
- font-weight: bold;
- margin-bottom: 24rpx;
- border: 2rpx solid #ffe0b2;
- }
- .warning-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333;
- margin-bottom: 20rpx;
- }
- .warning-text {
- font-size: 28rpx;
- color: #666;
- margin-bottom: 24rpx;
- line-height: 1.6;
- }
- .warning-list {
- width: 100%;
- }
- .warning-item {
- display: block;
- font-size: 28rpx;
- color: #666;
- line-height: 2.2;
- }
- .confirm-section {
- margin-top: 40rpx;
- padding-bottom: 40rpx;
- }
- .check-row {
- margin-bottom: 32rpx;
- }
- .check-label {
- display: flex;
- align-items: center;
- font-size: 28rpx;
- color: #666;
- }
- .delete-btn {
- width: 100%;
- height: 88rpx;
- background: #f44336;
- color: #fff;
- border: none;
- border-radius: 44rpx;
- font-size: 30rpx;
- font-weight: bold;
- line-height: 88rpx;
- &::after { border: none; }
- }
- .delete-btn[disabled] {
- background: #ccc;
- }
- </style>
|