|
|
@@ -10,23 +10,32 @@
|
|
|
<show-transition>
|
|
|
<course-detail v-if="showMore" :course="course"></course-detail>
|
|
|
</show-transition>
|
|
|
- <template v-if="notices">
|
|
|
+ <div class="vertical-center mb-24">
|
|
|
+ 课程:{{course.name}}
|
|
|
+ <c-button text icon="close" :left="12" theme="red" @click="handleDeleteCourse">删除课程</c-button>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
<template v-for="notice of notices">
|
|
|
- <notice-card show can-edit :notice="notice" :key="'notice-' + notice.id"></notice-card>
|
|
|
+ <notice-card can-edit :notice="notice" :key="'notice-' + notice.id"></notice-card>
|
|
|
</template>
|
|
|
- </template>
|
|
|
- <div class="vertical-center mt-24">
|
|
|
- <c-button icon="list" theme="blue" block @click="handleCheckSlideList">课件列表</c-button>
|
|
|
- <router-link :to="{ name: 'teacher-edit-notice', params: { noticeId: 0, courseId: course.id } }">
|
|
|
- <c-button theme="green" :left="12" icon="add">新建课程公告</c-button>
|
|
|
+ </div>
|
|
|
+ <router-link :to="{ name: 'teacher-edit-notice', params: { noticeId: 0, courseId: course.id } }">
|
|
|
+ <c-button text :left="-12" theme="green" icon="add">新建课程公告</c-button>
|
|
|
+ </router-link>
|
|
|
+ <div class="vertical-center mt-32">
|
|
|
+ <router-link :to="{ name: 'teacher-edit-course-knowledge', params: { courseId: course.id } }">
|
|
|
+ <c-button icon="lightbulb_outline" theme="green" block>设置课程知识点</c-button>
|
|
|
+ </router-link>
|
|
|
+ <router-link :to="{ name: 'teacher-course-slides' }">
|
|
|
+
|
|
|
</router-link>
|
|
|
+ <c-button icon="list" theme="blue" block :left="12" no-bold>课件列表</c-button>
|
|
|
</div>
|
|
|
- <div class="sub-title mt-24">修改选课码:</div>
|
|
|
+ <div class="mt-32 mb-12">修改选课码</div>
|
|
|
<div class="change-wrapper mb-24">
|
|
|
<c-input placeholder="修改不会影响已选学生" v-model="newCode"/>
|
|
|
<c-button text theme="green" icon="check">确认</c-button>
|
|
|
</div>
|
|
|
- <c-button icon="delete" class="mt-32" theme="red" block @click="handleDeleteCourse">删除课程</c-button>
|
|
|
</tab-side-component>
|
|
|
</template>
|
|
|
|
|
|
@@ -35,8 +44,7 @@ import TabSideComponent from '@/components/Layouts/TabSideComponent'
|
|
|
import CInput from '@/components/Basic/CInput'
|
|
|
import CButton from '@/components/Basic/CButton'
|
|
|
import BackTitle from '@/components/Basic/BackTitle'
|
|
|
-import { mapState } from 'vuex'
|
|
|
-import { modifyCourse, removeCourse } from '@/server/course'
|
|
|
+import { getOneCourse, modifyCourse, removeCourse } from '@/server/course'
|
|
|
import CourseDetail from '@/components/Details/CourseDetail'
|
|
|
import momentFromNow from '@/utils/moment-from-now'
|
|
|
import ShowTransition from '@/animations/ShowTransition'
|
|
|
@@ -50,34 +58,37 @@ export default {
|
|
|
newCode: '',
|
|
|
notices: null,
|
|
|
showMore: false,
|
|
|
- showNoticeForm: false
|
|
|
+ showNoticeForm: false,
|
|
|
+ course: {}
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- ...mapState({
|
|
|
- course: state => state.main.courseInfo
|
|
|
- }),
|
|
|
createTime () {
|
|
|
return momentFromNow(this.course.createAt)
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
- course () {
|
|
|
- this.fetchNotices()
|
|
|
+ $route () {
|
|
|
+ this.init()
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
- this.fetchNotices()
|
|
|
+ created () {
|
|
|
+ this.init()
|
|
|
},
|
|
|
methods: {
|
|
|
+ init () {
|
|
|
+ getOneCourse({ courseId: this.$route.params.courseId })
|
|
|
+ .then(res => {
|
|
|
+ this.course = res
|
|
|
+ this.fetchNotices()
|
|
|
+ })
|
|
|
+ .catch(err => this.$setErrorMessage(err.response.data.msg))
|
|
|
+ },
|
|
|
fetchNotices () {
|
|
|
getNotices({ courseId: this.course.id }).then(res => {
|
|
|
this.notices = res.data
|
|
|
})
|
|
|
},
|
|
|
- handleCheckSlideList () {
|
|
|
- this.$router.push({ name: 'teacher-course-slides' })
|
|
|
- },
|
|
|
handleChangeCode () {
|
|
|
modifyCourse({ ...this.course, code: this.newCode }).then(res => {
|
|
|
this.$setSuccessMessage('选课码修改成功')
|
|
|
@@ -104,6 +115,7 @@ export default {
|
|
|
.c-input {
|
|
|
margin-bottom: 24px;
|
|
|
}
|
|
|
+
|
|
|
.change-wrapper {
|
|
|
display: flex;
|
|
|
align-items: center;
|