|
@@ -1,27 +1,44 @@
|
|
|
<template>
|
|
|
<div class="curricula">
|
|
|
+ <!-- 查询条件 -->
|
|
|
<div class="curricula-search">
|
|
|
<div class="curricula-search-condition">
|
|
|
<el-input v-model="search" prefix-icon="el-icon-search">
|
|
|
<el-button slot="append" @click="queryMyCourseList">搜索</el-button>
|
|
|
</el-input>
|
|
|
+ </div>
|
|
|
+ <div class="curricula-search-button">
|
|
|
+ <el-select v-if="userType === 'STUDENT'" v-model="teacher_id">
|
|
|
+ <el-option label="请选择" value="" />
|
|
|
+ <el-option
|
|
|
+ v-for="item in teacher_list"
|
|
|
+ :key="item.teacher_id"
|
|
|
+ :label="item.teacher_name"
|
|
|
+ :value="item.teacher_id"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
<el-select v-model="finish_status">
|
|
|
+ <el-option label="请选择" :value="-1" />
|
|
|
<el-option
|
|
|
v-for="item in finish_status_list"
|
|
|
- :key="item.finish_status"
|
|
|
+ :key="userType === 'TEACHER' ? item.finish_status : item.status"
|
|
|
:label="item.name"
|
|
|
- :value="item.finish_status"
|
|
|
+ :value="userType === 'TEACHER' ? item.finish_status : item.status"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
- </div>
|
|
|
- <div class="curricula-search-button">
|
|
|
<el-button type="primary" @click="queryMyCourseList">查询</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- 课程列表 -->
|
|
|
<div class="curricula-container">
|
|
|
<div class="curricula-container-title">
|
|
|
- <span>课程列表</span>
|
|
|
<div>
|
|
|
+ <span class="title">课程列表</span>
|
|
|
+ <span v-if="userType === 'STUDENT'" class="tip">
|
|
|
+ 你也可以去 学习中心 选择更多的课程。
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div v-if="userType === 'TEACHER'">
|
|
|
<el-button class="create" @click="$router.push('/create_course')">
|
|
|
<div><svg-icon icon-class="create" /><span>创建课程</span></div>
|
|
|
</el-button>
|
|
@@ -29,22 +46,47 @@
|
|
|
</div>
|
|
|
<div class="curricula-container-list">
|
|
|
<el-table :data="courseList">
|
|
|
- <el-table-column prop="name" label="课程名称" width="240" />
|
|
|
- <el-table-column prop="begin_date" label="课程周期" />
|
|
|
- <el-table-column fixed="right" width="80">
|
|
|
- <template slot-scope="scope">
|
|
|
+ <el-table-column
|
|
|
+ :prop="userType === 'TEACHER' ? 'name' : 'course_name'"
|
|
|
+ label="课程名称"
|
|
|
+ width="320"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ v-if="userType === 'STUDENT'"
|
|
|
+ label="教师"
|
|
|
+ prop="teacher_name_desc"
|
|
|
+ width="200"
|
|
|
+ />
|
|
|
+ <el-table-column label="课程周期">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <template v-if="userType === 'TEACHER'">
|
|
|
+ <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
|
|
|
+ </template>
|
|
|
+ <template v-else>
|
|
|
+ <i class="el-icon-date" /> {{ row.date_space_view_text }}
|
|
|
+ </template>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column v-if="userType === 'TEACHER'" fixed="right" width="80">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
<el-dropdown trigger="click">
|
|
|
<span class="el-dropdown-link">
|
|
|
<svg-icon icon-class="more"></svg-icon>
|
|
|
</span>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item @click.native="studentList(scope.row.id)">
|
|
|
+ <el-dropdown-item @click.native="studentList(row.id)">
|
|
|
<svg-icon icon-class="students" /> Students
|
|
|
</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column v-if="userType === 'STUDENT'" label="状态">
|
|
|
+ <template slot-scope="{ row }">
|
|
|
+ <span class="status-name" :style="{ 'background-color': statusColor(row.status) }" />
|
|
|
+ <span :style="{ color: statusColor(row.status) }">{{ row.status_name }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -65,16 +107,23 @@
|
|
|
|
|
|
<script>
|
|
|
import { updateWordPack } from '@/utils/i18n';
|
|
|
-import { pageQueryMyCourseList } from '@/api/table';
|
|
|
-import { GetFinishStatusList_Course } from '@/api/select';
|
|
|
+import { PageQueryMyCourseList, PageQueryMyJoinCourseList_Student } from '@/api/table';
|
|
|
+import {
|
|
|
+ GetFinishStatusList_Course,
|
|
|
+ GetMyJoinCourseTeacherList_Student,
|
|
|
+ GetStudentCourseStatusList
|
|
|
+} from '@/api/select';
|
|
|
|
|
|
export default {
|
|
|
name: 'CurriculaList',
|
|
|
data() {
|
|
|
return {
|
|
|
+ userType: this.$store.state.user.user_type,
|
|
|
search: '',
|
|
|
finish_status_list: [],
|
|
|
- finish_status: 50,
|
|
|
+ teacher_list: [],
|
|
|
+ teacher_id: '',
|
|
|
+ finish_status: -1,
|
|
|
page_capacity: 10,
|
|
|
cur_page: 1,
|
|
|
total_count: 0,
|
|
@@ -84,14 +133,28 @@ export default {
|
|
|
created() {
|
|
|
this.queryMyCourseList();
|
|
|
this.getFinishStatusList_Course();
|
|
|
+ if (this.userType === 'STUDENT') {
|
|
|
+ this.getMyJoinCourseTeacherList_Student();
|
|
|
+ }
|
|
|
updateWordPack({
|
|
|
word_key_list: ['Learn_New_Courses']
|
|
|
});
|
|
|
},
|
|
|
methods: {
|
|
|
getFinishStatusList_Course() {
|
|
|
- GetFinishStatusList_Course().then(({ finish_status_list }) => {
|
|
|
- this.finish_status_list = finish_status_list;
|
|
|
+ if (this.userType === 'TEACHER') {
|
|
|
+ GetFinishStatusList_Course().then(({ finish_status_list }) => {
|
|
|
+ this.finish_status_list = finish_status_list;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ GetStudentCourseStatusList().then(({ status_list }) => {
|
|
|
+ this.finish_status_list = status_list;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getMyJoinCourseTeacherList_Student() {
|
|
|
+ GetMyJoinCourseTeacherList_Student().then(({ teacher_list }) => {
|
|
|
+ this.teacher_list = teacher_list;
|
|
|
});
|
|
|
},
|
|
|
selectTab(status, i) {
|
|
@@ -108,16 +171,44 @@ export default {
|
|
|
this.queryMyCourseList();
|
|
|
},
|
|
|
queryMyCourseList() {
|
|
|
- const queryCriteria = {
|
|
|
- finish_status: this.finish_status,
|
|
|
- name: this.search,
|
|
|
- page_capacity: this.page_capacity,
|
|
|
- cur_page: this.cur_page
|
|
|
- };
|
|
|
- pageQueryMyCourseList(queryCriteria).then(({ course_list, total_count }) => {
|
|
|
- this.courseList = course_list;
|
|
|
- this.total_count = total_count;
|
|
|
- });
|
|
|
+ if (this.userType === 'TEACHER') {
|
|
|
+ const queryCriteria = {
|
|
|
+ finish_status: this.finish_status,
|
|
|
+ name: this.search,
|
|
|
+ page_capacity: this.page_capacity,
|
|
|
+ cur_page: this.cur_page
|
|
|
+ };
|
|
|
+ PageQueryMyCourseList(queryCriteria).then(({ course_list, total_count }) => {
|
|
|
+ this.courseList = course_list;
|
|
|
+ this.total_count = total_count;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ let data = {
|
|
|
+ teacher_id: this.teacher_id,
|
|
|
+ status_list: [this.finish_status],
|
|
|
+ course_name: this.search,
|
|
|
+ page_capacity: this.page_capacity,
|
|
|
+ cur_page: this.cur_page
|
|
|
+ };
|
|
|
+ PageQueryMyJoinCourseList_Student(data).then(({ course_list, total_count }) => {
|
|
|
+ this.courseList = course_list;
|
|
|
+ this.total_count = total_count;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ statusColor(val) {
|
|
|
+ if (val === 0) {
|
|
|
+ return '#68CEFA';
|
|
|
+ }
|
|
|
+ if (val === 1) {
|
|
|
+ return '#2ECE5B';
|
|
|
+ }
|
|
|
+ if (val === 3) {
|
|
|
+ return '#f90';
|
|
|
+ }
|
|
|
+ if (val === 4) {
|
|
|
+ return '#4F8EEC';
|
|
|
+ }
|
|
|
},
|
|
|
studentList(id) {
|
|
|
this.$router.push(`/student_list/index/${id}`);
|
|
@@ -139,11 +230,6 @@ export default {
|
|
|
&-condition {
|
|
|
> .el-input {
|
|
|
width: 528px;
|
|
|
- margin-right: 12px;
|
|
|
- }
|
|
|
-
|
|
|
- .el-select {
|
|
|
- width: 225px;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -151,6 +237,11 @@ export default {
|
|
|
.el-button {
|
|
|
width: 114px;
|
|
|
}
|
|
|
+
|
|
|
+ .el-select {
|
|
|
+ width: 225px;
|
|
|
+ margin-right: 12px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -168,9 +259,14 @@ export default {
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
|
|
|
- > span {
|
|
|
+ .title {
|
|
|
font-size: 20px;
|
|
|
font-weight: 700;
|
|
|
+ margin-right: 36px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .tip {
|
|
|
+ color: #aaa;
|
|
|
}
|
|
|
|
|
|
.create {
|
|
@@ -186,6 +282,8 @@ export default {
|
|
|
&-list {
|
|
|
@include list;
|
|
|
|
|
|
+ margin-top: 0;
|
|
|
+
|
|
|
.el-dropdown {
|
|
|
cursor: pointer;
|
|
|
|
|
@@ -193,6 +291,15 @@ export default {
|
|
|
font-size: 19px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .status-name {
|
|
|
+ display: inline-block;
|
|
|
+ width: 8px;
|
|
|
+ height: 8px;
|
|
|
+ border-radius: 50%;
|
|
|
+ margin-right: 8px;
|
|
|
+ margin-bottom: 1px;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|