ResourceCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  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. this.$set(this, 'total', 111)
  208. })
  209. },
  210. //知识点题库
  211. examElQuestionBankGroupByKnowledgePoint(){
  212. let obj = {
  213. page:1,
  214. pageSize:6,
  215. disciplineTypeId:this.tableList[this.topCheckIndex].id,
  216. }
  217. examElQuestionBankGroupByKnowledgePoint(obj).then(response => {
  218. this.$set(this, 'topRightList', response.data.records)
  219. })
  220. },
  221. //类型选项卡数据
  222. examElDisciplineTypeList(){
  223. examElDisciplineTypeList({}).then(response => {
  224. this.$set(this, 'tableList', response.data)
  225. this.leftExamUserCoursewareLearningList();
  226. this.rightExamUserCoursewareLearningList();
  227. this.examElQuestionBankGroupByKnowledgePoint();
  228. })
  229. },
  230. //换算分钟
  231. secondsToMinutes(totalSeconds) {
  232. if (typeof totalSeconds !== 'number' || totalSeconds <= 0) {
  233. return 1;
  234. }
  235. return Math.ceil(totalSeconds / 60);
  236. },
  237. },
  238. }
  239. </script>
  240. <style scoped lang="scss">
  241. .resource-card {
  242. .resource-card-page{
  243. background: #fff;
  244. margin-bottom: 12px;
  245. background: rgba(255, 255, 255, 0.95);
  246. border: 1px solid #e8edf5;
  247. border-radius: 16px;
  248. box-shadow: 0 4px 20px rgba(37, 50, 74, 0.06);
  249. padding:20px;
  250. position: relative;
  251. .skip-button{
  252. position: absolute;
  253. top:50px;
  254. right:25px;
  255. color:#409EFF;
  256. cursor: pointer;
  257. font-size: 14px;
  258. line-height:50px;
  259. }
  260. .card-title {
  261. font-size: 16px;
  262. font-weight: 700;
  263. line-height:20px;
  264. color: #333;
  265. margin-bottom:20px;
  266. }
  267. .table-max-big-box{
  268. display: flex;
  269. p{
  270. height:40px;
  271. padding:0 20px;
  272. line-height:40px;
  273. font-size: 14px;
  274. font-weight: 500;
  275. color: #303133;
  276. text-align: center;
  277. }
  278. .table-for-p:nth-child(1){
  279. border-left:1px solid #E4E7ED;
  280. border-top-left-radius:4px;
  281. }
  282. :nth-last-child(2){
  283. border-top-right-radius:4px;
  284. }
  285. .table-for-p{
  286. border-top:1px solid #E4E7ED;
  287. border-right:1px solid #E4E7ED;
  288. border-bottom:1px solid #E4E7ED;
  289. cursor: pointer;
  290. }
  291. .table-null-p{
  292. flex:1;
  293. border-bottom:1px solid #E4E7ED;
  294. }
  295. .check-table-p{
  296. color:#0183fa!important;
  297. border-bottom:none!important;
  298. }
  299. }
  300. .text-null-p{
  301. text-align: center;
  302. font-size:14px;
  303. line-height:400px;
  304. color:#999;
  305. }
  306. .resource-body-top{
  307. height:500px;
  308. border-left:1px solid #E4E7ED;
  309. border-right:1px solid #E4E7ED;
  310. border-bottom:1px solid #E4E7ED;
  311. display: flex;
  312. .left-resource-box{
  313. flex:1;
  314. padding:10px 15px 20px 20px;
  315. overflow: hidden;
  316. .for-max-big-box{
  317. margin-top:15px;
  318. border: 1px solid #e8edf3;
  319. border-radius: 10px;
  320. padding: 14px;
  321. display: flex;
  322. align-items: flex-start;
  323. gap: 12px;
  324. cursor: pointer;
  325. transition: all 0.2s;
  326. background: #fafbfd;
  327. .left-box{
  328. width:40px;
  329. height:40px;
  330. border-radius: 8px;
  331. background: #eef3ff;
  332. text-align: center;
  333. p{
  334. font-size: 20px;
  335. color: #5b95f7;
  336. line-height:40px;
  337. text-align: center;
  338. }
  339. }
  340. .center-box{
  341. flex: 1;
  342. p:nth-child(1){
  343. font-size: 14px;
  344. color: #25324a;
  345. font-weight: 500;
  346. display: block;
  347. margin-bottom: 5px;
  348. /*单行省略号*/
  349. overflow:hidden;
  350. text-overflow:ellipsis;
  351. white-space:nowrap;
  352. }
  353. p:nth-child(2){
  354. font-size: 12px;
  355. color: #93a0b5;
  356. }
  357. }
  358. .right-box{
  359. display: flex;
  360. margin-top:20px;
  361. p{
  362. font-size: 12px;
  363. line-height:20px;
  364. color: #60708a;
  365. }
  366. p:nth-child(1){
  367. margin-right:4px;
  368. }
  369. }
  370. }
  371. .for-max-big-box:hover{
  372. border-color:#5b95f7;
  373. background-color: #f0f6ff;
  374. box-shadow: 0 2px 8px rgba(91,149,247,0.1);
  375. }
  376. }
  377. .right-resource-box{
  378. flex:1;
  379. padding:10px 20px 20px 15px;
  380. overflow: hidden;
  381. .for-max-big-box:nth-child(even){
  382. margin:15px 15px 0 0!important;
  383. }
  384. .for-max-big-box{
  385. margin-top:15px;
  386. border: 1px solid #e8edf3;
  387. border-radius: 10px;
  388. padding: 16px 14px;
  389. display: inline-block;
  390. flex-direction: column;
  391. align-items: center;
  392. gap: 8px;
  393. cursor: pointer;
  394. transition: all 0.2s;
  395. background: #fafbfd;
  396. text-align: center;
  397. width:348px;
  398. height:127px;
  399. p:nth-child(1){
  400. width:36px;
  401. height:36px;
  402. font-size:18px;
  403. border-radius: 50%;
  404. background-color: #eef3ff;
  405. color:#5b95f7;
  406. text-align: center;
  407. line-height:36px;
  408. margin-top:5px;
  409. }
  410. p:nth-child(2){
  411. font-size: 13px;
  412. color: #25324a;
  413. font-weight: 500;
  414. margin-top:10px;
  415. }
  416. p:nth-child(3){
  417. font-size: 12px;
  418. color: #93a0b5;
  419. margin-top:5px;
  420. }
  421. }
  422. .for-max-big-box:hover{
  423. border-color:#5b95f7;
  424. background-color: #f0f6ff;
  425. box-shadow: 0 2px 8px rgba(91,149,247,0.1);
  426. }
  427. }
  428. .resource-title-box{
  429. display: flex;
  430. border-bottom:1px solid #E4E7ED;
  431. p{
  432. font-size: 14px;
  433. line-height:50px;
  434. }
  435. p:nth-child(1){
  436. color: #5b95f7;
  437. margin-right:10px;
  438. }
  439. p:nth-child(2){
  440. flex:1;
  441. color: #25324a;
  442. font-weight: 600;
  443. }
  444. p:nth-child(3){
  445. color:#409EFF;
  446. cursor: pointer;
  447. }
  448. }
  449. }
  450. .resource-body-bottom{
  451. height:500px;
  452. border-left:1px solid #E4E7ED;
  453. border-right:1px solid #E4E7ED;
  454. border-bottom:1px solid #E4E7ED;
  455. .for-max-big-box{
  456. display: inline-block;
  457. border-radius: 10px;
  458. overflow: hidden;
  459. cursor: pointer;
  460. box-shadow: 0 2px 8px rgba(37, 50, 74, 0.08);
  461. transition: transform 0.2s;
  462. margin:15px 0 0 15px;
  463. img{
  464. display: block;
  465. height: 164px;
  466. width: 356px;
  467. }
  468. div{
  469. padding: 12px;
  470. p:nth-child(1){
  471. font-size: 13px;
  472. color: #25324a;
  473. font-weight: 500;
  474. margin-bottom: 4px;
  475. /*单行省略号*/
  476. display:block;
  477. overflow:hidden;
  478. text-overflow:ellipsis;
  479. white-space:nowrap;
  480. }
  481. p:nth-child(2){
  482. font-size: 11px;
  483. color: #93a0b5;
  484. }
  485. }
  486. }
  487. .for-max-big-box:hover{
  488. transform:translateY(-2px),
  489. }
  490. }
  491. }
  492. }
  493. </style>