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.

333 lines
7.0 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
3 months ago
3 months ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
4 months ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
1 month ago
4 months ago
1 month ago
4 months ago
4 months ago
4 months ago
4 months ago
  1. <template>
  2. <view class="content">
  3. <up-navbar leftText=" " title="" :safeAreaInsetTop="false" :autoBack="true">
  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="con padding">
  12. <view class="h1_row">
  13. <text class="tag">{{types[questionBank.types-1]}}</text>
  14. <text class="h1">{{ questionBank.title}}</text>
  15. </view>
  16. <view class="option">
  17. <view class="optionItem flex" v-for="(item,index) in questionBank.optionArr" @click="chooseOption(item)">
  18. <view class="icon"></view>
  19. <up-icon name="close-circle-fill" color="#ff0000" size="20"></up-icon>
  20. <up-icon name="checkmark-circle-fill" color="#55ff7f" size="20"></up-icon>
  21. <view class="text">{{item.key}} {{item.text}}</view>
  22. </view>
  23. </view>
  24. <view class="answer flex">
  25. <view class="ans">正确答案是<text>B</text></view>
  26. <view class="ans">您的答案是<text>B</text></view>
  27. </view>
  28. <view class="btn_row flex-b">
  29. <view class="btn border" @click="$goPage('/pages/exercises/lastPage/lastPage')">上一题</view>
  30. <view class="btn bg">下一题</view>
  31. </view>
  32. <view class="analysis">
  33. <view class="tit">题目解析</view>
  34. <view class="txt">解析解析解析解析解析解析解析解析解析解析解析解析</view>
  35. </view>
  36. <view class="btn" @click="">确定</view>
  37. </view>
  38. <view class="bottomBar">
  39. <view class="ul">
  40. <view class="li">
  41. <view class="icon">1</view>
  42. <view class="text">答对</view>
  43. </view>
  44. <view class="li">
  45. <view class="icon">1</view>
  46. <view class="text">答错</view>
  47. </view>
  48. <view class="li">
  49. <view class="icon">1</view>
  50. <view class="text">题目</view>
  51. </view>
  52. <view class="li">
  53. <view class="icon">
  54. <image src="@/static/images/theory/fankui.png" mode=""></image>
  55. </view>
  56. <view class="text">反馈</view>
  57. </view>
  58. <view class="li">
  59. <view class="icon">
  60. <image src="@/static/images/theory/dtk.png" mode=""></image>
  61. </view>
  62. <view class="text">答题卡</view>
  63. </view>
  64. <view class="li">
  65. <view class="icon">
  66. <image src="@/static/images/theory/sc.png" mode=""></image>
  67. </view>
  68. <view class="text">收藏</view>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script setup>
  75. import { startQuestionApi, submitAnswerResultApi } from '@/config/api.js'
  76. import {
  77. ref,
  78. reactive
  79. } from 'vue';
  80. const currentNav = ref('1')
  81. const types = ref([
  82. '单选题',
  83. '多选题',
  84. '判断题'
  85. ])
  86. // 1:单选题,2:多选题,3:判断题
  87. function changeNav(val) {
  88. console.log(window)
  89. if(currentNav.value == val) return
  90. currentNav.value = val
  91. }
  92. function goEmam() {
  93. uni.navigateTo({
  94. // url: '/pages/exercises/exam/exam',
  95. // url: '/pages/exercises/beforeExam/beforeExam',
  96. // url: '/pages/exercises/examResults/examResults',
  97. // url: '/pages/exercises/wrongQuestion/wrongQuestion',
  98. // url: '/pages/exercises/theoryStudy/theoryStudy',
  99. url: '/pages/vip/vipEntry/vipEntry'
  100. })
  101. }
  102. function changeTabbar(val) {
  103. console.log(val)
  104. }
  105. // 请求数据
  106. const questionBank = ref({})
  107. async function startQuestionFn() {
  108. let obj = {
  109. carType: 'car',
  110. stepType: '1',
  111. volume: '0',
  112. types: '1',
  113. sift: '0',
  114. contentType: '1'
  115. }
  116. const {data: res} = await startQuestionApi(obj)
  117. console.log(res.questionBank.types)
  118. if(res.questionBank.types !=3) {
  119. res.questionBank.optionArr = []
  120. let abcd = [
  121. 'a',
  122. 'b',
  123. 'c',
  124. 'd',
  125. 'e',
  126. 'f'
  127. ]
  128. abcd.forEach((k,i)=>{
  129. let option = 'option'+k
  130. if(res.questionBank[option]) {
  131. let obj = {
  132. key: k.toLocaleUpperCase(),
  133. text: res.questionBank[option],
  134. index: i+1
  135. }
  136. res.questionBank.optionArr.push(obj)
  137. }
  138. })
  139. }
  140. questionBank.value = res.questionBank
  141. console.log(questionBank.value)
  142. }
  143. startQuestionFn()
  144. // 选择答案
  145. const curOption = ref({})
  146. async function chooseOption(item) {
  147. curOption.value = item
  148. let obj = {
  149. answer: '1',
  150. carType: 'car',
  151. questionId: questionBank.value.id,
  152. result: '0',
  153. stepType: 1,
  154. }
  155. const {data: res} = await submitAnswerResultApi(obj)
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. image {display: block;width: 100%;height: 100%;}
  160. .bottomBar {
  161. position: fixed;
  162. bottom: 0;
  163. left: 0;
  164. width: 100%;
  165. height: 98rpx;
  166. background: #FFFFFF;
  167. border-top: 1rpx solid #F4F4F4;
  168. .ul {
  169. display: flex;
  170. justify-content: space-between;
  171. height: 100%;
  172. align-items: center;
  173. .li {
  174. width: 16.6%;
  175. display: flex;
  176. flex-direction: column;
  177. align-items: center;
  178. justify-content: center;
  179. .icon {
  180. font-size: 30rpx;
  181. height: 30rpx;
  182. line-height: 30rpx;
  183. image {
  184. display: block;
  185. margin-top: 4rpx;
  186. width: 26rpx;
  187. height: 26rpx;
  188. }
  189. }
  190. .text {
  191. font-weight: 500;
  192. font-size: 24rpx;
  193. color: #999999;
  194. margin-top: 10rpx;
  195. }
  196. }
  197. }
  198. }
  199. .content {
  200. padding: 120rpx 0 0 0;
  201. min-height: 100vh;
  202. .u-nav-slot {
  203. width: 306rpx;
  204. height: 54rpx;
  205. border-radius: 10rpx;
  206. border: 1px solid #333333;
  207. display: flex;
  208. .btn {
  209. font-size: 24rpx;
  210. color: #333333;
  211. flex: 1;
  212. text-align: center;
  213. line-height: 54rpx;
  214. &.active {
  215. background-color: #333333;
  216. color: #fff;
  217. }
  218. }
  219. }
  220. .btn_row {
  221. padding: 100rpx 0 50rpx 0;
  222. .btn {
  223. width: 44%;
  224. height: 76rpx;
  225. border-radius: 38rpx;
  226. border: 1rpx solid $themC;
  227. line-height: 76rpx;
  228. text-align: center;
  229. font-size: 28rpx;
  230. color: $themC;
  231. &.bg {
  232. background: #3776FF;
  233. border-radius: 38rpx;
  234. color: #fff;
  235. }
  236. }
  237. }
  238. .con {
  239. .h1_row {
  240. margin-bottom: 50rpx;
  241. .tag {
  242. display: inline-block;
  243. // width: 66px;
  244. height: 36rpx;
  245. line-height: 36rpx;
  246. padding: 4rpx 6rpx;
  247. background: #63C168;
  248. border-radius: 6rpx;
  249. margin-top: -2rpx;
  250. margin-right: 16rpx;
  251. font-size: 28rpx;
  252. color: #fff;
  253. }
  254. text.h1 {
  255. font-size: 36rpx;
  256. }
  257. }
  258. .option {
  259. width: 100%;
  260. .optionItem {
  261. margin-bottom: 50rpx;
  262. align-items: center;
  263. .icon {
  264. width: 36rpx;
  265. height:36rpx;
  266. border-radius: 50%;
  267. border: 1rpx solid #999;
  268. }
  269. .text {
  270. font-size: 32rpx;
  271. margin-left: 16rpx;
  272. }
  273. }
  274. }
  275. .answer {
  276. height: 90rpx;
  277. background: #F4F4F4;
  278. line-height: 90rpx;
  279. padding: 0 30rpx;
  280. margin-top: 20rpx;
  281. .ans {
  282. margin-right: 60rpx;
  283. text {
  284. color: red;
  285. }
  286. }
  287. }
  288. .analysis {
  289. margin-top: 60rpx;
  290. .tit {
  291. font-weight: 700;
  292. font-size: 32rpx;
  293. position: relative;
  294. padding-left: 30rpx;
  295. &::after {
  296. content: '';
  297. position: absolute;
  298. left: 0;
  299. top: 8rpx;
  300. width: 6rpx;
  301. height: 30rpx;
  302. background: linear-gradient(0deg, #43EA80 0%, #38F8D4 100%);
  303. border-radius: 3rpx;
  304. }
  305. }
  306. .txt {
  307. margin-top: 39rpx;
  308. font-size: 32rpx;
  309. color: #333333;
  310. }
  311. }
  312. }
  313. }
  314. </style>