李志伟 3 年之前
父節點
當前提交
cdad9cafcb
共有 3 個文件被更改,包括 19 次插入9 次删除
  1. 5
    5
      src/components/ClassInfo.vue
  2. 3
    2
      src/views/Course.vue
  3. 11
    2
      src/views/components/CourseCard.vue

+ 5
- 5
src/components/ClassInfo.vue 查看文件

@@ -32,7 +32,7 @@ import { parseTime, SignInTime } from '../util/formattingData'
32 32
 export default {
33 33
   data() {
34 34
     return {
35
-      ClassContent: null,
35
+      ClassContent: {},
36 36
       isShoucang: false,
37 37
       courseIds: '',
38 38
 
@@ -42,12 +42,12 @@ export default {
42 42
   },
43 43
   mounted() {
44 44
     this.onloadClass()
45
-    this.courseIds = this.$route.params.courseId
45
+    this.courseIds = this.$route.query.courseId
46 46
   },
47 47
   methods: {
48 48
     parseTime,
49 49
     onloadClass() {
50
-      getCourseInfof(this.$route.params.courseId).then((e) => {
50
+      getCourseInfof(this.$route.query.courseId).then((e) => {
51 51
         this.ClassContent = e
52 52
         if (e.isFavored) {
53 53
           this.isShoucang = true
@@ -58,7 +58,7 @@ export default {
58 58
     },
59 59
     collectionHande() {
60 60
       addCollection({
61
-        targetId: this.$route.params.courseId,
61
+        targetId: this.$route.query.courseId,
62 62
         targetName: this.ClassContent.title,
63 63
         targetType: 'course'
64 64
       }).then((e) => {
@@ -69,7 +69,7 @@ export default {
69 69
     },
70 70
     deleteColl() {
71 71
       deleteCollection({
72
-        targetId: this.$route.params.courseId,
72
+        targetId: this.$route.query.courseId,
73 73
         targetName: this.ClassContent.title,
74 74
         targetType: 'course'
75 75
       }).then((e) => {

+ 3
- 2
src/views/Course.vue 查看文件

@@ -49,8 +49,8 @@ export default {
49 49
 
50 50
   methods: {
51 51
     goQuestion(courseId) {
52
-      // this.$router.push({ name: 'ClassInfo', params: { courseId: courseId } })
53
-      this.$router.push('/Questionnaire')
52
+      this.$router.push({ name: 'ClassInfo', params: { courseId: courseId } })
53
+      // this.$router.push('/Questionnaire')
54 54
     },
55 55
     parseTime, //时间格式化
56 56
 
@@ -59,6 +59,7 @@ export default {
59 59
         // console.log(parseTime(aTime, '{y}年{m}月{d}日 {h}:{i}'))
60 60
 
61 61
         this.courseList = e.records
62
+        console.log('----------courseList--------------', this.courseList)
62 63
       })
63 64
     },
64 65
     onBanner() {

+ 11
- 2
src/views/components/CourseCard.vue 查看文件

@@ -9,7 +9,7 @@
9 9
         <div class="subtitle">{{dateStr}}</div>
10 10
       </div>
11 11
     </div>
12
-    <div class="card-footer">
12
+    <div class="card-footer" @click="onDetail">
13 13
       <div class="footer-body">
14 14
         查看详情
15 15
       </div>
@@ -26,6 +26,7 @@ import { parseTime } from "@/util/formattingData";
26 26
 export default {
27 27
   name: 'CourseCard',
28 28
   props: {
29
+    courseId: String,
29 30
     title: String,
30 31
     startDate: [String, Date],
31 32
     endDate: [String, Date],
@@ -40,7 +41,15 @@ export default {
40 41
 
41 42
       return `课程时间: ${start} ~ ${end}`
42 43
     }
43
-  }
44
+  },
45
+  // 组件加载完成执行
46
+  mounted() {
47
+  },
48
+  methods: {
49
+    onDetail() {
50
+      this.$router.push({ name: 'ClassInfo', query: { courseId: this.courseId } })
51
+    }
52
+  }  
44 53
 }
45 54
 </script>
46 55