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.

304 lines
7.3 KiB

4 months ago
3 weeks ago
4 months ago
2 weeks ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
2 weeks ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
4 months ago
3 weeks ago
2 weeks ago
3 weeks ago
4 months ago
2 weeks ago
3 weeks ago
2 weeks ago
3 weeks ago
4 months ago
2 weeks ago
4 months ago
3 weeks ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
2 weeks ago
4 months ago
  1. <template>
  2. <view class="content">
  3. <up-navbar leftText=" " :leftIconColor="'#fff'" :safeAreaInsetTop="true" :autoBack="true" :bgColor="'transparent'">
  4. <template #center>
  5. <view class="u-nav-slot flex">
  6. <view class="btn" @click="changeNav(1)" :class="{active: currentNav==1}">错题本</view>
  7. <view class="btn" @click="changeNav(2)" :class="{active: currentNav==2}">收藏夹</view>
  8. </view>
  9. </template>
  10. </up-navbar>
  11. <view class="card">
  12. <view class="h7">我的{{ currentNav==2?'收藏':'错题'}}</view>
  13. <view class="flex-b">
  14. <view class="cardBg">
  15. <view class="flex" @click="goPage('/pages/exercises/brushQuestions/wrongQuestions?wrong=' +currentNav, countInfo.allCount)">
  16. <view class="label">全部{{ currentNav==2?'收藏':'错题'}}</view>
  17. <u-icon name="arrow-right" color="#fff" size="14"></u-icon>
  18. </view>
  19. <view class="num">{{ countInfo.allCount}}</view>
  20. </view>
  21. <view class="cardBg" :class="{green: currentNav==2}">
  22. <view class="flex" @click="goPage('/pages/exercises/brushQuestions/wrongQuestions?wrong=' + currentNav + '&isHigh=1', countInfo.highCount)">
  23. <view class="label">{{ currentNav==2?'今日收藏': '高频错题'}}</view>
  24. <u-icon name="arrow-right" color="#fff" size="14"></u-icon>
  25. </view>
  26. <view class="num">{{ countInfo.highCount}}</view>
  27. </view>
  28. </view>
  29. <view class="flex-b" v-if="currentNav==1">
  30. <view class="h8">答对题后自动移除错题</view>
  31. <u-switch v-model="switchValue" @change="changeSwitch"></u-switch>
  32. </view>
  33. </view>
  34. <view class="card" v-if="subMenu.length">
  35. <view class="flex-b">
  36. <view class="h7">章节练习</view>
  37. <view class="rightall" @click="deleteAll">
  38. <u-icon name="trash" color="#ccc" size="14"></u-icon>
  39. <view class="txt">全部移除</view>
  40. </view>
  41. </view>
  42. <view class="radioWrap" v-if="switchValue&&currentNav==1">
  43. <up-radio-group
  44. v-model="switchNum"
  45. >
  46. <up-radio label="答对1次就移除" :name="1" class="mr"></up-radio>
  47. <up-radio label="答对3次就移除" :name="3" class="mr"></up-radio>
  48. </up-radio-group>
  49. </view>
  50. <view class="ul">
  51. <view class="li" v-for="(item,index) in subMenu" :key="index" @click="subMenuClick(item)">
  52. <view class="num">{{index+1}}</view>
  53. <view class="txt">{{ item.name }}</view>
  54. <view class="rightBox">
  55. <view class="p">{{ item.total }}</view>
  56. <u-icon name="arrow-right" color="#D9D9D9" size="14"></u-icon>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script setup>
  64. import { myWrongQuestion, questionSubmenu, deleteWrongOrCol } from '@/config/api.js'
  65. import { computed, ref } from 'vue'
  66. import carStore from '@/store/modules/car.js'
  67. let usecarStore = carStore()
  68. import { onShow } from "@dcloudio/uni-app"
  69. import wrongQuestion from '@/store/modules/wrongQuestionBook.js'
  70. let usewrongQuestion = wrongQuestion()
  71. const value = ref(false)
  72. const currentNav = ref(1)
  73. let list = ref([])
  74. // let switchValue = ref(false)
  75. function subMenuClick(item) {
  76. if(!item.total) return uni.$u.toast('暂无题目')
  77. usecarStore.setCar('chapter', item.param)
  78. uni.navigateTo({
  79. url: '/pages/exercises/brushQuestions/wrongQuestions?wrong=' +currentNav.value
  80. })
  81. }
  82. function changeNav(val) {
  83. currentNav.value = val
  84. countInfo.value = {}
  85. subMenu.value = []
  86. myWrongQuestionFn()
  87. questionSubmenuFn()
  88. }
  89. // 1-错题,2-收藏
  90. let countInfo = ref({})
  91. async function myWrongQuestionFn() {
  92. const {data: res} = await myWrongQuestion({stepType: usecarStore.carInfo.stepType,carType: usecarStore.carInfo.carType, city: usecarStore.carInfo.city,type: currentNav.value})
  93. countInfo.value = res
  94. console.log(res)
  95. }
  96. // 章节列表
  97. const subMenu = ref([])
  98. async function questionSubmenuFn() {
  99. const {data: res} = await questionSubmenu({stepType: usecarStore.carInfo.stepType,carType: usecarStore.carInfo.carType, type: currentNav.value})
  100. subMenu.value = res
  101. console.log(res)
  102. }
  103. onShow(()=>{
  104. myWrongQuestionFn()
  105. questionSubmenuFn()
  106. })
  107. function changeSwitch(val) {
  108. console.log(val)
  109. }
  110. // 是否对题后自动删除错题
  111. let switchValue = computed({
  112. get() {
  113. return usewrongQuestion.frequency?true:false
  114. },
  115. set(val) {
  116. let num = val?1:0
  117. usewrongQuestion.setFrequency(num)
  118. }
  119. })
  120. // 答对几次删除
  121. let switchNum = computed({
  122. get() {
  123. return usewrongQuestion.frequency
  124. },
  125. set(val) {
  126. usewrongQuestion.setFrequency(val)
  127. }
  128. })
  129. // 删除全部的错题
  130. function deleteAll() {
  131. uni.showModal({
  132. title: '确定要全部移除吗?',
  133. async success() {
  134. let obj = {
  135. "carType": usecarStore.carInfo.carType,
  136. "questionId": '',
  137. "stepType": usecarStore.carInfo.stepType,
  138. "type": currentNav.value
  139. }
  140. await deleteWrongOrCol(obj)
  141. myWrongQuestionFn()
  142. questionSubmenuFn()
  143. }
  144. })
  145. }
  146. function goPage(url, num) {
  147. if(!num) return uni.$u.toast('暂无题目')
  148. uni.navigateTo({
  149. url
  150. })
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. .radioWrap {
  155. padding: 40rpx 0 0 0;
  156. .mr {
  157. margin: 0 34rpx;
  158. }
  159. }
  160. .u-nav-slot {
  161. display: flex;
  162. .btn {
  163. color: #fff;
  164. position: relative;
  165. padding: 0 20rpx;
  166. &.active {
  167. &::before {
  168. content: '';
  169. position: absolute;
  170. left: 50%;
  171. bottom: -20rpx;
  172. width: 30rpx;
  173. height: 4rpx;
  174. background: #F6F7F8;
  175. border-radius: 2rpx;
  176. transform: translateX(-50%);
  177. }
  178. }
  179. }
  180. }
  181. .content {
  182. width: 100%;
  183. // background-color: #F6F7FA;
  184. min-height: 100vh;
  185. padding: 100rpx 30rpx 30rpx 30rpx;
  186. background: url('../../../static/images/topbg.png') #F6F7FA no-repeat;
  187. background-size: 100% 410rpx;
  188. .card {
  189. width: 100%;
  190. background: #FFFFFF;
  191. border-radius: 20rpx;
  192. padding: 20rpx;
  193. margin-top: 20rpx;
  194. .h7 {
  195. font-size: 32rpx;
  196. font-weight: 550;
  197. }
  198. .cardBg {
  199. width: 48%;
  200. height: 147rpx;
  201. background: linear-gradient(125deg, #3776FF 0%, #6193FF 100%);
  202. border-radius: 20rpx;
  203. padding: 20rpx;
  204. color: #fff;
  205. margin-top: 30rpx;
  206. &:last-child {
  207. background: linear-gradient(125deg, #FE5656 0%, #FFC5C5 100%);
  208. }
  209. &.green {
  210. background: linear-gradient(125deg, #53FC87 0%, #80FEB5 100%);
  211. }
  212. .flex {
  213. .label {
  214. font-size: 24rpx;
  215. }
  216. u-icon {
  217. }
  218. }
  219. .num {
  220. font-weight: bold;
  221. font-size: 48rpx;
  222. margin-top: 20rpx;
  223. }
  224. }
  225. .flex-b {
  226. .h8 {
  227. font-size: 28rpx;
  228. line-height: 120rpx;
  229. font-weight: 550;
  230. }
  231. u-switch {
  232. }
  233. }
  234. }
  235. .rightall {
  236. display: flex;
  237. align-items: center;
  238. font-size: 24rpx;
  239. color: #ccc;
  240. .txt {
  241. margin-left: 6rpx;
  242. }
  243. }
  244. .ul {
  245. padding-top: 30rpx;
  246. .li {
  247. width: 100%;
  248. display: flex;
  249. align-items: center;
  250. padding: 34rpx 0;
  251. .num {
  252. height: 32rpx;
  253. background: #F5C142;
  254. border-radius: 50%;
  255. padding: 0 10rpx;
  256. color: #fff;
  257. font-size: 24rpx;
  258. line-height: 32rpx;
  259. }
  260. .txt {
  261. flex: 1;
  262. width: 0;
  263. font-size: 28rpx;
  264. padding: 0 20rpx;
  265. }
  266. .rightBox {
  267. display: flex;
  268. align-items: center;
  269. .p {
  270. font-size: 24rpx;
  271. color: #FF3333;
  272. margin-right: 4rpx;
  273. }
  274. u-icon {
  275. }
  276. }
  277. }
  278. }
  279. }
  280. </style>