examTask.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <!-- 考试任务 -->
  2. <template>
  3. <view class="examTask-component">
  4. <view class="card">
  5. <view class="card-header">
  6. <view class="header-left">
  7. <view class="card-title">考试任务</view>
  8. <view class="header-subtitle">待完成的学习考试任务</view>
  9. </view>
  10. <text class="header-link" @click="goToPage('1')">更多 ›</text>
  11. </view>
  12. <view class="card-body">
  13. <view class="for-max-box" @click="goToPage('2',item)"
  14. v-for="(item,index) in onlineExamList" :key="index">
  15. <view class="left-box">
  16. <view>{{item.examName}}</view>
  17. <view>待完成</view>
  18. </view>
  19. <view class="right-box">›</view>
  20. </view>
  21. <view v-if="!onlineExamList[0]" class="empty-tip">暂无考试任务</view>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. examUserExamStudyTaskList,
  29. } from '@/pages_safetyEducationExamination/api/index.js'
  30. export default {
  31. data() {
  32. return {
  33. onlineExamList:[],
  34. }
  35. },
  36. created() {
  37. },
  38. mounted() {
  39. this.examUserExamStudyTaskList();
  40. },
  41. methods: {
  42. goToPage(type,item){
  43. if(type == 1){
  44. //考试列表
  45. }else if(type == 2){
  46. //开始考试相关业务
  47. }
  48. },
  49. async examUserExamStudyTaskList() {
  50. try {
  51. let obj = { page: 1, pageSize: 1, examStatus: 2, isSpecialExam: false };
  52. const { data } = await examUserExamStudyTaskList(obj);
  53. if (data.code === 200) {
  54. this.$set(this,'onlineExamList',data.data.records);
  55. }
  56. } catch (e) { console.error('获取考试任务失败', e); }
  57. },
  58. },
  59. }
  60. </script>
  61. <style lang="stylus" scoped>
  62. .examTask-component {
  63. margin: 0 32rpx 32rpx;
  64. .card {
  65. background: #fff;
  66. border-radius: 24rpx;
  67. overflow: hidden;
  68. margin-bottom: 24rpx;
  69. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
  70. border: 1px solid #dde3ed;
  71. }
  72. .card-header {
  73. padding: 20rpx 28rpx;
  74. display: flex;
  75. justify-content: space-between;
  76. align-items: center;
  77. .card-title {
  78. font-size: 28rpx;
  79. color: #333;
  80. }
  81. .header-subtitle{
  82. margin-top:10rpx;
  83. font-size:22rpx;
  84. color:#8896a7;
  85. }
  86. .header-link {
  87. padding:10rpx 20rpx;
  88. font-size: 24rpx;
  89. color: #1857d4;
  90. }
  91. }
  92. .card-body {
  93. padding: 0 28rpx 24rpx;
  94. .for-max-box:nth-child(1){
  95. margin-top:0;
  96. }
  97. .for-max-box{
  98. margin-top:20rpx;
  99. display: flex;
  100. background-color:#f4f6fa;
  101. padding: 20rpx 24rpx;
  102. border-radius: 16rpx;
  103. .left-box{
  104. flex:1;
  105. view:nth-child(1){
  106. font-size:26rpx;
  107. margin-bottom:4rpx;
  108. }
  109. view:nth-child(2){
  110. font-size:22rpx;
  111. color:#8896a7;
  112. }
  113. }
  114. .right-box{
  115. line-height:60rpx;
  116. font-size:40rpx;
  117. color:#8896a7;
  118. }
  119. }
  120. .empty-tip{
  121. text-align: center;
  122. line-height:40rpx;
  123. color:#8896a7;
  124. font-size:24rpx;
  125. }
  126. }
  127. }
  128. </style>