studyTimes.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. <template>
  2. <div id="studyTimes">
  3. <StudentInfo
  4. :userData="userData"
  5. :totalTime="totalTime"
  6. :numTotal="numTotal"
  7. ></StudentInfo>
  8. <Study-tables
  9. class="box"
  10. ref="study"
  11. v-if="tablesData"
  12. :tablesData="tablesData"
  13. :userData="userData"
  14. :setData="setData"
  15. :getUserInfo="getUserInfo"
  16. ></Study-tables>
  17. </div>
  18. </template>
  19. <script>
  20. import StudyTables from "./component/StudyTables.vue";
  21. import StudentInfo from "@/components/Study/StudentInfo.vue";
  22. export default {
  23. props: ["setData"],
  24. data() {
  25. return {
  26. loading: false,
  27. userData: {},
  28. setTimeDOM: null, //定时器
  29. totalTime: [],
  30. numTotal:0,
  31. tablesData: undefined,
  32. };
  33. },
  34. created() {
  35. this.$api
  36. .inquireGradegradelockPeriodStatus({
  37. gradeId: Number(this.setData.id),
  38. userId: Number(this.setData.userId),
  39. goodsId: Number(this.setData.goodsId),
  40. })
  41. .then((res) => {
  42. if (res.msg) {
  43. this.$alert(`${res.msg}正在操作该页面,请关闭当前页`, "提示", {
  44. dangerouslyUseHTMLString: true,
  45. showClose: false,
  46. }).then((result) => {
  47. const SESSION = sessionStorage.getItem("hoursAudit");
  48. let parseSession = {};
  49. if (SESSION) {
  50. parseSession = JSON.parse(SESSION);
  51. }
  52. if (parseSession.options.length > 1) {
  53. this.$emit("removeTab", this.setData.keyId);
  54. } else {
  55. this.$store
  56. .dispatch("tagsView/delView", this.$route)
  57. .then((results) => {
  58. this.$router.go(-1);
  59. });
  60. }
  61. });
  62. } else {
  63. this.getSetTime();
  64. // 每10秒调用一次 锁定页面
  65. this.setTimeDOM = setInterval(() => {
  66. this.getSetTime();
  67. }, 10000);
  68. }
  69. });
  70. },
  71. mounted() {
  72. this.getUserInfo(true);
  73. },
  74. methods: {
  75. /**
  76. * 每10秒调用一次 锁定页面
  77. */
  78. getSetTime() {
  79. this.$api
  80. .inquireGradegradelockPeriod({
  81. gradeId: Number(this.setData.id),
  82. userId: Number(this.setData.userId),
  83. goodsId: Number(this.setData.goodsId),
  84. })
  85. .then((res) => {});
  86. },
  87. /**
  88. *
  89. * @param {Number} index 节索引
  90. * @param {Number} int 节记录索引
  91. * @param {Object} item 节完整数据
  92. * @remards 节
  93. */
  94. getNewList(index, int, item) {
  95. let data = {
  96. courseId: item.courseId,
  97. moduleId: item.moduleId,
  98. chapterId: item.chapterId,
  99. numIndex: int,
  100. userId: this.setData.userId,
  101. goodsId: this.setData.goodsId,
  102. gradeId: this.setData.id,
  103. };
  104. if (item.type === 3) {
  105. data.sectionId = item.id;
  106. }
  107. if (item.type === 4) {
  108. data.examId = item.id;
  109. }
  110. this.$api.inquireGradegradelistPeriodAuditStatus(data).then((res) => {
  111. this.$set(this.listData.tableData3, index, res.data);
  112. this.getUserInfo();
  113. });
  114. },
  115. /**
  116. *
  117. * @param {Number} a 章索引
  118. * @param {Number} b 节索引
  119. * @param {Number} int 节记录索引
  120. * @param {Object} item 节完整数据
  121. * @remards 章 节
  122. */
  123. getNewListchapt(a, b, int, item) {
  124. let data = {
  125. courseId: item.courseId,
  126. moduleId: item.moduleId,
  127. chapterId: item.chapterId,
  128. numIndex: int,
  129. userId: this.setData.userId,
  130. goodsId: this.setData.goodsId,
  131. gradeId: this.setData.id,
  132. };
  133. if (item.type === 3) {
  134. data.sectionId = item.id;
  135. }
  136. if (item.type === 4) {
  137. data.examId = item.id;
  138. }
  139. this.$api.inquireGradegradelistPeriodAuditStatus(data).then((res) => {
  140. this.$set(
  141. this.listData.tableData2[a].classPeriodSectionList,
  142. b,
  143. res.data
  144. );
  145. this.getUserInfo();
  146. });
  147. },
  148. /**
  149. *
  150. * @param {Number} a 模块索引
  151. * @param {Number} b 章索引
  152. * @param {Number} c 节索引
  153. * @param {Number} int 节记录索引
  154. * @param {Object} item 节完整数据
  155. * @remards 模块 章 节
  156. */
  157. getNewListMores(a, b, c, int, item) {
  158. let data = {
  159. courseId: item.courseId,
  160. moduleId: item.moduleId,
  161. chapterId: item.chapterId,
  162. numIndex: int,
  163. userId: this.setData.userId,
  164. goodsId: this.setData.goodsId,
  165. gradeId: this.setData.id,
  166. };
  167. if (item.type === 3) {
  168. data.sectionId = item.id;
  169. }
  170. if (item.type === 4) {
  171. data.examId = item.id;
  172. }
  173. this.$api.inquireGradegradelistPeriodAuditStatus(data).then((res) => {
  174. this.$set(
  175. this.listData.tableData1[a].classPeriods[b].classPeriodSectionList,
  176. c,
  177. res.data
  178. );
  179. this.getUserInfo();
  180. });
  181. },
  182. //获取用户信息
  183. getUserInfo(isS = false) {
  184. this.$api
  185. .inquireGradegradelistUserlistPeriod({
  186. gradeId: this.setData.id,
  187. userId: this.setData.userId,
  188. goodsId: this.setData.goodsId,
  189. })
  190. .then((res) => {
  191. this.userData = res.rows[0];
  192. isS && this.search();
  193. });
  194. },
  195. changeData(data) {
  196. let obj = {};
  197. data.forEach((e) => {
  198. if (e.type == 5) {
  199. e.classPeriodSectionList = [JSON.parse(JSON.stringify(e))];
  200. }
  201. // 区分章和模块卷
  202. if (e.type == 1) {
  203. e.classPeriods &&
  204. e.classPeriods.forEach((ele, i) => {
  205. if (ele.type == 5) {
  206. ele.classPeriodSectionList = [JSON.parse(JSON.stringify(ele))];
  207. e.arr = [ele];
  208. e.classPeriods.splice(i, 1);
  209. }
  210. });
  211. }
  212. (obj[e.type] || (obj[e.type] = [])).push(e);
  213. });
  214. if (obj["3"]) {
  215. obj["6"] = obj["3"];
  216. delete obj["3"];
  217. }
  218. return obj;
  219. },
  220. //获取学时审核数据
  221. search() {
  222. let data = {
  223. gradeId: this.setData.id,
  224. userId: this.setData.userId,
  225. goodsId: this.setData.goodsId,
  226. };
  227. this.loading = true;
  228. this.$api
  229. .inquireGradegradelistPeriodAudit(data)
  230. .then((res) => {
  231. this.tablesData = this.changeData(res.rows);
  232. if (res.rows.length > 0) {
  233. this.totalTime = [
  234. res.rows[0].startTotalTime,
  235. res.rows[0].endTotalTime,
  236. ];
  237. this.numTotal = res.rows[0].secTotalTime
  238. }
  239. })
  240. .finally(() => {
  241. this.loading = false;
  242. });
  243. },
  244. },
  245. components: {
  246. StudyTables,
  247. StudentInfo,
  248. },
  249. /**
  250. * 离开页面前销毁定时器
  251. */
  252. beforeDestroy() {
  253. if (this.setTimeDOM) {
  254. clearInterval(this.setTimeDOM);
  255. }
  256. },
  257. };
  258. </script>
  259. <style lang="less" scoped>
  260. .top_style {
  261. background: #ffffff;
  262. box-shadow: 0px 0px 8px 0px rgba(217, 217, 217, 0.8);
  263. border-radius: 8px;
  264. padding: 8px 16px;
  265. & > header {
  266. display: flex;
  267. align-items: center;
  268. justify-content: space-between;
  269. height: 48px;
  270. line-height: 48px;
  271. & > .left {
  272. display: flex;
  273. align-items: center;
  274. i {
  275. display: inline-block;
  276. width: 2px;
  277. height: 18px;
  278. background: #0c5dfb;
  279. margin-right: 8px;
  280. }
  281. span {
  282. color: #666;
  283. font-weight: bold;
  284. }
  285. }
  286. & > span {
  287. font-size: 14px;
  288. }
  289. }
  290. & > .info_img {
  291. display: flex;
  292. height: 210px;
  293. ul {
  294. width: 320px;
  295. li {
  296. margin-bottom: 12px;
  297. font-size: 14px;
  298. }
  299. }
  300. .img_by {
  301. flex: 1;
  302. display: flex;
  303. align-items: center;
  304. .pos_bottom {
  305. position: absolute;
  306. z-index: 1;
  307. bottom: 0px;
  308. width: 100%;
  309. height: 32px;
  310. background-color: rgba(53, 53, 53, 0.6);
  311. text-align: center;
  312. color: #fff;
  313. font-size: 16px;
  314. line-height: 32px;
  315. }
  316. & > .photoSty1 {
  317. width: 152px;
  318. height: 208px;
  319. position: relative;
  320. overflow: hidden;
  321. border-radius: 8px;
  322. background-color: #f5f5f5;
  323. margin-right: 75px;
  324. & > img {
  325. width: 106px;
  326. height: 150px;
  327. margin: 29px auto 0px;
  328. display: block;
  329. }
  330. }
  331. & > .photoSty2 {
  332. width: 328px;
  333. height: 208px;
  334. position: relative;
  335. overflow: hidden;
  336. border-radius: 8px;
  337. background-color: #f5f5f5;
  338. margin-right: 75px;
  339. & > img {
  340. width: 243px;
  341. height: 154px;
  342. margin: 27px auto 0px;
  343. display: block;
  344. }
  345. &:last-of-type {
  346. margin-right: 0px;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. /deep/ .el-table__expanded-cell {
  353. background: #f5f5f5;
  354. }
  355. /deep/ .el-table__expanded-cell {
  356. padding: 0px !important;
  357. }
  358. #studyTimes {
  359. display: flex;
  360. flex-direction: column;
  361. }
  362. .imgBox {
  363. width: 100%;
  364. // height: 210px;
  365. border: 1px solid #e2e2e2;
  366. border-radius: 8px;
  367. padding: 8px 8px 3px;
  368. display: flex;
  369. flex-direction: column;
  370. align-items: center;
  371. .imgLabel {
  372. flex: 1;
  373. width: 100%;
  374. border: 1px dotted #e2e2e2;
  375. color: #999;
  376. font-size: 14px;
  377. cursor: pointer;
  378. border-radius: 8px;
  379. .msPhoto {
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. max-width: 100%;
  384. max-height: 270px;
  385. img {
  386. max-width: 100%;
  387. max-height: 270px;
  388. }
  389. }
  390. .imgbbx {
  391. display: flex;
  392. flex-direction: column;
  393. align-items: center;
  394. justify-content: center;
  395. width: 100%;
  396. height: 100%;
  397. i {
  398. font-weight: bold;
  399. margin: 14px 0;
  400. font-size: 24px;
  401. }
  402. }
  403. }
  404. p {
  405. margin: 5px 0px;
  406. }
  407. }
  408. .box {
  409. flex: 1;
  410. overflow: hidden;
  411. }
  412. </style>