student.vue 7.4 KB

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