selectTeachingClassDialog.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div>
  3. <el-dialog
  4. :center="true"
  5. :visible.sync="show"
  6. :close-on-click-modal="true"
  7. :modal="true"
  8. width="auto"
  9. height="auto"
  10. :append-to-body="true"
  11. class="dialog"
  12. >
  13. <div class="box">
  14. <div class="b_head">
  15. <span>选择授课班级</span>
  16. <svg
  17. @click="close()"
  18. t="1748587270371"
  19. class="icon"
  20. viewBox="0 0 1024 1024"
  21. version="1.1"
  22. xmlns="http://www.w3.org/2000/svg"
  23. p-id="5023"
  24. width="200"
  25. height="200"
  26. >
  27. <path
  28. d="M0 0h1024v1024H0z"
  29. fill="#FF0033"
  30. fill-opacity="0"
  31. p-id="5024"
  32. ></path>
  33. <path
  34. 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"
  35. fill="#fff"
  36. p-id="5025"
  37. ></path>
  38. </svg>
  39. </div>
  40. <div class="b_main" v-loading="loading">
  41. <template v-for="item in classList" >
  42. <div class="b_m_classItem" :class="{'b_m_classItem_active':selectId == item.id}" :key="item.id" v-if="item.name" @click="selectId == item.id ? selectId = '' : selectId = item.id">
  43. <div>{{ item.name }}</div>
  44. <span v-if="item.studentNum>=0">{{ item.studentNum }}名学生</span>
  45. </div>
  46. </template>
  47. <div class="b_m_classItem" @click="editClass" v-if="courseDetail.userid == userId">
  48. <div>
  49. <span>+</span>
  50. <svg t="1756867649445" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10274" width="200" height="200"><path d="M417.664 921.6l317.184-824.32h-63.616L353.152 921.6z" fill="#999999" p-id="10275"></path></svg>
  51. <span>-</span>
  52. </div>
  53. <div>添加/修改班级</div>
  54. </div>
  55. </div>
  56. <div class="b_bottom">
  57. <div @click="close()">取消</div>
  58. <div class="b_b_submit" @click="submit()">{{selectId ? '确定' : '直接进入'}}</div>
  59. </div>
  60. </div>
  61. </el-dialog>
  62. <addClassDialog ref="addClassDialogRef" @success="addClassSuccess"/>
  63. </div>
  64. </template>
  65. <script>
  66. import addClassDialog from './addClassDialog.vue';
  67. export default {
  68. props:{
  69. courseDetail:{
  70. type:Object,
  71. default:()=>{return {}}
  72. },
  73. userId:{
  74. type:String,
  75. default:""
  76. }
  77. },
  78. components:{
  79. addClassDialog
  80. },
  81. data() {
  82. return {
  83. loading: false,
  84. show: false,
  85. data: null,
  86. classList:[],
  87. selectId:"",
  88. };
  89. },
  90. computed: {},
  91. methods: {
  92. open(data) {
  93. this.data = JSON.parse(JSON.stringify(data));
  94. this.classList = this.data.classList;
  95. this.loading = false;
  96. this.show = true;
  97. },
  98. close() {
  99. this.show = false;
  100. this.init();
  101. },
  102. init() {
  103. this.data = null;
  104. this.classList = [];
  105. this.selectId = "";
  106. this.loading = false;
  107. },
  108. submit(){
  109. // console.log(this.selectId)
  110. this.$emit("success",this.selectId)
  111. },
  112. editClass(){
  113. this.$refs.addClassDialogRef.open({classList:this.classList});
  114. },
  115. addClassSuccess(data){
  116. this.classList = data;
  117. this.$emit("changeClassList",this.classList);
  118. this.$refs.addClassDialogRef.close();
  119. },
  120. },
  121. };
  122. </script>
  123. <style scoped>
  124. .dialog >>> .el-dialog {
  125. width: 900px !important;
  126. border-radius: 8px;
  127. padding: 0;
  128. background-color: #fff;
  129. overflow: hidden;
  130. }
  131. .dialog >>> .el-dialog__body {
  132. width: 900px !important;
  133. height: auto;
  134. flex-shrink: 0;
  135. padding: 0;
  136. box-sizing: border-box;
  137. overflow: auto;
  138. }
  139. .dialog >>> .el-dialog__header {
  140. display: none !important;
  141. }
  142. .box {
  143. width: 900px;
  144. height: auto;
  145. background: #fafafa;
  146. border-radius: 15px;
  147. box-shadow: 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  148. 0px 16px 24px 2px rgba(0, 0, 0, 0.04), 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  149. }
  150. .b_head {
  151. width: 100%;
  152. height: 50px;
  153. /* border-radius: 15px 15px 0 0; */
  154. background: #1A1A1A;
  155. display: flex;
  156. align-items: center;
  157. justify-content: space-between;
  158. box-sizing: border-box;
  159. padding: 0 20px;
  160. color: #fff;
  161. }
  162. .b_head > span {
  163. font-size: 18px;
  164. font-weight: bold;
  165. color: #fff;
  166. }
  167. .b_head > img {
  168. width: 20px;
  169. height: 20px;
  170. cursor: pointer;
  171. }
  172. .b_head > svg {
  173. width: 20px;
  174. height: 20px;
  175. cursor: pointer;
  176. }
  177. .b_main {
  178. width: 100%;
  179. height: 400px;
  180. background: #fafafa;
  181. padding: 20px 20px 20px 20px;
  182. box-sizing: border-box;
  183. overflow: auto;
  184. }
  185. .b_bottom {
  186. width: 100%;
  187. height: 70px;
  188. display: flex;
  189. align-items: center;
  190. justify-content: flex-end;
  191. box-sizing: border-box;
  192. padding: 0 20px;
  193. }
  194. .b_bottom>div{
  195. padding: 10px 25px;
  196. background: #fff;
  197. color: #000;
  198. border-radius: 4px;
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. border: solid 1px #EEEEEE;
  203. margin-left: 15px;
  204. cursor: pointer;
  205. font-size: 16px;
  206. }
  207. .b_bottom>.b_b_submit{
  208. background: #1A1A1A;
  209. color: #D4D4D4;
  210. border-color: #1A1A1A;
  211. }
  212. .b_m_classItem{
  213. width: 32%;
  214. height: 85px;
  215. float: left;
  216. margin-bottom: 20px;
  217. display: flex;
  218. align-items: center;
  219. justify-content: center;
  220. flex-direction: column;
  221. background: #fff;
  222. box-shadow: 0px 6px 30px 5px rgba(0, 0, 0, 0.05),
  223. 0px 16px 24px 2px rgba(0, 0, 0, 0.04), 0px 8px 10px -5px rgba(0, 0, 0, 0.08);
  224. border-radius: 12px;
  225. cursor: pointer;
  226. transition: .2s;
  227. }
  228. .b_m_classItem>div{
  229. color: #5F5F5F;
  230. font-size: 16px;
  231. margin: 4px 0;
  232. display: flex;
  233. flex-wrap: wrap;
  234. align-content: center;
  235. }
  236. .b_m_classItem>div>span{
  237. display: flex;
  238. justify-content: center;
  239. align-items: center;
  240. width: 25px;
  241. height: 25px;
  242. border-radius: 4px;
  243. border: solid 1px #B0B0B0;
  244. }
  245. .b_m_classItem>div>svg{
  246. width: 20px;
  247. height: 25px;
  248. margin: 0 5px;
  249. }
  250. .b_m_classItem>span{
  251. color: #A3A3A3;
  252. font-size: 14px;
  253. }
  254. .b_main > div:nth-child(3n-1) {
  255. margin: 0 2%;
  256. }
  257. .b_m_classItem_active{
  258. box-shadow: 4px 4px 4px 0px rgba(138, 238, 138, 0.555);
  259. }
  260. </style>