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. <div>
  32. <el-button class="create" @click="$router.push('/create_course')">
  33. <svg-icon icon-class="create" /><span>{{ $t('Key285') }}</span>
  34. </el-button>
  35. </div>
  36. </div>
  37. <div class="curricula-teacher-container-list">
  38. <el-table :data="courseList">
  39. <el-table-column prop="name" :label="$t('Key134')" width="320" />
  40. <el-table-column :label="$t('Key250')" width="210">
  41. <template slot-scope="{ row }">
  42. <i class="el-icon-date" /> {{ row.begin_date }} - {{ row.end_date }}
  43. </template>
  44. </el-table-column>
  45. <el-table-column :label="$t('Key129')" width="90">
  46. <template slot-scope="{ row }">
  47. {{ row.is_release === 'true' ? '√' : '' }}
  48. </template>
  49. </el-table-column>
  50. <el-table-column :label="$t('Key136')" width="280" prop="org_name" />
  51. <el-table-column :label="$t('Key280')" prop="creator_name" />
  52. <el-table-column fixed="right" width="80">
  53. <template slot-scope="{ row }">
  54. <el-dropdown trigger="click">
  55. <span class="el-dropdown-link">
  56. <svg-icon icon-class="more" />
  57. </span>
  58. <el-dropdown-menu slot="dropdown">
  59. <el-dropdown-item @click.native="edit(row.id)">
  60. <svg-icon icon-class="edit" /> {{ $t('Key123') }}
  61. </el-dropdown-item>
  62. <el-dropdown-item @click.native="view(row.id)">
  63. <svg-icon icon-class="view" /> {{ $t('Key169') }}
  64. </el-dropdown-item>
  65. <el-dropdown-item v-if="row.is_release === 'false'" @click.native="releaseCourse(row.id, true)">
  66. <svg-icon icon-class="publish" /> {{ $t('Key173') }}
  67. </el-dropdown-item>
  68. <el-dropdown-item v-else @click.native="releaseCourse(row.id, false)">
  69. <svg-icon icon-class="undo" /> {{ $t('Key171') }}
  70. </el-dropdown-item>
  71. <el-dropdown-item @click.native="deleteCourse(row.id)">
  72. <svg-icon icon-class="delete" /> {{ $t('Key172') }}
  73. </el-dropdown-item>
  74. <el-dropdown-item @click.native="studentList(row.id)">
  75. <svg-icon icon-class="students" /> {{ $t('Key296') }}
  76. </el-dropdown-item>
  77. </el-dropdown-menu>
  78. </el-dropdown>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. </div>
  83. </div>
  84. <el-pagination
  85. background
  86. :page-sizes="[10, 20, 30, 40, 50]"
  87. :page-size="page_capacity"
  88. layout="prev, pager, next, total, sizes, jumper"
  89. :total="total_count"
  90. :current-page="cur_page"
  91. @prev-click="changePage"
  92. @next-click="changePage"
  93. @current-change="changePage"
  94. @size-change="changePageSize"
  95. />
  96. </div>
  97. </template>
  98. <script>
  99. import MainMenu from '../components/MainMenu.vue';
  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. components: {
  106. MainMenu
  107. },
  108. data() {
  109. return {
  110. search: '',
  111. finish_status_list: [],
  112. teacher_list: [],
  113. finish_status: -1,
  114. page_capacity: 10,
  115. cur_page: 1,
  116. total_count: 0,
  117. courseList: []
  118. };
  119. },
  120. created() {
  121. this.updateWordPack({
  122. word_key_list: [
  123. 'Key131',
  124. 'Key168',
  125. 'Key295',
  126. 'Key285',
  127. 'Key134',
  128. 'Key250',
  129. 'Key129',
  130. 'Key136',
  131. 'Key280',
  132. 'Key123',
  133. 'Key169',
  134. 'Key171',
  135. 'Key173',
  136. 'Key172',
  137. 'Key296'
  138. ]
  139. });
  140. this.queryMyCourseList();
  141. this.getFinishStatusList_Course();
  142. updateWordPack({
  143. word_key_list: ['Learn_New_Courses']
  144. });
  145. },
  146. methods: {
  147. getFinishStatusList_Course() {
  148. GetFinishStatusList_Course().then(({ finish_status_list }) => {
  149. this.finish_status_list = finish_status_list;
  150. });
  151. },
  152. changePage(newPage) {
  153. this.cur_page = newPage;
  154. this.queryMyCourseList();
  155. },
  156. changePageSize(pageSize) {
  157. this.page_capacity = pageSize;
  158. this.queryMyCourseList();
  159. },
  160. queryMyCourseList() {
  161. PageQueryMyCourseList({
  162. finish_status: this.finish_status,
  163. name: this.search,
  164. page_capacity: this.page_capacity,
  165. cur_page: this.cur_page
  166. }).then(({ course_list, total_count }) => {
  167. this.courseList = course_list;
  168. this.total_count = total_count;
  169. });
  170. },
  171. statusColor(val) {
  172. if (val === 0) return '#68CEFA';
  173. if (val === 1) return '#2ECE5B';
  174. if (val === 3) return '#f90';
  175. if (val === 4) return '#4F8EEC';
  176. },
  177. studentList(id) {
  178. this.$router.push(`/student_list/index/${id}`);
  179. },
  180. edit(id) {
  181. this.$router.push(`/create_course_step_table/course_info?id=${id}`);
  182. },
  183. view(id) {
  184. this.$router.push(`/GoodsDetail?goods_id=${id}&goods_type=201&readonly=true`);
  185. },
  186. releaseCourse(course_id, is_release) {
  187. ReleaseCourse({ course_id, is_release }).then(() => {
  188. this.queryMyCourseList();
  189. this.$message.success(`${is_release ? '' : '取消'}发布课程成功`);
  190. });
  191. },
  192. deleteCourse(id) {
  193. this.$confirm('您确定要删除该课程吗?', '提示', {
  194. confirmButtonText: '确定',
  195. cancelButtonText: '取消',
  196. type: 'warning'
  197. }).then(() => {
  198. DeleteCourse({ id }).then(() => {
  199. this.$message.success('删除课程成功');
  200. this.queryMyCourseList();
  201. });
  202. });
  203. },
  204. changeTab(tab) {
  205. this.$emit('changeTab', tab);
  206. }
  207. }
  208. };
  209. </script>
  210. <style lang="scss">
  211. @import '~@/styles/mixin';
  212. .curricula-teacher {
  213. @include pagination;
  214. &-search {
  215. display: flex;
  216. justify-content: space-between;
  217. &-condition {
  218. > .el-input {
  219. width: 528px;
  220. }
  221. }
  222. &-button {
  223. .el-button {
  224. width: 114px;
  225. }
  226. .el-select {
  227. width: 225px;
  228. margin-right: 12px;
  229. }
  230. }
  231. }
  232. &-container {
  233. width: 100%;
  234. min-height: calc(100vh - 300px);
  235. margin-top: 16px;
  236. background-color: #fff;
  237. border-radius: 8px;
  238. &-title {
  239. display: flex;
  240. align-items: center;
  241. justify-content: space-between;
  242. height: 88px;
  243. padding: 24px 32px;
  244. .title {
  245. margin-right: 36px;
  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>