selectTeachingClassDialog.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div class="opkDialogHeader">
  3. <el-dialog v-model="show" :show-close="false">
  4. <template #header>
  5. <div class="b_head">
  6. <span>添加班级</span>
  7. <svg
  8. @click="close()"
  9. t="1748587270371"
  10. class="icon"
  11. viewBox="0 0 1024 1024"
  12. version="1.1"
  13. xmlns="http://www.w3.org/2000/svg"
  14. p-id="5023"
  15. width="200"
  16. height="200"
  17. >
  18. <path
  19. d="M0 0h1024v1024H0z"
  20. fill="#FF0033"
  21. fill-opacity="0"
  22. p-id="5024"
  23. ></path>
  24. <path
  25. d="M240.448 168l2.346667 2.154667 289.92 289.941333 279.253333-279.253333a42.666667 42.666667 0 0 1 62.506667 58.026666l-2.133334 2.346667-279.296 279.210667 279.274667 279.253333a42.666667 42.666667 0 0 1-58.005333 62.528l-2.346667-2.176-279.253333-279.253333-289.92 289.962666a42.666667 42.666667 0 0 1-62.506667-58.005333l2.154667-2.346667 289.941333-289.962666-289.92-289.92a42.666667 42.666667 0 0 1 57.984-62.506667z"
  26. fill="#fff"
  27. p-id="5025"
  28. ></path>
  29. </svg>
  30. </div>
  31. </template>
  32. <div class="b_main" v-loading="loading">
  33. <template v-for="item in classList">
  34. <div
  35. class="b_m_classItem"
  36. :class="{ b_m_classItem_active: selectId == item.id }"
  37. :key="item.id"
  38. v-if="item.name"
  39. >
  40. <!-- @click="
  41. selectId == item.id ? (selectId = '') : (selectId = item.id)
  42. " -->
  43. <div>{{ item.name }}</div>
  44. <span v-if="item.studentNum >= 0"
  45. >{{ item.studentNum }} 名学生
  46. </span>
  47. </div>
  48. </template>
  49. <div
  50. class="b_m_classItem"
  51. @click="editClass"
  52. >
  53. <div>
  54. <span>+</span>
  55. <svg
  56. t="1756867649445"
  57. class="icon"
  58. viewBox="0 0 1024 1024"
  59. version="1.1"
  60. xmlns="http://www.w3.org/2000/svg"
  61. p-id="10274"
  62. width="200"
  63. height="200"
  64. >
  65. <path
  66. d="M417.664 921.6l317.184-824.32h-63.616L353.152 921.6z"
  67. fill="#999999"
  68. p-id="10275"
  69. ></path>
  70. </svg>
  71. <span>-</span>
  72. </div>
  73. <div>添加或修改班级</div>
  74. </div>
  75. </div>
  76. </el-dialog>
  77. </div>
  78. <addClassDialog
  79. ref="addClassDialogRef"
  80. :courseDetail="courseDetail"
  81. @success="getCourseList"
  82. />
  83. </template>
  84. <script setup>
  85. import { ref } from "vue";
  86. import { userInfoStore } from "../../stores/counter";
  87. import addClassDialog from "./addClassDialog.vue";
  88. const emit = defineEmits(["success", "changeClassList"]);
  89. import axios from '@/services/config'
  90. const courseDetail = ref({});
  91. const loading = ref(false);
  92. const show = ref(false);
  93. const classList = ref([]);
  94. const selectId = ref("");
  95. const userInfo = userInfoStore();
  96. const addClassDialogRef = ref(null);
  97. const getClasslist = (options) => {
  98. courseDetail.value = JSON.parse(JSON.stringify(options));
  99. getCourseList();
  100. loading.value = true;
  101. show.value = true;
  102. };
  103. const getCourseList = () => {
  104. axios.get('https://pbl.cocorobo.cn/api/pbl/selectCourseDetail2',{
  105. params: { courseId: courseDetail.value.courseId }
  106. })
  107. .then(res => {
  108. console.log(res);
  109. classList.value = res[3]
  110. loading.value = false
  111. })
  112. .catch(err=>{
  113. console.log(err);
  114. loading.value = false
  115. })
  116. };
  117. const close = () => {
  118. show.value = false;
  119. }
  120. const editClass = () => {
  121. addClassDialogRef.value.open({ classList: classList.value });
  122. };
  123. defineExpose({
  124. getClasslist,
  125. });
  126. </script>
  127. <style scoped>
  128. .opkDialogHeader >>> .el-dialog {
  129. width: 900px !important;
  130. border-radius: 8px;
  131. padding: 0;
  132. background-color: #fff;
  133. overflow: hidden;
  134. border-radius: 8px !important;
  135. }
  136. .opkDialogHeader >>> .el-dialog__body {
  137. padding: 0 !important;
  138. background: #fafafa !important;
  139. }
  140. .opkDialogHeader >>> .el-dialog__header { /* 注意这里没有 :deep,因为是全局 */
  141. /* background: #2575fc !important; */
  142. padding: 0 !important;margin: 0 !important;
  143. }
  144. .box {
  145. width: 900px;
  146. height: auto;
  147. background: #fafafa;
  148. border-radius: 15px;
  149. box-shadow:
  150. 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  151. 0px 16px 24px 2px rgba(0, 0, 0, 0.04),
  152. 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  153. }
  154. .b_head {
  155. width: 100%;
  156. height: 50px;
  157. /* border-radius: 15px 15px 0 0; */
  158. background: #1a1a1a;
  159. display: flex;
  160. align-items: center;
  161. justify-content: space-between;
  162. box-sizing: border-box;
  163. padding: 0 20px;
  164. color: #fff;
  165. }
  166. .b_head > span {
  167. font-size: 18px;
  168. font-weight: bold;
  169. color: #fff;
  170. }
  171. .b_head > img {
  172. width: 20px;
  173. height: 20px;
  174. cursor: pointer;
  175. }
  176. .b_head > svg {
  177. width: 20px;
  178. height: 20px;
  179. cursor: pointer;
  180. }
  181. .b_main {
  182. width: 100%;
  183. height: 400px;
  184. background: #fafafa;
  185. padding: 20px 20px 20px 20px;
  186. box-sizing: border-box;
  187. overflow: auto;
  188. }
  189. .b_bottom {
  190. width: 100%;
  191. height: 70px;
  192. display: flex;
  193. align-items: center;
  194. justify-content: flex-end;
  195. box-sizing: border-box;
  196. padding: 0 20px;
  197. }
  198. .b_bottom > div {
  199. padding: 10px 25px;
  200. /* background: #fff; */
  201. color: #000;
  202. border-radius: 4px;
  203. display: flex;
  204. align-items: center;
  205. justify-content: center;
  206. border: solid 1px #eeeeee;
  207. margin-left: 15px;
  208. cursor: pointer;
  209. font-size: 16px;
  210. }
  211. .b_bottom > .b_b_submit {
  212. background: #1a1a1a;
  213. color: #d4d4d4;
  214. border-color: #1a1a1a;
  215. }
  216. .b_m_classItem {
  217. width: 32%;
  218. height: 85px;
  219. float: left;
  220. margin-bottom: 20px;
  221. display: flex;
  222. align-items: center;
  223. justify-content: center;
  224. flex-direction: column;
  225. background: #fff;
  226. box-shadow:
  227. 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  228. 0px 16px 24px 2px rgba(0, 0, 0, 0.04),
  229. 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  230. border-radius: 12px;
  231. cursor: pointer;
  232. transition: 0.2s;
  233. }
  234. .b_m_classItem > div {
  235. color: #5f5f5f;
  236. font-size: 16px;
  237. margin: 4px 0;
  238. display: flex;
  239. flex-wrap: wrap;
  240. align-content: center;
  241. }
  242. .b_m_classItem > div > span {
  243. display: flex;
  244. justify-content: center;
  245. align-items: center;
  246. width: 25px;
  247. height: 25px;
  248. border-radius: 4px;
  249. border: solid 1px #b0b0b0;
  250. }
  251. .b_m_classItem > div > svg {
  252. width: 20px;
  253. height: 25px;
  254. margin: 0 5px;
  255. }
  256. .b_m_classItem > span {
  257. color: #a3a3a3;
  258. font-size: 14px;
  259. }
  260. .b_main > div:nth-child(3n-1) {
  261. margin: 0 2%;
  262. }
  263. .b_m_classItem_active {
  264. box-shadow: 4px 4px 4px 0px rgba(138, 238, 138, 0.555);
  265. }
  266. .b_m_noClassMsg {
  267. width: 100%;
  268. height: 100%;
  269. display: flex;
  270. justify-content: center;
  271. align-items: center;
  272. }
  273. </style>