更新:数据迁移功能完善;(数据迁移功能已注释,暂不上线)

This commit is contained in:
2025-12-08 14:34:18 +08:00
parent 79aa8e3fe6
commit b671e8d76c
6 changed files with 57 additions and 8 deletions

View File

@@ -7,8 +7,8 @@ export const ENV = process.env.NODE_ENV || 'development';
*/
const BASE_URL_MAP = {
development: {
// MAIN: 'http://192.168.110.100:9300/pb/', // 张川川
MAIN: 'https://global.nuttyreading.com/', // 线上
MAIN: 'http://192.168.110.100:9300/pb/', // 张川川
// MAIN: 'https://global.nuttyreading.com/', // 线上
// PAYMENT: 'https://dev-pay.example.com', // 暂时用不到
// CDN: 'https://cdn-dev.example.com', // 暂时用不到
},

View File

@@ -227,6 +227,9 @@
"instruction2": "After data migration is complete, the chinese account data will be cleared, and all purchased Tianyi Coins, points, courses, E-book, VIP, certificate, and User Contribution will be transferred to the current account",
"instruction3": "The migration process may take a few minutes, please be patient.",
"instruction4": "If you encounter any issues, please contact customer service for assistance.",
"alreadyMigrated": "You have already migrated:",
"notMigration": "This migration:",
"migratedCompleted": "You have completed all migrations:",
"closeWindow": "Close the payment pop-up window"
},
"book": {

View File

@@ -228,6 +228,9 @@
"instruction2": "数据迁移完成后旧账号数据将被清空已购买的天医币、积分、课程、电子书、VIP、证书、湖分将转移到当前账号。",
"instruction3": "迁移过程可能需要几分钟时间,请耐心等待。",
"instruction4": "如遇到问题,请联系客服获取帮助。",
"alreadyMigrated": "您已迁移过:",
"notMigration": "本次迁移:",
"migratedCompleted": "您已迁移过所有可迁移数据:",
"closeWindow": "关闭支付弹窗"
},
"book": {

View File

@@ -255,7 +255,7 @@
$theme-color: #54a966;
.user-page {
min-height: 100vh;
min-height: calc(100vh - 50px);
background-color: #f7faf9;
}

View File

@@ -3,10 +3,20 @@
<!-- 自定义导航栏 -->
<nav-bar :title="$t('user.dataMigrate')"></nav-bar>
<view class="text-red-500 text-center mb-[20rpx]! font-bold">{{ $t('user.migrateWarning') }}</view>
<view v-if="!!migrateInfo.notMigration" class="text-center mb-[20rpx]!">
<view v-if="!!migrateInfo.alreadyMigration">{{ $t('user.alreadyMigrated') }}{{ migrateInfo.alreadyMigration }}</view>
<view>{{ $t('user.notMigration') }}<text class="font-bold">{{ migrateInfo.notMigration }}</text></view>
</view>
<view v-else class="text-center mb-[20rpx]! bg-white p-[20rpx] rounded-[10rpx] shadow-[0_4rpx_12rpx_rgba(0,0,0,0.05)]">
<wd-text :text="$t('user.migratedCompleted')" type="warning" />
<wd-text :text="migrateInfo.alreadyMigration" type="warning" bold />
</view>
<view v-if="!!migrateInfo.notMigration" class="text-red-500 text-center mb-[20rpx]! font-bold">{{ $t('user.migrateWarning') }}</view>
<!-- 主要内容区域 -->
<wd-form ref="migrateForm" :model="formData" :rules="rules" :label-width="120" class="migrate-card p-[10rpx]">
<wd-form v-if="!!migrateInfo.notMigration" ref="migrateForm" :model="formData" :rules="rules" :label-width="120" class="migrate-card p-[10rpx]">
<wd-cell-group border>
<wd-input
v-model="formData.tel"
@@ -60,22 +70,40 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { ref, onMounted } from 'vue'
import { t } from '@/utils/i18n'
import { migrateUserData } from '@/api/modules/user'
import { migrateUserData, getUserMigrateInfo } from '@/api/modules/user'
import { useMessage } from '@/uni_modules/wot-design-uni'
const message = useMessage()
const migrateInfo = ref({
alreadyMigration: '',
notMigration: ''
})
// 表单引用
const migrateForm = ref()
// 表单数据
const formData = ref({
tel: '',
code: ''
code: '',
type: ''
})
// 获取用户迁移信息
const getMigrateInfo = async () => {
const res = await getUserMigrateInfo()
migrateInfo.value.alreadyMigration = res.alreadyMigration
// migrateInfo.value.notMigration = res.notMigration
}
onMounted(() => {
getMigrateInfo()
})
// 表单验证规则
const rules = ref({
tel: [
@@ -113,6 +141,7 @@ const handleSubmit = async () => {
}
// 处理迁移
const submitMigrate = async () => {
formData.value.type = migrateInfo.value.notMigration
await migrateUserData(formData.value)
uni.showToast({
title: t('user.migrateSuccess'),

View File

@@ -8,6 +8,7 @@
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
"Courier New", monospace;
--color-red-500: oklch(63.7% 0.237 25.331);
--color-white: #fff;
--spacing: 0.25rem;
--text-xs: 0.75rem;
--text-xs--line-height: calc(1 / 0.75);
@@ -265,16 +266,25 @@
.flex-wrap {
flex-wrap: wrap;
}
.rounded-\[10rpx\] {
border-radius: 10rpx;
}
.border {
border-style: var(--tw-border-style);
border-width: 1px;
}
.bg-white {
background-color: var(--color-white);
}
.p-0\! {
padding: calc(var(--spacing) * 0) !important;
}
.p-\[10rpx\] {
padding: 10rpx;
}
.p-\[20rpx\] {
padding: 20rpx;
}
.p-\[30rpx\] {
padding: 30rpx;
}
@@ -337,6 +347,10 @@
--tw-ordinal: ordinal;
font-variant-numeric: var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,);
}
.shadow-\[0_4rpx_12rpx_rgba\(0\,0\,0\,0\.05\)\] {
--tw-shadow: 0 4rpx 12rpx var(--tw-shadow-color, rgba(0,0,0,0.05));
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.ring {
--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);