ResourceCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <!-- 实验室安全素养资源卡 -->
  2. <template>
  3. <div class="resource-card">
  4. <div class="resource-card-page">
  5. <div class="card-title">实验室安全素养资源</div>
  6. <div class="table-max-big-box">
  7. <p class="table-for-p" :class="topCheckIndex == index ? 'check-table-p':''"
  8. @click="topTableButton(index)"
  9. v-for="(item,index) in tableList" :key="index">{{item.disciplineName}}</p>
  10. <p class="table-null-p"></p>
  11. </div>
  12. <div class="resource-body-top">
  13. <div class="left-resource-box">
  14. <div class="resource-title-box">
  15. <p class="el-icon-folder-opened"></p>
  16. <p>学习资料</p>
  17. <p @click="goPage(1)">查看更多</p>
  18. </div>
  19. <p class="text-null-p" v-if="!topLeftList[0]">暂无数据</p>
  20. <div class="for-max-big-box" @click="tableButton(item)"
  21. v-for="(item,index) in topLeftList" :key="index">
  22. <div class="left-box">
  23. <p v-if="item.materialType == 1" class="el-icon-video-play"></p>
  24. <p v-if="item.materialType == 3" class="el-icon-document"></p>
  25. <p v-if="item.materialType == 4" class="el-icon-reading"></p>
  26. </div>
  27. <div class="center-box">
  28. <p>{{ item.coursewareName }}</p>
  29. <p>{{ item.materialType == 4?'文章':item.attachmentType.substring(1) }}</p>
  30. </div>
  31. <div class="right-box">
  32. <p class="el-icon-time"></p>
  33. <p>{{secondsToMinutes(item.minLearningDuration)}}分钟</p>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="right-resource-box">
  38. <div class="resource-title-box">
  39. <p class="el-icon-edit-outline"></p>
  40. <p>题库</p>
  41. <p @click="goPage(2)">查看更多</p>
  42. </div>
  43. <p class="text-null-p" v-if="!topRightList[0]">暂无数据</p>
  44. <div class="for-max-big-box" v-for="(item,index) in topRightList" :key="index" @click="goPage(4,item)">
  45. <p class="el-icon-notebook-2"></p>
  46. <p>{{item.knowledgePointName}}</p>
  47. <p>{{item.questionCount}} 题</p>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. <div class="resource-card-page">
  53. <div class="card-title">视频学习资源</div>
  54. <p class="skip-button" @click="goPage(3)">查看更多</p>
  55. <div class="table-max-big-box">
  56. <p class="table-for-p" :class="bottomCheckIndex == index ? 'check-table-p':''"
  57. @click="bottomTableButton(index)"
  58. v-for="(item,index) in tableList" :key="index">{{item.disciplineName}}</p>
  59. <p class="table-null-p"></p>
  60. </div>
  61. <div class="resource-body-bottom">
  62. <p class="text-null-p" v-if="!bottomList[0]">暂无数据</p>
  63. <div class="for-max-big-box" @click="tableButton(item)"
  64. v-for="(item,index) in bottomList" :key="index">
  65. <img v-if="item.exampleImg" :src="item.exampleImg">
  66. <img v-else src="@/assets/ZDimages/basicsModules/image_420782143223404.png">
  67. <div>
  68. <p>{{item.coursewareName}}</p>
  69. <p>{{secondsToMinutes(item.minLearningDuration)}}分钟 丨 {{item.creditHours}}学时 丨 {{item.points}}积分</p>
  70. </div>
  71. </div>
  72. </div>
  73. <pagination layout="total, prev, pager, next, jumper"
  74. v-show="total>0"
  75. :total="total"
  76. :page.sync="queryParams.page"
  77. :limit.sync="queryParams.pageSize"
  78. @pagination="rightExamUserCoursewareLearningList"
  79. />
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import {
  85. examElDisciplineTypeList,examUserCoursewareLearningRestart,
  86. examUserCoursewareLearningList,examElQuestionBankGroupByKnowledgePoint,
  87. } from "@/api/safetyEducationExaminationNew/index";
  88. export default {
  89. name: 'ResourceCard',
  90. data() {
  91. return {
  92. topCheckIndex:0,
  93. bottomCheckIndex:0,
  94. tableList:[],
  95. tableListBottom:[],
  96. topLeftList:[],
  97. topRightList:[],
  98. bottomList:[],
  99. queryParams:{
  100. page:1,
  101. pageSize:8,
  102. },
  103. total:0
  104. }
  105. },
  106. mounted(){
  107. this.examElDisciplineTypeList();
  108. },
  109. methods:{
  110. //顶部选项切换
  111. topTableButton(index){
  112. if(this.topCheckIndex != index){
  113. this.$set(this,'topCheckIndex',index);
  114. this.leftExamUserCoursewareLearningList();
  115. this.examElQuestionBankGroupByKnowledgePoint();
  116. }
  117. },
  118. bottomTableButton(index){
  119. if(this.bottomCheckIndex != index){
  120. this.$set(this,'bottomCheckIndex',index);
  121. this.$set(this.queryParams,'page',1);
  122. this.rightExamUserCoursewareLearningList();
  123. }
  124. },
  125. tableButton(item){
  126. let self = this;
  127. if(item.learnStatus == 2){
  128. this.$confirm('该课件已学完,是否重置进度重新学习?', "提示", {
  129. confirmButtonText: "确认",
  130. cancelButtonText: "取消",
  131. type: "warning"
  132. }).then(function() {
  133. }).then(() => {
  134. examUserCoursewareLearningRestart({coursewareId:item.coursewareId}).then(response => {
  135. self.$router.push({
  136. path: '/learningMaterials',
  137. query: {
  138. coursewareId: item.coursewareId,
  139. }
  140. })
  141. });
  142. }).catch(() => {});
  143. }else{
  144. this.$router.push({
  145. path: '/learningMaterials',
  146. query: {
  147. coursewareId: item.coursewareId,
  148. }
  149. })
  150. }
  151. },
  152. goPage(type,item){
  153. //1.文章文档 2.刷题 3.视频 4.知识点指向刷题
  154. if(type == 1){
  155. this.$router.push({
  156. path: '/safetyEducationExaminationNew/safetyEducation/knowledgeLearning',
  157. query: {
  158. skipType: 2,
  159. disciplineId:this.tableList[this.topCheckIndex].id,
  160. }
  161. })
  162. }else if(type == 2){
  163. this.$router.push({
  164. path: '/safetyEducationExaminationNew/safetyTest/practiceQuestions',
  165. query: {
  166. disciplineId:this.tableList[this.bottomCheckIndex].id,
  167. }
  168. })
  169. }else if(type == 3){
  170. this.$router.push({
  171. path: '/safetyEducationExaminationNew/safetyEducation/knowledgeLearning',
  172. query: {
  173. skipType: 1,
  174. disciplineId:this.tableList[this.bottomCheckIndex].id,
  175. }
  176. })
  177. }else if(type == 4){
  178. this.$router.push({
  179. path: '/safetyEducationExaminationNew/safetyTest/practiceQuestions',
  180. query: {
  181. knowledgePointId:item.knowledgePointId,
  182. disciplineId:this.tableList[this.bottomCheckIndex].id,
  183. }
  184. })
  185. }
  186. },
  187. //文章
  188. leftExamUserCoursewareLearningList(){
  189. let obj = {
  190. page:1,
  191. pageSize:5,
  192. materialType:2,
  193. disciplineTypeId:this.tableList[this.topCheckIndex].id,
  194. }
  195. examUserCoursewareLearningList(obj).then(response => {
  196. this.$set(this, 'topLeftList', response.data.records)
  197. })
  198. },
  199. //视频
  200. rightExamUserCoursewareLearningList(){
  201. let obj = JSON.parse(JSON.stringify(this.queryParams))
  202. obj.materialType=1,
  203. obj.disciplineTypeId=this.tableList[this.bottomCheckIndex].id,
  204. examUserCoursewareLearningList(obj).then(response => {
  205. this.$set(this, 'bottomList', response.data.records)
  206. this.$set(this, 'total', response.data.total)
  207. })
  208. },
  209. //知识点题库
  210. examElQuestionBankGroupByKnowledgePoint(){
  211. let obj = {
  212. page:1,
  213. pageSize:6,
  214. disciplineTypeId:this.tableList[this.topCheckIndex].id,
  215. }
  216. examElQuestionBankGroupByKnowledgePoint(obj).then(response => {
  217. this.$set(this, 'topRightList', response.data.records)
  218. })
  219. },
  220. //类型选项卡数据
  221. examElDisciplineTypeList(){
  222. examElDisciplineTypeList({}).then(response => {
  223. this.$set(this, 'tableList', response.data)
  224. this.leftExamUserCoursewareLearningList();
  225. this.rightExamUserCoursewareLearningList();
  226. this.examElQuestionBankGroupByKnowledgePoint();
  227. })
  228. },
  229. //换算分钟
  230. secondsToMinutes(totalSeconds) {
  231. if (typeof totalSeconds !== 'number' || totalSeconds <= 0) {
  232. return 1;
  233. }
  234. return Math.ceil(totalSeconds / 60);
  235. },
  236. },
  237. }
  238. </script>
  239. <style scoped lang="scss">
  240. .resource-card {
  241. .resource-card-page{
  242. background: #fff;
  243. margin-bottom: 12px;
  244. background: rgba(255, 255, 255, 0.95);
  245. border: 1px solid #e8edf5;
  246. border-radius: 16px;
  247. box-shadow: 0 4px 20px rgba(37, 50, 74, 0.06);
  248. padding:20px;
  249. position: relative;
  250. .skip-button{
  251. position: absolute;
  252. top:50px;
  253. right:25px;
  254. color:#409EFF;
  255. cursor: pointer;
  256. font-size: 14px;
  257. line-height:50px;
  258. }
  259. .card-title {
  260. font-size: 16px;
  261. font-weight: 700;
  262. line-height:20px;
  263. color: #333;
  264. margin-bottom:20px;
  265. }
  266. .table-max-big-box{
  267. display: flex;
  268. p{
  269. height:40px;
  270. padding:0 20px;
  271. line-height:40px;
  272. font-size: 14px;
  273. font-weight: 500;
  274. color: #303133;
  275. text-align: center;
  276. }
  277. .table-for-p:nth-child(1){
  278. border-left:1px solid #E4E7ED;
  279. border-top-left-radius:4px;
  280. }
  281. :nth-last-child(2){
  282. border-top-right-radius:4px;
  283. }
  284. .table-for-p{
  285. border-top:1px solid #E4E7ED;
  286. border-right:1px solid #E4E7ED;
  287. border-bottom:1px solid #E4E7ED;
  288. cursor: pointer;
  289. }
  290. .table-null-p{
  291. flex:1;
  292. border-bottom:1px solid #E4E7ED;
  293. }
  294. .check-table-p{
  295. color:#0183fa!important;
  296. border-bottom:none!important;
  297. }
  298. }
  299. .text-null-p{
  300. text-align: center;
  301. font-size:14px;
  302. line-height:400px;
  303. color:#999;
  304. }
  305. .resource-body-top{
  306. height:500px;
  307. border-left:1px solid #E4E7ED;
  308. border-right:1px solid #E4E7ED;
  309. border-bottom:1px solid #E4E7ED;
  310. display: flex;
  311. .left-resource-box{
  312. flex:1;
  313. padding:10px 15px 20px 20px;
  314. overflow: hidden;
  315. .for-max-big-box{
  316. margin-top:15px;
  317. border: 1px solid #e8edf3;
  318. border-radius: 10px;
  319. padding: 14px;
  320. display: flex;
  321. align-items: flex-start;
  322. gap: 12px;
  323. cursor: pointer;
  324. transition: all 0.2s;
  325. background: #fafbfd;
  326. .left-box{
  327. width:40px;
  328. height:40px;
  329. border-radius: 8px;
  330. background: #eef3ff;
  331. text-align: center;
  332. p{
  333. font-size: 20px;
  334. color: #5b95f7;
  335. line-height:40px;
  336. text-align: center;
  337. }
  338. }
  339. .center-box{
  340. flex: 1;
  341. p:nth-child(1){
  342. font-size: 14px;
  343. color: #25324a;
  344. font-weight: 500;
  345. display: block;
  346. margin-bottom: 5px;
  347. /*单行省略号*/
  348. overflow:hidden;
  349. text-overflow:ellipsis;
  350. white-space:nowrap;
  351. }
  352. p:nth-child(2){
  353. font-size: 12px;
  354. color: #93a0b5;
  355. }
  356. }
  357. .right-box{
  358. display: flex;
  359. margin-top:20px;
  360. p{
  361. font-size: 12px;
  362. line-height:20px;
  363. color: #60708a;
  364. }
  365. p:nth-child(1){
  366. margin-right:4px;
  367. }
  368. }
  369. }
  370. .for-max-big-box:hover{
  371. border-color:#5b95f7;
  372. background-color: #f0f6ff;
  373. box-shadow: 0 2px 8px rgba(91,149,247,0.1);
  374. }
  375. }
  376. .right-resource-box{
  377. flex:1;
  378. padding:10px 20px 20px 15px;
  379. overflow: hidden;
  380. .for-max-big-box:nth-child(even){
  381. margin:15px 15px 0 0!important;
  382. }
  383. .for-max-big-box{
  384. margin-top:15px;
  385. border: 1px solid #e8edf3;
  386. border-radius: 10px;
  387. padding: 16px 14px;
  388. display: inline-block;
  389. flex-direction: column;
  390. align-items: center;
  391. gap: 8px;
  392. cursor: pointer;
  393. transition: all 0.2s;
  394. background: #fafbfd;
  395. text-align: center;
  396. width:348px;
  397. height:127px;
  398. p:nth-child(1){
  399. width:36px;
  400. height:36px;
  401. font-size:18px;
  402. border-radius: 50%;
  403. background-color: #eef3ff;
  404. color:#5b95f7;
  405. text-align: center;
  406. line-height:36px;
  407. margin-top:5px;
  408. }
  409. p:nth-child(2){
  410. font-size: 13px;
  411. color: #25324a;
  412. font-weight: 500;
  413. margin-top:10px;
  414. }
  415. p:nth-child(3){
  416. font-size: 12px;
  417. color: #93a0b5;
  418. margin-top:5px;
  419. }
  420. }
  421. .for-max-big-box:hover{
  422. border-color:#5b95f7;
  423. background-color: #f0f6ff;
  424. box-shadow: 0 2px 8px rgba(91,149,247,0.1);
  425. }
  426. }
  427. .resource-title-box{
  428. display: flex;
  429. border-bottom:1px solid #E4E7ED;
  430. p{
  431. font-size: 14px;
  432. line-height:50px;
  433. }
  434. p:nth-child(1){
  435. color: #5b95f7;
  436. margin-right:10px;
  437. }
  438. p:nth-child(2){
  439. flex:1;
  440. color: #25324a;
  441. font-weight: 600;
  442. }
  443. p:nth-child(3){
  444. color:#409EFF;
  445. cursor: pointer;
  446. }
  447. }
  448. }
  449. .resource-body-bottom{
  450. height:500px;
  451. border-left:1px solid #E4E7ED;
  452. border-right:1px solid #E4E7ED;
  453. border-bottom:1px solid #E4E7ED;
  454. .for-max-big-box{
  455. display: inline-block;
  456. border-radius: 10px;
  457. overflow: hidden;
  458. cursor: pointer;
  459. box-shadow: 0 2px 8px rgba(37, 50, 74, 0.08);
  460. transition: transform 0.2s;
  461. margin:15px 0 0 15px;
  462. img{
  463. display: block;
  464. height: 164px;
  465. width: 356px;
  466. }
  467. div{
  468. padding: 12px;
  469. p:nth-child(1){
  470. font-size: 13px;
  471. color: #25324a;
  472. font-weight: 500;
  473. margin-bottom: 4px;
  474. /*单行省略号*/
  475. display:block;
  476. overflow:hidden;
  477. text-overflow:ellipsis;
  478. white-space:nowrap;
  479. }
  480. p:nth-child(2){
  481. font-size: 11px;
  482. color: #93a0b5;
  483. }
  484. }
  485. }
  486. .for-max-big-box:hover{
  487. transform:translateY(-2px),
  488. }
  489. }
  490. }
  491. }
  492. </style>