|
@@ -40,16 +40,16 @@
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <el-divider v-if="isCourseSelected"/>
|
|
|
|
|
|
|
+ <el-divider v-if="isCreator || isCourseSelected"/>
|
|
|
|
|
|
|
|
- <div v-if="isCourseSelected" class="course-tabs">
|
|
|
|
|
|
|
+ <div v-if="isCreator || isCourseSelected" class="course-tabs">
|
|
|
<el-radio-group v-model="tabName" size="large">
|
|
<el-radio-group v-model="tabName" size="large">
|
|
|
<el-radio-button label="tasks">任务时间轴</el-radio-button>
|
|
<el-radio-button label="tasks">任务时间轴</el-radio-button>
|
|
|
<el-radio-button label="notice">通知栏</el-radio-button>
|
|
<el-radio-button label="notice">通知栏</el-radio-button>
|
|
|
<el-radio-button label="courseware">课件列表</el-radio-button>
|
|
<el-radio-button label="courseware">课件列表</el-radio-button>
|
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-popover v-if="isTeacher && tabName==='notice'"
|
|
|
|
|
|
|
+ <el-popover v-if="isCreator && tabName==='notice'"
|
|
|
v-model:visible="noticePopover"
|
|
v-model:visible="noticePopover"
|
|
|
:width="160"
|
|
:width="160"
|
|
|
placement="bottom">
|
|
placement="bottom">
|
|
@@ -84,7 +84,8 @@
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-popover>
|
|
</el-popover>
|
|
|
- <el-upload v-if="isTeacher && tabName==='courseware'" :http-request="handleFileUploading" :on-success="handleFileUploadSuccess"
|
|
|
|
|
|
|
+ <el-upload v-if="isCreator && tabName==='courseware'" :http-request="handleFileUploading"
|
|
|
|
|
+ :on-success="handleFileUploadSuccess"
|
|
|
:show-file-list="false" action="">
|
|
:show-file-list="false" action="">
|
|
|
<el-button plain type="primary">上传课件</el-button>
|
|
<el-button plain type="primary">上传课件</el-button>
|
|
|
</el-upload>
|
|
</el-upload>
|
|
@@ -93,36 +94,38 @@
|
|
|
|
|
|
|
|
<div class="course-tab-content">
|
|
<div class="course-tab-content">
|
|
|
<div v-if="tabName==='tasks'" class="tab-tasks">
|
|
<div v-if="tabName==='tasks'" class="tab-tasks">
|
|
|
- <el-timeline>
|
|
|
|
|
- <el-timeline-item
|
|
|
|
|
- v-for="(task, index) in tasks"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- :timestamp="task.timestamp"
|
|
|
|
|
- >
|
|
|
|
|
- {{ task.content }}
|
|
|
|
|
- </el-timeline-item>
|
|
|
|
|
- </el-timeline>
|
|
|
|
|
|
|
+ <!-- <el-timeline>-->
|
|
|
|
|
+ <!-- <el-timeline-item-->
|
|
|
|
|
+ <!-- v-for="(task, index) in tasks"-->
|
|
|
|
|
+ <!-- :key="index"-->
|
|
|
|
|
+ <!-- :timestamp="task.timestamp"-->
|
|
|
|
|
+ <!-- >-->
|
|
|
|
|
+ <!-- {{ task.content }}-->
|
|
|
|
|
+ <!-- </el-timeline-item>-->
|
|
|
|
|
+ <!-- </el-timeline>-->
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else-if="tabName==='notice'" class="tab-notice">
|
|
<div v-else-if="tabName==='notice'" class="tab-notice">
|
|
|
- <NoticeItem v-for="(item,index) in announcementList" :key="index" :notice-info="item"></NoticeItem>
|
|
|
|
|
|
|
+ <NoticeItem v-for="(item,index) in announcementList" :key="index" :ref="'noticeItem'+item.id"
|
|
|
|
|
+ :notice-v-o="item" @update="beforeUpdateAnnouncement(item)"
|
|
|
|
|
+ @delete="deleteAnnouncement(item, index)"/>
|
|
|
</div>
|
|
</div>
|
|
|
<div v-else-if="tabName==='courseware'" class="tab-courseware">
|
|
<div v-else-if="tabName==='courseware'" class="tab-courseware">
|
|
|
- <div class="entry-header">
|
|
|
|
|
- <span class="name">文件名</span>
|
|
|
|
|
- <span class="size">文件大小</span>
|
|
|
|
|
- <span class="uploadTime">上传时间</span>
|
|
|
|
|
- <span class="operation">操作</span>
|
|
|
|
|
- </div>
|
|
|
|
|
- <FileEntry v-for="(entry,index) in fileEntryList"
|
|
|
|
|
- :key="index"
|
|
|
|
|
- :file-entry-info="entry"
|
|
|
|
|
- @downloadFileIconClick="handleDownloadFileIconClick"
|
|
|
|
|
- ></FileEntry>
|
|
|
|
|
|
|
+ <!-- <div class="entry-header">-->
|
|
|
|
|
+ <!-- <span class="name">文件名</span>-->
|
|
|
|
|
+ <!-- <span class="size">文件大小</span>-->
|
|
|
|
|
+ <!-- <span class="uploadTime">上传时间</span>-->
|
|
|
|
|
+ <!-- <span class="operation">操作</span>-->
|
|
|
|
|
+ <!-- </div>-->
|
|
|
|
|
+ <!-- <FileEntry v-for="(entry,index) in fileEntryList"-->
|
|
|
|
|
+ <!-- :key="index"-->
|
|
|
|
|
+ <!-- :file-entry-info="entry"-->
|
|
|
|
|
+ <!-- @downloadFileIconClick="handleDownloadFileIconClick"-->
|
|
|
|
|
+ <!-- ></FileEntry>-->
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
- <el-dialog v-model="announcementFormDialog" :before-close="beforeFormClose" :title="'添加发布'">
|
|
|
|
|
|
|
+ <el-dialog v-model="announcementFormDialog" :before-close="beforeFormClose" :title="announcementForm.dialogTitle">
|
|
|
<el-form ref="announceFormRef" :model="announcementForm" :rules="announcementFormRule" label-position="right"
|
|
<el-form ref="announceFormRef" :model="announcementForm" :rules="announcementFormRule" label-position="right"
|
|
|
label-width="60px">
|
|
label-width="60px">
|
|
|
<el-form-item label="类别" prop="type">
|
|
<el-form-item label="类别" prop="type">
|
|
@@ -145,20 +148,17 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</el-card>
|
|
</el-card>
|
|
|
- <GlobalFooter/>
|
|
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import NoticeItem from "./components/NoticeItem";
|
|
import NoticeItem from "./components/NoticeItem";
|
|
|
import FileEntry from "./components/FileEntry";
|
|
import FileEntry from "./components/FileEntry";
|
|
|
-import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
|
|
|
|
+import {ElMessageBox, ElMessage} from "element-plus";
|
|
|
import variables from "@/utils/variables";
|
|
import variables from "@/utils/variables";
|
|
|
-import GlobalFooter from "@/components/GlobalFooter";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "CourseDetail",
|
|
name: "CourseDetail",
|
|
|
components: {
|
|
components: {
|
|
|
- GlobalFooter,
|
|
|
|
|
// eslint-disable-next-line vue/no-unused-components
|
|
// eslint-disable-next-line vue/no-unused-components
|
|
|
NoticeItem,
|
|
NoticeItem,
|
|
|
// eslint-disable-next-line vue/no-unused-components
|
|
// eslint-disable-next-line vue/no-unused-components
|
|
@@ -181,6 +181,8 @@ export default {
|
|
|
|
|
|
|
|
announcementFormDialog: false,
|
|
announcementFormDialog: false,
|
|
|
announcementForm: {
|
|
announcementForm: {
|
|
|
|
|
+ dialogTitle: "添加发布",
|
|
|
|
|
+ id: null,
|
|
|
type: null,
|
|
type: null,
|
|
|
title: "",
|
|
title: "",
|
|
|
content: "",
|
|
content: "",
|
|
@@ -201,11 +203,11 @@ export default {
|
|
|
color: "",
|
|
color: "",
|
|
|
},
|
|
},
|
|
|
noticeTypeMap: {
|
|
noticeTypeMap: {
|
|
|
- announce: { type: "公告", title: "发布公告", color: themeColor.orange },
|
|
|
|
|
- homework: { type: "作业", title: "发布作业", color: themeColor.blue },
|
|
|
|
|
- exam: { type: "考试", title: "发布考试", color: themeColor.red },
|
|
|
|
|
|
|
+ announce: {type: "公告", title: "发布公告", color: themeColor.orange},
|
|
|
|
|
+ homework: {type: "作业", title: "发布作业", color: themeColor.blue},
|
|
|
|
|
+ exam: {type: "考试", title: "发布考试", color: themeColor.red},
|
|
|
},
|
|
},
|
|
|
- newNoticeInfo: { noticeDescription: "", priority: "1", fileList: [] },
|
|
|
|
|
|
|
+ newNoticeInfo: {noticeDescription: "", priority: "1", fileList: []},
|
|
|
postNoticeInfo: {},
|
|
postNoticeInfo: {},
|
|
|
fileEntryList: [{
|
|
fileEntryList: [{
|
|
|
id: 1,
|
|
id: 1,
|
|
@@ -250,7 +252,7 @@ export default {
|
|
|
return this.$store.getters.isTeacher;
|
|
return this.$store.getters.isTeacher;
|
|
|
},
|
|
},
|
|
|
isCreator() {
|
|
isCreator() {
|
|
|
- return this.courseInfo.teacher.id === this.$store.state.user.id;
|
|
|
|
|
|
|
+ return this.courseInfo.teacher.id === Number(this.$store.state.user.id);
|
|
|
},
|
|
},
|
|
|
imgUrl() {
|
|
imgUrl() {
|
|
|
return this.courseInfo.imageUrl === null ? this.noImgUrl : this.courseInfo.imageUrl;
|
|
return this.courseInfo.imageUrl === null ? this.noImgUrl : this.courseInfo.imageUrl;
|
|
@@ -296,24 +298,101 @@ export default {
|
|
|
this.announcementFormDialog = false;
|
|
this.announcementFormDialog = false;
|
|
|
this.$refs.announceFormRef.resetFields();
|
|
this.$refs.announceFormRef.resetFields();
|
|
|
})
|
|
})
|
|
|
- .catch((err) => {
|
|
|
|
|
- console.log(err);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ .catch(err => console.log(err));
|
|
|
},
|
|
},
|
|
|
handlePublishAnnouncement() {
|
|
handlePublishAnnouncement() {
|
|
|
- let announcementVO = {
|
|
|
|
|
- sender: { id: this.$store.state.user.id, },
|
|
|
|
|
- courseId: this.courseInfo.id,
|
|
|
|
|
- title: this.announcementForm.title,
|
|
|
|
|
- content: this.announcementForm.content,
|
|
|
|
|
- type: this.announcementForm.type.toUpperCase(),
|
|
|
|
|
- createdAt: new Date(),
|
|
|
|
|
- };
|
|
|
|
|
- this.$apis.createAnnouncement(announcementVO)
|
|
|
|
|
|
|
+ const _this = this;
|
|
|
|
|
+ if (this.announcementForm.content === "") {
|
|
|
|
|
+ ElMessageBox.confirm("是否确认发布内容为空?", "提示", {
|
|
|
|
|
+ confirmButtonText: "确认为空",
|
|
|
|
|
+ cancelButtonText: "我再想想",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ center: true,
|
|
|
|
|
+ })
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ if (this.announcementForm.id === null) {
|
|
|
|
|
+ createAnnouncement();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ updateAnnouncement();
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (this.announcementForm.id === null) {
|
|
|
|
|
+ createAnnouncement();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ updateAnnouncement();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function createAnnouncement() {
|
|
|
|
|
+ let announcementVO = {
|
|
|
|
|
+ sender: {id: _this.$store.state.user.id,},
|
|
|
|
|
+ courseId: _this.courseInfo.id,
|
|
|
|
|
+ title: _this.announcementForm.title,
|
|
|
|
|
+ content: _this.announcementForm.content,
|
|
|
|
|
+ type: _this.announcementForm.type.toUpperCase(),
|
|
|
|
|
+ createdAt: new Date(),
|
|
|
|
|
+ };
|
|
|
|
|
+ _this.$apis.createAnnouncement(announcementVO)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ _this.announcementList.push(res.data.data);
|
|
|
|
|
+ _this.announcementFormDialog = false;
|
|
|
|
|
+ _this.$refs.announceFormRef.resetFields();
|
|
|
|
|
+ ElMessage.success("新建公告完成");
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ function updateAnnouncement() {
|
|
|
|
|
+ let announcementVO = {
|
|
|
|
|
+ id: _this.announcementForm.id,
|
|
|
|
|
+ sender: {id: _this.$store.state.user.id,},
|
|
|
|
|
+ courseId: _this.courseInfo.id,
|
|
|
|
|
+ title: _this.announcementForm.title,
|
|
|
|
|
+ content: _this.announcementForm.content,
|
|
|
|
|
+ type: _this.announcementForm.type.toUpperCase(),
|
|
|
|
|
+ };
|
|
|
|
|
+ _this.$apis.updateAnnouncement(announcementVO)
|
|
|
|
|
+ .then(res => {
|
|
|
|
|
+ for (let i = 0; i < _this.announcementList.length; i++) {
|
|
|
|
|
+ if (_this.announcementList[i].id === _this.announcementForm.id) {
|
|
|
|
|
+ _this.announcementList[i] = res.data.data;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ _this.$refs["noticeItem" + _this.announcementForm.id][0].setNoticeInfo(res.data.data);
|
|
|
|
|
+ _this.announcementFormDialog = false;
|
|
|
|
|
+ _this.$refs.announceFormRef.resetFields();
|
|
|
|
|
+ ElMessage.success("修改公告完成");
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch();
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ beforeUpdateAnnouncement(item) {
|
|
|
|
|
+ this.announcementForm.dialogTitle = "修改公告";
|
|
|
|
|
+ this.announcementForm.id = item.id;
|
|
|
|
|
+ this.announcementForm.type = item.type;
|
|
|
|
|
+ this.announcementForm.title = item.title;
|
|
|
|
|
+ this.announcementForm.content = item.content;
|
|
|
|
|
+ this.announcementFormDialog = true;
|
|
|
|
|
+ },
|
|
|
|
|
+ deleteAnnouncement(item, index) {
|
|
|
|
|
+ ElMessageBox.confirm("是否确认删除公告 \"" + item.title + "\" ?", "提示", {
|
|
|
|
|
+ confirmButtonText: "确认删除",
|
|
|
|
|
+ cancelButtonText: "我再想想",
|
|
|
|
|
+ type: "warning",
|
|
|
|
|
+ center: true,
|
|
|
|
|
+ })
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- ElMessage.success("新建公告完成");
|
|
|
|
|
|
|
+ this.$apis.deleteAnnouncement(item.id, this.$store.state.user.id)
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ this.announcementList.splice(index, 1);
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch();
|
|
|
})
|
|
})
|
|
|
- .catch(err => console.log(err));
|
|
|
|
|
|
|
+ .catch(action => {
|
|
|
|
|
+ console.log(action);
|
|
|
|
|
+ });
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
//
|
|
//
|
|
@@ -330,7 +409,7 @@ export default {
|
|
|
confirmButtonText: "立即选课",
|
|
confirmButtonText: "立即选课",
|
|
|
cancelButtonText: "我再想想",
|
|
cancelButtonText: "我再想想",
|
|
|
})
|
|
})
|
|
|
- .then(({ value }) => {
|
|
|
|
|
|
|
+ .then(({value}) => {
|
|
|
if (value !== this.courseInfo.invitationCode) {
|
|
if (value !== this.courseInfo.invitationCode) {
|
|
|
ElMessage.error("选课码错误");
|
|
ElMessage.error("选课码错误");
|
|
|
} else {
|
|
} else {
|