serverIndexDetail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  1. <template >
  2. <div class="m-container">
  3. <h2>
  4. <!-- <div class="squrt"></div> -->
  5. <el-page-header @back="goBack" :content="studentName"> </el-page-header>
  6. </h2>
  7. <el-card
  8. class="box-card"
  9. v-for="(card, index) in dataList"
  10. :key="index + 'index'"
  11. style="width: 1200px"
  12. >
  13. <p class="timeTitle">{{ card.monday }} - {{ card.sunday }}</p>
  14. <div
  15. class="listWrap"
  16. v-for="(item, subIndex) in card.data"
  17. :key="subIndex"
  18. >
  19. <div class="m-row">
  20. <div class="textWrap">
  21. <p class="title">类型 :</p>
  22. <p class="contant">
  23. {{ item.homeworkType == "HOMEWORK" ? "课堂训练" : "课外训练" }}
  24. </p>
  25. </div>
  26. <div class="textWrap">
  27. <p class="title">布置时间 :</p>
  28. <p
  29. class="contant"
  30. v-if="item.homeworkCreateTime"
  31. style="width: 150px"
  32. >
  33. {{ item.homeworkCreateTime | dateForMinFormat }}
  34. </p>
  35. </div>
  36. <div class="textWrap">
  37. <p class="title">是否点评 :</p>
  38. <p class="contant">{{ item.isReplied ? "是" : "否" }}</p>
  39. </div>
  40. </div>
  41. <div class="m-row" v-if="item.homeworkType == 'HOMEWORK'">
  42. <div class="textWrap">
  43. <p class="title">课程组 :</p>
  44. <p class="contant">{{ item.groupName }}</p>
  45. </div>
  46. <div class="textWrap">
  47. <p class="title">课程编号 :</p>
  48. <p
  49. class="contant"
  50. style="width: 150px"
  51. v-if="item.courseScheduleId"
  52. >
  53. {{ item.courseScheduleId }}
  54. </p>
  55. </div>
  56. <div class="textWrap">
  57. <p class="title">上课时间 :</p>
  58. <p class="contant" style="width: 150px" v-if="item.courseStartTime">
  59. {{ item.courseStartTime | dateForMinFormat }}
  60. </p>
  61. </div>
  62. </div>
  63. <div class="m-row">
  64. <div class="textWrap">
  65. <p class="title">指导老师 :</p>
  66. <p class="contant">{{ item.teacherName }}</p>
  67. </div>
  68. <div class="textWrap">
  69. <p class="title">提交时间 :</p>
  70. <p class="contant" v-if="item.submitTime" style="width: 150px">
  71. {{ item.submitTime | dateForMinFormat }}
  72. </p>
  73. </div>
  74. </div>
  75. <div class="arrowBox" @click="getComment(item, index, subIndex)">
  76. <div class="border">
  77. <i :class="item.up ? 'el-icon-arrow-up' : 'el-icon-arrow-down'"></i>
  78. </div>
  79. </div>
  80. <div style="margin-top: 20px">
  81. <el-collapse-transition>
  82. <div v-show="item.up">
  83. <div class="transition-box">
  84. <div class="cell">
  85. <p style="width: 80px; padding-top: 4px">训练内容:</p>
  86. <el-input
  87. type="textarea"
  88. :disabled="true"
  89. :rows="3"
  90. :value="item.content"
  91. style="font-size: 16px"
  92. placeholder="老师布置的训练"
  93. ></el-input>
  94. </div>
  95. <div class="cell">
  96. <p style="width: 80px">查看训练:</p>
  97. <div v-for="(some, index) in item.homeWork" :key="index">
  98. <p class="homeWork" v-if="some" @click="openVideo(some)">
  99. 训练{{ index + 1 }}
  100. </p>
  101. </div>
  102. </div>
  103. </div>
  104. <div class="msgWrap">
  105. <div
  106. class="msgLi"
  107. v-for="(msg, index) in activeCommit"
  108. :key="index"
  109. >
  110. <div class="info">
  111. <p>{{ msg.userName }}</p>
  112. <p style="color: #999" v-if="msg.createTime">
  113. {{ msg.createTime | dateForMinFormat }}
  114. </p>
  115. </div>
  116. <p class="contant" v-if="msg.msgType == 'TXT'">
  117. {{ msg.content }}
  118. </p>
  119. <el-image
  120. style="width: 100px; height: 100px"
  121. fit="cover"
  122. v-if="msg.msgType == 'IMG'"
  123. :src="msg.content"
  124. :preview-src-list="[msg.content]"
  125. >
  126. </el-image>
  127. <p
  128. v-if="msg.msgType == 'VC'"
  129. class="contant"
  130. style="color: #1890ff"
  131. @click="openAideo(msg.content)"
  132. >
  133. 播放语音
  134. </p>
  135. </div>
  136. </div>
  137. </div>
  138. </el-collapse-transition>
  139. </div>
  140. <el-divider></el-divider>
  141. </div>
  142. </el-card>
  143. <el-dialog
  144. title="查看训练"
  145. width="360px"
  146. append-to-body
  147. :visible.sync="workVisible"
  148. >
  149. <!-- activeUrl -->
  150. <video
  151. style="width: 320px"
  152. id="video"
  153. :src="activeUrl"
  154. ref="dialogVideo"
  155. controls="controls"
  156. >
  157. 您的浏览器不支持视频播放
  158. </video>
  159. </el-dialog>
  160. <el-dialog
  161. title="查看评论"
  162. width="680px"
  163. append-to-body
  164. :visible.sync="comVisible"
  165. >
  166. <audio
  167. id="audio"
  168. controls
  169. style="width: 640px"
  170. :src="comUrl"
  171. ref="dialogVideo"
  172. >
  173. 您的浏览器不支持视频播放
  174. </audio>
  175. </el-dialog>
  176. </div>
  177. </template>
  178. <script>
  179. import {
  180. findServiceStudentDetail,
  181. findStudentHomeworkComments,
  182. } from "@/api/operateManager";
  183. export default {
  184. data() {
  185. return {
  186. studentId: null,
  187. monday: null,
  188. sunday: null,
  189. studentName: null,
  190. show3: false,
  191. dataList: [],
  192. activeCommit: [],
  193. activeUrl: null,
  194. workVisible: false,
  195. comUrl: null,
  196. comVisible: null,
  197. Fsearch: null,
  198. Frules: null,
  199. };
  200. },
  201. mounted() {
  202. this.init();
  203. },
  204. activated() {
  205. this.init();
  206. },
  207. methods: {
  208. init() {
  209. this.studentId = this.$route.query.studentId;
  210. this.studentName = this.$route.query.studentName;
  211. this.monday = this.$route.query.startTime;
  212. this.sunday = this.$route.query.endTime;
  213. // 判断是否带缓存参数
  214. if (this.$route.query.search) {
  215. this.Fsearch = this.$route.query.search;
  216. }
  217. if (this.$route.query.rules) {
  218. this.Frules = this.$route.query.rules;
  219. }
  220. findServiceStudentDetail({
  221. studentId: this.studentId,
  222. monday: this.monday,
  223. sunday: this.sunday,
  224. rows: 9999,
  225. }).then((res) => {
  226. if (res.code == 200) {
  227. this.dataList = res.data;
  228. for (let i in this.dataList) {
  229. this.dataList[i].sunday = this.getNowDateAndSunday(
  230. this.dataList[i].monday
  231. );
  232. this.dataList[i].data = this.dataList[i].data.map((res) => {
  233. res.up = false;
  234. res.homeWork = res.attachments.split(",");
  235. return res;
  236. });
  237. }
  238. // this.dataList = res.data.rows.
  239. }
  240. });
  241. },
  242. goBack() {
  243. this.$store.dispatch('delVisitedViews', this.$route)
  244. this.$router.push({
  245. path: "/serverIndexManager/serverIndexList",
  246. });
  247. },
  248. getComment(item, index, subIndex) {
  249. // 数据处理
  250. if (item.up) {
  251. item.up = false;
  252. this.$forceUpdate();
  253. // item.up = false;
  254. } else {
  255. let extra;
  256. if (item.homeworkType == "EXTRA") {
  257. extra = 1;
  258. } else {
  259. extra = 0;
  260. }
  261. findStudentHomeworkComments({
  262. studentCourseHomeworkId: item.studentHomeworkId,
  263. extra,
  264. rows: 9999,
  265. }).then((res) => {
  266. if (res.code == 200) {
  267. this.activeCommit = res.data.rows;
  268. // item.up = false
  269. for (let i in this.dataList) {
  270. this.dataList[i].data = this.dataList[i].data.map((res) => {
  271. res.up = false;
  272. return res;
  273. });
  274. }
  275. item.up = true;
  276. }
  277. });
  278. }
  279. },
  280. openAideo(src) {
  281. this.comUrl = src;
  282. this.comVisible = true;
  283. },
  284. openVideo(src) {
  285. this.activeUrl = src;
  286. this.workVisible = true;
  287. },
  288. getNowDateAndSunday(time) {
  289. let timestamp = new Date(time.replace(/-/g, "/")).getTime();
  290. let serverDate = new Date(time);
  291. let num = 7 - serverDate.getDay();
  292. if (num == 7) {
  293. num = 0;
  294. }
  295. let sundayTiem = timestamp + num * 24 * 60 * 60 * 1000;
  296. let SundayData = new Date(sundayTiem);
  297. //年
  298. let tomorrowY = SundayData.getFullYear(); //月
  299. let tomorrowM =
  300. SundayData.getMonth() + 1 < 10
  301. ? "0" + (SundayData.getMonth() + 1)
  302. : SundayData.getMonth() + 1;
  303. //日
  304. let tomorrowD =
  305. SundayData.getDate() < 10
  306. ? "0" + SundayData.getDate()
  307. : SundayData.getDate();
  308. let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
  309. return str;
  310. },
  311. },
  312. watch: {
  313. workVisible(val) {
  314. if (!val) {
  315. let video = document.querySelector("#video");
  316. video.pause();
  317. video.currentTime = 0;
  318. this.activeUrl = null;
  319. }
  320. },
  321. comVisible(val) {
  322. if (!val) {
  323. let audio = document.querySelector("#audio");
  324. audio.pause();
  325. audio.currentTime = 0;
  326. this.comUrl = null;
  327. }
  328. },
  329. },
  330. };
  331. </script>
  332. <style lang='scss' scoped>
  333. .timeTitle {
  334. margin-bottom: 20px;
  335. }
  336. .box-card {
  337. margin-bottom: 30px;
  338. .listWrap {
  339. cursor: pointer;
  340. margin-bottom: 50px;
  341. .m-row {
  342. display: flex;
  343. flex-direction: row;
  344. justify-content: flex-start;
  345. font-size: 14px;
  346. .textWrap {
  347. margin-right: 150px;
  348. display: flex;
  349. flex-direction: row;
  350. justify-content: flex-start;
  351. p {
  352. line-height: 30px;
  353. }
  354. .title {
  355. width: 80px;
  356. margin-right: 10px;
  357. text-align: left;
  358. }
  359. .contant {
  360. text-align: left;
  361. width: 150px;
  362. }
  363. }
  364. }
  365. .arrowBox {
  366. display: flex;
  367. flex-direction: row;
  368. justify-content: center;
  369. .border {
  370. margin-top: 20px;
  371. width: 120px;
  372. border: 1px solid #dedede;
  373. border-radius: 5px;
  374. display: flex;
  375. flex-direction: row;
  376. justify-content: center;
  377. height: 30px;
  378. line-height: 30px;
  379. i {
  380. font-size: 18px;
  381. line-height: 30px;
  382. color: #999;
  383. }
  384. }
  385. }
  386. }
  387. .cell {
  388. display: flex;
  389. flex-direction: row;
  390. justify-content: flex-start;
  391. margin-bottom: 20px;
  392. line-height: 30px;
  393. font-size: 14px;
  394. .homeWork {
  395. width: 80px;
  396. text-align: center;
  397. border: 1px solid #e5e5e5;
  398. height: 30px;
  399. line-height: 30px;
  400. border-radius: 4px;
  401. margin-right: 20px;
  402. font-size: 14px;
  403. cursor: pointer;
  404. }
  405. }
  406. .msgWrap {
  407. border: 1px solid #e5e5e5;
  408. padding: 5px 20px;
  409. border-radius: 5px;
  410. min-height: 150px;
  411. overflow: auto;
  412. font-size: 14px;
  413. .msgLi {
  414. padding: 10px 0;
  415. .info {
  416. display: flex;
  417. flex-direction: row;
  418. justify-content: space-between;
  419. margin-bottom: 10px;
  420. padding: 0 10px;
  421. }
  422. .contant {
  423. border-bottom: 1px solid #ededed;
  424. line-height: 30px;
  425. padding: 0 10px;
  426. color: #666;
  427. }
  428. }
  429. }
  430. }
  431. </style>