studyTimes.vue 9.5 KB

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