examTask.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. uni.navigateTo({
  46. url: '/pages_safetyEducationExamination/views/exam/index',
  47. });
  48. }else if(type == 2){
  49. //开始考试相关业务
  50. }
  51. },
  52. async examUserExamStudyTaskList() {
  53. try {
  54. let obj = { page: 1, pageSize: 1, examStatus: 2, isSpecialExam: false };
  55. const { data } = await examUserExamStudyTaskList(obj);
  56. if (data.code === 200) {
  57. this.$set(this,'onlineExamList',data.data.records);
  58. }
  59. } catch (e) { console.error('获取考试任务失败', e); }
  60. },
  61. },
  62. }
  63. </script>
  64. <style lang="stylus" scoped>
  65. .examTask-component {
  66. margin: 0 32rpx 32rpx;
  67. .card {
  68. background: #fff;
  69. border-radius: 24rpx;
  70. overflow: hidden;
  71. margin-bottom: 24rpx;
  72. box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.03);
  73. border: 1px solid #dde3ed;
  74. }
  75. .card-header {
  76. padding: 20rpx 28rpx;
  77. display: flex;
  78. justify-content: space-between;
  79. align-items: center;
  80. .card-title {
  81. font-size: 28rpx;
  82. color: #333;
  83. }
  84. .header-subtitle{
  85. margin-top:10rpx;
  86. font-size:22rpx;
  87. color:#8896a7;
  88. }
  89. .header-link {
  90. padding:10rpx 20rpx;
  91. font-size: 24rpx;
  92. color: #1857d4;
  93. }
  94. }
  95. .card-body {
  96. padding: 0 28rpx 24rpx;
  97. .for-max-box:nth-child(1){
  98. margin-top:0;
  99. }
  100. .for-max-box{
  101. margin-top:20rpx;
  102. display: flex;
  103. background-color:#f4f6fa;
  104. padding: 20rpx 24rpx;
  105. border-radius: 16rpx;
  106. .left-box{
  107. flex:1;
  108. view:nth-child(1){
  109. font-size:26rpx;
  110. margin-bottom:4rpx;
  111. }
  112. view:nth-child(2){
  113. font-size:22rpx;
  114. color:#8896a7;
  115. }
  116. }
  117. .right-box{
  118. line-height:60rpx;
  119. font-size:40rpx;
  120. color:#8896a7;
  121. }
  122. }
  123. .empty-tip{
  124. text-align: center;
  125. line-height:40rpx;
  126. color:#8896a7;
  127. font-size:24rpx;
  128. }
  129. }
  130. }
  131. </style>