|
|
@@ -1,6 +1,7 @@
|
|
|
<template>
|
|
|
<div class="course-detail-page">
|
|
|
<div v-if="courseInfo!==null" class="course-detail-container">
|
|
|
+ <!--课程基本信息-->
|
|
|
<el-card>
|
|
|
<div class="header">
|
|
|
<div class="course-img">
|
|
|
@@ -39,16 +40,17 @@
|
|
|
<div class="introduce-content">{{ description }}</div>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
-
|
|
|
<el-divider v-if="isCreator || isCourseSelected"/>
|
|
|
-
|
|
|
+ <!--tab页-->
|
|
|
<el-card v-if="isCreator || isCourseSelected">
|
|
|
-
|
|
|
+ <!--tab标签-->
|
|
|
<div v-if="isCreator || isCourseSelected" class="course-tabs">
|
|
|
<el-radio-group v-model="tabName" size="large">
|
|
|
<el-radio-button label="task" @click="switchTab('task')">任务</el-radio-button>
|
|
|
+ <el-radio-button label="courseware" @click="switchTab('courseware')">课件(暂未启用)</el-radio-button>
|
|
|
<el-radio-button label="notice" @click="switchTab('notice')">通知</el-radio-button>
|
|
|
<el-radio-button label="project" @click="switchTab('project')">项目</el-radio-button>
|
|
|
+ <el-radio-button label="group" @click="switchTab('group')">团队</el-radio-button>
|
|
|
<el-radio-button label="comment" @click="switchTab('comment')">评论</el-radio-button>
|
|
|
</el-radio-group>
|
|
|
<div v-if="isCreator">
|
|
|
@@ -101,38 +103,10 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-popover>
|
|
|
-
|
|
|
- <el-popover v-if="tabName==='project'"
|
|
|
- v-model:visible="projectPopover"
|
|
|
- :width="160"
|
|
|
- placement="bottom">
|
|
|
- <el-row class="sel-project-type">
|
|
|
- <div class="project-type-txt">
|
|
|
- <el-link href="javascript:void(0);" type="success" @click="setRule">
|
|
|
- 开放组队
|
|
|
- </el-link>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- <el-row class="sel-project-type">
|
|
|
- <div class="project-type-txt">
|
|
|
- <el-link href="javascript:void(0);" type="warning">
|
|
|
- 修改组队信息
|
|
|
- </el-link>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- <el-row class="sel-project-type">
|
|
|
- <div class="project-type-txt">
|
|
|
- <el-link href="javascript:void(0);" type="danger">
|
|
|
- 查看队伍信息
|
|
|
- </el-link>
|
|
|
- </div>
|
|
|
- </el-row>
|
|
|
- <template #reference>
|
|
|
- <el-button plain type="primary" @click="projectPopover = true">组队
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
- </el-popover>
|
|
|
-
|
|
|
+ <el-button v-if="tabName==='group'&&isRuleExisted!==null"
|
|
|
+ plain type="primary" :disabled="isRuleExisted" @click="setRule">
|
|
|
+ {{ isRuleExisted ? '已开放组队' : '开放组队' }}
|
|
|
+ </el-button>
|
|
|
<el-upload v-if="tabName==='courseware'" :http-request="handleFileUploading"
|
|
|
:on-success="handleFileUploadSuccess"
|
|
|
:show-file-list="false" action="">
|
|
|
@@ -140,7 +114,7 @@
|
|
|
</el-upload>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
+ <!--tab内容-->
|
|
|
<div v-if="isCreator || isCourseSelected" class="course-tab-content">
|
|
|
<div v-if="tabName==='task'">
|
|
|
<el-timeline>
|
|
|
@@ -184,7 +158,7 @@
|
|
|
</el-timeline>
|
|
|
</div>
|
|
|
<div v-else-if="tabName==='notice'">
|
|
|
- <el-collapse>
|
|
|
+ <el-collapse v-if="announcementList.length!==0">
|
|
|
<el-collapse-item v-for="(item,index) in announcementList" :key="item.id" :name="index"
|
|
|
@click="readAnnouncement(item)">
|
|
|
<template #title>
|
|
|
@@ -218,7 +192,7 @@
|
|
|
<el-button style="width: 100%" type="primary" @click="createComment" plain>发表评论</el-button>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-divider/>
|
|
|
+ <el-divider v-if="commentTree.length!==0"/>
|
|
|
<div class="comment">
|
|
|
<div v-for="(comments,index) in commentTree" :key="comments.id" class="comment-body">
|
|
|
<div class="comment-main">
|
|
|
@@ -281,7 +255,7 @@
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
-
|
|
|
+ <!--发布通知-->
|
|
|
<el-dialog v-model="announcementFormDialog" :before-close="beforeFormClose" :title="announcementForm.dialogTitle">
|
|
|
<el-form ref="announceFormRef" :model="announcementForm" :rules="announcementFormRule" label-position="right"
|
|
|
label-width="60px">
|
|
|
@@ -304,7 +278,7 @@
|
|
|
<el-button plain type="danger" @click="beforeFormClose">我再想想</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
-
|
|
|
+ <!--小组规则-->
|
|
|
<el-dialog v-model="ruleFormDialog" :before-close="beforeFormClose" :title="ruleForm.dialogTitle">
|
|
|
<el-form ref="ruleFormRef" :model="ruleForm" :rules="ruleFormRule" label-position="right" label-width="150px">
|
|
|
<el-form-item label="小组最大人数" prop="maxSize">
|
|
|
@@ -315,10 +289,9 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div style="margin: auto;width: fit-content">
|
|
|
- <el-button plain type="primary" @click="CreateRule">确认</el-button>
|
|
|
+ <el-button plain type="primary" @click="createRule">确认</el-button>
|
|
|
<el-button plain type="danger" @click="beforeRuleFormClose">我再想想</el-button>
|
|
|
</div>
|
|
|
-
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -326,7 +299,7 @@
|
|
|
<script>
|
|
|
import NoticeItem from "./components/NoticeItem";
|
|
|
import FileEntry from "./components/FileEntry";
|
|
|
-import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
+import {ElMessageBox, ElMessage} from "element-plus";
|
|
|
import variables from "@/utils/variables";
|
|
|
|
|
|
export default {
|
|
|
@@ -349,7 +322,6 @@ export default {
|
|
|
themeColor,
|
|
|
tabName: "task",
|
|
|
noticePopover: false,
|
|
|
- projectPopover: false,
|
|
|
//
|
|
|
evalExamList: [],
|
|
|
coderExamList: [],
|
|
|
@@ -371,7 +343,8 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
announcementList: [],
|
|
|
- //
|
|
|
+ // group
|
|
|
+ isRuleExisted: null,
|
|
|
ruleFormDialog: false,
|
|
|
ruleForm: {
|
|
|
dialogTitle: "制定组队规则",
|
|
|
@@ -388,7 +361,7 @@ export default {
|
|
|
required: true, message: "请输入组名最大长度", trigger: "blur",
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ //
|
|
|
commentContent: "",
|
|
|
commentTree: [],
|
|
|
|
|
|
@@ -398,11 +371,11 @@ export default {
|
|
|
color: "",
|
|
|
},
|
|
|
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: {},
|
|
|
fileEntryList: [{
|
|
|
id: 1,
|
|
|
@@ -455,10 +428,6 @@ export default {
|
|
|
isCreator() {
|
|
|
return Number(this.courseInfo.teacher.id) === Number(this.$store.state.user.id);
|
|
|
},
|
|
|
- isNotRule() {
|
|
|
- return false;
|
|
|
- //todo
|
|
|
- },
|
|
|
imgUrl() {
|
|
|
return this.courseInfo.imageUrl === null ? this.noImgUrl : this.courseInfo.imageUrl;
|
|
|
},
|
|
|
@@ -472,7 +441,7 @@ export default {
|
|
|
return b_time - a_time;
|
|
|
});
|
|
|
},
|
|
|
- isOwnComment(){
|
|
|
+ isOwnComment() {
|
|
|
const _this = this;
|
|
|
return function (senderId) {
|
|
|
return senderId === Number(_this.$store.state.user.id);
|
|
|
@@ -598,8 +567,8 @@ export default {
|
|
|
this.announcementForm.type = type;
|
|
|
this.announcementFormDialog = true;
|
|
|
},
|
|
|
- setRule(){
|
|
|
- this.ruleFormDialog =true;
|
|
|
+ setRule() {
|
|
|
+ this.ruleFormDialog = true;
|
|
|
},
|
|
|
|
|
|
beforeFormClose() {
|
|
|
@@ -615,6 +584,7 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
|
|
|
+ // group
|
|
|
beforeRuleFormClose() {
|
|
|
ElMessageBox.confirm("是否确认退出?退出后将不保存组队规则信息。", "提示", {
|
|
|
confirmButtonText: "确认退出",
|
|
|
@@ -622,27 +592,35 @@ export default {
|
|
|
type: "warning",
|
|
|
center: true,
|
|
|
})
|
|
|
- .then(() => {
|
|
|
- this.ruleFormDialog = false;
|
|
|
- this.$refs.ruleFormRef.resetFields();
|
|
|
- });
|
|
|
+ .then(() => {
|
|
|
+ this.ruleFormDialog = false;
|
|
|
+ this.$refs.ruleFormRef.resetFields();
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
- CreateRule(){
|
|
|
- let RuleVO={
|
|
|
- courseVO: {courseId: this.courseInfo.id},
|
|
|
- maxSize: this.ruleForm.maxSize,
|
|
|
- maxNameLen: this.ruleForm.maxNameLen,
|
|
|
- };
|
|
|
- console.log(RuleVO);
|
|
|
- this.$apis.editGroupRule(RuleVO)
|
|
|
- .then(res => {
|
|
|
- this.ruleFormDialog=false;
|
|
|
- this.$refs.ruleFormRef.resetFields;
|
|
|
- ElMessage.success("创建规则成功");
|
|
|
- });
|
|
|
+ createRule() {
|
|
|
+ this.$refs.ruleFormRef.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ let RuleVO = {
|
|
|
+ courseVO: {id: this.courseInfo.id},
|
|
|
+ maxSize: this.ruleForm.maxSize,
|
|
|
+ maxNameLen: this.ruleForm.maxNameLen,
|
|
|
+ };
|
|
|
+ console.log(RuleVO);
|
|
|
+ this.$apis.createGroupRule(RuleVO)
|
|
|
+ .then(res => {
|
|
|
+ if (res.data.code) {
|
|
|
+ ElMessage.error(res.data.message);
|
|
|
+ } else {
|
|
|
+ this.isRuleExisted = true;
|
|
|
+ this.ruleFormDialog = false;
|
|
|
+ this.$refs.ruleFormRef.resetFields();
|
|
|
+ ElMessage.success("创建规则成功");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
-
|
|
|
+ // announcement
|
|
|
handlePublishAnnouncement() {
|
|
|
const _this = this;
|
|
|
if (this.announcementForm.content === "") {
|
|
|
@@ -669,7 +647,7 @@ export default {
|
|
|
|
|
|
function createAnnouncement() {
|
|
|
let announcementVO = {
|
|
|
- sender: { id: _this.$store.state.user.id, },
|
|
|
+ sender: {id: _this.$store.state.user.id,},
|
|
|
courseId: _this.courseInfo.id,
|
|
|
title: _this.announcementForm.title,
|
|
|
content: _this.announcementForm.content,
|
|
|
@@ -757,7 +735,7 @@ export default {
|
|
|
confirmButtonText: "立即选课",
|
|
|
cancelButtonText: "我再想想",
|
|
|
})
|
|
|
- .then(({ value }) => {
|
|
|
+ .then(({value}) => {
|
|
|
if (value !== this.courseInfo.invitationCode) {
|
|
|
ElMessage.error("选课码错误");
|
|
|
} else {
|
|
|
@@ -832,6 +810,11 @@ export default {
|
|
|
break;
|
|
|
case "project":
|
|
|
//todo
|
|
|
+ break;
|
|
|
+ case "group":
|
|
|
+ const res = (await this.$apis.findGroupRule(this.courseInfo.id)).data;
|
|
|
+ this.isRuleExisted = !res.code;
|
|
|
+ break;
|
|
|
}
|
|
|
},
|
|
|
// comment相关
|
|
|
@@ -853,7 +836,7 @@ export default {
|
|
|
.then(res => {
|
|
|
const msg = res.data.data;
|
|
|
msg.createdAt = this.timestampToTime(msg.createdAt);
|
|
|
- this.commentTree.push({ mainMessage: msg, children: {} });
|
|
|
+ this.commentTree.push({mainMessage: msg, children: {}});
|
|
|
this.commentContent = "";
|
|
|
ElMessage.success("发送成功");
|
|
|
});
|
|
|
@@ -873,7 +856,7 @@ export default {
|
|
|
confirmButtonText: "发送",
|
|
|
cancelButtonText: "取消",
|
|
|
})
|
|
|
- .then(({ value }) => {
|
|
|
+ .then(({value}) => {
|
|
|
if (value === "") {
|
|
|
ElMessage.error("无法发表空评论");
|
|
|
} else {
|