|
|
@@ -1,299 +1,360 @@
|
|
|
<template>
|
|
|
<div class="course-detail-page">
|
|
|
- <div class="course-detail-container">
|
|
|
+ <div class="course-detail-container" v-if="courseInfo!==null">
|
|
|
<div class="header">
|
|
|
<div class="course-img">
|
|
|
- <img alt="" src="https://p.seec.seecoder.cn/image/java.png">
|
|
|
+ <img alt="" :src="courseInfo.imageUrl">
|
|
|
</div>
|
|
|
<div class="course-info">
|
|
|
- <div>课程名:{{ courseInfo.courseName }}</div>
|
|
|
- <div>教师:{{ courseInfo.teacher }}</div>
|
|
|
- <div>开课时间:{{ courseInfo.startTime }}</div>
|
|
|
- <div class="mooc-link">
|
|
|
- <a :href="courseInfo.moocLink" target="_blank">Mooc课程链接</a>
|
|
|
- <img alt="link" src="../../assets/link.svg">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-divider></el-divider>
|
|
|
- <div class="introduce">
|
|
|
- <span class="title">简介</span>
|
|
|
- <br/>
|
|
|
- <div class="introduce-content">
|
|
|
- {{ courseInfo.introduce }}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-divider></el-divider>
|
|
|
- <div class="course-tabs">
|
|
|
- <el-radio-group v-model="tabName" size="large">
|
|
|
- <el-radio-button label="tasks">任务时间轴</el-radio-button>
|
|
|
- <el-radio-button label="notice">通知栏</el-radio-button>
|
|
|
- <el-radio-button label="courseware">课件列表</el-radio-button>
|
|
|
- </el-radio-group>
|
|
|
- <div v-teacher-permission="{role:role}">
|
|
|
- <el-popover v-if="tabName==='notice'" v-model:visible="showPopover" :width="160" placement="bottom">
|
|
|
- <div class="sel-notice-type">
|
|
|
- <div :style="{color:themeColor.orange}" class="notice-type-icon">
|
|
|
- 公告
|
|
|
- </div>
|
|
|
- <div class="notice-type-txt" @click="selAndInitNotice('announce')">
|
|
|
- 发布公告
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="sel-notice-type">
|
|
|
- <div :style="{color:themeColor.blue}" class="notice-type-icon">
|
|
|
- 作业
|
|
|
- </div>
|
|
|
- <div class="notice-type-txt" @click="selAndInitNotice('homework')">
|
|
|
- 发布作业
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="sel-notice-type">
|
|
|
- <div :style="{color:themeColor.red}" class="notice-type-icon">
|
|
|
- 考试
|
|
|
- </div>
|
|
|
- <div class="notice-type-txt" @click="selAndInitNotice('test')">
|
|
|
- 发布考试
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <template #reference>
|
|
|
- <el-button plain type="warning" @click="showPopover = true">添加发布
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
- <el-upload
|
|
|
- v-if="tabName==='courseware'"
|
|
|
- :action="actionUrl"
|
|
|
- :http-request="handleFileUploading"
|
|
|
- :on-success="handFileUploadSuccess"
|
|
|
- :show-file-list="false"
|
|
|
- class="upload-demo width-100"
|
|
|
- method="put"
|
|
|
- >
|
|
|
- <el-button plain type="primary">上传课件</el-button>
|
|
|
- </el-upload>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="course-tab-content">
|
|
|
- <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>
|
|
|
- </div>
|
|
|
- <div v-else-if="tabName==='notice'" class="tab-notice">
|
|
|
- <NoticeItem v-for="(item,index) in noticeInfoList" :key="index" :notice-info="item"></NoticeItem>
|
|
|
- </div>
|
|
|
- <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>
|
|
|
-
|
|
|
+ <el-row>课程名称:{{ courseInfo.name }}</el-row>
|
|
|
+ <el-row>教师:{{ courseInfo.teacher.name }}</el-row>
|
|
|
+ <el-row>学期:{{ courseInfo.semester }}</el-row>
|
|
|
+ <el-row>时间:{{ timestampToTime(courseInfo.startTime) }} 至 {{ timestampToTime(courseInfo.endTime) }}</el-row>
|
|
|
+ <el-row class="mooc-link">
|
|
|
+ MOOC链接:
|
|
|
+ <el-link v-if="courseInfo.moocUrl!==null" :href="courseInfo.moocUrl" target="_blank">点击此处<i
|
|
|
+ class="el-icon-link el-icon--right"></i></el-link>
|
|
|
+ <span v-else>无</span>
|
|
|
+ </el-row>
|
|
|
+ <el-row v-if="isStudent">
|
|
|
+ <el-button size="mini" :disabled="isCourseSelected" @click="handleSelectCourse">
|
|
|
+ {{ isCourseSelected ? "已选课" : "立即选课" }}
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="isCourseSelected" size="mini" type="danger" @click="handleCancelCourse">
|
|
|
+ 退课
|
|
|
+ </el-button>
|
|
|
+ </el-row>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- <el-divider></el-divider>-->
|
|
|
+ <!-- <div class="introduce">-->
|
|
|
+ <!-- <span class="title">简介</span>-->
|
|
|
+ <!-- <br/>-->
|
|
|
+ <!-- <div class="introduce-content">-->
|
|
|
+ <!-- {{ courseInfo.introduce }}-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <el-divider></el-divider>-->
|
|
|
+ <!-- <div class="course-tabs">-->
|
|
|
+ <!-- <el-radio-group v-model="tabName" size="large">-->
|
|
|
+ <!-- <el-radio-button label="tasks">任务时间轴</el-radio-button>-->
|
|
|
+ <!-- <el-radio-button label="notice">通知栏</el-radio-button>-->
|
|
|
+ <!-- <el-radio-button label="courseware">课件列表</el-radio-button>-->
|
|
|
+ <!-- </el-radio-group>-->
|
|
|
+ <!-- <div v-teacher-permission="{role:role}">-->
|
|
|
+ <!-- <el-popover v-if="tabName==='notice'" v-model:visible="showPopover" :width="160" placement="bottom">-->
|
|
|
+ <!-- <div class="sel-notice-type">-->
|
|
|
+ <!-- <div :style="{color:themeColor.orange}" class="notice-type-icon">-->
|
|
|
+ <!-- 公告-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="notice-type-txt" @click="selAndInitNotice('announce')">-->
|
|
|
+ <!-- 发布公告-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="sel-notice-type">-->
|
|
|
+ <!-- <div :style="{color:themeColor.blue}" class="notice-type-icon">-->
|
|
|
+ <!-- 作业-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="notice-type-txt" @click="selAndInitNotice('homework')">-->
|
|
|
+ <!-- 发布作业-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="sel-notice-type">-->
|
|
|
+ <!-- <div :style="{color:themeColor.red}" class="notice-type-icon">-->
|
|
|
+ <!-- 考试-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="notice-type-txt" @click="selAndInitNotice('test')">-->
|
|
|
+ <!-- 发布考试-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <template #reference>-->
|
|
|
+ <!-- <el-button plain type="warning" @click="showPopover = true">添加发布-->
|
|
|
+ <!-- </el-button>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ <!-- </el-popover>-->
|
|
|
+ <!-- <el-upload-->
|
|
|
+ <!-- v-if="tabName==='courseware'"-->
|
|
|
+ <!-- :action="actionUrl"-->
|
|
|
+ <!-- :http-request="handleFileUploading"-->
|
|
|
+ <!-- :on-success="handFileUploadSuccess"-->
|
|
|
+ <!-- :show-file-list="false"-->
|
|
|
+ <!-- class="upload-demo width-100"-->
|
|
|
+ <!-- method="put"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <el-button plain type="primary">上传课件</el-button>-->
|
|
|
+ <!-- </el-upload>-->
|
|
|
+ <!-- </div>-->
|
|
|
</div>
|
|
|
- <div>
|
|
|
- <el-dialog
|
|
|
- v-model="showNewNoticeDialog"
|
|
|
- :title="newNoticeType.title"
|
|
|
- width="40%"
|
|
|
- >
|
|
|
- <div class="new-notice-content">
|
|
|
- <div class="new-notice-item">
|
|
|
- <span>创建者: </span>
|
|
|
- <div class="flex-vc">
|
|
|
- <span>kenny 67</span>
|
|
|
- <div :style="{backgroundColor:newNoticeType.color}" class="mini-name-icon">刘</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="new-notice-item">
|
|
|
- <span>所属课程:</span>
|
|
|
- <div>软件工程与计算 I 2021</div>
|
|
|
- </div>
|
|
|
- <div class="new-notice-item">
|
|
|
- <span>发布时间:</span>
|
|
|
- <div>2021年12月15日 18时30分</div>
|
|
|
- </div>
|
|
|
- <div class="content-description-area">
|
|
|
- <span>内容描述:</span>
|
|
|
- <el-input
|
|
|
- v-model="newNoticeInfo.noticeDescription"
|
|
|
- :rows="4"
|
|
|
- placeholder="内容描述"
|
|
|
- type="textarea"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="new-notice-item">
|
|
|
- <span>优先级: </span>
|
|
|
- <div>
|
|
|
- <el-radio v-model="newNoticeInfo.priority" border label="1" size="large">重要</el-radio>
|
|
|
- <el-radio v-model="newNoticeInfo.priority" border label="2" size="large">一般</el-radio>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="new-notice-btn">
|
|
|
- <el-button style="margin-right: 32px" type="primary">确认</el-button>
|
|
|
- <el-button type="danger">取消</el-button>
|
|
|
+ <!-- <div class="course-tab-content">-->
|
|
|
+ <!-- <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>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div v-else-if="tabName==='notice'" class="tab-notice">-->
|
|
|
+ <!-- <NoticeItem v-for="(item,index) in noticeInfoList" :key="index" :notice-info="item"></NoticeItem>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <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>
|
|
|
-
|
|
|
- </el-dialog>
|
|
|
- </div>
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- <el-dialog-->
|
|
|
+ <!-- v-model="showNewNoticeDialog"-->
|
|
|
+ <!-- :title="newNoticeType.title"-->
|
|
|
+ <!-- width="40%"-->
|
|
|
+ <!-- >-->
|
|
|
+ <!-- <div class="new-notice-content">-->
|
|
|
+ <!-- <div class="new-notice-item">-->
|
|
|
+ <!-- <span>创建者: </span>-->
|
|
|
+ <!-- <div class="flex-vc">-->
|
|
|
+ <!-- <span>kenny 67</span>-->
|
|
|
+ <!-- <div :style="{backgroundColor:newNoticeType.color}" class="mini-name-icon">刘</div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="new-notice-item">-->
|
|
|
+ <!-- <span>所属课程:</span>-->
|
|
|
+ <!-- <div>软件工程与计算 I 2021</div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="new-notice-item">-->
|
|
|
+ <!-- <span>发布时间:</span>-->
|
|
|
+ <!-- <div>2021年12月15日 18时30分</div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="content-description-area">-->
|
|
|
+ <!-- <span>内容描述:</span>-->
|
|
|
+ <!-- <el-input-->
|
|
|
+ <!-- v-model="newNoticeInfo.noticeDescription"-->
|
|
|
+ <!-- :rows="4"-->
|
|
|
+ <!-- placeholder="内容描述"-->
|
|
|
+ <!-- type="textarea"-->
|
|
|
+ <!-- />-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="new-notice-item">-->
|
|
|
+ <!-- <span>优先级: </span>-->
|
|
|
+ <!-- <div>-->
|
|
|
+ <!-- <el-radio v-model="newNoticeInfo.priority" border label="1" size="large">重要</el-radio>-->
|
|
|
+ <!-- <el-radio v-model="newNoticeInfo.priority" border label="2" size="large">一般</el-radio>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- </div>-->
|
|
|
+ <!-- <div class="new-notice-btn">-->
|
|
|
+ <!-- <el-button style="margin-right: 32px" type="primary">确认</el-button>-->
|
|
|
+ <!-- <el-button type="danger">取消</el-button>-->
|
|
|
|
|
|
+ <!-- </div>-->
|
|
|
|
|
|
+ <!-- </el-dialog>-->
|
|
|
+ <!-- </div>-->
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
-<script setup>
|
|
|
+<script>
|
|
|
import NoticeItem from "./components/NoticeItem";
|
|
|
import FileEntry from "./components/FileEntry";
|
|
|
-import {reactive, ref} from "vue";
|
|
|
-import {useStore} from "vuex";
|
|
|
+import {ElMessageBox, ElMessage} from "element-plus";
|
|
|
|
|
|
-const role = useStore().state.user.role;
|
|
|
-
|
|
|
-const newNoticeType = reactive({type: "", title: "", color: ""});
|
|
|
-const showNewNoticeDialog = ref(false);
|
|
|
-const themeColor = {
|
|
|
- orange: "#E38800",
|
|
|
- blue: "#1989FA",
|
|
|
- red: "#F56C6C"
|
|
|
-};
|
|
|
-const noticeTypeMap = {
|
|
|
- //Use policy objects to remove if-else judgments
|
|
|
- announce: {type: "公告", title: "发布公告", color: themeColor.orange},
|
|
|
- homework: {type: "作业", title: "发布作业", color: themeColor.blue},
|
|
|
- test: {type: "考试", title: "发布考试", color: themeColor.red}
|
|
|
-};
|
|
|
-
|
|
|
-const tabName = ref("tasks");
|
|
|
-let showPopover = ref(false);
|
|
|
-
|
|
|
-const selAndInitNotice = (noticeType) => {
|
|
|
- //Copy properties from source object to target object
|
|
|
- Object.assign(newNoticeType, noticeTypeMap[noticeType]);
|
|
|
- showNewNoticeDialog.value = true;
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-const newNoticeInfo = reactive({noticeDescription: "", priority: "1", fileList: []});
|
|
|
-
|
|
|
-//newNoticeInfo to post
|
|
|
-const postNoticeInfo = {
|
|
|
- userId: 1,
|
|
|
- courseId: 1,
|
|
|
- noticeType: newNoticeType.type,
|
|
|
- releaseTime: "",
|
|
|
- noticeDescription: "",
|
|
|
- priority: 1,
|
|
|
- fileList: []//undecided
|
|
|
-};
|
|
|
-
|
|
|
-const noticeInfoList = [
|
|
|
- {
|
|
|
- mode: "考试",
|
|
|
- text: "【重要】1月13日代码作业已发布",
|
|
|
- time: "01-19 18:24",
|
|
|
- name: "刘"
|
|
|
- },
|
|
|
- {
|
|
|
- mode: "作业",
|
|
|
- text: "【重要】1月13日代码作业已发布",
|
|
|
- time: "01-19 18:24",
|
|
|
- name: "刘"
|
|
|
+export default {
|
|
|
+ name: "CourseDetail",
|
|
|
+ components: {
|
|
|
+ // eslint-disable-next-line vue/no-unused-components
|
|
|
+ NoticeItem,
|
|
|
+ // eslint-disable-next-line vue/no-unused-components
|
|
|
+ FileEntry,
|
|
|
},
|
|
|
- {
|
|
|
- mode: "公告",
|
|
|
- text: "【重要】1月13日代码作业已发布",
|
|
|
- time: "01-19 18:24",
|
|
|
- name: "刘"
|
|
|
- }
|
|
|
-];
|
|
|
+ data() {
|
|
|
+ const themeColor = {
|
|
|
+ orange: "#E38800",
|
|
|
+ blue: "#1989FA",
|
|
|
+ red: "#F56C6C"
|
|
|
+ };
|
|
|
+ return {
|
|
|
+ courseInfo: null,
|
|
|
+ isCourseSelected: false,
|
|
|
|
|
|
-
|
|
|
-const courseInfo = {
|
|
|
- introduce: "JVM是Java Virtual Machine(Java虚拟机)的缩写,JVM是用于计算设备的规范,它是一个虚构出来的计算机,是通过在实际的计算机上仿真模拟各种计算机功能来实现的。\n" +
|
|
|
- "引入Java语言虚拟机后,Java语言在不同平台上运行时不需要重新编译。Java语言使用Java虚拟机屏蔽了与具体平台相关的信息,使得Java语言编译程序只需生成在Java虚拟机上运行的目标代码(字节码),就可以在多种平台上不加修改地运行。",
|
|
|
- courseName: "软件工程与计算",
|
|
|
- teacher: "刘钦",
|
|
|
- startTime: "2021.9.3",
|
|
|
- moocLink: "https://www.icourse163.org/"
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-//处理上传的文件相关
|
|
|
-const fileEntryList = reactive([
|
|
|
- {
|
|
|
- id: 1,
|
|
|
- name: "课程作业",
|
|
|
- size: "12.6MB",
|
|
|
- uploadTime: "2021-12-12 08:22:23",
|
|
|
- url: ""
|
|
|
+ newNoticeType: {
|
|
|
+ type: "",
|
|
|
+ title: "",
|
|
|
+ color: "",
|
|
|
+ },
|
|
|
+ noticeTypeMap: {
|
|
|
+ announce: {type: "公告", title: "发布公告", color: themeColor.orange},
|
|
|
+ homework: {type: "作业", title: "发布作业", color: themeColor.blue},
|
|
|
+ test: {type: "考试", title: "发布考试", color: themeColor.red},
|
|
|
+ },
|
|
|
+ newNoticeInfo: {noticeDescription: "", priority: "1", fileList: []},
|
|
|
+ noticeInfoList: [{
|
|
|
+ mode: "考试",
|
|
|
+ text: "【重要】1月13日代码作业已发布",
|
|
|
+ time: "01-19 18:24",
|
|
|
+ name: "刘"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ mode: "作业",
|
|
|
+ text: "【重要】1月13日代码作业已发布",
|
|
|
+ time: "01-19 18:24",
|
|
|
+ name: "刘"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ mode: "公告",
|
|
|
+ text: "【重要】1月13日代码作业已发布",
|
|
|
+ time: "01-19 18:24",
|
|
|
+ name: "刘"
|
|
|
+ }],
|
|
|
+ postNoticeInfo: {},
|
|
|
+ showNewNoticeDialog: false,
|
|
|
+ tabName: "tasks",
|
|
|
+ showPopover: false,
|
|
|
+ fileEntryList: [{
|
|
|
+ id: 1,
|
|
|
+ name: "课程作业",
|
|
|
+ size: "12.6MB",
|
|
|
+ uploadTime: "2021-12-12 08:22:23",
|
|
|
+ url: ""
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 2,
|
|
|
+ name: "测试",
|
|
|
+ size: "6KB",
|
|
|
+ uploadTime: "2021-12-12 08:22:23",
|
|
|
+ url: ""
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: 3,
|
|
|
+ name: "小练习",
|
|
|
+ size: "45KB",
|
|
|
+ uploadTime: "2021-12-12 08:22:23",
|
|
|
+ url: ""
|
|
|
+ }],
|
|
|
+ tasks: [{
|
|
|
+ content: "软工二大作业迭代一",
|
|
|
+ timestamp: "2018-04-15",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ content: "代码题提交",
|
|
|
+ timestamp: "2018-03-11",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ content: "Eval评测题目提交",
|
|
|
+ timestamp: "2018-02-28",
|
|
|
+ }],
|
|
|
+ };
|
|
|
},
|
|
|
- {
|
|
|
- id: 2,
|
|
|
- name: "测试",
|
|
|
- size: "6KB",
|
|
|
- uploadTime: "2021-12-12 08:22:23",
|
|
|
- url: ""
|
|
|
+ computed: {
|
|
|
+ isStudent() {
|
|
|
+ return ["STUDENT", "ADMIN", "SEEC"].indexOf(this.$store.state.user.role);
|
|
|
+ },
|
|
|
},
|
|
|
- {
|
|
|
- id: 3,
|
|
|
- name: "小练习",
|
|
|
- size: "45KB",
|
|
|
- uploadTime: "2021-12-12 08:22:23",
|
|
|
- url: ""
|
|
|
- }
|
|
|
-]);
|
|
|
-
|
|
|
-//新增上传文件相关
|
|
|
-const handleFileUploading = function () {
|
|
|
+ async mounted() {
|
|
|
+ this.$apis.getCourse(this.$route.params.id)
|
|
|
+ .then(res => {
|
|
|
+ this.courseInfo = res.data.data;
|
|
|
+ });
|
|
|
+ this.$apis.checkCourseSelection(this.$route.params.id, this.$store.state.user.id)
|
|
|
+ .then(res => {
|
|
|
+ this.isCourseSelected = res.data.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ timestampToTime(timestamp) {
|
|
|
+ const date = new Date(timestamp);
|
|
|
+ const Y = date.getFullYear() + "-";
|
|
|
+ const M = (date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1) + "-";
|
|
|
+ const D = (date.getDate() < 10 ? "0" + date.getDate() : date.getDate());
|
|
|
+ return Y + M + D;
|
|
|
+ },
|
|
|
|
|
|
-};
|
|
|
-const handFileUploadSuccess = function () {
|
|
|
+ selAndInitNotice(noticeType) {
|
|
|
+ Object.assign(this.newNoticeType, this.noticeTypeMap[noticeType]);
|
|
|
+ this.showNewNoticeDialog = true;
|
|
|
+ },
|
|
|
+ handleFileUploading() {
|
|
|
+ },
|
|
|
+ handleFileUploadSuccess() {
|
|
|
+ },
|
|
|
+ handleDownloadFileIconClick(url) {
|
|
|
+ },
|
|
|
|
|
|
-};
|
|
|
+ handleSelectCourse() {
|
|
|
+ ElMessageBox.prompt("请输入选课码", "选课:" + this.courseInfo.name, {
|
|
|
+ confirmButtonText: "立即选课",
|
|
|
+ cancelButtonText: "我再想想",
|
|
|
+ })
|
|
|
+ .then(({value}) => {
|
|
|
+ if (value !== this.courseInfo.invitationCode) {
|
|
|
+ ElMessage.error("选课码错误");
|
|
|
+ } else {
|
|
|
+ this.$apis.confirmCourseSelection(
|
|
|
+ {
|
|
|
+ courseId: this.courseInfo.id,
|
|
|
+ userId: this.$store.state.user.id,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ ElMessage.success("选课成功");
|
|
|
+ setTimeout(function () {
|
|
|
+ location.reload();
|
|
|
+ }, 500);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log("handleSelectCourse: " + err);
|
|
|
+ ElMessage.error("handleSelectCourse: " + err);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
-const handleDownloadFileIconClick = function (url) {
|
|
|
- window.open(url);
|
|
|
+ handleCancelCourse() {
|
|
|
+ ElMessageBox.confirm("是否确认退课?", "退课:" + this.courseInfo.name, {
|
|
|
+ confirmButtonText: "立即退课",
|
|
|
+ cancelButtonText: "我再想想",
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ this.$apis.cancelCourseSelection(
|
|
|
+ {
|
|
|
+ courseId: this.courseInfo.id,
|
|
|
+ userId: this.$store.state.user.id,
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(res => {
|
|
|
+ console.log(res);
|
|
|
+ ElMessage.success("退课成功");
|
|
|
+ setTimeout(function () {
|
|
|
+ location.reload();
|
|
|
+ }, 500);
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ console.log("handleCancelCourse: " + err);
|
|
|
+ ElMessage.error("handleCancelCourse: " + err);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
-
|
|
|
-
|
|
|
-//新增任务时间轴相关
|
|
|
-const tasks = reactive([
|
|
|
- {
|
|
|
- content: "软工二大作业迭代一",
|
|
|
- timestamp: "2018-04-15",
|
|
|
- },
|
|
|
- {
|
|
|
- content: "代码题提交",
|
|
|
- timestamp: "2018-03-11",
|
|
|
- },
|
|
|
- {
|
|
|
- content: "Eval评测题目提交",
|
|
|
- timestamp: "2018-02-28",
|
|
|
- },
|
|
|
- ]
|
|
|
-);
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
@import "style/CourseDetail.css";
|
|
|
-
|
|
|
-/*.el-radio.is-bordered {*/
|
|
|
-/* margin: 0;*/
|
|
|
-/*}*/
|
|
|
</style>
|