teacher.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <template>
  2. <div class="curricula-teacher">
  3. <!-- 查询条件 -->
  4. <div class="curricula-teacher-search">
  5. <div class="curricula-teacher-search-condition">
  6. <el-input v-model="search" prefix-icon="el-icon-search" @change="queryMyCourseList">
  7. <el-button slot="append" @click="queryMyCourseList">搜索</el-button>
  8. </el-input>
  9. </div>
  10. <div class="curricula-teacher-search-button">
  11. <el-select v-model="finish_status">
  12. <el-option label="-请选择-" :value="-1" />
  13. <el-option
  14. v-for="item in finish_status_list"
  15. :key="item.finish_status"
  16. :label="item.name"
  17. :value="item.finish_status"
  18. ></el-option>
  19. </el-select>
  20. <el-button type="primary" @click="queryMyCourseList">查询</el-button>
  21. </div>
  22. </div>
  23. <!-- 课程列表 -->
  24. <div class="curricula-teacher-container">
  25. <div class="curricula-teacher-container-title">
  26. <div>
  27. <span class="title">课程列表</span>
  28. </div>
  29. <div>
  30. <el-button class="create" @click="$router.push('/create_course')">
  31. <div><svg-icon icon-class="create" /><span>创建课程</span></div>
  32. </el-button>
  33. </div>
  34. </div>
  35. <div class="curricula-teacher-container-list">
  36. <el-table :data="courseList">
  37. <el-table-column prop="name" label="课程名称" width="320" />
  38. <el-table-column label="课程周期" width="210">
  39. <template slot-scope="{ row }">
  40. <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="已发布" width="80">
  44. <template slot-scope="{ row }">
  45. {{ row.is_release === 'true' ? '√' : '' }}
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="所属机构" width="180" prop="org_name" />
  49. <el-table-column label="创建人" prop="creator_name" />
  50. <el-table-column fixed="right" width="80">
  51. <template slot-scope="{ row }">
  52. <el-dropdown trigger="click">
  53. <span class="el-dropdown-link">
  54. <svg-icon icon-class="more"></svg-icon>
  55. </span>
  56. <el-dropdown-menu slot="dropdown">
  57. <el-dropdown-item @click.native="edit(row.id)">
  58. <svg-icon icon-class="edit" /> 编辑
  59. </el-dropdown-item>
  60. <el-dropdown-item @click.native="view(row.id)">
  61. <svg-icon icon-class="view" /> 查看
  62. </el-dropdown-item>
  63. <el-dropdown-item
  64. v-if="row.is_release === 'false'"
  65. @click.native="releaseCourse(row.id, true)"
  66. >
  67. <svg-icon icon-class="publish" /> 发布
  68. </el-dropdown-item>
  69. <el-dropdown-item v-else @click.native="releaseCourse(row.id, false)">
  70. <svg-icon icon-class="undo" /> 取消发布
  71. </el-dropdown-item>
  72. <el-dropdown-item @click.native="deleteCourse(row.id)">
  73. <svg-icon icon-class="delete" /> 删除
  74. </el-dropdown-item>
  75. <el-dropdown-item @click.native="studentList(row.id)">
  76. <svg-icon icon-class="students" /> 学生列表
  77. </el-dropdown-item>
  78. </el-dropdown-menu>
  79. </el-dropdown>
  80. </template>
  81. </el-table-column>
  82. </el-table>
  83. </div>
  84. </div>
  85. <el-pagination
  86. background
  87. :page-sizes="[10, 20, 30, 40, 50]"
  88. :page-size="page_capacity"
  89. layout="prev, pager, next, total, sizes, jumper"
  90. :total="total_count"
  91. :current-page="cur_page"
  92. @prev-click="changePage"
  93. @next-click="changePage"
  94. @current-change="changePage"
  95. @size-change="changePageSize"
  96. />
  97. </div>
  98. </template>
  99. <script>
  100. import { updateWordPack } from '@/utils/i18n';
  101. import { PageQueryMyCourseList } from '@/api/table';
  102. import { GetFinishStatusList_Course } from '@/api/select';
  103. import { ReleaseCourse, DeleteCourse } from '@/api/course';
  104. export default {
  105. data() {
  106. return {
  107. search: '',
  108. finish_status_list: [],
  109. teacher_list: [],
  110. finish_status: -1,
  111. page_capacity: 10,
  112. cur_page: 1,
  113. total_count: 0,
  114. courseList: []
  115. };
  116. },
  117. created() {
  118. this.queryMyCourseList();
  119. this.getFinishStatusList_Course();
  120. updateWordPack({
  121. word_key_list: ['Learn_New_Courses']
  122. });
  123. },
  124. methods: {
  125. getFinishStatusList_Course() {
  126. GetFinishStatusList_Course().then(({ finish_status_list }) => {
  127. this.finish_status_list = finish_status_list;
  128. });
  129. },
  130. changePage(newPage) {
  131. this.cur_page = newPage;
  132. this.queryMyCourseList();
  133. },
  134. changePageSize(pageSize) {
  135. this.page_capacity = pageSize;
  136. this.queryMyCourseList();
  137. },
  138. queryMyCourseList() {
  139. const queryCriteria = {
  140. finish_status: this.finish_status,
  141. name: this.search,
  142. page_capacity: this.page_capacity,
  143. cur_page: this.cur_page
  144. };
  145. PageQueryMyCourseList(queryCriteria).then(({ course_list, total_count }) => {
  146. this.courseList = course_list;
  147. this.total_count = total_count;
  148. });
  149. },
  150. statusColor(val) {
  151. if (val === 0) {
  152. return '#68CEFA';
  153. }
  154. if (val === 1) {
  155. return '#2ECE5B';
  156. }
  157. if (val === 3) {
  158. return '#f90';
  159. }
  160. if (val === 4) {
  161. return '#4F8EEC';
  162. }
  163. },
  164. studentList(id) {
  165. this.$router.push(`/student_list/index/${id}`);
  166. },
  167. edit(id) {
  168. this.$router.push(`/create_course_step_table/course_info?id=${id}`);
  169. },
  170. view(id) {
  171. this.$router.push(`/GoodsDetail?goods_id=${id}&goods_type=201&readonly=true`);
  172. },
  173. releaseCourse(course_id, is_release) {
  174. ReleaseCourse({ course_id, is_release }).then(() => {
  175. this.queryMyCourseList();
  176. this.$message.success(`${is_release ? '' : '取消'}发布课程成功`);
  177. });
  178. },
  179. deleteCourse(id) {
  180. this.$confirm('您确定要删除该课程吗?', '提示', {
  181. confirmButtonText: '确定',
  182. cancelButtonText: '取消',
  183. type: 'warning'
  184. }).then(() => {
  185. DeleteCourse({ id }).then(() => {
  186. this.$message.success('删除课程成功');
  187. this.queryMyCourseList();
  188. });
  189. });
  190. }
  191. }
  192. };
  193. </script>
  194. <style lang="scss">
  195. @import '~@/styles/mixin.scss';
  196. .curricula-teacher {
  197. @include pagination;
  198. &-search {
  199. display: flex;
  200. justify-content: space-between;
  201. &-condition {
  202. > .el-input {
  203. width: 528px;
  204. }
  205. }
  206. &-button {
  207. .el-button {
  208. width: 114px;
  209. }
  210. .el-select {
  211. width: 225px;
  212. margin-right: 12px;
  213. }
  214. }
  215. }
  216. &-container {
  217. width: 100%;
  218. min-height: calc(100vh - 325px);
  219. margin-top: 16px;
  220. background-color: #fff;
  221. border-radius: 8px;
  222. &-title {
  223. height: 88px;
  224. padding: 24px 32px;
  225. display: flex;
  226. justify-content: space-between;
  227. align-items: center;
  228. .title {
  229. font-size: 20px;
  230. font-weight: 700;
  231. margin-right: 36px;
  232. }
  233. .create {
  234. width: 138px;
  235. div {
  236. display: flex;
  237. justify-content: space-around;
  238. }
  239. }
  240. }
  241. &-list {
  242. @include list;
  243. margin-top: 0;
  244. .el-dropdown {
  245. cursor: pointer;
  246. .svg-icon {
  247. font-size: 19px;
  248. }
  249. }
  250. }
  251. }
  252. }
  253. </style>
  254. <style scoped>
  255. .el-dropdown-menu .svg-icon {
  256. margin-right: 8px;
  257. }
  258. </style>