|
@@ -77,6 +77,47 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
+ <!-- 地区编辑 -->
|
|
|
|
|
+ <div class="edit-section" v-if="type === 'region'">
|
|
|
|
|
+ <van-field
|
|
|
|
|
+ v-model="region"
|
|
|
|
|
+ :placeholder="$t('user.region')"
|
|
|
|
|
+ maxlength="50"
|
|
|
|
|
+ class="edit-input"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 年龄编辑 -->
|
|
|
|
|
+ <div class="edit-section" v-if="type === 'age'">
|
|
|
|
|
+ <van-field
|
|
|
|
|
+ v-model="age"
|
|
|
|
|
+ type="digit"
|
|
|
|
|
+ :placeholder="$t('user.age')"
|
|
|
|
|
+ maxlength="3"
|
|
|
|
|
+ class="edit-input"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 性别编辑 -->
|
|
|
|
|
+ <div class="edit-section" v-if="type === 'gender'">
|
|
|
|
|
+ <div class="gender-options">
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="gender-item"
|
|
|
|
|
+ :class="{ active: gender === 1 }"
|
|
|
|
|
+ @click="gender = 1"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ $t('user.male') }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div
|
|
|
|
|
+ class="gender-item"
|
|
|
|
|
+ :class="{ active: gender === 2 }"
|
|
|
|
|
+ @click="gender = 2"
|
|
|
|
|
+ >
|
|
|
|
|
+ {{ $t('user.female') }}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
<!-- 实名认证 -->
|
|
<!-- 实名认证 -->
|
|
|
<div class="edit-section" v-if="type === 'realName'">
|
|
<div class="edit-section" v-if="type === 'realName'">
|
|
|
<van-field
|
|
<van-field
|
|
@@ -120,6 +161,9 @@ const nickname = ref(userInfo.value?.nickname || '');
|
|
|
const phone = ref('');
|
|
const phone = ref('');
|
|
|
const email = ref('');
|
|
const email = ref('');
|
|
|
const code = ref('');
|
|
const code = ref('');
|
|
|
|
|
+const region = ref(userInfo.value?.region || '');
|
|
|
|
|
+const age = ref(userInfo.value?.age ? String(userInfo.value.age) : '');
|
|
|
|
|
+const gender = ref(userInfo.value?.gender || 0);
|
|
|
const realName = ref('');
|
|
const realName = ref('');
|
|
|
const idCard = ref('');
|
|
const idCard = ref('');
|
|
|
const countdown = ref(0);
|
|
const countdown = ref(0);
|
|
@@ -130,6 +174,9 @@ const getTitle = () => {
|
|
|
nickname: t('user.nickname'),
|
|
nickname: t('user.nickname'),
|
|
|
phone: t('user.bindPhone'),
|
|
phone: t('user.bindPhone'),
|
|
|
email: t('user.bindEmail'),
|
|
email: t('user.bindEmail'),
|
|
|
|
|
+ region: t('user.region'),
|
|
|
|
|
+ age: t('user.age'),
|
|
|
|
|
+ gender: t('user.gender'),
|
|
|
realName: t('user.realName')
|
|
realName: t('user.realName')
|
|
|
};
|
|
};
|
|
|
return map[type.value] || '';
|
|
return map[type.value] || '';
|
|
@@ -198,6 +245,30 @@ const handleSave = async () => {
|
|
|
res = await requestBindEmail({ email: email.value, code: code.value });
|
|
res = await requestBindEmail({ email: email.value, code: code.value });
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
|
|
+ case 'region':
|
|
|
|
|
+ if (!region.value.trim()) {
|
|
|
|
|
+ showToast(t('user.region'));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ res = await requestUpdateUserInfo({ region: region.value });
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case 'age':
|
|
|
|
|
+ if (!age.value || Number(age.value) <= 0) {
|
|
|
|
|
+ showToast(t('user.age'));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ res = await requestUpdateUserInfo({ age: Number(age.value) });
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case 'gender':
|
|
|
|
|
+ if (!gender.value) {
|
|
|
|
|
+ showToast(t('user.gender'));
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ res = await requestUpdateUserInfo({ gender: gender.value });
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
case 'realName':
|
|
case 'realName':
|
|
|
if (!realName.value || !idCard.value) {
|
|
if (!realName.value || !idCard.value) {
|
|
|
showToast('Please fill in all fields');
|
|
showToast('Please fill in all fields');
|
|
@@ -227,6 +298,9 @@ const goBack = () => {
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
if (userInfo.value) {
|
|
if (userInfo.value) {
|
|
|
nickname.value = userInfo.value.nickname || '';
|
|
nickname.value = userInfo.value.nickname || '';
|
|
|
|
|
+ region.value = userInfo.value.region || '';
|
|
|
|
|
+ age.value = userInfo.value.age ? String(userInfo.value.age) : '';
|
|
|
|
|
+ gender.value = userInfo.value.gender || 0;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
</script>
|
|
</script>
|
|
@@ -302,6 +376,28 @@ onMounted(() => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ .gender-options {
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ gap: 12px;
|
|
|
|
|
+
|
|
|
|
|
+ .gender-item {
|
|
|
|
|
+ flex: 1;
|
|
|
|
|
+ padding: 16px;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ background: rgba(255, 255, 255, 0.05);
|
|
|
|
|
+ border-radius: 12px;
|
|
|
|
|
+ font-size: 14px;
|
|
|
|
|
+ color: rgba(255, 255, 255, 0.7);
|
|
|
|
|
+ border: 2px solid transparent;
|
|
|
|
|
+
|
|
|
|
|
+ &.active {
|
|
|
|
|
+ border-color: #ffc300;
|
|
|
|
|
+ color: #ffc300;
|
|
|
|
|
+ background: rgba(255, 195, 0, 0.1);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
.tips {
|
|
.tips {
|
|
|
margin-top: 16px;
|
|
margin-top: 16px;
|
|
|
padding: 12px;
|
|
padding: 12px;
|