student.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <div class="curricula-student">
  3. <!-- 查询条件 -->
  4. <div class="curricula-student-search">
  5. <div class="curricula-student-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-student-search-button">
  11. <el-select v-model="teacher_id">
  12. <el-option label="-请选择-" value="" />
  13. <el-option
  14. v-for="item in teacher_list"
  15. :key="item.teacher_id"
  16. :label="item.teacher_name"
  17. :value="item.teacher_id"
  18. />
  19. </el-select>
  20. <el-select v-model="finish_status">
  21. <el-option label="-请选择-" :value="-1" />
  22. <el-option
  23. v-for="item in finish_status_list"
  24. :key="item.finish_status"
  25. :label="item.name"
  26. :value="item.finish_status"
  27. ></el-option>
  28. </el-select>
  29. <el-select v-model="buy_status">
  30. <el-option label="-请选择-" :value="-1" />
  31. <el-option
  32. v-for="item in buy_status_list"
  33. :key="item.status"
  34. :label="item.name"
  35. :value="item.status"
  36. ></el-option>
  37. </el-select>
  38. <el-button type="primary" @click="queryMyCourseList">查询</el-button>
  39. </div>
  40. </div>
  41. <!-- 课程列表 -->
  42. <div class="curricula-student-container">
  43. <div class="curricula-student-container-title">
  44. <div>
  45. <span class="title">课程列表</span>
  46. <span class="tip">
  47. 你也可以去 <a @click="goLearningCenter">学习中心</a> 选择更多的课程。
  48. </span>
  49. </div>
  50. </div>
  51. <div class="curricula-student-container-list">
  52. <el-table :data="courseList">
  53. <el-table-column prop="course_name" label="课程名称" width="300" />
  54. <el-table-column label="课程教师" prop="teacher_name_desc" width="360" />
  55. <el-table-column label="课程周期" width="280">
  56. <template slot-scope="{ row }">
  57. <i class="el-icon-date" /> {{ row.date_space_view_text }}
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="完成状态" width="140">
  61. <template slot-scope="{ row }">
  62. <span
  63. class="status-name"
  64. :style="{ 'background-color': statusColor(row.finish_status) }"
  65. />
  66. <span :style="{ color: statusColor(row.finish_status) }">
  67. {{ row.finish_status_name }}
  68. </span>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="购买状态">
  72. <template slot-scope="{ row }">
  73. <span>{{ row.buy_status_name }}</span>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. </div>
  78. </div>
  79. <el-pagination
  80. background
  81. :page-sizes="[10, 20, 30, 40, 50]"
  82. :page-size="page_capacity"
  83. layout="prev, pager, next, total, sizes, jumper"
  84. :total="total_count"
  85. :current-page="cur_page"
  86. @prev-click="changePage"
  87. @next-click="changePage"
  88. @current-change="changePage"
  89. @size-change="changePageSize"
  90. />
  91. </div>
  92. </template>
  93. <script>
  94. import { updateWordPack } from '@/utils/i18n';
  95. import { PageQueryMyJoinCourseList_Student } from '@/api/table';
  96. import {
  97. GetFinishStatusList_Course,
  98. GetMyJoinCourseTeacherList_Student,
  99. GetStudentCourseBuyStatusList
  100. } from '@/api/select';
  101. export default {
  102. data() {
  103. return {
  104. search: '',
  105. // 完成状态
  106. finish_status_list: [],
  107. finish_status: -1,
  108. // 购买状态
  109. buy_status_list: [],
  110. buy_status: -1,
  111. teacher_list: [],
  112. teacher_id: '',
  113. page_capacity: 10,
  114. cur_page: 1,
  115. total_count: 0,
  116. courseList: []
  117. };
  118. },
  119. created() {
  120. this.queryMyCourseList();
  121. this.initData();
  122. updateWordPack({
  123. word_key_list: ['Learn_New_Courses']
  124. });
  125. },
  126. methods: {
  127. initData() {
  128. GetFinishStatusList_Course().then(({ finish_status_list }) => {
  129. this.finish_status_list = finish_status_list;
  130. });
  131. GetStudentCourseBuyStatusList().then(({ status_list }) => {
  132. this.buy_status_list = status_list;
  133. });
  134. GetMyJoinCourseTeacherList_Student().then(({ teacher_list }) => {
  135. this.teacher_list = teacher_list;
  136. });
  137. },
  138. changePage(newPage) {
  139. this.cur_page = newPage;
  140. this.queryMyCourseList();
  141. },
  142. changePageSize(pageSize) {
  143. this.page_capacity = pageSize;
  144. this.queryMyCourseList();
  145. },
  146. queryMyCourseList() {
  147. let data = {
  148. teacher_id: this.teacher_id,
  149. finish_status: this.finish_status,
  150. course_name: this.search,
  151. page_capacity: this.page_capacity,
  152. cur_page: this.cur_page,
  153. buy_status: this.buy_status
  154. };
  155. PageQueryMyJoinCourseList_Student(data).then(({ course_list, total_count }) => {
  156. this.courseList = course_list;
  157. this.total_count = total_count;
  158. });
  159. },
  160. statusColor(val) {
  161. if (val === 50) {
  162. return '#FF5050';
  163. }
  164. if (val === 51) {
  165. return '#2ECE5B';
  166. }
  167. if (val === 52) {
  168. return '#68CEFA';
  169. }
  170. },
  171. goLearningCenter() {
  172. window.location.href = `/GCLS-LC/#/EnterSys`;
  173. }
  174. }
  175. };
  176. </script>
  177. <style lang="scss">
  178. @import '~@/styles/mixin.scss';
  179. .curricula-student {
  180. @include pagination;
  181. &-search {
  182. display: flex;
  183. justify-content: space-between;
  184. &-condition {
  185. > .el-input {
  186. width: 528px;
  187. }
  188. }
  189. &-button {
  190. .el-button {
  191. width: 114px;
  192. }
  193. .el-select {
  194. width: 160px;
  195. margin-right: 12px;
  196. }
  197. }
  198. }
  199. &-container {
  200. width: 100%;
  201. min-height: calc(100vh - 325px);
  202. margin-top: 16px;
  203. background-color: #fff;
  204. border-radius: 8px;
  205. &-title {
  206. height: 88px;
  207. padding: 24px 32px;
  208. display: flex;
  209. justify-content: space-between;
  210. align-items: center;
  211. .title {
  212. font-size: 20px;
  213. font-weight: 700;
  214. margin-right: 36px;
  215. }
  216. .tip {
  217. color: #aaa;
  218. > a {
  219. color: $basicColor;
  220. }
  221. }
  222. .create {
  223. width: 138px;
  224. div {
  225. display: flex;
  226. justify-content: space-around;
  227. }
  228. }
  229. }
  230. &-list {
  231. @include list;
  232. margin-top: 0;
  233. .el-dropdown {
  234. cursor: pointer;
  235. .svg-icon {
  236. font-size: 19px;
  237. }
  238. }
  239. .status-name {
  240. display: inline-block;
  241. width: 8px;
  242. height: 8px;
  243. border-radius: 50%;
  244. margin-right: 8px;
  245. margin-bottom: 1px;
  246. }
  247. }
  248. }
  249. }
  250. </style>