You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
6.5 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
3 months ago
3 months ago
2 weeks ago
2 weeks ago
2 weeks ago
3 months ago
2 weeks ago
3 months ago
3 months ago
3 months ago
2 weeks ago
3 months ago
  1. <template>
  2. <view class="content">
  3. <up-navbar leftText=" " :leftIconColor="'#fff'" :safeAreaInsetTop="true" :autoBack="true" title="我的学习" :bgColor="'transparent'" :titleStyle="{color: '#fff'}" :fixed="false">
  4. </up-navbar>
  5. <view class="padding">
  6. <view class="studyDay" v-if="info.days">已坚持学习{{info.days}}</view>
  7. <view class="card">
  8. <view class="tabs">
  9. <view class="tab" @click="changeNav(1)" :class="{active: currentNav==1}">科一</view>
  10. <view class="tab" @click="changeNav(4)" :class="{active: currentNav==4}">科四</view>
  11. </view>
  12. <view class="pd20">
  13. <view class="statistics">
  14. <view class="statisticsItem" v-for="(item,index) in statisticsData" :key="index">
  15. <view class="num">{{ item.num }}</view>
  16. <view class="text">{{ item.name }}</view>
  17. </view>
  18. </view>
  19. <view class="h3">刷题进度</view>
  20. <view class="bgCard_row">
  21. <view class="bgCard">
  22. <view class="lab">顺序练习</view>
  23. <view class="tps">已完成</view>
  24. <view class="num">{{adCount.orderAlready }} <text>/</text>{{ adCount.orderTotal }}</view>
  25. </view>
  26. <view class="bgCard">
  27. <view class="lab">精选试题</view>
  28. <view class="tps">已完成</view>
  29. <view class="num">{{adCount.siftAlready }}<text>/</text>{{ adCount.siftTotal }}</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <statistics tit="模拟考试" :chartData="chartData" :listData="listData" key="1" :subject="currentNav"></statistics>
  35. <statistics tit="防真考试" :chartData="chartData2" :listData="listData2" key="2" :subject="currentNav" url="/pages/exercises/beforeExam/beforeExam"></statistics>
  36. </view>
  37. </view>
  38. </template>
  39. <script setup>
  40. import { ref } from 'vue'
  41. import nodata from '@/components/nodata/nodata.vue'
  42. import { mystudy, examStatistics, indexAdCount } from '@/config/api.js'
  43. import statistics from './comp/statistics.vue'
  44. const value = ref(false)
  45. const currentNav = ref(1)
  46. import carStore from '@/store/modules/car.js'
  47. let usecarStore = carStore()
  48. currentNav.value = usecarStore.carInfo.stepType
  49. function changeNav(val) {
  50. if(currentNav.value == val) return
  51. currentNav.value = val
  52. let data = info.value.oneresponse
  53. if(val==2) {
  54. data = info.value.fourResponse
  55. }
  56. initStatisticsData(data)
  57. indexAdCountFn()
  58. }
  59. const statisticsData = ref([])
  60. const info = ref({})
  61. async function mystudyFn() {
  62. const {data: res} = await mystudy(usecarStore.carInfo.carType)
  63. initStatisticsData(res.oneresponse)
  64. info.value = res
  65. console.log(res)
  66. }
  67. function initStatisticsData(data) {
  68. statisticsData.value = [
  69. {name: '我的收藏', num: data.collectCount || 0},
  70. {name: '我的错题', num: data.errorCount || 0},
  71. {name: '考试记录', num: data.examCount || 0},
  72. {name: '预计合格率', num: data.exampassRate +'%' || 0},
  73. ]
  74. }
  75. mystudyFn()
  76. // stepType 1模拟考试 2仿真考试
  77. let chartData = ref({})
  78. let listData = ref([])
  79. let chartData2 = ref({})
  80. let listData2 = ref([])
  81. async function examStatisticsFn(examType) {
  82. let obj = usecarStore.carInfo
  83. const {data: res} = await examStatistics({carType: obj.carType, stepType: obj.stepType, examType})
  84. if(!res?.length) return
  85. let obj2 = {
  86. categories: res.map(item=>item.formatStartTime),
  87. series: [
  88. {
  89. name: "目标值",
  90. data: res.map(item=>item.score)
  91. }
  92. ]
  93. }
  94. if(examType==1) {
  95. listData.value = res
  96. chartData.value = obj2
  97. console.log(chartData.value)
  98. }else {
  99. listData2.value = res
  100. chartData2.value = obj2
  101. console.log(chartData2.value)
  102. }
  103. }
  104. examStatisticsFn(1)
  105. examStatisticsFn(2)
  106. // 统计多少题目
  107. let adCount = ref({})
  108. async function indexAdCountFn() {
  109. const {data:res} = await indexAdCount({subject: currentNav.value, carType: usecarStore.carInfo.carType, city: usecarStore.carInfo.city})
  110. adCount.value = res
  111. }
  112. indexAdCountFn()
  113. </script>
  114. <style lang="scss" scoped>
  115. .u-nav-slot {
  116. display: flex;
  117. .btn {
  118. color: #fff;
  119. position: relative;
  120. padding: 0 20rpx;
  121. &.active {
  122. &::before {
  123. content: '';
  124. position: absolute;
  125. left: 50%;
  126. bottom: -20rpx;
  127. width: 30rpx;
  128. height: 4rpx;
  129. background: #F6F7F8;
  130. border-radius: 2rpx;
  131. transform: translateX(-50%);
  132. }
  133. }
  134. }
  135. }
  136. .content {
  137. width: 100%;
  138. // background-color: #F6F7FA;
  139. min-height: 100vh;
  140. padding: 0rpx 0rpx 30rpx 0rpx;
  141. background: url('../../../static/images/topbg.png') #F6F7FA no-repeat;
  142. background-size: 100% 410rpx;
  143. .studyDay {
  144. font-weight: bold;
  145. font-size: 36rpx;
  146. color: #FFFFFF;
  147. padding: 20rpx 0;
  148. }
  149. .card {
  150. background: #FFFFFF;
  151. border-radius: 20rpx;
  152. overflow: hidden;
  153. margin-top: 20rpx;
  154. &.card2 {
  155. padding: 20rpx;
  156. }
  157. .pd20 {
  158. padding: 20rpx;
  159. }
  160. .tabs {
  161. height: 84rpx;
  162. background: #F6F7FA;
  163. border-radius: 20rpx 20rpx 0px 0px;
  164. display: flex;
  165. line-height: 84rpx;
  166. text-align: center;
  167. .tab {
  168. width: 160rpx;
  169. font-weight: 500;
  170. font-size: 28rpx;
  171. &.active {
  172. background: #fff;
  173. }
  174. }
  175. }
  176. .statistics {
  177. display: flex;
  178. .statisticsItem {
  179. width: 25%;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. justify-content: center;
  184. height: 152rpx;
  185. &:last-child {
  186. background: linear-gradient(0deg, rgba(55,118,255,0) 0%, #EDF3FF 100%);
  187. border-radius: 10px;
  188. color: $themC;
  189. .text {
  190. color: $themC;
  191. }
  192. }
  193. .num {
  194. font-family: DIN;
  195. font-weight: bold;
  196. font-size: 38rpx;
  197. margin-bottom: 6rpx;
  198. }
  199. .text {
  200. font-size: 24rpx;
  201. color: #CCCCCC;
  202. margin-bottom: 16rpx;
  203. }
  204. }
  205. }
  206. .h3 {
  207. font-weight: 500;
  208. font-size: 30rpx;
  209. }
  210. .bgCard_row {
  211. display: flex;
  212. justify-content: space-between;
  213. margin-top: 20rpx;
  214. .bgCard {
  215. padding: 20rpx 0 0 30rpx;
  216. height: 172rpx;
  217. width: 48%;
  218. &:first-child {
  219. background: url('../../../static/images/mystudy1.png') no-repeat;
  220. background-size: 100% 100%;
  221. color: #24CBBA;
  222. }
  223. &:last-child {
  224. background: url('../../../static/images/mystudy2.png') no-repeat;
  225. background-size: 100% 100%;
  226. color: #F07634;
  227. }
  228. .lab {
  229. font-size: 28rpx;
  230. }
  231. .tps {
  232. font-size: 24rpx;
  233. opacity: 0.3;
  234. padding: 6rpx 0;
  235. }
  236. .num {
  237. font-family: DIN;
  238. font-weight: bold;
  239. font-size: 36rpx;
  240. }
  241. }
  242. }
  243. }
  244. }
  245. </style>