Kaynağa Gözat

fix: 修正一些信息显示错误

ChenYangfan 6 yıl önce
ebeveyn
işleme
89c7b124b9

+ 1 - 1
src/components/CComment.vue

@@ -2,7 +2,7 @@
   <div class="comment">
     <div @click="showActions = !showActions">
       <div class="comment-title">主题:{{comment.title}}</div>
-      <div class="comment-content">详情:{{comment.content}}</div>
+      <div class="comment-content">{{comment.content}}</div>
       <div class="comment-author">{{createTime}} | 作者:{{comment.userName}} <span class="role">{{role}}</span></div>
       <div v-if="comment.reply" class="comment-reply">
         <div>教师回复:{{comment.reply.content}}</div>

+ 40 - 0
src/components/CourseDetail.vue

@@ -0,0 +1,40 @@
+<template>
+  <div>
+    <div class="detail">
+      <div>课程名称:{{course.name}}</div>
+      <div>课程简介:{{course.bio}}</div>
+      <div>创建时间:{{createTime}}</div>
+      <div>教师:{{course.teacherName}}</div>
+    </div>
+  </div>
+</template>
+
+<script>
+export default {
+  props: ['course'],
+  computed: {
+    createTime () {
+      return this.$moment(this.course.createAt).fromNow()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.detail {
+  font-weight: bold;
+  font-size: 14px;
+  margin-bottom: 24px;
+  color: #7a8a9a;
+
+  div {
+    margin-top: 2px;
+
+  }
+
+  div:not(:last-child) {
+    border-bottom: 1px dashed #aabaca;
+    padding-bottom: 2px;
+  }
+}
+</style>

+ 3 - 1
src/views/student/components/JoinCourse.vue

@@ -5,6 +5,7 @@
     <c-input placeholder="选课码" v-model="code"></c-input>
     <c-button class="secondary full-width mb-24" @click="handleJoinCourse">确认选课</c-button>
     <div class="sub-title">课程信息</div>
+    <course-detail :course="course"></course-detail>
   </tab-side-component>
 </template>
 
@@ -15,9 +16,10 @@ import CButton from '@/components/CButton'
 import BackTitle from '@/components/BackTitle'
 import { mapState } from 'vuex'
 import { chooseCourse } from '@/server/course'
+import CourseDetail from '@/components/CourseDetail'
 
 export default {
-  components: { BackTitle, CButton, CInput, TabSideComponent },
+  components: { CourseDetail, BackTitle, CButton, CInput, TabSideComponent },
   data () {
     return {
       code: ''

+ 3 - 24
src/views/student/components/StudentCourseDetail.vue

@@ -1,12 +1,7 @@
 <template>
   <tab-side-component>
     <back-title>课程详情</back-title>
-    <div class="detail">
-      <div>课程名称:{{course.name}}</div>
-      <div>课程简介:{{course.bio}}</div>
-      <div>创建时间:{{createTime}}</div>
-      <div>教师:{{course.teacherName}}</div>
-    </div>
+    <course-detail :course="course"></course-detail>
     <c-button class="secondary full-width mb-16" @click="handleCheckSlideList">点击查看课件列表</c-button>
     <c-button class="error full-width" @click="handleQuitCourse">退出本课程</c-button>
   </tab-side-component>
@@ -18,9 +13,10 @@ import CButton from '@/components/CButton'
 import BackTitle from '@/components/BackTitle'
 import { mapState } from 'vuex'
 import { quitCourse } from '@/server/course'
+import CourseDetail from '@/components/CourseDetail'
 
 export default {
-  components: { BackTitle, CButton, TabSideComponent },
+  components: { CourseDetail, BackTitle, CButton, TabSideComponent },
   data () {
     return {
       newCode: ''
@@ -54,23 +50,6 @@ export default {
 </script>
 
 <style lang="scss" scoped>
-.detail {
-  font-weight: bold;
-  font-size: 14px;
-  margin-bottom: 24px;
-  color: #7a8a9a;
-
-  div {
-    margin-top: 2px;
-
-  }
-
-  div:not(:last-child) {
-    border-bottom: 1px dashed #aabaca;
-    padding-bottom: 2px;
-  }
-}
-
 .c-input {
   margin-bottom: 24px;
 }

+ 1 - 5
src/views/student/components/StudentCourseSlides.vue

@@ -4,12 +4,11 @@
     <div class="sub-title">课件列表</div>
     <div class="no-content-warning" v-if="!slides || slides.length === 0">
       <div class="no-content-warning-tip">本课程尚无课件~</div>
-      <c-button class="full-width secondary" @click="handleToCreateCourse">去创建课件</c-button>
     </div>
     <template v-for="slide of slides">
       <slide-card :key="slide.id" :slide="slide" :click-handler="handleSlideCardClick"></slide-card>
     </template>
-    <c-button class="full-width secondary mt-16" @click="handleToManager">管理本课程</c-button>
+    <c-button class="full-width secondary mt-16" @click="handleToManager">管理课程</c-button>
   </tab-side-component>
 </template>
 
@@ -58,9 +57,6 @@ export default {
     handleToManager () {
       this.$store.commit(SET_COURSE, { courseInfo: this.course })
       this.$router.push({ name: 'student-course-detail', params: { courseId: this.course.id } })
-    },
-    handleToCreateCourse () {
-      this.$router.push({ name: 'create-slide' })
     }
   }
 }

+ 1 - 1
src/views/teacher/components/CreateNewCourse.vue

@@ -4,7 +4,7 @@
     <div class="sub-title">课程名称:</div>
     <c-input placeholder="不能与已有课程名称重名" v-model="name"/>
     <div class="sub-title">课程简介:</div>
-    <c-input textarea="true" maxlength="65" v-model="bio" placeholder="课程简要介绍,少于 65 字"/>
+    <c-input textarea="true" maxlength="200" v-model="bio" placeholder="课程简要介绍,字数上限为 200"/>
     <div class="sub-title">选课码:</div>
     <c-input placeholder="学生将通过选课码注册课程" v-model="code"/>
     <c-button class="secondary full-width" @click="handleCreate" :disabled="!formChecked()">确认创建</c-button>

+ 3 - 7
src/views/teacher/components/TeacherCourseDetail.vue

@@ -1,12 +1,7 @@
 <template>
   <tab-side-component>
     <back-title>课程详情</back-title>
-    <div class="detail">
-      <div>课程名称:{{course.name}}</div>
-      <div>课程简介:{{course.bio}}</div>
-      <div>创建时间:{{createTime}}</div>
-      <div>教师:{{course.teacherName}}</div>
-    </div>
+    <course-detail :course="course"></course-detail>
     <div class="sub-title">修改选课码:</div>
     <div class="change-wrapper mb-24">
       <c-input placeholder="修改不会影响已选学生" v-model="newCode"/>
@@ -24,9 +19,10 @@ import CButton from '@/components/CButton'
 import BackTitle from '@/components/BackTitle'
 import { mapState } from 'vuex'
 import { modifyCourse, removeCourse } from '@/server/course'
+import CourseDetail from '@/components/CourseDetail'
 
 export default {
-  components: { BackTitle, CButton, CInput, TabSideComponent },
+  components: { CourseDetail, BackTitle, CButton, CInput, TabSideComponent },
   data () {
     return {
       newCode: ''