|
|
@@ -107,7 +107,7 @@
|
|
|
<text class="todo-item-meta todo-item-meta--overdue" v-else>已超期</text>
|
|
|
</view>
|
|
|
<view v-if="task._isOverdue" class="todo-overdue-tag">已超期</view>
|
|
|
- <button v-else class="btn-quick-complete" @click.stop="quickCompleteTask(task)">{{ task._isLinked ? '去完成' : '完成' }}</button>
|
|
|
+ <button v-else class="btn-quick-complete" @click.stop="quickCompleteTask(task)">{{ task._isLinked ? '去完成' : (task.requireInput === 1 ? '去填写' : '完成') }}</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
|
|
|
@@ -334,6 +334,26 @@
|
|
|
<view class="geo-seo-block" style="padding:8rpx 32rpx 20rpx;">
|
|
|
<text class="geo-seo-tagline">浠艾福:测一测、管一管,全家健康看得见。</text>
|
|
|
</view>
|
|
|
+
|
|
|
+ <!-- 填写式完成弹窗(requireInput=1 任务:快捷完成需先填内容,修复 400「该任务需填写内容后才能完成」) -->
|
|
|
+ <view class="home-modal-mask" v-if="showInputModal" @click="closeInputModal">
|
|
|
+ <view class="home-modal home-modal-large" @click.stop>
|
|
|
+ <view class="home-modal-title">完成任务</view>
|
|
|
+ <view class="home-modal-content">
|
|
|
+ <text class="home-input-tip">{{ activeInputTask && activeInputTask.title }}</text>
|
|
|
+ <textarea
|
|
|
+ v-model="inputContent"
|
|
|
+ class="home-input-textarea"
|
|
|
+ placeholder="请填写完成内容(如:今天完成了...)"
|
|
|
+ :maxlength="500"
|
|
|
+ ></textarea>
|
|
|
+ </view>
|
|
|
+ <view class="home-modal-btns">
|
|
|
+ <button class="home-modal-btn" @click="closeInputModal">取消</button>
|
|
|
+ <button class="home-modal-btn home-modal-btn-primary" :disabled="!inputContent" @click="submitWithInput">提交完成</button>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
@@ -491,6 +511,10 @@ components: {
|
|
|
pendingTasks: [],
|
|
|
familyTasks: [],
|
|
|
familyTodoCount: 0,
|
|
|
+ // 填写式完成弹窗(requireInput=1 任务)
|
|
|
+ showInputModal: false,
|
|
|
+ activeInputTask: null,
|
|
|
+ inputContent: '',
|
|
|
familyFeed: [],
|
|
|
notices: [],
|
|
|
loggedInInitDone: false,
|
|
|
@@ -1496,6 +1520,14 @@ membershipDays: 0,
|
|
|
},
|
|
|
quickCompleteTask: function(task) {
|
|
|
var self = this
|
|
|
+ // 填写式完成(requireInput=1):快捷完成必须先填内容,否则后端 400「该任务需填写内容后才能完成」。
|
|
|
+ // 与 pages/tasks/tasks.vue 同款:弹输入框 → submitWithInput 带 content 提交
|
|
|
+ if (task && task.requireInput === 1) {
|
|
|
+ self.activeInputTask = task
|
|
|
+ self.inputContent = ''
|
|
|
+ self.showInputModal = true
|
|
|
+ return
|
|
|
+ }
|
|
|
// 打卡/联动类任务:跳转对应功能页(饮食/运动/睡眠/阅读/购买/问卷/活动等),
|
|
|
// 提交后由后端回写完成,不在首页直接完成
|
|
|
if (task && task.actionType) {
|
|
|
@@ -1528,6 +1560,39 @@ membershipDays: 0,
|
|
|
uni.showToast({ title: '完成失败,请重试', icon: 'none' })
|
|
|
})
|
|
|
},
|
|
|
+ closeInputModal: function() {
|
|
|
+ this.showInputModal = false
|
|
|
+ this.activeInputTask = null
|
|
|
+ this.inputContent = ''
|
|
|
+ },
|
|
|
+ submitWithInput: async function() {
|
|
|
+ var self = this
|
|
|
+ var task = this.activeInputTask
|
|
|
+ if (!task || !this.inputContent) return
|
|
|
+ var memberId = (task && task.familyMemberId) || null
|
|
|
+ try {
|
|
|
+ var res = await completeTaskApi(task.id, memberId, '', this.inputContent, 'text')
|
|
|
+ if (res && res.code !== 200) {
|
|
|
+ uni.showToast({ title: (res && res.message) || '提交失败', icon: 'none' })
|
|
|
+ self.closeInputModal()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (res.data && res.data.needReview) {
|
|
|
+ uni.showToast({ title: '已提交,待审核', icon: 'none' })
|
|
|
+ } else if (res.data && res.data.overdue) {
|
|
|
+ uni.showToast({ title: '已过期,打卡成功但不计奖励', icon: 'none' })
|
|
|
+ } else if (res.data) {
|
|
|
+ uni.showToast({ title: '获得 ' + (res.data.pointsEarned || 0) + ' CF', icon: 'success' })
|
|
|
+ } else {
|
|
|
+ uni.showToast({ title: '只能完成自己的任务', icon: 'none' })
|
|
|
+ }
|
|
|
+ self.closeInputModal()
|
|
|
+ self.loadTodayTasks()
|
|
|
+ } catch (e) {
|
|
|
+ console.error('提交填写内容失败', e)
|
|
|
+ uni.showToast({ title: '提交失败,请重试', icon: 'none' })
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 打卡/联动类任务:跳转对应功能页(与 pages/tasks/tasks.vue 的 navigateByAction 同款) */
|
|
|
navigateByLinkedAction: function(task) {
|
|
|
var cfg = {}
|
|
|
@@ -2815,4 +2880,101 @@ $c-violet-mid: $violet-700;
|
|
|
text-overflow: ellipsis;
|
|
|
white-space: nowrap;
|
|
|
}
|
|
|
+
|
|
|
+/* ===== 填写式完成弹窗(requireInput=1 任务快捷完成;样式对齐 pages/tasks/tasks.vue,加 home- 前缀避免全局污染) ===== */
|
|
|
+.home-modal-mask {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ right: 0;
|
|
|
+ bottom: 0;
|
|
|
+ background: rgba(0, 0, 0, 0.45);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ z-index: 1000;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal {
|
|
|
+ background: $app-surface;
|
|
|
+ border-radius: 24rpx;
|
|
|
+ padding: 40rpx;
|
|
|
+ width: 85%;
|
|
|
+ max-height: 80vh;
|
|
|
+ overflow-y: auto;
|
|
|
+ box-shadow: 0 8rpx 40rpx rgba(0, 0, 0, 0.12);
|
|
|
+ box-sizing: border-box;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-large {
|
|
|
+ width: 90%;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-title {
|
|
|
+ font-size: calc(34rpx * var(--font-scale, 1));
|
|
|
+ font-weight: bold;
|
|
|
+ margin-bottom: 32rpx;
|
|
|
+ text-align: center;
|
|
|
+ color: $facade-text-strong;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-content {
|
|
|
+ font-size: calc(28rpx * var(--font-scale, 1));
|
|
|
+ color: $facade-text-body;
|
|
|
+ line-height: 1.6;
|
|
|
+ margin-bottom: $uni-space-lg;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+
|
|
|
+.home-input-tip {
|
|
|
+ display: block;
|
|
|
+ margin-bottom: 16rpx;
|
|
|
+ color: $facade-text-strong;
|
|
|
+ font-weight: 500;
|
|
|
+}
|
|
|
+
|
|
|
+.home-input-textarea {
|
|
|
+ width: 100%;
|
|
|
+ min-height: 180rpx;
|
|
|
+ padding: 20rpx;
|
|
|
+ background: $facade-fill-gray-50;
|
|
|
+ border-radius: 16rpx;
|
|
|
+ font-size: calc(28rpx * var(--font-scale, 1));
|
|
|
+ box-sizing: border-box;
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-btns {
|
|
|
+ display: flex;
|
|
|
+ gap: 20rpx;
|
|
|
+ margin-top: $uni-space-lg;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-btn {
|
|
|
+ flex: 1;
|
|
|
+ height: 88rpx;
|
|
|
+ line-height: 88rpx;
|
|
|
+ border-radius: 24rpx;
|
|
|
+ font-size: calc(28rpx * var(--font-scale, 1));
|
|
|
+ border: none;
|
|
|
+ padding: 0;
|
|
|
+ box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.06);
|
|
|
+ background: $facade-fill-2;
|
|
|
+ color: $facade-text-strong;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-btn::after {
|
|
|
+ border: none;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-btn-primary {
|
|
|
+ background: $brand-primary;
|
|
|
+ color: $app-surface;
|
|
|
+ font-weight: bold;
|
|
|
+}
|
|
|
+
|
|
|
+.home-modal-btn-primary[disabled] {
|
|
|
+ background: $facade-fill-2;
|
|
|
+ color: $facade-text-body;
|
|
|
+}
|
|
|
</style>
|