studentWork.vue 11 KB

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