|
|
@@ -397,6 +397,7 @@ export default {
|
|
|
splashOverlayFading: false,
|
|
|
_splashReady: false,
|
|
|
_watchPageReadyDone: false,
|
|
|
+ pendingSurveys: [],
|
|
|
|
|
|
typeList: [
|
|
|
{ label: '全部', value: '' },
|
|
|
@@ -530,6 +531,8 @@ export default {
|
|
|
|
|
|
// 始终执行初始化,确保登录态变更后及时切换视图
|
|
|
this._doInit()
|
|
|
+ // 定期调研待办角标(内部自检登录态,未登录静默清空)
|
|
|
+ this._loadSurveyBadge()
|
|
|
},
|
|
|
methods: {
|
|
|
_checkSplashReady() {
|
|
|
@@ -886,8 +889,35 @@ export default {
|
|
|
var id = this.currentChildId || ''
|
|
|
uni.navigateTo({ url: '/pages/health/report-upload?memberId=' + id + '&from=index' })
|
|
|
},
|
|
|
+ // 定期调研待办角标(内部自检登录态,未登录静默清空)
|
|
|
+ _loadSurveyBadge: function() {
|
|
|
+ var self = this
|
|
|
+ if (!this.isLoggedIn()) { self.pendingSurveys = []; return }
|
|
|
+ getSurveyStatus({}).then(function(res) {
|
|
|
+ var list = (res && res.code === 200 && res.data && res.data instanceof Array) ? res.data : []
|
|
|
+ var pending = []
|
|
|
+ for (var i = 0; i < list.length; i++) {
|
|
|
+ if (list[i] && list[i].status === 'pending') pending.push(list[i])
|
|
|
+ }
|
|
|
+ self.pendingSurveys = pending
|
|
|
+ }).catch(function() { self.pendingSurveys = [] })
|
|
|
+ },
|
|
|
goSelfTest: function() {
|
|
|
- uni.navigateTo({ url: '/pages/health/survey-questionnaire?dim=all' })
|
|
|
+ var firstPending = null
|
|
|
+ for (var i = 0; i < this.pendingSurveys.length; i++) {
|
|
|
+ var s = this.pendingSurveys[i]
|
|
|
+ if (s && s.templateId) { firstPending = s; break }
|
|
|
+ }
|
|
|
+ if (firstPending) {
|
|
|
+ var url = '/pages/health/survey-questionnaire?templateId=' + firstPending.templateId +
|
|
|
+ '&templateTitle=' + encodeURIComponent(firstPending.title || '定期调研') +
|
|
|
+ '&templateDimension=' + encodeURIComponent(firstPending.dimension || '') +
|
|
|
+ '&periodStart=' + (firstPending.periodStart || '') +
|
|
|
+ '&periodEnd=' + (firstPending.periodEnd || '')
|
|
|
+ uni.navigateTo({ url: url })
|
|
|
+ } else {
|
|
|
+ uni.navigateTo({ url: '/pages/health/survey-questionnaire?dim=all' })
|
|
|
+ }
|
|
|
},
|
|
|
_doInit(options) {
|
|
|
options = options || {}
|
|
|
@@ -1808,5 +1838,6 @@ export default {
|
|
|
.challenge-add-btn::after {
|
|
|
border: none;
|
|
|
}
|
|
|
+.self-test-badge { display: inline-block; align-self: flex-start; margin-top: 8rpx; font-size: 20rpx; color: #F97316; background: rgba(249,115,22,0.1); padding: 4rpx 14rpx; border-radius: 999rpx; }
|
|
|
|
|
|
</style>
|