teacher.vue 8.0 KB

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