Răsfoiți Sursa

修改h5端任务完成或结束后的问卷显示

lm 1 săptămână în urmă
părinte
comite
c23b5fa27f

+ 74 - 50
src/views/appView/QuestionnaireCommit.vue

@@ -21,7 +21,7 @@
 
 
 <script setup lang="ts">
-import { ref, computed, onMounted } from 'vue';
+import { ref, computed, onMounted,watch } from 'vue';
 import { ElMessage } from 'element-plus';
 import { useStore } from 'vuex'
 
@@ -48,8 +48,29 @@ interface TeacherItm {
  * 2. 问卷整体数据
  */
 
+ // 问卷填写截止时间
+const deadlineTime = ref('')
+
+// 问卷是否结束
+const isQuestionnaireEnd = computed(()=>{
+    let timestamp = new Date(deadlineTime.value).getTime()
+    let currentTimestamp = new Date().getTime()
+    let sectionTime = timestamp - currentTimestamp
+    if(sectionTime > 0){
+        return false
+    }else{
+        return true
+    }
+})
+
 //  当前问卷任务是否全部完成 ———— 以及问卷是否结束
-const isCurrentQuestionnaireTaskFinish = ref(false) //true  false
+const isCurrentQuestionnaireTaskFinish = computed(()=>{
+    // 判断教师列表是否全部完成
+    let allTaskFinish = !(teacherList.value.find(teacher=>{
+        return (teacher.evaluationStatus === 0 || teacher.evaluationStatus === 1)
+    }))
+    return allTaskFinish || isQuestionnaireEnd.value
+}) 
 
 /**
  * 3. 整卷填写相关变量 和操作
@@ -66,54 +87,6 @@ const teacherQuestionnaireData = ref([])
 const currentActiveTeacherId = ref<number|string>('') 
 
 
-// 接收问卷表单填写信息的变更
-const HandleQuestionnaireFormChange = (val)=>{
-    fullQuestionnaireAnswer.value = val
-}
-// 问卷整卷提交
-const HandleFinishReview = async ()=>{
-    console.log('整卷提交的问卷答案--',fullQuestionnaireAnswer.value)
-
-    let params = {
-        evaluationCodeRelationId: currentSelectedQuestionnaireData.value?.evaluationCodeRelationId,
-        assessmentId: currentSelectedQuestionnaireData.value?.assessmentId,
-        answerData: Object.values(fullQuestionnaireAnswer.value)
-    }
-
-    let res = await saveEvaluationQuestionDataApi(params)
-
-    if(res?.code == 200){
-        ElMessage({
-            message: '问卷评价提交成功',
-            type: 'success',
-            customClass:'app_el_message',
-        })
-        // true  表示当前问卷全部填写完成,跳到下一个问卷( false 没有完成的留在当前问卷页)
-        if(res.data){
-            fullQuestionnaireAnswer.value = {}
-            // 重新查询教师状态和问卷状态
-            await ReloadPageData()
-            // 重查和索引切换顺序不能颠倒
-            // 找到当前选中的教师
-            let currentIndex = teacherList.value.findIndex(item=>{
-                return item.id == currentActiveTeacherId.value
-            })
-            // 如果不是最后一卷,跳转到下一卷
-            if((currentIndex + 1) >= teacherList.value.length ){
-                return
-            }
-            // 跳转到下一个教师的问卷
-            currentActiveTeacherId.value = teacherList.value?.[currentIndex + 1]?.id || ''
-            store.commit('updateSubjectQuestionnaireTitle',teacherList.value?.[currentIndex + 1]?.evaluationSubjectName + '-' + teacherList.value?.[currentIndex + 1]?.teacherName + '问卷')
-        }else{
-            // 重新查询教师状态和问卷状态
-            await ReloadPageData()
-        }
-    }
-}
-
-
-
 // 当前选择的教师问卷(整卷填写)  或者 题目问卷(按题填写) 全部信息
 const currentSelectedQuestionnaireData = computed(()=>{
     return teacherQuestionnaireData.value.find((item:any)=>{
@@ -189,6 +162,57 @@ const questionaireMsg = computed(()=>{
 })
 
 
+watch(()=>questionaireMsg?.value?.deadlineTime,async (newVal)=>{
+    deadlineTime.value = newVal
+})
+
+// 接收问卷表单填写信息的变更
+const HandleQuestionnaireFormChange = (val)=>{
+    fullQuestionnaireAnswer.value = val
+}
+// 问卷整卷提交
+const HandleFinishReview = async ()=>{
+    console.log('整卷提交的问卷答案--',fullQuestionnaireAnswer.value)
+
+    let params = {
+        evaluationCodeRelationId: currentSelectedQuestionnaireData.value?.evaluationCodeRelationId,
+        assessmentId: currentSelectedQuestionnaireData.value?.assessmentId,
+        answerData: Object.values(fullQuestionnaireAnswer.value)
+    }
+
+    let res = await saveEvaluationQuestionDataApi(params)
+
+    if(res?.code == 200){
+        ElMessage({
+            message: '问卷评价提交成功',
+            type: 'success',
+            customClass:'app_el_message',
+        })
+        // true  表示当前问卷全部填写完成,跳到下一个问卷( false 没有完成的留在当前问卷页)
+        if(res.data){
+            fullQuestionnaireAnswer.value = {}
+            // 重新查询教师状态和问卷状态
+            await ReloadPageData()
+            // 重查和索引切换顺序不能颠倒
+            // 找到当前选中的教师
+            let currentIndex = teacherList.value.findIndex(item=>{
+                return item.id == currentActiveTeacherId.value
+            })
+            // 如果不是最后一卷,跳转到下一卷
+            if((currentIndex + 1) >= teacherList.value.length ){
+                return
+            }
+            // 跳转到下一个教师的问卷
+            currentActiveTeacherId.value = teacherList.value?.[currentIndex + 1]?.id || ''
+            store.commit('updateSubjectQuestionnaireTitle',teacherList.value?.[currentIndex + 1]?.evaluationSubjectName + '-' + teacherList.value?.[currentIndex + 1]?.teacherName + '问卷')
+        }else{
+            // 重新查询教师状态和问卷状态
+            await ReloadPageData()
+        }
+    }
+}
+
+
 // 获取评价教师列表
 const GetEvaluationProcessMsg = async ()=>{
     let res = await getEvaluationProcessMsgApi()

+ 14 - 1
src/views/appView/SelfQuestionnaireProcess.vue

@@ -86,6 +86,18 @@ const remainTime = ref()      //剩余时间
 // 教师列表数据
 const teacherList = ref<TeacherItm[]>([]);
 
+// 问卷是否结束
+const isQuestionnaireEnd = computed(()=>{
+    let timestamp = new Date(deadlineTime.value).getTime()
+    let currentTimestamp = new Date().getTime()
+    let sectionTime = timestamp - currentTimestamp
+    if(sectionTime > 0){
+        return false
+    }else{
+        return true
+    }
+})
+
 
 //  当前问卷任务是否全部完成 ———— 以及问卷是否结束
 const isCurrentQuestionnaireTaskFinish = computed(()=>{
@@ -113,8 +125,9 @@ const GoToFillOutQuestionnaire = ()=>{
 
 // 查看已完成的问卷 信息
 const HandleQuestoinnaireOpen = (teacher)=>{
+    // 如果评卷结束了,可以随意查看
     // evaluationStatus  0-待评价  1-进行中  2-已评价
-    if(teacher.evaluationStatus === 2){
+    if(isQuestionnaireEnd.value || teacher.evaluationStatus === 2){
         // 跳转到问卷评价页
         sessionStorage.setItem('currentEditTeacherQuestionnaire',JSON.stringify({
             id:teacher.id,

+ 8 - 5
src/views/questionnaireCommit/QuestionnaireCommit.vue

@@ -46,10 +46,12 @@
                 </div>
 
                 <ul class="teacher_list">
+
+                    <!-- 任务结束后或者任务完成后,可以随意切换 评价任务 -->
                     <li v-for="(teacher,index) in teacherList" :key="teacher.id" 
                         :class="['teacher_card',{active:currentActiveTeacherId === teacher.id,},
-                                {disabled:defaultQuestionnaireMode == 'split' || !isTeacherEdit(teacher,index)}]" 
-                        @click="(defaultQuestionnaireMode == 'split' || !isTeacherEdit(teacher,index)) ? '' : HandleSubjectTeacherChange(index,teacher)">
+                                {disabled:defaultQuestionnaireMode == 'split' || !(isTeacherEdit(teacher,index) || isCurrentQuestionnaireTaskFinish)}]" 
+                        @click="(defaultQuestionnaireMode == 'split' || !(isTeacherEdit(teacher,index) || isCurrentQuestionnaireTaskFinish) ) ? '' : HandleSubjectTeacherChange(index,teacher)">
                         
                         
                         <div class="teacher_tag" :style="{backgroundColor:subjectToColor(teacher.evaluationSubjectName)?.color}">
@@ -170,11 +172,11 @@
                     <li  v-for="(question,index) in questionaireMsg.questionData" :key="question.id">
                         <span @click="defaultQuestionnaireMode=='full' ? 
                                         ScrollToItem(question.id) : 
-                                        (!isQuestionTitleEdit(question,index) ? '' :  HandleChangeQuestion(index,question)) " 
+                                        (!(isQuestionTitleEdit(question,index) || isCurrentQuestionnaireTaskFinish) ? '' :  HandleChangeQuestion(index,question)) " 
                             :title="question.questionTitleName" 
                             class="one_line_ellipsis" 
                             :class="[{active:defaultQuestionnaireMode=='split' && currentSelectedQuestionIndex == index,
-                                    disabled:defaultQuestionnaireMode=='split' && !isQuestionTitleEdit(question,index)}]">
+                                    disabled:defaultQuestionnaireMode=='split' && !(isQuestionTitleEdit(question,index) || isCurrentQuestionnaireTaskFinish) }]">
                             {{ index + 1 }}.{{ question.questionTitleName }}
                         </span>
                         <img v-if="IsSplitQuestionnaireFinish(question.studentAnswerStatus)" :src="finishIcon" alt="">
@@ -310,9 +312,10 @@ const isQuestionTitleEdit = computed(()=>{
 //  当前问卷任务是否全部完成 ———— 以及问卷是否结束
 const isCurrentQuestionnaireTaskFinish = computed(()=>{
     // 判断教师列表是否全部完成
-    return !(teacherList.value.find(teacher=>{
+    let allTaskFinish = !(teacherList.value.find(teacher=>{
         return (teacher.evaluationStatus === 0 || teacher.evaluationStatus === 1)
     }))
+    return allTaskFinish || deadlineCountDown.value?.abort
 }) 
 
 // 问卷填写截止时间