studentWork.vue 11 KB

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