瀏覽代碼

加个loading

SanHQin 1 年之前
父節點
當前提交
d1a5ec2caf

+ 3 - 3
src/components/pages/test/add/components/course/index.vue

@@ -16,12 +16,12 @@
                 <div @click="openCourse" class="setting">设置课程选择范围</div>
 								<!-- {{courses}} -->
                 <div class="set_title_list" v-loading="loading">
-                    <div v-for="(item,index) in courses" class="set_title_list_item" v-if="coursesList.find(i=>i.courseId==item)">
+                    <div v-for="(item,index) in courses" class="set_title_list_item" :key="index" v-if="coursesList.find(i=>i.courseId==item)">
 											<!-- {{ `课程名称:${item.title}     创建人:${item.username}`}} -->
 											<div class="set_title_list_itemBtn el-icon-remove-outline" @click.stop="delCourse(item)"></div>
 											<div class="set_title_list_itemLabel">
-												<span>课程名称:{{ coursesList.find(i=>i.courseId==item).title }}</span>
-												<span>创建人:{{ coursesList.find(i=>i.courseId==item).username }}</span>
+												<span>课程名称:{{ coursesList.find(i=>i.courseId==item) && coursesList.find(i=>i.courseId==item).title }}</span>
+												<span>创建人:{{ coursesList.find(i=>i.courseId==item) && coursesList.find(i=>i.courseId==item).username }}</span>
 											</div>
 										</div>
                 </div>

+ 5 - 1
src/components/pages/test/add/edit/check/course.vue

@@ -9,7 +9,7 @@
                 style="color: #00000099;margin-top: 5px;">
             </div>
             <div class="choices" v-if="checkJson.courses.length">
-                <div class="course">
+                <div class="course" @click="openCourse()">
                     <div class="banner">
                         <img :src="courseDetail.cover" alt="">
                     </div>    
@@ -107,6 +107,9 @@ export default {
             this.checkJson.answer2 = this.checkJson.courses[this.page]
             this.getCourse(this.checkJson.answer2)
         },
