更新:数据迁移功能完善;(数据迁移功能已注释,暂不上线)
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user