studentWork.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. <template>
  2. <div>
  3. <!-- <el-alert
  4. type="info"
  5. :closable="false"
  6. :description="content">
  7. </el-alert> -->
  8. <div class="workTitle" v-if="title || content">
  9. {{ title }}:<span>{{ content }}</span>
  10. </div>
  11. <div v-else class="workTitle">暂未布置作业</div>
  12. <el-form :inline="true" class="workForm" style="padding: 0 25px">
  13. <el-form-item label="应交学生数">
  14. <!-- <el-input disabled
  15. :value="homeworkStudentNum"></el-input>-->
  16. <div class="inputStyle">{{ homeworkStudentNum }}</div>
  17. </el-form-item>
  18. <el-form-item label="已交学生数">
  19. <!-- <el-input disabled
  20. :value="homeworkNum"></el-input>-->
  21. <div class="inputStyle">{{ homeworkNum }}</div>
  22. </el-form-item>
  23. <el-form-item label="已回复数">
  24. <!-- <el-input disabled
  25. :value="repliedNum"></el-input>-->
  26. <div class="inputStyle">{{ repliedNum }}</div>
  27. </el-form-item>
  28. </el-form>
  29. <div class="tableWrap">
  30. <el-table
  31. :data="tableList"
  32. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  33. >
  34. <el-table-column
  35. align="center"
  36. prop="studentName"
  37. width="160"
  38. label="学生姓名"
  39. >
  40. <template slot-scope="scope">
  41. <div>
  42. {{ scope.row.studentName }}
  43. <span style="color: #f56c6c">({{ scope.row.studentId }})</span>
  44. </div>
  45. </template>
  46. </el-table-column>
  47. <!-- <el-table-column align="center"
  48. prop="studentId"
  49. label="学生编号"></el-table-column> -->
  50. <el-table-column
  51. align="center"
  52. prop="phone"
  53. label="手机号"
  54. width="120"
  55. ></el-table-column>
  56. <el-table-column
  57. align="center"
  58. prop="subjectNames"
  59. label="声部名称"
  60. ></el-table-column>
  61. <el-table-column
  62. align="center"
  63. prop="submitTime"
  64. width="150"
  65. label="提交训练时间"
  66. >
  67. <template slot-scope="scope">
  68. <div>{{ scope.row.submitTime | dateForMinFormat }}</div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column align="center" prop="isView" label="是否提交">
  72. <template slot-scope="scope">
  73. <div>{{ scope.row.submitTime ? "是" : "否" }}</div>
  74. </template>
  75. </el-table-column>
  76. <el-table-column align="center" prop="isView" label="是否查看">
  77. <template slot-scope="scope">
  78. <div>{{ scope.row.isView ? "是" : "否" }}</div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column align="center" prop="isReplied" label="是否回复">
  82. <template slot-scope="scope">
  83. <div>{{ scope.row.isReplied ? "是" : "否" }}</div>
  84. </template>
  85. </el-table-column>
  86. <el-table-column align="center" label="查看训练" width="100px">
  87. <template slot-scope="scope">
  88. <div>
  89. <!-- -->
  90. <el-button
  91. type="text"
  92. v-if="scope.row.urlList && scope.row.submitTime"
  93. @click="lookWork(scope.row)"
  94. >查看训练</el-button
  95. >
  96. </div>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <pagination
  101. :total="rules.total"
  102. :page.sync="rules.page"
  103. :limit.sync="rules.limit"
  104. @pagination="getList"
  105. />
  106. </div>
  107. <el-dialog
  108. title="查看训练"
  109. @close="closeWorkVisible"
  110. width="940px"
  111. append-to-body
  112. :visible.sync="workVisible"
  113. v-if="workVisible"
  114. >
  115. <!-- activeUrl -->
  116. <div class="sliderWrap">
  117. <div class="swiperWrap">
  118. <swiper
  119. ref="mySwiper"
  120. :options="swiperOptions"
  121. :auto-update="true"
  122. :auto-destroy="false"
  123. :delete-instance-on-destroy="false"
  124. :cleanup-styles-on-destroy="false"
  125. >
  126. <swiper-slide
  127. class="swiper-no-swiping"
  128. v-for="(item, index) in activeRow.urlList"
  129. :key="index"
  130. >
  131. <div class="videoWrap" v-if="activeIndex == index">
  132. <video
  133. style="width: 480px"
  134. :src="item"
  135. ref="dialogVideo"
  136. controls="controls"
  137. >
  138. 您的浏览器不支持视频播放
  139. </video>
  140. </div>
  141. </swiper-slide>
  142. <div class="swiper-pagination" slot="pagination"></div>
  143. <div
  144. v-if="activeRow.urlList.length>1"
  145. class="swiper-button-prev swiper-button-white"
  146. @click="prev"
  147. slot="button-prev"
  148. ></div>
  149. <div
  150. v-if="activeRow.urlList.length>1"
  151. class="swiper-button-next swiper-button-white"
  152. @click="next"
  153. slot="button-next"
  154. ></div>
  155. </swiper>
  156. </div>
  157. <div>
  158. <p class="workContainer">训练回复内容:</p>
  159. <div class="msgWrap">
  160. <div
  161. :class="activeCommit.length > 0 ? '' : 'flex'"
  162. v-if="activeCommit.length > 0"
  163. >
  164. <messageBox
  165. v-for="(msg, index) in activeCommit"
  166. :key="index"
  167. :item="msg"
  168. />
  169. <!-- <div
  170. class="msgLi"
  171. v-for="(msg, index) in activeCommit"
  172. :key="index"
  173. >
  174. <div class="info">
  175. <p>{{ msg.userName }}</p>
  176. <p style="color: #999" v-if="msg.createTime">
  177. {{ msg.createTime | dateForMinFormat }}
  178. </p>
  179. </div>
  180. <p class="contant" v-if="msg.msgType == 'TXT'">
  181. {{ msg.content }}
  182. </p>
  183. <el-image
  184. style="width: 100px; height: 100px"
  185. fit="cover"
  186. v-if="msg.msgType == 'IMG'"
  187. :src="msg.content"
  188. :preview-src-list="[msg.content]"
  189. >
  190. </el-image>
  191. <audio
  192. id="audio"
  193. v-if="msg.msgType == 'VC'"
  194. controls
  195. :src="msg.content"
  196. ref="dialogVideo"
  197. >
  198. 您的浏览器不支持音频播放
  199. </audio>
  200. </div> -->
  201. <p class="nomore" v-if="activeCommit.length <= 0">暂无回复内容</p>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </el-dialog>
  207. </div>
  208. </template>
  209. <script>
  210. import { Swiper, SwiperSlide, directive } from "vue-awesome-swiper";
  211. import "swiper/swiper-bundle.css";
  212. import pagination from "@/components/Pagination/index";
  213. import {
  214. findStudentCourseHomeworks,
  215. sumStudentAttendance,
  216. getCourseScheduleHomework,
  217. } from "@/api/buildTeam";
  218. import { findStudentHomeworkComments } from "@/api/operateManager";
  219. import messageBox from "./message-box";
  220. export default {
  221. props: ["courseScheduleId"],
  222. components: {
  223. pagination,
  224. Swiper,
  225. SwiperSlide,
  226. messageBox,
  227. },
  228. directives: {
  229. swiper: directive,
  230. },
  231. data() {
  232. return {
  233. tableList: [],
  234. rules: {
  235. // 分页规则
  236. limit: 10, // 限制显示条数
  237. page: 1, // 当前页
  238. total: 0, // 总条数
  239. },
  240. workVisible: false,
  241. repliedVisible: false,
  242. studentNum: null,
  243. homeworkStudentNum: null,
  244. homeworkNum: null,
  245. repliedNum: null,
  246. activeUrl: null,
  247. content: null,
  248. title: null,
  249. activeRow: null,
  250. activeIndex: 0,
  251. swiperOptions: {
  252. noSwiping: true,
  253. // autoHeight: true,
  254. observer: true, //修改swiper自己或子元素时,自动初始化swiper
  255. observeParents: true, //修改swiper的父元素时,自动初始化swiper
  256. speed: 300,
  257. loop: true,
  258. pagination: ".swiper-pagination",
  259. navigation: {
  260. nextEl: ".swiper-button-next",
  261. prevEl: ".swiper-button-prev",
  262. },
  263. on: {
  264. slideChange: (val) => {
  265. // console.log("掉用slideChange");
  266. this.activeIndex = val.realIndex;
  267. },
  268. },
  269. // Some Swiper option/callback...
  270. },
  271. comUrl: "",
  272. comVisible: false,
  273. activeCommit: [],
  274. };
  275. },
  276. computed: {
  277. swiper() {
  278. return this.$refs.mySwiper.$swiper;
  279. },
  280. },
  281. mounted() {
  282. this.init();
  283. },
  284. activated() {
  285. this.init();
  286. },
  287. methods: {
  288. init() {
  289. sumStudentAttendance({ courseScheduleId: this.courseScheduleId }).then(
  290. (res) => {
  291. if (res.code == 200) {
  292. this.studentNum = res.data.studentNum;
  293. this.homeworkStudentNum = res.data.homeworkStudentNum;
  294. this.homeworkNum = res.data.homeworkNum;
  295. this.repliedNum = res.data.repliedNum;
  296. }
  297. }
  298. );
  299. //this.courseScheduleId
  300. //
  301. getCourseScheduleHomework({
  302. courseScheduleId: this.courseScheduleId,
  303. }).then((res) => {
  304. if (res.code == 200) {
  305. if (res.data) {
  306. this.content = res.data.content;
  307. this.title = res.data.title;
  308. }
  309. this.content ? this.content : (this.content = "");
  310. }
  311. });
  312. this.getList();
  313. },
  314. getList() {
  315. findStudentCourseHomeworks({
  316. search: this.courseScheduleId,
  317. rows: this.rules.limit,
  318. page: this.rules.page,
  319. }).then((res) => {
  320. if (res.code == 200) {
  321. this.rules.total = res.data.total;
  322. this.tableList = res.data.rows.map((item) => {
  323. item.urlList = [];
  324. if (item.url) {
  325. item.url.split(",").forEach((url) => {
  326. if (url) {
  327. item.urlList.push(url);
  328. }
  329. });
  330. }
  331. return item;
  332. });
  333. }
  334. });
  335. },
  336. lookWork(row) {
  337. this.activeRow = row;
  338. findStudentHomeworkComments({
  339. studentCourseHomeworkId: row.studentCourseHomeworkId,
  340. rows: 9999,
  341. }).then((res) => {
  342. if (res.code == 200) {
  343. this.activeCommit = res.data.rows;
  344. this.workVisible = true;
  345. // item.up = false
  346. }
  347. });
  348. },
  349. closeWorkVisible() {
  350. this.activeUrl = "";
  351. // this.activeIndex= -1;
  352. },
  353. prev(val) {
  354. this.$nextTick(() => {
  355. // this.swiper.slidePrev();
  356. this.$refs.mySwiper.$swiper.slidePrev();
  357. });
  358. },
  359. next(val) {
  360. this.$nextTick(() => {
  361. // console.log(this.swiper.slideNext, this.swiper.slideNext());
  362. this.$refs.mySwiper.$swiper.slideNext();
  363. // this.swiper.slideNext();
  364. });
  365. },
  366. lookReplied(row) {
  367. // repliedVisible
  368. },
  369. openAideo(src) {
  370. this.comUrl = src;
  371. this.comVisible = true;
  372. },
  373. },
  374. watch: {
  375. courseScheduleId(val) {
  376. if (val) {
  377. this.init();
  378. }
  379. },
  380. },
  381. };
  382. </script>
  383. <style lang="scss" scoped>
  384. .workForm {
  385. /deep/.el-form-item {
  386. margin-bottom: 0 !important;
  387. }
  388. }
  389. .inputStyle {
  390. width: 100px;
  391. text-align: center;
  392. }
  393. .work {
  394. line-height: 30px;
  395. font-size: 14px;
  396. }
  397. .flex {
  398. display: flex;
  399. flex-direction: row;
  400. height: 100%;
  401. }
  402. .videoWrap {
  403. min-height: 640px;
  404. background-color: #efefef;
  405. align-items: center;
  406. display: flex;
  407. flex-direction: row;
  408. }
  409. .swiper-wrapper {
  410. }
  411. .sliderWrap {
  412. width: 100%;
  413. display: flex;
  414. flex-direction: row;
  415. justify-content: space-between;
  416. .swiperWrap {
  417. width: 480px;
  418. }
  419. .msgWrap {
  420. .nomore {
  421. text-align: center;
  422. width: 100%;
  423. margin-top: 120px;
  424. display: block;
  425. }
  426. width: 400px;
  427. background-color: #efefef;
  428. min-height: 300px;
  429. height: calc(100% - 40px);
  430. overflow-y: auto;
  431. border: 1px solid #e5e5e5;
  432. padding: 5px 20px;
  433. border-radius: 5px;
  434. overflow: auto;
  435. font-size: 14px;
  436. .msgLi {
  437. padding: 10px 0;
  438. .info {
  439. display: flex;
  440. flex-direction: row;
  441. justify-content: space-between;
  442. margin-bottom: 10px;
  443. padding: 0 10px;
  444. }
  445. .contant {
  446. border-bottom: 1px solid #ededed;
  447. line-height: 30px;
  448. padding: 0 10px;
  449. color: #666;
  450. }
  451. }
  452. }
  453. }
  454. .workTitle {
  455. padding-left: 25px;
  456. color: var(--color-primary);
  457. font-weight: bold;
  458. background-color: #f4f4f5;
  459. line-height: 40px;
  460. span {
  461. color: #303133;
  462. font-weight: normal;
  463. }
  464. }
  465. .workContainer {
  466. margin-bottom: 20px;
  467. }
  468. </style>