studentWork.vue 11 KB

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