+        openCourse(){
+            top.postMessage({ cid: this.checkJson.answer2, screenType: "3" }, "*");
+        },
         getCourse(id) {
             this.isloading = true
             let params = {
@@ -175,6 +178,7 @@ export default {
 .course {
     display: flex;
     align-items: center;
+    cursor: pointer;
 }
 .course > .banner {
     width: 200px;

+ 54 - 23
src/components/pages/testStudent/view/component/course.vue

@@ -9,10 +9,11 @@
                 style="color: #00000099;margin-top: 5px;">
             </div>
             <div class="choices" v-if="checkJson.courses.length">
-                <div class="course">
+                <div class="course" @click="openCourse()">
                     <div class="banner">
+                        <div v-if="tid" class="isRate">已评分</div>
                         <img :src="courseDetail.cover" alt="">
-                    </div>    
+                    </div>
                     <div class="content">
                         <div class="c_c">
                             <span>课程名称:</span>
@@ -22,7 +23,7 @@
                         </div>
                         <div class="c_c">
                             <span>课程类型:</span>
-                            <span v-if="!courseDetail.name">{{  '暂无' }}</span>
+                            <span v-if="!courseDetail.name">{{ '暂无' }}</span>
                             <el-tooltip v-else :content="courseDetail.name" placement="top" effect="dark">
                                 <span>{{ courseDetail.name }}</span>
                             </el-tooltip>
@@ -33,16 +34,17 @@
                         </div>
                         <div class="c_c">
                             <span>协作者:</span>
-                            <span v-if="!courseDetail.xieName">{{  '暂无' }}</span>
+                            <span v-if="!courseDetail.xieName">{{ '暂无' }}</span>
                             <el-tooltip v-else :content="courseDetail.xieName" placement="top" effect="dark">
                                 <span>{{ courseDetail.xieName }}</span>
                             </el-tooltip>
                         </div>
-                    </div>    
+                    </div>
                 </div>
                 <div class="page" v-if="checktype == '1'">
                     <el-button type="primary" size="mini" :disabled="page == 0" @click="setPage('-1')">上一个</el-button>
-                    <div class="p_page"><span>{{ page + 1 }}</span><span>/</span><span>{{ checkJson.courses.length }}</span>
+                    <div class="p_page"><span>{{ page + 1 }}</span><span>/</span><span>{{ checkJson.courses.length
+                            }}</span>
                     </div>
                     <el-button type="primary" size="mini" :disabled="page == (checkJson.courses.length - 1)"
                         @click="setPage('1')">下一个</el-button>
@@ -72,6 +74,9 @@ export default {
         issetPage: {
             type: Boolean,
             default: false
+        },
+        tid: {
+            type: String
         }
     },
     data() {
@@ -89,7 +94,7 @@ export default {
             isTong: false,
             page: 0,
             isloading: false,
-            courseDetail:{},
+            courseDetail: {},
             courseid: ''
         }
     },
@@ -105,9 +110,9 @@ export default {
         },
         cJson: {
             handler(newValue) {
-                if(newValue.answer2 != this.checkJson.answer2){
+                if (newValue.answer2 != this.checkJson.answer2) {
                     this.checkJson = this.depthCopy(newValue)
-                    if(this.checkJson.courses.length){
+                    if (this.checkJson.courses.length) {
                         this.page = this.checkJson.courses.indexOf(this.courseid)
                         this.checkJson.answer2 = this.courseid
                     }
@@ -118,10 +123,10 @@ export default {
         },
         courseid: {
             handler(newValue) {
-                if(this.issetPage){
+                if (this.issetPage) {
                     this.$emit('update:issetPage', false)
-                }else{
-                    this.$emit('getTestWorkByCid',newValue)
+                } else {
+                    this.$emit('getTestWorkByCid', newValue)
                 }
             },
             deep: true
@@ -145,9 +150,12 @@ export default {
                 this.checkJson.answer2 = this.checkJson.courses[this.page]
                 this.courseid = this.checkJson.answer2
                 this.$forceUpdate()
-                this.getCourse(this.checkJson.answer2)  
+                this.getCourse(this.checkJson.answer2)
             }, 500);
         },
+        openCourse() {
+            top.postMessage({ cid: this.checkJson.answer2, screenType: "3" }, "*");
+        },
         getCourse(id) {
             this.isloading = true
             let params = {
@@ -168,7 +176,7 @@ export default {
     },
     mounted() {
         this.checkJson = this.cJson ? this.depthCopy(this.cJson) : undefined
-        if(this.checkJson.courses.length){
+        if (this.checkJson.courses.length) {
             this.page = this.checkJson.courses.indexOf(this.checkJson.answer2)
             this.courseid = this.checkJson.answer2
             this.getCourse(this.checkJson.answer2)
@@ -208,21 +216,23 @@ export default {
     align-items: center;
 }
 
-.choices > .page{
+.choices>.page {
     margin-top: 10px;
     display: flex;
     align-items: center;
 }
 
-.p_page{
+.p_page {
     margin: 0 10px;
 }
 
 .course {
     display: flex;
     align-items: center;
+    cursor: pointer;
 }
-.course > .banner {
+
+.course>.banner {
     width: 200px;
     height: 120px;
     border-radius: 5px;
@@ -231,22 +241,43 @@ export default {
     box-sizing: border-box;
     padding: 5px;
     margin-right: 15px;
+    position: relative;
+}
+
+.isRate {
+    position: absolute;
+    background: #0061FF;
+    width: 70px;
+    height: 30px;
+    border-radius: 5px;
+    color: #fff;
+    font-size: 14px;
+    text-align: center;
+    line-height: 30px;
+    top: 5px;
+    left: 5px;
 }
-.course > .banner > img{
+
+.course>.banner>img {
     width: 100%;
     height: 100%;
     object-fit: cover;
 }
-.course > .content {}
-.course > .content > .c_c {
+
+.course>.content {}
+
+.course>.content>.c_c {
     display: flex;
     align-items: center;
 }
-.course > .content > .c_c + .c_c{
+
+.course>.content>.c_c+.c_c {
     margin-top: 5px;
 }
-.course > .content > .c_c span:nth-child(1){}
-.course > .content > .c_c span:nth-child(2){
+
+.course>.content>.c_c span:nth-child(1) {}
+
+.course>.content>.c_c span:nth-child(2) {
     max-width: 250px;
     overflow: hidden;
     white-space: nowrap;