index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. <template>
  2. <view>
  3. <nav-bar title="模考预约" class="nav"></nav-bar>
  4. <view class="tabs">
  5. <view class="tab" :class="{ active: index == 1 }" data-index="1" @click="tab(1)">
  6. <view>全部</view>
  7. <u-icon class="icon" :class="index ==1? 'animals':''" name="arrow-down"></u-icon>
  8. </view>
  9. <view class="tab" :class="{ active: index == 2 }" data-index="2">
  10. <view class="dateRange">
  11. <picker mode="date" :value="dateFrom" :start="startDate" :end="endDate" @change="bindDateFromChange">
  12. <view class="uni-input">{{dateFrom}}</view>
  13. </picker>
  14. -
  15. <picker mode="date" :value="dateTo" :start="startDate" :end="endDate" @change="bindDateToChange">
  16. <view class="uni-input">{{dateTo}}</view>
  17. </picker></view>
  18. <u-icon class="icon" name="calendar"></u-icon>
  19. </view>
  20. </view>
  21. <view class="scroll">
  22. <scroll-view scroll-x="true" class="scroll-x" >
  23. <view class="content">
  24. <view class="scroll-tag active">AAAAAAAAAAAAAA</view>
  25. <view class="scroll-tag">bbbbbbbbbbbb</view>
  26. <view class="scroll-tag">ccccccccccc</view>
  27. <view class="scroll-tag">AAAAAAAAAAAAAA</view>
  28. <view class="scroll-tag">bbbbbbbbbbbb</view>
  29. <view class="scroll-tag">ccccccccccc</view>
  30. <view class="scroll-tag">AAAAAAAAAAAAAA</view>
  31. <view class="scroll-tag">bbbbbbbbbbbb</view>
  32. <view class="scroll-tag">ccccccccccc</view>
  33. </view>
  34. </scroll-view>
  35. </view>
  36. <view class="record">
  37. <view class="item" v-for="(item,index) in 5" :key="index">
  38. <view class="item__header">建设工程法规及相关知识建设工程</view>
  39. <view class="item__body">
  40. <view class="title">
  41. <image class="img" mode="widthFix" src="/pages5/static/time.png"></image>
  42. <text>考试时间</text>
  43. </view>
  44. <view class="desc">2022年4月15日(周五) 9:00-11:00 </view>
  45. <view class="btn" @click="appoint(item)" :class="{active: index % 2 == 0}">预约考试</view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="notice" @click="noticeModal=true">
  50. <u-icon class="icon" color="#fff" name="info-circle"></u-icon>
  51. <view class="text">模考说明</view>
  52. </view>
  53. <view class="modal" :style="{top:modalTop+'px'}" v-if="index == 1">
  54. <view class="content">
  55. <scroll-view scroll-y="true" style="height:100%">
  56. <view class="top" :class="activeIndex === 0 ? 'activesty' : ''" @click="testClick(3)">全部</view>
  57. <view class="list">
  58. <view class="item" :class="activeIndex == listItem.goodsId ? 'activesty' : ''" v-for="(listItem,listIndex) in list" :key="listIndex" @click="testClick(listItem)">
  59. {{ listItem.goodsName }}
  60. </view>
  61. </view>
  62. </scroll-view>
  63. </view>
  64. <view class="modal_wrap" @click="index = 0"></view>
  65. </view>
  66. <view class="notice_modal" :style="{top:modalTop+'px'}" v-if="index == 2">
  67. <view class="content">
  68. <scroll-view scroll-y="true" style="height:100%">
  69. <view class="top" :class="typeIndex === 0 ? 'activesty' : ''" @click="paperClick(3)">全部试卷类型</view>
  70. <view class="list">
  71. <view class="item" :class="typeIndex == listItem.paperId ? 'activesty' : ''" v-for="(listItem,listIndex) in list1" :key="listIndex" @click="paperClick(listItem)">{{ listItem.paperName }}</view>
  72. </view>
  73. </scroll-view>
  74. </view>
  75. <view class="modal_wrap" @click="index = 0"></view>
  76. </view>
  77. <u-popup class="notice__modal" v-model="noticeModal" mode="center" border-radius="24" :mask-close-able="false">
  78. <view class="notice__content">
  79. <view class="body">
  80. <scroll-view scroll-y="true" style="height:700rpx">
  81. <view class="content">
  82. <view class="bold text">模拟考试说明</view>
  83. <view>在您注册过程中,您需要完成我们的注册流程并通过点击“同意并继续”的形式在线签署以下协议及政策,请您务必仔细阅读、充分理解协议中的条款内容后再点击同意(尤其是以粗体标识的条款,因为这些条款可能会明确您应履行的义务或对您的权利有所限制)。
  84. </view>
  85. </view>
  86. </scroll-view>
  87. </view>
  88. <view class="footer">
  89. <view class="btn close" @click="noticeModal = false">我知道了</view>
  90. </view>
  91. </view>
  92. </u-popup>
  93. <view class="appoint__modal" v-if="appointModal" mode="center" border-radius="24" :mask-close-able="false">
  94. <view class="appoint__content">
  95. <view class="body">
  96. <image class="img" src="/pages5/static/img-header.png" mode="widthFix"></image>
  97. <view class="content">
  98. <view class="bold center">模拟考试说明</view>
  99. <view>
  100. 您预约的模拟考试,安排如下:
  101. </view>
  102. <view>
  103. <text class="bold text">模考场次: </text>
  104. <text class="text">2022年考前一建模拟考试</text>
  105. </view>
  106. <view>
  107. <text class="bold text">项目: </text>
  108. <text class="text">一级建造师</text>
  109. </view>
  110. <view>
  111. <text class="bold text">专业:</text>
  112. <text class="text">市政专业</text>
  113. </view>
  114. <view>
  115. <text class="bold text">科目:</text>
  116. <text class="text">建设工程经济</text>
  117. </view>
  118. <view>
  119. <text class="bold text">考试时间:</text>
  120. <text class="text">2022年4月15日(周五) 9:00-10:00</text>
  121. </view>
  122. <view>请准时参加考试哦~</view>
  123. </view>
  124. </view>
  125. <view class="footer">
  126. <view class="btn close" @click="appointModal = false;openAppoint=true">我知道了</view>
  127. </view>
  128. </view>
  129. </view>
  130. <u-popup class="open__modal" v-model="openAppoint" mode="center" border-radius="24" :mask-close-able="false">
  131. <view class="open__content">
  132. <view class="body">
  133. <view class="content">
  134. <view class="bold center">开考提醒</view>
  135. <view class="center">
  136. 开考前10分钟提醒入场,不错过实战机会
  137. </view>
  138. </view>
  139. </view>
  140. <view class="footer">
  141. <view class="btn close" @click="openAppoint = false">我知道了</view>
  142. </view>
  143. </view>
  144. </u-popup>
  145. </view>
  146. </template>
  147. <script>
  148. export default {
  149. data() {
  150. return {
  151. openAppoint:false,
  152. appointModal:false,
  153. noticeModal:false,
  154. index: 0,
  155. list: [],
  156. list1: [],
  157. recordList: [],
  158. goodsData: {},
  159. param: {
  160. pageNum: 1,
  161. pageSize: 10
  162. },
  163. dateFrom:'',
  164. dateTo:'',
  165. isRepeat:false,
  166. total: 0,
  167. activeIndex: 0,
  168. typeIndex:0,
  169. itemIndex:'',
  170. modalTop:0,
  171. endDate:'',
  172. };
  173. },
  174. onLoad(option) {
  175. this.dateFrom = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  176. this.dateTo = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  177. this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  178. uni.getSystemInfo({
  179. success:(e) => {
  180. let info = uni.createSelectorQuery().select(".nav");
  181. info.boundingClientRect((navData) => { //data - 各种参数
  182. let info = uni.createSelectorQuery().select(".tabs");
  183. info.boundingClientRect((tabData) => { //data - 各种参数
  184. this.modalTop = navData.height + tabData.height
  185. console.log(navData) // 获取元素宽度
  186. console.log(tabData) // 获取元素宽度
  187. }).exec()
  188. }).exec()
  189. }
  190. })
  191. },
  192. onPullDownRefresh() {
  193. let that = this;
  194. this.param = {
  195. pageNum: 1,
  196. pageSize: 10
  197. };
  198. this.getExamRecordList();
  199. setTimeout(function() {
  200. uni.stopPullDownRefresh();
  201. }, 500);
  202. },
  203. onReachBottom() {
  204. if (this.recordList.length < this.total) {
  205. this.param.pageNum++;
  206. this.getExamRecordList();
  207. }
  208. },
  209. onShow() {
  210. if(this.isRepeat) {
  211. this.addRecord();
  212. } else {
  213. if(this.itemIndex !== '') {
  214. this.refreshByIndex();
  215. }
  216. }
  217. },
  218. methods: {
  219. refreshByIndex() {
  220. this.$api.examRecordGroupList({
  221. pageNum: this.itemIndex+1,
  222. pageSize: 1
  223. }).then(res => {
  224. this.$set(this.recordList,this.itemIndex,res.data.rows[0])
  225. this.itemIndex = ''
  226. });
  227. },
  228. appoint(item) {
  229. this.appointModal = true;
  230. },
  231. tab(index) {
  232. console.log(index,this.index)
  233. if(this.index == index) {
  234. this.index = 0;
  235. return;
  236. }
  237. this.index = index;
  238. console.log(this.index);
  239. },
  240. bindDateFromChange(e) {
  241. this.dateFrom = e.detail.value
  242. },
  243. bindDateToChange(e) {
  244. this.dateTo = e.detail.value
  245. }
  246. }
  247. };
  248. </script>
  249. <style>
  250. page {
  251. background: #eaeef1;
  252. }
  253. </style>
  254. <style lang="scss" scope>
  255. .animals{
  256. transition: all 0.3s;
  257. transform: rotate(180deg);
  258. }
  259. .tabs {
  260. position: fixed;
  261. left: 0;
  262. width: 100%;
  263. display: flex;
  264. z-index: 10;
  265. .tab {
  266. padding:0 18rpx;
  267. flex: 1;
  268. display: flex;
  269. justify-content: space-between;
  270. height: 80rpx;
  271. line-height: 80rpx;
  272. background: #ffffff;
  273. font-size: 24rpx;
  274. color: #999999;
  275. &:nth-of-type(1) {
  276. border-right:1px solid #EEEEEE;
  277. }
  278. .dateRange {
  279. display: flex;
  280. justify-content: space-between;
  281. }
  282. &.active {
  283. color: #333333;
  284. .icon{
  285. transform: rotate(180deg);
  286. }
  287. }
  288. }
  289. }
  290. .scroll {
  291. width:100%;
  292. margin-top:80rpx;
  293. .scroll-x {
  294. .content {
  295. display: flex;
  296. padding:16rpx;
  297. .scroll-tag {
  298. padding:11rpx 17rpx;
  299. background: #fff;
  300. color:#666666;
  301. margin-right:16rpx;
  302. border-radius:16rpx;;
  303. &.active {
  304. background: #007AFF;
  305. color:#fff;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. .record {
  312. padding: 16rpx 16rpx;
  313. display: flex;
  314. flex-wrap: wrap;
  315. .item {
  316. margin-bottom: 16rpx;
  317. width:351rpx;
  318. background: #ffffff;
  319. border-radius: 16rpx;
  320. position: relative;
  321. &:nth-of-type(2n) {
  322. margin-left:16rpx;
  323. }
  324. &__header {
  325. padding:24rpx 16rpx;
  326. background: #F2F6FF;
  327. font-size: 30rpx;
  328. color:#007AFF;
  329. &::before {
  330. content:'';
  331. display: inline-block;
  332. width: 4rpx;
  333. height: 32rpx;
  334. background: #007AFF;
  335. margin-right:10rpx;
  336. vertical-align: middle;
  337. }
  338. }
  339. &__body {
  340. padding:16rpx;
  341. .title {
  342. font-size: 24rpx;
  343. color: #666666;
  344. line-height: 48rpx;
  345. .img {
  346. vertical-align: middle;
  347. width:32rpx;
  348. }
  349. }
  350. .desc {
  351. margin-top:10rpx;
  352. font-size: 28rpx;
  353. font-weight: bold;
  354. color: #666666;
  355. line-height: 36rpx;
  356. }
  357. .btn {
  358. margin-top:30rpx;
  359. background: #FFFFFF;
  360. border-radius: 16rpx;
  361. height: 64rpx;
  362. line-height: 62rpx;
  363. text-align: center;
  364. font-size: 28rpx;
  365. border: 1px solid #D9D9D9;
  366. color:#D9D9D9;
  367. &.active {
  368. border: 1px solid #007AFF;
  369. color:#007AFF;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. .notice {
  376. position:fixed;
  377. right:0;
  378. top:50%;
  379. width: 48rpx;
  380. height: 200rpx;
  381. background: #52C41A;
  382. box-shadow: 0px 3rpx 16rpx 0rpx rgba(44, 121, 7, 0.5);
  383. border-radius: 24rpx;
  384. display: flex;
  385. flex-direction: column;
  386. align-items: center;
  387. justify-content: center;
  388. padding:10rpx 0;
  389. .text {
  390. flex:1;
  391. color:#fff;
  392. text-align: center;
  393. }
  394. }
  395. .modal {
  396. bottom:0;
  397. z-index: 199999999;
  398. position: fixed;
  399. left: 0;
  400. width: 100%;
  401. .content {
  402. height:80%;
  403. overflow: hidden;
  404. position: relative;
  405. z-index: 10;
  406. background: #fff;
  407. padding: 8rpx 12rpx 20rpx;
  408. display: flex;
  409. flex-wrap: wrap;
  410. .top {
  411. margin: 0 auto;
  412. width: 726rpx;
  413. height: 80rpx;
  414. background: #f5f5f5;
  415. color: #666666;
  416. border-radius: 16rpx;
  417. text-align: center;
  418. line-height: 80rpx;
  419. font-size: 32rpx;
  420. }
  421. .list {
  422. width:100%;
  423. margin-top: 16rpx;
  424. display: flex;
  425. flex-wrap: wrap;
  426. justify-content: space-between;
  427. .item {
  428. padding: 25rpx 20rpx;
  429. width: 49%;
  430. background: #f5f5f5;
  431. border-radius: 16rpx;
  432. font-size: 32rpx;
  433. color: #666666;
  434. margin: 8rpx 0;
  435. }
  436. }
  437. }
  438. .modal_wrap {
  439. position: absolute;
  440. left: 0;
  441. width: 100%;
  442. top: 0;
  443. height: 100%;
  444. background: rgba(0, 0, 0, 0.3);
  445. }
  446. }
  447. .notice__modal {
  448. .notice__content {
  449. width: 640rpx;
  450. height: 818rpx;
  451. background: #FFFFFF;
  452. display: flex;
  453. flex-direction: column;
  454. .body {
  455. flex:1;
  456. .content {
  457. padding:30rpx 40rpx 28rpx;
  458. line-height: 40rpx;
  459. font-size: 28rpx;
  460. color:#666;
  461. .bold {
  462. color:#333;
  463. font-size: 32rpx;
  464. font-weight: bold;
  465. }
  466. .center {
  467. text-align: center;
  468. }
  469. }
  470. }
  471. .footer {
  472. height:140rpx;
  473. border-top:1px solid #EEEEEE;
  474. display: flex;
  475. align-items: center;
  476. justify-content: center;
  477. .btn {
  478. margin:0 12rpx;
  479. width: 200rpx;
  480. height: 80rpx;
  481. color:#007AFF;
  482. font-size: 30rpx;
  483. text-align: center;
  484. line-height: 80rpx;
  485. background: #F5F5F5;
  486. border-radius: 40rpx 40rpx 40rpx 40rpx;
  487. &.close {
  488. color:#fff;
  489. width: 560rpx;
  490. height: 80rpx;
  491. background: #007AFF;
  492. border-radius: 40rpx 40rpx 40rpx 40rpx;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. .open__modal {
  499. .open__content {
  500. width: 640rpx;
  501. background: #FFFFFF;
  502. .body {
  503. .content {
  504. padding:30rpx 40rpx 28rpx;
  505. line-height: 40rpx;
  506. font-size: 28rpx;
  507. color:#666;
  508. .bold {
  509. color:#333;
  510. font-size: 32rpx;
  511. font-weight: bold;
  512. }
  513. .center {
  514. text-align: center;
  515. }
  516. }
  517. }
  518. .footer {
  519. height:140rpx;
  520. border-top:1px solid #EEEEEE;
  521. display: flex;
  522. align-items: center;
  523. justify-content: center;
  524. .btn {
  525. margin:0 12rpx;
  526. width: 200rpx;
  527. height: 80rpx;
  528. color:#007AFF;
  529. font-size: 30rpx;
  530. text-align: center;
  531. line-height: 80rpx;
  532. background: #F5F5F5;
  533. border-radius: 40rpx 40rpx 40rpx 40rpx;
  534. &.close {
  535. color:#fff;
  536. width: 560rpx;
  537. height: 80rpx;
  538. background: #007AFF;
  539. border-radius: 40rpx 40rpx 40rpx 40rpx;
  540. }
  541. }
  542. }
  543. }
  544. }
  545. .appoint__modal {
  546. position:fixed;
  547. left:0;
  548. top:0;
  549. width:100%;
  550. height:100%;
  551. background:rgba(0,0,0,0.3);
  552. .img {
  553. width:280rpx;
  554. position:absolute;
  555. left:50%;
  556. margin-left:-140rpx;
  557. top:-70rpx;
  558. }
  559. .appoint__content {
  560. border-radius:20rpx;
  561. position:absolute;
  562. left:50%;
  563. top:50%;
  564. transform: translate3D(-50%,-50%,0);
  565. width: 640rpx;
  566. height: 867rpx;
  567. background: #FFFFFF;
  568. .body {
  569. position: relative;
  570. .content {
  571. padding:160rpx 40rpx 28rpx;
  572. line-height: 60rpx;
  573. font-size: 28rpx;
  574. color:#666;
  575. .bold {
  576. color:#333;
  577. font-size: 32rpx;
  578. font-weight: bold;
  579. }
  580. .center {
  581. text-align: center;
  582. }
  583. .text {
  584. color:#666;
  585. font-size: 28rpx;
  586. }
  587. }
  588. }
  589. .footer {
  590. height:140rpx;
  591. border-top:1px solid #EEEEEE;
  592. display: flex;
  593. align-items: center;
  594. justify-content: center;
  595. .btn {
  596. margin:0 12rpx;
  597. width: 200rpx;
  598. height: 80rpx;
  599. color:#007AFF;
  600. font-size: 30rpx;
  601. text-align: center;
  602. line-height: 80rpx;
  603. background: #F5F5F5;
  604. border-radius: 40rpx 40rpx 40rpx 40rpx;
  605. &.close {
  606. color:#fff;
  607. width: 560rpx;
  608. height: 80rpx;
  609. background: #007AFF;
  610. border-radius: 40rpx 40rpx 40rpx 40rpx;
  611. }
  612. }
  613. }
  614. }
  615. }
  616. .activesty {
  617. background: #007aff !important;
  618. color: #fff !important;
  619. }
  620. </style>