Browse Source

完成自主学习切换班级状态功能

liqk 4 years ago
parent
commit
ae2e8fe8e5

+ 15 - 4
TEAMModelOS/ClientApp/src/view/selfstudy/ActivityInfo.vue

@@ -36,9 +36,18 @@
 
             </div>
             <div slot="right" class="activity-detail-info">
-                <LearnProgress v-if="!showAnswer" @goToAnswer="goToAnswer"></LearnProgress>
-                <!--<AnswerDetail v-else @closeAnswerDetail="closeAnswerDetail"></AnswerDetail>-->
-                <AnswerRecord v-else @closeAnswerDetail="closeAnswerDetail"></AnswerRecord>
+                <vuescroll>
+                    <div v-if="classList[curClassIndex][id]">
+                        <transition name="fade" mode="out-in">
+                            <LearnProgress v-if="!showAnswer" @goToAnswer="goToAnswer"></LearnProgress>
+                            
+                        </transition>
+                        <transition name="fade" mode="out-in">
+                            <AnswerRecord v-if="showAnswer" @closeAnswerDetail="closeAnswerDetail"></AnswerRecord>
+                        </transition>
+                    </div>
+                    <NoData v-else textContent="此班未分享,暂无学习数据" style="padding-top:200px;"></NoData>
+                </vuescroll>
             </div>
         </Split>
         <Modal v-model="publishStatus"
@@ -75,13 +84,15 @@
     </div>
 </template>
 <script>
+    import NoData from '@/common/NoData.vue'
+    import Loading from '@/common/Loading.vue'
     import LearnProgress from '@/view/selflearning/LearnProgress.vue'
     import AnswerDetail from './AnswerDetail.vue'
     import AnswerRecord from './AnswerRecord.vue'
 
     export default {
         components: {
-            LearnProgress,AnswerDetail,AnswerRecord
+            LearnProgress,AnswerDetail,AnswerRecord,NoData,Loading
         },
         props: {
             id: {

+ 13 - 5
TEAMModelOS/ClientApp/src/view/selfstudy/SelfLearn.vue

@@ -99,10 +99,17 @@ import { faTruck } from '@fortawesome/free-solid-svg-icons'
             },
             id() {
                 if (this.listType == 'order') {
-
-                    return this.orderLearnList[this.currentLearnIndex].id
+                    if (this.orderLearnList.length > 0) {
+                        return this.orderLearnList[this.currentLearnIndex].id
+                    } else {
+                        return ''
+                    }
                 } else {
-                    return this.unitList[this.currentUnitIndex].id
+                    if (this.unitList.length > 0) {
+                        return this.unitList[this.currentUnitIndex].id
+                    } else {
+                        return ''
+                    }
                 }
             }
         },
@@ -219,11 +226,12 @@ import { faTruck } from '@fortawesome/free-solid-svg-icons'
                             for (let index in resData) {
                                 for (let i in this.classList) {
                                     if (this.classList[i].classroomCode == resData[index].code) {
-                                        this.classList[i][resData[index].id] = resData[index]
+                                        this.$set(this.classList[i], [resData[index].id], resData[index])
                                         break
                                     }
                                 }
                             }
+                            this.requestIds.push(this.id)
                             console.log(this.classList)
                         } else {
                             this.$Message.error('API error!')
@@ -256,7 +264,7 @@ import { faTruck } from '@fortawesome/free-solid-svg-icons'
                         res => {
                             if (res.error == null) {
                                 this.classList = res.result.data
-                                //this.findTask()
+                                this.findTask()
                             } else {
                                 this.$Message.error('API ERROR!')
                             }