|
@@ -136,6 +136,12 @@
|
|
|
</picker>
|
|
</picker>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
|
|
+ <!-- 地址选择 -->
|
|
|
|
|
+ <view class="form-item">
|
|
|
|
|
+ <text class="label">所在地区 <text class="required" v-if="isNewUserFlow">*</text></text>
|
|
|
|
|
+ <AddressPicker ref="addressPicker" />
|
|
|
|
|
+ </view>
|
|
|
|
|
+
|
|
|
<!-- 兴趣爱好 -->
|
|
<!-- 兴趣爱好 -->
|
|
|
<view class="form-item">
|
|
<view class="form-item">
|
|
|
<text class="label">兴趣爱好</text>
|
|
<text class="label">兴趣爱好</text>
|
|
@@ -248,8 +254,12 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import { updateUserInfo, joinFamily, createFamily, directRegister, getUserInfo } from '../../utils/api.js'
|
|
import { updateUserInfo, joinFamily, createFamily, directRegister, getUserInfo } from '../../utils/api.js'
|
|
|
|
|
+import AddressPicker from '../../components/address-picker.vue'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
|
|
+ components: {
|
|
|
|
|
+ AddressPicker
|
|
|
|
|
+ },
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
isEdit: false,
|
|
isEdit: false,
|
|
@@ -275,7 +285,9 @@ export default {
|
|
|
highestEducation: '',
|
|
highestEducation: '',
|
|
|
maritalStatus: '',
|
|
maritalStatus: '',
|
|
|
hobbies: '',
|
|
hobbies: '',
|
|
|
- dietPreferences: ''
|
|
|
|
|
|
|
+ dietPreferences: '',
|
|
|
|
|
+ address: '',
|
|
|
|
|
+ addressId: null
|
|
|
},
|
|
},
|
|
|
ethnicityOptions: ['汉族','蒙古族','回族','藏族','维吾尔族','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克族','傣族','黎族','其他'],
|
|
ethnicityOptions: ['汉族','蒙古族','回族','藏族','维吾尔族','苗族','彝族','壮族','布依族','朝鲜族','满族','侗族','瑶族','白族','土家族','哈尼族','哈萨克族','傣族','黎族','其他'],
|
|
|
bloodTypeOptions: ['A','B','AB','O','未知'],
|
|
bloodTypeOptions: ['A','B','AB','O','未知'],
|
|
@@ -309,16 +321,27 @@ export default {
|
|
|
if (options.token && options.userId) {
|
|
if (options.token && options.userId) {
|
|
|
this.token = options.token
|
|
this.token = options.token
|
|
|
this.userId = options.userId
|
|
this.userId = options.userId
|
|
|
-
|
|
|
|
|
- // 检查是否需要选择角色(新用户)- 只有明确传递 needsRoleSelect=true 才显示选择
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (options.autoParent === 'true') {
|
|
|
|
|
+ // 首次登录:跳过角色选择,默认 parent,直接进入信息补充页
|
|
|
|
|
+ this.showRoleSelect = false
|
|
|
|
|
+ this.isEdit = true
|
|
|
|
|
+ this.isNewUserFlow = true
|
|
|
|
|
+ this.form.role = 'parent'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 检查是否需要选择角色(新用户)- 只有明确传递 needsRoleSelect=true 才显示选择
|
|
|
|
|
+ this.showRoleSelect = options.needsRoleSelect === 'true'
|
|
|
|
|
+ this.isEdit = !this.showRoleSelect
|
|
|
|
|
+ this.isNewUserFlow = options.needsRoleSelect === 'true'
|
|
|
|
|
+ }
|
|
|
|
|
+ } else if (options.phone && (options.autoParent === 'true' || options.needsRoleSelect === 'true')) {
|
|
|
|
|
+ // 测试环境:没有token,只有手机号,是新用户注册流程
|
|
|
this.showRoleSelect = options.needsRoleSelect === 'true'
|
|
this.showRoleSelect = options.needsRoleSelect === 'true'
|
|
|
this.isEdit = !this.showRoleSelect
|
|
this.isEdit = !this.showRoleSelect
|
|
|
- this.isNewUserFlow = options.needsRoleSelect === 'true'
|
|
|
|
|
- } else if (options.phone && options.needsRoleSelect === 'true') {
|
|
|
|
|
- // 测试环境:没有token,只有手机号,是新用户注册流程
|
|
|
|
|
- this.showRoleSelect = true
|
|
|
|
|
- this.isEdit = false
|
|
|
|
|
this.isNewUserFlow = true
|
|
this.isNewUserFlow = true
|
|
|
|
|
+ if (options.autoParent === 'true') {
|
|
|
|
|
+ this.form.role = 'parent'
|
|
|
|
|
+ }
|
|
|
// 将手机号传递给表单
|
|
// 将手机号传递给表单
|
|
|
this.form.phone = options.phone
|
|
this.form.phone = options.phone
|
|
|
} else {
|
|
} else {
|
|
@@ -430,6 +453,7 @@ export default {
|
|
|
this.form.hobbies = userData.hobbies || ''
|
|
this.form.hobbies = userData.hobbies || ''
|
|
|
this.form.dietPreferences = userData.dietPreferences || ''
|
|
this.form.dietPreferences = userData.dietPreferences || ''
|
|
|
this.form.mascot = userData.mascot || ''
|
|
this.form.mascot = userData.mascot || ''
|
|
|
|
|
+ this.form.address = userData.address || ''
|
|
|
}
|
|
}
|
|
|
} catch (e) {
|
|
} catch (e) {
|
|
|
console.error('加载用户信息失败', e)
|
|
console.error('加载用户信息失败', e)
|
|
@@ -442,6 +466,11 @@ export default {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 从 AddressPicker 读取地址文本
|
|
|
|
|
+ if (this.$refs.addressPicker && this.$refs.addressPicker.fullAddress) {
|
|
|
|
|
+ this.form.address = this.$refs.addressPicker.fullAddress
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
try {
|
|
try {
|
|
|
await updateUserInfo({
|
|
await updateUserInfo({
|
|
@@ -457,7 +486,8 @@ export default {
|
|
|
highestEducation: this.form.highestEducation,
|
|
highestEducation: this.form.highestEducation,
|
|
|
maritalStatus: this.form.maritalStatus,
|
|
maritalStatus: this.form.maritalStatus,
|
|
|
hobbies: this.form.hobbies,
|
|
hobbies: this.form.hobbies,
|
|
|
- dietPreferences: this.form.dietPreferences
|
|
|
|
|
|
|
+ dietPreferences: this.form.dietPreferences,
|
|
|
|
|
+ address: this.form.address
|
|
|
})
|
|
})
|
|
|
uni.showToast({ title: '保存成功', icon: 'success' })
|
|
uni.showToast({ title: '保存成功', icon: 'success' })
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|