|
|
@@ -44,17 +44,6 @@
|
|
|
|
|
|
<!-- 详细信息填写(选择角色后显示) -->
|
|
|
<view v-if="isEdit && (!isNewUserFlow || hasFamily)" :class="isEdit && form.role !== 'teacher' && isNewUserFlow ? 'user-form-wrap' : ''">
|
|
|
- <!-- 家庭身份(接受家庭邀请时置顶显示,方便第一时间选择家庭身份) -->
|
|
|
- <view class="family-section" v-if="isEdit && form.role === 'parent' && isNewUserFlow && hasPendingFamilyInvite">
|
|
|
- <view class="section-title">👨👩👧👦 家庭身份(可选)</view>
|
|
|
- <view class="form-item">
|
|
|
- <text class="label">您在家庭中的身份</text>
|
|
|
- <picker mode="selector" :range="familyRoleOptions" :value="familyRoleIndex" @change="onFamilyRoleChange">
|
|
|
- <view class="picker-input">{{ form.familyRole || '请选择(可跳过)' }}</view>
|
|
|
- </picker>
|
|
|
- </view>
|
|
|
- <text class="hint-text">不选也可先保存,后续在家庭页面发起申请</text>
|
|
|
- </view>
|
|
|
<view class="form-section">
|
|
|
<!-- 头像 -->
|
|
|
<view class="form-item avatar-item">
|
|
|
@@ -230,17 +219,6 @@
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <!-- 新用户流程:提交申请 / 跳过(接受邀请时按钮固定在页面底部悬浮) -->
|
|
|
- <view class="family-section" v-if="isEdit && form.role !== 'teacher' && isNewUserFlow">
|
|
|
- <view class="family-actions family-actions-fixed">
|
|
|
- <button class="btn btn-primary" @click="saveUserInfo" :loading="loading" :disabled="loading">
|
|
|
- {{ hasPendingFamilyInvite ? '提交申请' : '保存资料' }}
|
|
|
- </button>
|
|
|
- <button class="btn btn-skip" @click="skip">
|
|
|
- 跳过
|
|
|
- </button>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
<!-- 免费用户提示(新用户首次注册信息完善时不展示,注册流程不推送会员) -->
|
|
|
<view class="family-section" v-if="isEdit && !isNewUserFlow && memberLevel === 'FREE'">
|
|
|
<view class="mascot-locked-hint" @click="goUpgrade">
|
|
|
@@ -397,10 +375,6 @@ export default {
|
|
|
if (this.token) return true
|
|
|
return this.$store.getters.hasFamily
|
|
|
},
|
|
|
- // 是否有待处理的家庭邀请码
|
|
|
- hasPendingFamilyInvite: function() {
|
|
|
- return !!uni.getStorageSync('pendingFamilyInviteCode')
|
|
|
- },
|
|
|
regionBreadcrumb: function() {
|
|
|
var names = []
|
|
|
names.push(this.tempProvince ? this.getRegionName(this.tempProvince) : '省份')
|
|
|
@@ -416,43 +390,13 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- if (options.token && options.userId) {
|
|
|
- this.token = options.token
|
|
|
- this.userId = options.userId
|
|
|
-
|
|
|
- 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.isEdit = !this.showRoleSelect
|
|
|
- this.isNewUserFlow = true
|
|
|
- if (options.autoParent === 'true') {
|
|
|
- this.form.role = 'parent'
|
|
|
- }
|
|
|
- // 将手机号传递给表单
|
|
|
- this.form.phone = options.phone
|
|
|
- } else {
|
|
|
- // 其他情况:默认进入编辑模式(如从"我的"页面进入)
|
|
|
- this.showRoleSelect = false
|
|
|
- this.isEdit = true
|
|
|
- this.isNewUserFlow = false
|
|
|
- }
|
|
|
-
|
|
|
- // 非新用户流程时,加载已有用户信息
|
|
|
- if (this.isEdit && !this.isNewUserFlow) {
|
|
|
- this.loadUserInfo()
|
|
|
- }
|
|
|
+ // 注册零填写改造:本页仅保留「个人中心编辑资料」用途
|
|
|
+ // 新用户注册不再跳转本页(autoParent / needsRoleSelect 参数已废弃,不再处理)
|
|
|
+ this.showRoleSelect = false
|
|
|
+ this.isEdit = true
|
|
|
+ this.isNewUserFlow = false
|
|
|
+ // 加载已有用户信息
|
|
|
+ this.loadUserInfo()
|
|
|
// 加载会员等级(用于助手解锁)
|
|
|
var self = this
|
|
|
getMyMembership().then(function(res) {
|
|
|
@@ -750,32 +694,14 @@ export default {
|
|
|
street: this.form.street
|
|
|
})
|
|
|
|
|
|
- // 新用户流程且有家庭邀请码:提交加入家庭申请
|
|
|
- if (this.isNewUserFlow && this.hasPendingFamilyInvite) {
|
|
|
- var inviteCode = uni.getStorageSync('pendingFamilyInviteCode')
|
|
|
- var familyRole = this.form.familyRole || ''
|
|
|
- if (inviteCode) {
|
|
|
- try {
|
|
|
- await requestJoinByCode(inviteCode, familyRole)
|
|
|
- uni.showToast({ title: '加入家庭申请已提交,等待管理员审批', icon: 'success' })
|
|
|
- } catch (e) {
|
|
|
- uni.showToast({ title: e.message || '申请提交失败,可稍后在家庭页重试', icon: 'none' })
|
|
|
- }
|
|
|
- uni.removeStorageSync('pendingFamilyInviteCode')
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
+ uni.showToast({ title: '保存成功', icon: 'success' })
|
|
|
+ setTimeout(() => {
|
|
|
+ if (this.isNewUserFlow) {
|
|
|
this.navigateToHome()
|
|
|
- }, 1500)
|
|
|
- } else {
|
|
|
- uni.showToast({ title: '保存成功', icon: 'success' })
|
|
|
- setTimeout(() => {
|
|
|
- if (this.isNewUserFlow) {
|
|
|
- this.navigateToHome()
|
|
|
- } else {
|
|
|
- uni.navigateBack()
|
|
|
- }
|
|
|
- }, 1500)
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ uni.navigateBack()
|
|
|
+ }
|
|
|
+ }, 1500)
|
|
|
} catch (e) {
|
|
|
uni.showToast({ title: '保存失败', icon: 'none' })
|
|
|
} finally {
|