index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <template>
  2. <view>
  3. <nav-bar title="模考预约" class="nav"></nav-bar>
  4. <view class="tabs">
  5. <view class="tab" :class="{ active: param.mockStatus == 0 }" data-index="1" @click="tab(0)">
  6. <view>未考试</view>
  7. </view>
  8. <view class="tab" :class="{ active: param.mockStatus == 1 }" data-index="2" @click="tab(1)">
  9. <view>已结束</view>
  10. </view>
  11. <view class="sort" @click="showSort = true">
  12. 筛选
  13. </view>
  14. </view>
  15. <view class="record">
  16. <template v-if=" param.mockStatus == 0">
  17. <view class="examList" v-for="(item,index) in recordList" :key="index">
  18. <view class="main">
  19. <view class="top" @click="showDetails(item)">
  20. <view class="subject">{{item.applyName}}</view>
  21. </view>
  22. <view class="item">
  23. <view class="left">项目</view>
  24. <view class="right">{{ item.businessName }} {{item.projectName}}</view>
  25. </view>
  26. <view class="item">
  27. <view class="left">专业</view>
  28. <view class="right">{{item.categoryName}}</view>
  29. </view>
  30. <view class="item">
  31. <view class="left">科目</view>
  32. <view class="right">{{item.subjectName}}</view>
  33. </view>
  34. <view class="item">
  35. <view class="left">考试时间</view>
  36. <view v-if="item.mockActivity == 0" class="right">
  37. {{ $method.timestampToTime(item.applySiteExamTime) }}
  38. {{ item.applySiteStartTime }} - {{ item.applySiteEndTime }}
  39. </view>
  40. </view>
  41. <view class="btn-wrap">
  42. <view class="btn-line">
  43. <!-- mockActivity 1是活动模考,0否 -->
  44. <view v-if="item.mockActivity == 1" class="btn" @click="goExamCount(item,index)">去考试</view>
  45. <view v-else>
  46. <view class="btn test-disabled" v-if="goTest(item)" @click="goExamCount(item,index)">去考试</view>
  47. <view class="btn test-disabled" v-else-if="item.handStatus">已考试</view>
  48. <view class="btn" v-else @click="goExamCount(item,index)">去考试</view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <template v-if=" param.mockStatus == 1">
  56. <view class="examList" v-for="(item,index) in recordList" :key="index">
  57. <view class="main">
  58. <view class="top" @click="showDetails(item)">
  59. <view class="subject">{{item.applyName}}</view>
  60. </view>
  61. <view class="item">
  62. <view class="left">项目</view>
  63. <view class="right">{{ item.businessName }} {{item.projectName}}</view>
  64. </view>
  65. <view class="item">
  66. <view class="left">专业</view>
  67. <view class="right">{{item.categoryName}}</view>
  68. </view>
  69. <view class="item">
  70. <view class="left">科目</view>
  71. <view class="right">{{item.subjectName}}</view>
  72. </view>
  73. <view class="item">
  74. <view class="left">考试时间</view>
  75. <view class="right">
  76. {{ $method.timestampToTime(item.applySiteExamTime) }}
  77. {{ item.applySiteStartTime }} - {{ item.applySiteEndTime }}
  78. </view>
  79. </view>
  80. <view class="btn-wrap">
  81. <view class="btn-line" v-if="item.reSubscribe == 1">
  82. <view class="btn border" @click="reApply(item)">重新预约</view>
  83. </view>
  84. <template v-else>
  85. <view class="btn-line">
  86. <view class="text" v-if="item.handStatus">当前报告含主观题需人工阅卷,阅卷完成后显示完整报告</view>
  87. <view class="text" v-if="!item.handStatus">由于未按时参加考试,主观题将不会提交至后台进行人工阅卷</view>
  88. <view class="btn border" :class="{disabled : item.canDo === 0,'btn--half':item.handStatus}" @click="doQuestion(item)">去做题</view>
  89. <view class="btn btn--half border" @click="report(item)" v-if="item.handStatus">查看报告</view>
  90. </view>
  91. <view class="btn-line" v-if="item.liveEndTime && item.liveStartTime && item.liveUrl">
  92. <view class="text-half">
  93. <view>模考讲解直播时间</view>
  94. <view>{{$method.timestampToTime(item.liveStartTime,false)}} - {{$method.timestampToTime(item.liveEndTime,false)}}</view>
  95. </view>
  96. <view class="btn btn--half border" @click="goLive(item)">去查看</view>
  97. </view>
  98. </template>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. </view>
  104. <view class="modal" :style="{top:modalTop+'px'}" v-if="showSort">
  105. <view class="content">
  106. <view class="item">
  107. <view class="item__title">考试时间</view>
  108. <view class="item__box">
  109. <view class="text">
  110. <picker mode="date" :value="param.startTime" :end="endDate" @change="bindDateFromChange">
  111. <view class="uni-input">{{param.startTime || '开始时间'}}</view>
  112. </picker>
  113. -
  114. <picker mode="date" :value="param.endTime" :end="endDate" @change="bindDateToChange">
  115. <view class="uni-input">{{param.endTime || '结束时间'}}</view>
  116. </picker>
  117. </view>
  118. <u-icon class="icon" name="calendar"></u-icon>
  119. </view>
  120. </view>
  121. <view class="item">
  122. <view class="item__title">考试标题</view>
  123. <view class="item__box">
  124. <picker class="picker" mode="selector" :range="listApplyName" range-key="applyName" :value="param.applyName" @change="bindTitleChange">
  125. <view style="width:650rpx;height:40rpx;">{{param.applyName}}</view>
  126. </picker>
  127. <u-icon class="icon" name="arrow-down"></u-icon>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="modal_wrap" @click="showSort = false"></view>
  132. </view>
  133. </view>
  134. </template>
  135. <script>
  136. import { mapGetters } from 'vuex';
  137. import {WEBVIEW_URL} from '@/common/request.js'
  138. export default {
  139. data() {
  140. return {
  141. showSort:false,
  142. index: 0,
  143. list: [],
  144. list1: [],
  145. recordList: [],
  146. goodsData: {},
  147. param: {
  148. pageNum: 1,
  149. pageSize: 10,
  150. mockStatus:0,
  151. endTime:'',
  152. startTime:'',
  153. applyName:''
  154. },
  155. nowTime:0,
  156. dateFrom:'',
  157. dateTo:'',
  158. isRepeat:false,
  159. total: 0,
  160. activeIndex: 0,
  161. typeIndex:0,
  162. itemIndex:'',
  163. modalTop:0,
  164. endDate:'',
  165. titleName:3,
  166. listApplyName:[],
  167. };
  168. },
  169. computed:{
  170. ...mapGetters(['userInfo'])
  171. },
  172. onLoad(option) {
  173. this.param.mockStatus = option.state || 0
  174. this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  175. this.mockSubscribeListSubscribe();
  176. uni.getSystemInfo({
  177. success:(e) => {
  178. let info = uni.createSelectorQuery().select(".nav");
  179. info.boundingClientRect((navData) => { //data - 各种参数
  180. let info = uni.createSelectorQuery().select(".tabs");
  181. info.boundingClientRect((tabData) => { //data - 各种参数
  182. this.modalTop = navData.height + tabData.height
  183. console.log(navData) // 获取元素宽度
  184. console.log(tabData) // 获取元素宽度
  185. }).exec()
  186. }).exec()
  187. }
  188. })
  189. },
  190. onPullDownRefresh() {
  191. let that = this;
  192. this.param.pageNum = 1;
  193. this.mockSubscribeListSubscribe();
  194. setTimeout(function() {
  195. uni.stopPullDownRefresh();
  196. }, 500);
  197. },
  198. onReachBottom() {
  199. console.log(this.total,'total');
  200. console.log(this.recordList.length,'length')
  201. if (this.recordList.length < this.total) {
  202. this.param.pageNum++;
  203. this.mockSubscribeListSubscribe();
  204. }
  205. },
  206. onShow() {
  207. this.nowTime = +this.$method.timest();
  208. if(this.itemIndex !== '') {
  209. this.refreshByIndex();
  210. }
  211. },
  212. methods: {
  213. mockApplyListApplyName() {
  214. let param = JSON.parse(JSON.stringify(this.param));
  215. if(param.endTime) {
  216. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  217. }
  218. if(param.startTime) {
  219. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  220. }
  221. console.log(param,'param')
  222. this.$api.mockApplyListApplyName(param).then((res) => {
  223. this.listApplyName = res.data.rows;
  224. console.log(this.listApplyName,'listApplyName')
  225. this.param.applyName = "";
  226. this.mockSubscribeListSubscribe();
  227. });
  228. },
  229. reApply(item){
  230. uni.redirectTo({
  231. url:'/pages5/examAppointList/index'
  232. })
  233. },
  234. report(item) {
  235. uni.navigateTo({
  236. url:
  237. "/pages5/examReport/index?&examId=" +
  238. item.examId +
  239. "&id=" +
  240. item.recordId+
  241. "&eachExamId="+item.eachExamId+
  242. "&subscribeId="+item.subscribeId
  243. });
  244. },
  245. doQuestion(item) {
  246. if(item.canDo === 0) {
  247. uni.showToast({
  248. icon:'none',
  249. msg:'请等待所有科目考试结束后再进入刷题'
  250. })
  251. return;
  252. }
  253. uni.navigateTo({
  254. url:'../examBank/index?examId='+item.examId+'&eachExamId='+item.eachExamId
  255. })
  256. },
  257. goTest(item) {
  258. if (item.mockActivity && item.mockActivity == 1) {
  259. return false
  260. }
  261. let startTime = this.$method.TimeTotimestamp(this.$method.timestampToTime(item.applySiteExamTime) + ' ' + item.applySiteStartTime)
  262. let canGo = (startTime-this.nowTime) <= (600) && (startTime-this.nowTime) >= (-(item.timeLimit * 60) || 0)
  263. return !canGo
  264. },
  265. isStart(item) {
  266. let startTime = this.$method.TimeTotimestamp(
  267. this.$method.timestampToTime(item.applySiteExamTime) +
  268. " " +
  269. item.applySiteStartTime
  270. );
  271. return startTime - this.nowTime <= 600;
  272. },
  273. mockSubscribeListSubscribe() {
  274. let param = JSON.parse(JSON.stringify(this.param))
  275. if(param.endTime) {
  276. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  277. }
  278. if(param.startTime) {
  279. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  280. }
  281. this.$api.mockSubscribeListSubscribe(param).then(res => {
  282. this.recordList.push(...res.data.rows)
  283. this.total = res.data.total
  284. })
  285. },
  286. refreshByIndex() {
  287. let param = JSON.parse(JSON.stringify(this.param))
  288. if(param.endTime) {
  289. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  290. }
  291. if(param.startTime) {
  292. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  293. }
  294. param.pageNum = this.itemIndex+1;
  295. param.pageSize = 1
  296. this.$api.mockSubscribeListSubscribe(param).then(res => {
  297. this.$set(this.recordList,this.itemIndex,res.data.rows[0])
  298. this.itemIndex = ''
  299. })
  300. },
  301. goLive(item) {
  302. let uuid = new Date().valueOf() + ""
  303. // buyCourse 是否购买课程:1是 0否
  304. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
  305. +item.liveUrl+'&buyCourse=1'+'&ident='+uuid)
  306. uni.navigateTo({
  307. url:`../../pages/webview/index?url=`+encode
  308. })
  309. },
  310. goExamCount(item,index) {
  311. console.log('item', item)
  312. if (item.mockActivity && item.mockActivity == 1) {
  313. item.applySiteExamTime = parseInt(new Date().getTime()/1000) // 当前时间的时间戳
  314. item.applySiteStartTime = this.$method.timestampToTime(new Date().getTime()/1000, false, false, true)
  315. let min = item.duration * 60 *1000 + new Date().getTime()
  316. item.applySiteEndTime = this.$method.timestampToTime(min/1000, false, false, true)
  317. }
  318. if(this.goTest(item)) {
  319. uni.showToast({
  320. icon:'none',
  321. title:'不在考试时间'
  322. })
  323. return;
  324. }
  325. this.itemIndex = index;
  326. uni.navigateTo({
  327. url:'../examCount/index?start='+this.$method.TimeTotimestamp(this.$method.timestampToTime(item.applySiteExamTime) + ' ' + item.applySiteStartTime)+'&limit='+item.timeLimit+'&examId='+item.examId+'&eachExamId='+item.eachExamId+'&subscribeId='+item.subscribeId+'&mockName='+item.applyName +'&examEndTime='+this.$method.TimeTotimestamp(this.$method.timestampToTime(item.applySiteExamTime) + ' ' + item.applySiteEndTime)
  328. })
  329. },
  330. sort() {
  331. },
  332. appoint(item) {
  333. this.appointModal = true;
  334. },
  335. tab(state) {
  336. if(this.param.mockStatus == state) {
  337. return;
  338. }
  339. this.recordList = [];
  340. this.param.endTime = '';
  341. this.param.startTime = '';
  342. this.param.applyName = '';
  343. this.param.pageNum = 1;
  344. this.param.mockStatus = state;
  345. this.mockSubscribeListSubscribe()
  346. },
  347. bindDateFromChange(e) {
  348. this.param.startTime = e.detail.value
  349. this.param.pageNum = 1;
  350. this.param.applyName = '';
  351. this.recordList = []
  352. this.mockApplyListApplyName();
  353. },
  354. bindDateToChange(e) {
  355. this.param.endTime = e.detail.value
  356. this.param.pageNum = 1;
  357. this.param.applyName = '';
  358. this.recordList = []
  359. this.mockApplyListApplyName();
  360. },
  361. bindTitleChange(e) {
  362. if (this.listApplyName.length) {
  363. let index = e.detail.value;
  364. this.param.applyName = this.listApplyName[index].applyName
  365. } else {
  366. this.param.applyName =''
  367. }
  368. this.param.pageNum = 1;
  369. this.recordList = []
  370. this.mockSubscribeListSubscribe();
  371. }
  372. }
  373. };
  374. </script>
  375. <style>
  376. page {
  377. background: #eaeef1;
  378. }
  379. </style>
  380. <style lang="scss" scope>
  381. .animals{
  382. transition: all 0.3s;
  383. transform: rotate(180deg);
  384. }
  385. .tabs {
  386. position: fixed;
  387. left: 0;
  388. width: 100%;
  389. display: flex;
  390. z-index: 10;
  391. background: #ffffff;
  392. padding:18rpx 0;
  393. border-bottom:1px solid #eee;
  394. .tab {
  395. padding:0 18rpx;
  396. flex: 1;
  397. background: #ffffff;
  398. font-size: 32rpx;
  399. color: #999999;
  400. text-align: center;
  401. position:relative;
  402. &:nth-of-type(2) {
  403. border-right:1px solid #EEEEEE;
  404. }
  405. &.active {
  406. color: #333333;
  407. &::before{
  408. content:'';
  409. position:absolute;
  410. width: 24px;
  411. height: 4px;
  412. background: #007AFF;
  413. border-radius: 2px;
  414. left:50%;
  415. margin-left:-12px;
  416. bottom:-18rpx;
  417. }
  418. }
  419. }
  420. .sort {
  421. width:160rpx;
  422. text-align: center;
  423. font-size: 32rpx;
  424. font-weight: 500;
  425. color: #999999;
  426. }
  427. }
  428. .record {
  429. margin-top:80rpx;
  430. padding: 16rpx 16rpx;
  431. .examList {
  432. .main {
  433. background: #ffffff;
  434. border-radius: 16rpx;
  435. margin: 20rpx 0;
  436. }
  437. .top {
  438. height: 80rpx;
  439. text-align: center;
  440. line-height: 80rpx;
  441. font-size: 30rpx;
  442. color:#333333;
  443. font-weight: bold;
  444. border-bottom: 1px solid #eeeeee;
  445. }
  446. .item {
  447. display: flex;
  448. justify-content: space-between;
  449. align-items: center;
  450. margin-left: 31rpx;
  451. height: 80rpx;
  452. padding-right: 24rpx;
  453. border-bottom: 1px solid #eeeeee;
  454. font-size: 24rpx;
  455. color: #666666;
  456. .right {
  457. font-size: 28rpx;
  458. }
  459. }
  460. .btn-wrap {
  461. padding:24rpx 16rpx ;
  462. border-bottom:1px solid #EEEEEE;
  463. .btn-line {
  464. display: flex;
  465. align-items: center;
  466. justify-content: center;
  467. flex-wrap: wrap;
  468. }
  469. .text {
  470. width:100%;
  471. color:#F5222D;
  472. font-size: 24rpx;
  473. text-align: center;
  474. }
  475. .text-half {
  476. color:#666666;
  477. font-size: 24rpx;
  478. width:320rpx;
  479. margin:8rpx;
  480. }
  481. .btn {
  482. margin:8rpx;
  483. width: 528rpx;
  484. height: 64rpx;
  485. background: #007AFF;
  486. border-radius: 16rpx;
  487. text-align: center;
  488. line-height: 64rpx;
  489. color:#fff;
  490. &--half {
  491. width:320rpx;
  492. }
  493. &.border {
  494. background:#fff;
  495. color:#007AFF;
  496. border:1px solid #007AFF;
  497. }
  498. &.disabled {
  499. color:#D9D9D9;
  500. border-color:#D9D9D9;
  501. }
  502. &.test-disabled {
  503. color:#fff;
  504. background:#D9D9D9;
  505. }
  506. }
  507. }
  508. }
  509. }
  510. .modal {
  511. bottom:0;
  512. z-index: 199999999;
  513. position: fixed;
  514. left: 0;
  515. width: 100%;
  516. .content {
  517. overflow: hidden;
  518. position: relative;
  519. z-index: 10;
  520. background: #fff;
  521. padding: 20rpx 12rpx 16rpx;
  522. .item {
  523. &__title {
  524. padding:16rpx 0;
  525. font-size: 28rpx;
  526. color: #999999;
  527. }
  528. &__box {
  529. padding:0 16rpx;
  530. display: flex;
  531. width: 718rpx;
  532. height: 80rpx;
  533. background: #FFFFFF;
  534. border: 1px solid #EEEEEE;
  535. border-radius: 16rpx;
  536. align-items: center;
  537. .text {
  538. flex:1;
  539. display: flex;
  540. align-items: center;
  541. }
  542. }
  543. }
  544. }
  545. .modal_wrap {
  546. position: absolute;
  547. left: 0;
  548. width: 100%;
  549. top: 0;
  550. height: 100%;
  551. background: rgba(0, 0, 0, 0.3);
  552. }
  553. }
  554. .activesty {
  555. background: #007aff !important;
  556. color: #fff !important;
  557. }
  558. </style>