ResourceCard.vue 13 KB

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