|
|
@@ -61,6 +61,9 @@
|
|
|
<input type="text" v-model="form.nickname" placeholder="请输入昵称" class="input" maxlength="20" />
|
|
|
</view>
|
|
|
|
|
|
+ <!-- 新用户流程:仅展示头像+昵称,其余字段按需在功能页补充 -->
|
|
|
+ <view v-if="!isNewUserFlow">
|
|
|
+
|
|
|
<!-- 真实姓名 -->
|
|
|
<view class="form-item">
|
|
|
<text class="label">真实姓名</text>
|
|
|
@@ -153,6 +156,7 @@
|
|
|
<text class="label">饮食偏好</text>
|
|
|
<input type="text" v-model="form.dietPreferences" placeholder="如: 清淡、无辣、低糖" class="input" maxlength="200" />
|
|
|
</view>
|
|
|
+ </view>
|
|
|
|
|
|
<!-- 成长规划师额外字段 -->
|
|
|
<view class="form-section-title" v-if="form.role === 'teacher'">成长规划师信息</view>
|
|
|
@@ -209,22 +213,11 @@
|
|
|
</view>
|
|
|
</view> -->
|
|
|
|
|
|
- <!-- 家庭绑定(新用户注册时显示) -->
|
|
|
+ <!-- 新用户流程:保存资料 / 跳过(不再创建或加入家庭) -->
|
|
|
<view class="family-section" v-if="isEdit && form.role !== 'teacher' && isNewUserFlow">
|
|
|
- <view class="section-title">家庭绑定</view>
|
|
|
-
|
|
|
- <!-- 邀请码输入 -->
|
|
|
- <view class="form-item">
|
|
|
- <text class="label">家庭邀请码</text>
|
|
|
- <input type="text" v-model="form.inviteCode" placeholder="选填,如有邀请码请输入" class="input" maxlength="8" />
|
|
|
- </view>
|
|
|
-
|
|
|
<view class="family-actions">
|
|
|
- <button v-if="form.inviteCode" class="btn btn-primary" @click="joinFamilyAction" :loading="loading">
|
|
|
- 加入家庭
|
|
|
- </button>
|
|
|
- <button v-else class="btn btn-primary" @click="createFamilyAction" :loading="loading">
|
|
|
- 创建新家庭
|
|
|
+ <button class="btn btn-primary" @click="saveUserInfo" :loading="loading">
|
|
|
+ 保存资料
|
|
|
</button>
|
|
|
<button class="btn btn-skip" @click="skip">
|
|
|
跳过
|
|
|
@@ -461,11 +454,16 @@ export default {
|
|
|
},
|
|
|
// 保存修改
|
|
|
async saveUserInfo() {
|
|
|
- if (!this.form.nickname) {
|
|
|
+ // 新用户流程:昵称可跳过(跳过时用默认昵称);老用户流程:昵称必填
|
|
|
+ if (!this.isNewUserFlow && !this.form.nickname) {
|
|
|
uni.showToast({ title: '请输入昵称', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
+ if (this.isNewUserFlow && !this.form.nickname) {
|
|
|
+ var phone = this.form.phone || ''
|
|
|
+ this.form.nickname = phone ? '用户' + phone.substring(phone.length - 4) : '微信用户'
|
|
|
+ }
|
|
|
+
|
|
|
// 从 AddressPicker 读取地址文本
|
|
|
if (this.$refs.addressPicker && this.$refs.addressPicker.fullAddress) {
|
|
|
this.form.address = this.$refs.addressPicker.fullAddress
|
|
|
@@ -491,7 +489,11 @@ export default {
|
|
|
})
|
|
|
uni.showToast({ title: '保存成功', icon: 'success' })
|
|
|
setTimeout(() => {
|
|
|
- uni.navigateBack()
|
|
|
+ if (this.isNewUserFlow) {
|
|
|
+ this.navigateToHome()
|
|
|
+ } else {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
}, 1500)
|
|
|
} catch (e) {
|
|
|
uni.showToast({ title: '保存失败', icon: 'none' })
|