|
|
@@ -1,5 +1,6 @@
|
|
|
<template>
|
|
|
<div class="course-detail-page">
|
|
|
+ <!--课程信息-->
|
|
|
<div v-if="courseInfo!==null" class="course-detail-container">
|
|
|
<!--课程基本信息-->
|
|
|
<el-card>
|
|
|
@@ -66,7 +67,7 @@
|
|
|
<el-button>添加测试</el-button>
|
|
|
</template>
|
|
|
</el-popover>
|
|
|
- <el-popover v-if="tabName==='notice'"
|
|
|
+ <el-popover v-else-if="tabName==='notice'"
|
|
|
v-model:visible="noticePopover"
|
|
|
:width="160"
|
|
|
placement="bottom">
|
|
|
@@ -103,15 +104,19 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</el-popover>
|
|
|
- <el-button v-if="tabName==='group'&&isRuleExisted!==null"
|
|
|
- plain type="primary" :disabled="isRuleExisted" @click="setRule">
|
|
|
- {{ isRuleExisted ? '已开放组队' : '开放组队' }}
|
|
|
+ <el-button v-else-if="tabName==='group'"
|
|
|
+ plain type="primary" :disabled="isRuleExisted||isRuleExisted===null" @click="setRule">
|
|
|
+ {{ isRuleExisted === null ? null : (isRuleExisted ? '已开放组队' : '开放组队') }}
|
|
|
</el-button>
|
|
|
- <el-upload v-if="tabName==='courseware'" :http-request="handleFileUploading"
|
|
|
+ <el-upload v-else-if="tabName==='courseware'" :http-request="handleFileUploading"
|
|
|
:on-success="handleFileUploadSuccess"
|
|
|
:show-file-list="false" action="">
|
|
|
<el-button plain type="primary">上传课件</el-button>
|
|
|
</el-upload>
|
|
|
+ <el-button v-else-if="tabName==='project'" @click="projectDialogVisible=true"
|
|
|
+ plain type="primary">
|
|
|
+ 新建项目
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!--tab内容-->
|
|
|
@@ -252,6 +257,24 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div v-else-if="tabName==='project'">
|
|
|
+ <el-tabs v-if="projects!==null" v-model="projectTabName" type="border-card">
|
|
|
+ <el-tab-pane label="公开项目" name="public">
|
|
|
+ <div v-if="projects.public.length===0">
|
|
|
+ 当前没有公开项目
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ {{ projects.public }}
|
|
|
+ </div>
|
|
|
+ </el-tab-pane>
|
|
|
+ <el-tab-pane label="私有项目" name="private">
|
|
|
+ <div v-if="projects.private.length===0">
|
|
|
+ 当前没有私有项目
|
|
|
+ </div>
|
|
|
+ <div v-else>{{ projects.private }}</div>
|
|
|
+ </el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</el-card>
|
|
|
</div>
|
|
|
@@ -293,6 +316,29 @@
|
|
|
<el-button plain type="danger" @click="beforeRuleFormClose">我再想想</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <!--新建项目-->
|
|
|
+ <el-dialog v-model="projectDialogVisible" title="新建项目"
|
|
|
+ :before-close="handleProjectFormCancel">
|
|
|
+ <el-form :model="projectForm" ref="projectFormRef">
|
|
|
+ <el-form-item label="项目名称" prop="name">
|
|
|
+ <el-input v-model="projectForm.name" placeholder="请输入项目名称"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="项目描述" prop="description">
|
|
|
+ <el-input v-model="projectForm.description" placeholder="请输入项目描述"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="是否公开" prop="isPublic">
|
|
|
+ <el-select v-model="projectForm.isPublic">
|
|
|
+ <el-option label="公开" :value="true" />
|
|
|
+ <el-option label="私有" :value="false" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <el-button type="primary" @click="handleProjectFormConfirm">
|
|
|
+ 确认
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -398,6 +444,15 @@ export default {
|
|
|
uploadTime: "2021-12-12 08:22:23",
|
|
|
url: ""
|
|
|
}],
|
|
|
+ // project
|
|
|
+ projects: null,
|
|
|
+ projectTabName: "public",
|
|
|
+ projectDialogVisible: false,
|
|
|
+ projectForm: {
|
|
|
+ name: "",
|
|
|
+ description: "",
|
|
|
+ isPublic: false,
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -782,6 +837,7 @@ export default {
|
|
|
},
|
|
|
// tab页相关
|
|
|
async switchTab(tabName) {
|
|
|
+ const _this = this;
|
|
|
switch (tabName) {
|
|
|
case "task":
|
|
|
if (this.isTeacher) {
|
|
|
@@ -809,11 +865,16 @@ export default {
|
|
|
this.commentTree = (await this.$apis.getCommentsByCourseId(this.$route.params.id)).data.data;
|
|
|
break;
|
|
|
case "project":
|
|
|
- //todo
|
|
|
+ const projectRes = (await _this.$apis.findProjectsByCourse(_this.courseInfo.id)).data;
|
|
|
+ if (projectRes.code) {
|
|
|
+ ElMessage.error(projectRes.message);
|
|
|
+ } else {
|
|
|
+ _this.projects = projectRes.data;
|
|
|
+ }
|
|
|
break;
|
|
|
case "group":
|
|
|
- const res = (await this.$apis.findGroupRule(this.courseInfo.id)).data;
|
|
|
- this.isRuleExisted = !res.code;
|
|
|
+ const groupRes = (await this.$apis.findGroupRule(this.courseInfo.id)).data;
|
|
|
+ this.isRuleExisted = !groupRes.code;
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
@@ -884,6 +945,30 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ // project
|
|
|
+ handleProjectFormCancel(){
|
|
|
+ const _this = this;
|
|
|
+ _this.projectDialogVisible = false;
|
|
|
+ _this.$refs.projectFormRef.resetFields();
|
|
|
+ },
|
|
|
+ async handleProjectFormConfirm(){
|
|
|
+ const _this = this;
|
|
|
+ const res = (await _this.$apis.createProject({
|
|
|
+ courseId: _this.courseInfo.id,
|
|
|
+ ..._this.projectForm,
|
|
|
+ })).data;
|
|
|
+ if(res.code){
|
|
|
+ ElMessage.error(res.message);
|
|
|
+ }else{
|
|
|
+ if(_this.projectForm.isPublic){
|
|
|
+ _this.projects.public.push(res.data);
|
|
|
+ }else{
|
|
|
+ _this.projects.private.push(res.data);
|
|
|
+ }
|
|
|
+ _this.projectDialogVisible = false;
|
|
|
+ _this.$refs.projectFormRef.resetFields();
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|