questionBankTest.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. <template>
  2. <view id="questionBank">
  3. <swiper class="swiper" :current="current" @change="swiperChange" :interval="interval">
  4. <swiper-item v-for="(bank,bankIndex) in bankList">
  5. <view class="pageContent">
  6. <view class="pad_8 titBox">
  7. <view class="firstLetter">
  8. <view class="leftLetters">
  9. <view class="btnType">单选</view>
  10. <text>1/{{current}}</text>
  11. </view>
  12. <view style="color: #666;font-size: 28rpx;">03:25:06</view>
  13. <view class="leftLetters"></view>
  14. </view>
  15. <view class="titles">建造师执业资格注册的有效期一般为( )年。</view>
  16. <view class="">
  17. <view v-if="ques[bankIndex] ">
  18. <view v-for="(item, index) in bank" :key="index"
  19. class="lisSty">
  20. <view :class="{right:(item.value == ques[bankIndex]) && (ques[bankIndex] == ans[bankIndex]),wrong:(item.value == ques[bankIndex]) && (ques[bankIndex] != ans[bankIndex])}" class="activeTI">{{ ast[index] }}</view>
  21. {{ item.label }}
  22. </view>
  23. </view>
  24. <view v-if="!ques[bankIndex]">
  25. <view v-for="(item, index) in bank" :key="index" @click="click" :data-value="item.value" class="lisSty">
  26. <text class="activeTI">{{ ast[index] }}</text>
  27. {{ item.label }}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view v-if="ques[bankIndex]">
  33. <view class="pad_8 answer">
  34. <view>正确答案:{{ans[bankIndex]}}</view>
  35. <view>我的答案:{{ques[bankIndex]}}</view>
  36. </view>
  37. <view class="pad_8 answerInfos">
  38. <view class="answerTitle">答案解析</view>
  39. <view class="answerContent">
  40. 建造师执业资格注册有效期一般为3年,有效期满前3个月,持证者应到原注册管理机构办理再次注册手续。在注册有效期内,变更执业单位者,应当及时办理变更手续。
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. </swiper-item>
  46. </swiper>
  47. <view class="footer_btn">
  48. <view @click="collect">收藏</view>
  49. <view @click="openFooterTab">答题卡</view>
  50. <view @click="submit">交卷</view>
  51. </view>
  52. <u-popup v-model="show" mode="bottom" border-radius="14" height="680rpx">
  53. <view class="popupView">
  54. <view class="popupTops">
  55. <view class="topIcon"></view>
  56. 点击编号即可跳转至对应题目
  57. </view>
  58. <view class="popupContent">
  59. <scroll-view scroll-y="true" style="height: 506rpx;">
  60. <view class="boxSty">
  61. <view v-for="(item, index) in 10" :key="index" :data-index="index" @click="changeIndex" :class="{disabled:index>=5}" class="liListSty">{{ index + 1 }}</view>
  62. </view>
  63. </scroll-view>
  64. </view>
  65. </view>
  66. </u-popup>
  67. </view>
  68. </template>
  69. <script>
  70. export default {
  71. data() {
  72. return {
  73. current:0,
  74. ast: ['A', 'B', 'C', 'D',],
  75. ans:[1,2,3,4,1],
  76. ques:['','','','',''],
  77. show: false,
  78. bankList: [
  79. [
  80. {
  81. label: '1',
  82. value: 1
  83. },
  84. {
  85. label: '2',
  86. value: 2
  87. },
  88. {
  89. label: '3',
  90. value: 3
  91. },
  92. {
  93. label: '4',
  94. value: 4
  95. }
  96. ],
  97. [
  98. {
  99. label: '5',
  100. value: 1
  101. },
  102. {
  103. label: '6',
  104. value: 2
  105. },
  106. {
  107. label: '7',
  108. value: 3
  109. },
  110. {
  111. label: '8',
  112. value: 4
  113. }
  114. ],
  115. [
  116. {
  117. label: '9',
  118. value: 1
  119. },
  120. {
  121. label: '10',
  122. value: 2
  123. },
  124. {
  125. label: '11',
  126. value: 3
  127. },
  128. {
  129. label: '12',
  130. value: 4
  131. }
  132. ],
  133. [
  134. {
  135. label: '13',
  136. value: 1
  137. },
  138. {
  139. label: '14',
  140. value: 2
  141. },
  142. {
  143. label: '15',
  144. value: 3
  145. },
  146. {
  147. label: '17',
  148. value: 4
  149. }
  150. ],
  151. [
  152. {
  153. label: '18',
  154. value: 1
  155. },
  156. {
  157. label: '19',
  158. value: 2
  159. },
  160. {
  161. label: '21',
  162. value: 3
  163. },
  164. {
  165. label: '22',
  166. value: 4
  167. }
  168. ]
  169. ]
  170. };
  171. },
  172. methods: {
  173. openFooterTab() {
  174. this.show = true;
  175. },
  176. changeIndex(e) {
  177. let index = e.currentTarget.dataset.index
  178. if(index >= 5) {
  179. uni.showToast({
  180. title: '返回详情购买后即可继续',
  181. duration: 2000,
  182. icon:'none'
  183. });
  184. return;
  185. }
  186. this.current = e.currentTarget.dataset.index
  187. },
  188. swiperChange(e) {
  189. this.current = e.detail.current;
  190. },
  191. submit() {
  192. uni.showToast({
  193. title: '不能试做返回详情购买后即可交卷~',
  194. duration: 2000,
  195. icon:'none'
  196. });
  197. return;
  198. },
  199. collect() {
  200. uni.showToast({
  201. title: '返回详情购买后即可收藏~',
  202. duration: 2000,
  203. icon:'none'
  204. });
  205. return;
  206. },
  207. click(e) {
  208. if(this.ques[this.current]) return;
  209. let value = e.currentTarget.dataset.value;
  210. this.ques[this.current] = value;
  211. this.ques = Object.assign({},this.ques)
  212. }
  213. }
  214. };
  215. </script>
  216. <style lang="scss" scoped>
  217. .swiper {
  218. width:100%;
  219. height:100vh;
  220. }
  221. .lisSty {
  222. margin-bottom: 16rpx;
  223. }
  224. .activeTI {
  225. vertical-align: middle;
  226. display: inline-block;
  227. border: 1rpx solid #eee;
  228. border-radius: 50rpx;
  229. height: 48rpx;
  230. line-height: 46rpx;
  231. text-align: center;
  232. width: 48rpx;
  233. margin-right: 15rpx;
  234. color: #666;
  235. font-size: 30rpx;
  236. &.right {
  237. color:#fff;
  238. background:green;
  239. }
  240. &.wrong {
  241. color:#fff;
  242. background:red;
  243. }
  244. }
  245. .titles {
  246. margin-bottom: 24rpx;
  247. }
  248. .titBox {
  249. padding: 41rpx 25rpx 24rpx 25rpx;
  250. }
  251. .firstLetter {
  252. display: flex;
  253. justify-content: space-between;
  254. align-items: center;
  255. margin-bottom: 30rpx;
  256. .leftLetters {
  257. display: flex;
  258. align-items: center;
  259. width: 220rpx;
  260. .btnType {
  261. padding: 5rpx 10rpx;
  262. border: 1rpx solid #007aff;
  263. border-radius: 10rpx;
  264. background-color: rgba(0, 122, 255, 0.1);
  265. font-size: 28rpx;
  266. color: #007aff;
  267. margin-right: 15rpx;
  268. }
  269. }
  270. }
  271. .popupView {
  272. height: 100%;
  273. padding-bottom: 100rpx;
  274. .popupTops {
  275. height: 77rpx;
  276. border-bottom: 1rpx solid #eee;
  277. text-align: center;
  278. line-height: 77rpx;
  279. font-size: 24rpx;
  280. color: #999;
  281. position: relative;
  282. .topIcon {
  283. position: absolute;
  284. top: 10rpx;
  285. left: 50%;
  286. transform: translateX(-50%);
  287. width: 80rpx;
  288. height: 8rpx;
  289. background-color: #999;
  290. border-radius: 4rpx;
  291. }
  292. }
  293. .popupContent {
  294. }
  295. }
  296. .pageContent {
  297. background-color: #eaeef1;
  298. min-height: 100vh;
  299. padding-top: 8rpx;
  300. padding-bottom: 100rpx;
  301. }
  302. .pad_8 {
  303. background-color: #fff;
  304. margin: 0rpx 8rpx 8rpx;
  305. border-radius: 16rpx;
  306. }
  307. .answer {
  308. height: 80rpx;
  309. line-height: 80rpx;
  310. padding: 0rpx 24rpx;
  311. display: flex;
  312. align-items: center;
  313. justify-content: space-between;
  314. color: #666;
  315. font-size: 30rpx;
  316. }
  317. .footer_btn {
  318. background-color: #fff;
  319. z-index: 10078;
  320. position: fixed;
  321. bottom: 0rpx;
  322. display: flex;
  323. align-items: center;
  324. justify-content: space-between;
  325. width: 100%;
  326. height: 98rpx;
  327. padding: 0rpx 38rpx;
  328. border-top: 1rpx solid #eee;
  329. }
  330. .boxSty {
  331. padding: 44rpx 41rpx 0rpx;
  332. }
  333. .liListSty {
  334. width: 88rpx;
  335. height: 88rpx;
  336. border-radius: 32rpx;
  337. background-color: #ff3b30;
  338. text-align: center;
  339. line-height: 88rpx;
  340. color: #fff;
  341. font-size: 32rpx;
  342. float: left;
  343. margin: 20rpx 23rpx;
  344. &.disabled {
  345. border:1rpx solid #EEEEEE;
  346. color:#EEEEEE;
  347. background: none;
  348. }
  349. }
  350. .answerInfos {
  351. padding: 25rpx 25rpx 25rpx 23rpx;
  352. }
  353. .answerTitle {
  354. margin-bottom: 28rpx;
  355. color: #666;
  356. font-size: 30rpx;
  357. }
  358. .answerContent {
  359. font-size: 30rpx;
  360. color: #666;
  361. }
  362. </style>