|
|
@@ -16,6 +16,15 @@
|
|
|
<!-- 用户卡片 -->
|
|
|
<ProfileHeader @avatar-click="goToEditInfo" />
|
|
|
|
|
|
+ <!-- 个人信息完善卡片(全部填满后隐藏) -->
|
|
|
+ <view class="profile-card" v-if="isLoggedIn && profileProgress < 14" @click="goToEditInfo">
|
|
|
+ <view class="profile-card-left">
|
|
|
+ <text class="profile-card-title">个人信息</text>
|
|
|
+ <text class="profile-card-desc">已完善 {{ profileProgress }}/14 个字段,点击继续补充</text>
|
|
|
+ </view>
|
|
|
+ <text class="profile-card-arrow">›</text>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 成长报告 -->
|
|
|
<ProfileGrowth />
|
|
|
|
|
|
@@ -50,7 +59,7 @@ import ProfileMenu from './components/ProfileMenu.vue'
|
|
|
import AIFloatingAvatar from '../../components/AIFloatingAvatar.vue'
|
|
|
import HealthBadge from '../../components/HealthBadge.vue'
|
|
|
import HealthTimeline from '../../components/HealthTimeline.vue'
|
|
|
-import { getHealthScoreInfo, getHealthTimeline } from '../../utils/api.js'
|
|
|
+import { getHealthScoreInfo, getHealthTimeline, getUserInfo } from '../../utils/api.js'
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
|
@@ -75,7 +84,9 @@ HealthTimeline
|
|
|
progress: 0,
|
|
|
nextLevel: null,
|
|
|
streakDays: 0,
|
|
|
- timelineEvents: []
|
|
|
+ timelineEvents: [],
|
|
|
+ // 个人信息完善进度(0-14 字段)
|
|
|
+ profileProgress: 0
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -108,6 +119,7 @@ HealthTimeline
|
|
|
uni.redirectTo({ url: '/pages/teacher/teacher-profile' })
|
|
|
}
|
|
|
this.loadHealthScoreData()
|
|
|
+ this.loadProfileProgress()
|
|
|
this._watchPageReady()
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -168,6 +180,25 @@ HealthTimeline
|
|
|
self.timelineEvents = res.data.slice(0, 10)
|
|
|
}
|
|
|
}).catch(function() {})
|
|
|
+ },
|
|
|
+ loadProfileProgress() {
|
|
|
+ var self = this
|
|
|
+ getUserInfo().then(function(res) {
|
|
|
+ if (res && res.code === 200 && res.data) {
|
|
|
+ var user = res.data
|
|
|
+ var fields = ['nickname', 'avatar', 'realName', 'gender', 'birthday', 'birthHour', 'ethnicity', 'bloodType', 'highestEducation', 'maritalStatus', 'address', 'hobbies', 'dietPreferences', 'phone']
|
|
|
+ var filled = 0
|
|
|
+ for (var i = 0; i < fields.length; i++) {
|
|
|
+ var v = user[fields[i]]
|
|
|
+ if (v !== null && v !== undefined && v !== '') filled++
|
|
|
+ }
|
|
|
+ self.profileProgress = filled
|
|
|
+ }
|
|
|
+ }).catch(function() {})
|
|
|
+ },
|
|
|
+ // 修复:ProfileHeader 头像点击进入编辑页(原方法缺失)
|
|
|
+ goToEditInfo() {
|
|
|
+ uni.navigateTo({ url: '/pages/user-edit/user-edit' })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -258,4 +289,33 @@ HealthTimeline
|
|
|
font-size: 26rpx;
|
|
|
color: #374151;
|
|
|
}
|
|
|
+
|
|
|
+.profile-card {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ margin: 20rpx 30rpx;
|
|
|
+ padding: 28rpx 32rpx;
|
|
|
+ background: #fff;
|
|
|
+ border-radius: 16rpx;
|
|
|
+}
|
|
|
+.profile-card-left {
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+}
|
|
|
+.profile-card-title {
|
|
|
+ font-size: 30rpx;
|
|
|
+ font-weight: bold;
|
|
|
+ color: #333;
|
|
|
+}
|
|
|
+.profile-card-desc {
|
|
|
+ font-size: 24rpx;
|
|
|
+ color: #999;
|
|
|
+ margin-top: 8rpx;
|
|
|
+}
|
|
|
+.profile-card-arrow {
|
|
|
+ font-size: 40rpx;
|
|
|
+ color: #ccc;
|
|
|
+}
|
|
|
</style>
|