index.vue 15 KB

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