index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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否 && (!item.handStatus || item.handStatus == 0)-->
  44. <view v-if="item.mockActivity == 1 && (!item.handStatus || item.handStatus == 0) " 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. console.log('查看返回的onloaddddd')
  174. this.param.mockStatus = option.state || 0
  175. // this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  176. // this.mockSubscribeListSubscribe();
  177. // uni.getSystemInfo({
  178. // success:(e) => {
  179. // let info = uni.createSelectorQuery().select(".nav");
  180. // info.boundingClientRect((navData) => { //data - 各种参数
  181. // let info = uni.createSelectorQuery().select(".tabs");
  182. // info.boundingClientRect((tabData) => { //data - 各种参数
  183. // this.modalTop = navData.height + tabData.height
  184. // console.log(navData) // 获取元素宽度
  185. // console.log(tabData) // 获取元素宽度
  186. // }).exec()
  187. // }).exec()
  188. // }
  189. // })
  190. },
  191. onShow() {
  192. console.log('查看返回的oonshow')
  193. this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  194. this.mockSubscribeListSubscribe();
  195. uni.getSystemInfo({
  196. success:(e) => {
  197. let info = uni.createSelectorQuery().select(".nav");
  198. info.boundingClientRect((navData) => { //data - 各种参数
  199. let info = uni.createSelectorQuery().select(".tabs");
  200. info.boundingClientRect((tabData) => { //data - 各种参数
  201. this.modalTop = navData.height + tabData.height
  202. console.log(navData) // 获取元素宽度
  203. console.log(tabData) // 获取元素宽度
  204. }).exec()
  205. }).exec()
  206. }
  207. })
  208. },
  209. onPullDownRefresh() {
  210. let that = this;
  211. this.param.pageNum = 1;
  212. this.mockSubscribeListSubscribe();
  213. setTimeout(function() {
  214. uni.stopPullDownRefresh();
  215. }, 500);
  216. },
  217. onReachBottom() {
  218. console.log(this.total,'total');
  219. console.log(this.recordList.length,'length')
  220. if (this.recordList.length < this.total) {
  221. this.param.pageNum++;
  222. this.mockSubscribeListSubscribe();
  223. }
  224. },
  225. onShow() {
  226. this.nowTime = +this.$method.timest();
  227. if(this.itemIndex !== '') {
  228. this.refreshByIndex();
  229. }
  230. },
  231. methods: {
  232. mockApplyListApplyName() {
  233. let param = JSON.parse(JSON.stringify(this.param));
  234. if(param.endTime) {
  235. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  236. }
  237. if(param.startTime) {
  238. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  239. }
  240. console.log(param,'param')
  241. this.$api.mockApplyListApplyName(param).then((res) => {
  242. this.listApplyName = res.data.rows;
  243. console.log(this.listApplyName,'listApplyName')
  244. this.param.applyName = "";
  245. this.mockSubscribeListSubscribe();
  246. });
  247. },
  248. reApply(item){
  249. uni.redirectTo({
  250. url:'/pages5/examAppointList/index'
  251. })
  252. },
  253. report(item) {
  254. uni.navigateTo({
  255. url:
  256. "/pages5/examReport/index?&examId=" +
  257. item.examId +
  258. "&id=" +
  259. item.recordId+
  260. "&eachExamId="+item.eachExamId+
  261. "&subscribeId="+item.subscribeId
  262. });
  263. },
  264. doQuestion(item) {
  265. if(item.canDo === 0) {
  266. uni.showToast({
  267. icon:'none',
  268. msg:'请等待所有科目考试结束后再进入刷题'
  269. })
  270. return;
  271. }
  272. uni.navigateTo({
  273. url:'../examBank/index?examId='+item.examId+'&eachExamId='+item.eachExamId
  274. })
  275. },
  276. goTest(item) {
  277. if (item.mockActivity && item.mockActivity == 1) {
  278. return false
  279. }
  280. let startTime = this.$method.TimeTotimestamp(this.$method.timestampToTime(item.applySiteExamTime) + ' ' + item.applySiteStartTime)
  281. let canGo = (startTime-this.nowTime) <= (600) && (startTime-this.nowTime) >= (-(item.timeLimit * 60) || 0)
  282. return !canGo
  283. },
  284. isStart(item) {
  285. let startTime = this.$method.TimeTotimestamp(
  286. this.$method.timestampToTime(item.applySiteExamTime) +
  287. " " +
  288. item.applySiteStartTime
  289. );
  290. return startTime - this.nowTime <= 600;
  291. },
  292. mockSubscribeListSubscribe() {
  293. let param = JSON.parse(JSON.stringify(this.param))
  294. if(param.endTime) {
  295. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  296. }
  297. if(param.startTime) {
  298. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  299. }
  300. // mock/subscribe/listSubscribe
  301. this.$api.mockSubscribeListSubscribe(param).then(res => {
  302. this.recordList = []
  303. this.recordList.push(...res.data.rows)
  304. this.total = res.data.total
  305. })
  306. },
  307. refreshByIndex() {
  308. let param = JSON.parse(JSON.stringify(this.param))
  309. if(param.endTime) {
  310. param.endTime = this.$method.TimeTotimestamp(param.endTime)
  311. }
  312. if(param.startTime) {
  313. param.startTime = this.$method.TimeTotimestamp(param.startTime)
  314. }
  315. param.pageNum = this.itemIndex+1;
  316. param.pageSize = 1
  317. this.$api.mockSubscribeListSubscribe(param).then(res => {
  318. this.$set(this.recordList,this.itemIndex,res.data.rows[0])
  319. this.itemIndex = ''
  320. })
  321. },
  322. goLive(item) {
  323. let uuid = new Date().valueOf() + ""
  324. // buyCourse 是否购买课程:1是 0否
  325. let encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='
  326. +item.liveUrl+'&buyCourse=1'+'&ident='+uuid)
  327. uni.navigateTo({
  328. url:`../../pages/webview/index?url=`+encode
  329. })
  330. },
  331. async goExamCount(item,index) {
  332. console.log('item', item)
  333. if (item.mockActivity && item.mockActivity == 1) {
  334. await this.$http({
  335. url: '/mock/apply/addMockTime',
  336. method: 'post',
  337. data: {
  338. applyId: item.applyId,
  339. duration: item.duration,
  340. majorId: item.majorId,
  341. subjectId: item.subjectId
  342. },
  343. }).then((res) => {
  344. const { examTime, startTime, endTime, eachExamId} = res.data.data
  345. item.applySiteExamTime = examTime // 当前时间的时间戳
  346. item.applySiteStartTime = startTime
  347. item.applySiteEndTime = endTime
  348. item.eachExamId = eachExamId
  349. // item.applySiteExamTime = parseInt(new Date().getTime()/1000) // 当前时间的时间戳
  350. // item.applySiteStartTime = this.$method.timestampToTime(new Date().getTime()/1000, false, false, true)
  351. // let min = item.duration * 60 *1000 + new Date().getTime()
  352. // item.applySiteEndTime = this.$method.timestampToTime(min/1000, false, false, true)
  353. console.log('item', item)
  354. })
  355. }
  356. if(this.goTest(item)) {
  357. uni.showToast({
  358. icon:'none',
  359. title:'不在考试时间'
  360. })
  361. return;
  362. }
  363. this.itemIndex = index;
  364. uni.navigateTo({
  365. 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)
  366. })
  367. },
  368. sort() {
  369. },
  370. appoint(item) {
  371. this.appointModal = true;
  372. },
  373. tab(state) {
  374. if(this.param.mockStatus == state) {
  375. return;
  376. }
  377. this.recordList = [];
  378. this.param.endTime = '';
  379. this.param.startTime = '';
  380. this.param.applyName = '';
  381. this.param.pageNum = 1;
  382. this.param.mockStatus = state;
  383. this.mockSubscribeListSubscribe()
  384. },
  385. bindDateFromChange(e) {
  386. this.param.startTime = e.detail.value
  387. this.param.pageNum = 1;
  388. this.param.applyName = '';
  389. this.recordList = []
  390. this.mockApplyListApplyName();
  391. },
  392. bindDateToChange(e) {
  393. this.param.endTime = e.detail.value
  394. this.param.pageNum = 1;
  395. this.param.applyName = '';
  396. this.recordList = []
  397. this.mockApplyListApplyName();
  398. },
  399. bindTitleChange(e) {
  400. if (this.listApplyName.length) {
  401. let index = e.detail.value;
  402. this.param.applyName = this.listApplyName[index].applyName
  403. } else {
  404. this.param.applyName =''
  405. }
  406. this.param.pageNum = 1;
  407. this.recordList = []
  408. this.mockSubscribeListSubscribe();
  409. }
  410. }
  411. };
  412. </script>
  413. <style>
  414. page {
  415. background: #eaeef1;
  416. }
  417. </style>
  418. <style lang="scss" scope>
  419. .animals{
  420. transition: all 0.3s;
  421. transform: rotate(180deg);
  422. }
  423. .tabs {
  424. position: fixed;
  425. left: 0;
  426. width: 100%;
  427. display: flex;
  428. z-index: 10;
  429. background: #ffffff;
  430. padding:18rpx 0;
  431. border-bottom:1px solid #eee;
  432. .tab {
  433. padding:0 18rpx;
  434. flex: 1;
  435. background: #ffffff;
  436. font-size: 32rpx;
  437. color: #999999;
  438. text-align: center;
  439. position:relative;
  440. &:nth-of-type(2) {
  441. border-right:1px solid #EEEEEE;
  442. }
  443. &.active {
  444. color: #333333;
  445. &::before{
  446. content:'';
  447. position:absolute;
  448. width: 24px;
  449. height: 4px;
  450. background: #007AFF;
  451. border-radius: 2px;
  452. left:50%;
  453. margin-left:-12px;
  454. bottom:-18rpx;
  455. }
  456. }
  457. }
  458. .sort {
  459. width:160rpx;
  460. text-align: center;
  461. font-size: 32rpx;
  462. font-weight: 500;
  463. color: #999999;
  464. }
  465. }
  466. .record {
  467. margin-top:80rpx;
  468. padding: 16rpx 16rpx;
  469. .examList {
  470. .main {
  471. background: #ffffff;
  472. border-radius: 16rpx;
  473. margin: 20rpx 0;
  474. }
  475. .top {
  476. height: 80rpx;
  477. text-align: center;
  478. line-height: 80rpx;
  479. font-size: 30rpx;
  480. color:#333333;
  481. font-weight: bold;
  482. border-bottom: 1px solid #eeeeee;
  483. }
  484. .item {
  485. display: flex;
  486. justify-content: space-between;
  487. align-items: center;
  488. margin-left: 31rpx;
  489. height: 80rpx;
  490. padding-right: 24rpx;
  491. border-bottom: 1px solid #eeeeee;
  492. font-size: 24rpx;
  493. color: #666666;
  494. .right {
  495. font-size: 28rpx;
  496. }
  497. }
  498. .btn-wrap {
  499. padding:24rpx 16rpx ;
  500. border-bottom:1px solid #EEEEEE;
  501. .btn-line {
  502. display: flex;
  503. align-items: center;
  504. justify-content: center;
  505. flex-wrap: wrap;
  506. }
  507. .text {
  508. width:100%;
  509. color:#F5222D;
  510. font-size: 24rpx;
  511. text-align: center;
  512. }
  513. .text-half {
  514. color:#666666;
  515. font-size: 24rpx;
  516. width:320rpx;
  517. margin:8rpx;
  518. }
  519. .btn {
  520. margin:8rpx;
  521. width: 528rpx;
  522. height: 64rpx;
  523. background: #007AFF;
  524. border-radius: 16rpx;
  525. text-align: center;
  526. line-height: 64rpx;
  527. color:#fff;
  528. &--half {
  529. width:320rpx;
  530. }
  531. &.border {
  532. background:#fff;
  533. color:#007AFF;
  534. border:1px solid #007AFF;
  535. }
  536. &.disabled {
  537. color:#D9D9D9;
  538. border-color:#D9D9D9;
  539. }
  540. &.test-disabled {
  541. color:#fff;
  542. background:#D9D9D9;
  543. }
  544. }
  545. }
  546. }
  547. }
  548. .modal {
  549. bottom:0;
  550. z-index: 199999999;
  551. position: fixed;
  552. left: 0;
  553. width: 100%;
  554. .content {
  555. overflow: hidden;
  556. position: relative;
  557. z-index: 10;
  558. background: #fff;
  559. padding: 20rpx 12rpx 16rpx;
  560. .item {
  561. &__title {
  562. padding:16rpx 0;
  563. font-size: 28rpx;
  564. color: #999999;
  565. }
  566. &__box {
  567. padding:0 16rpx;
  568. display: flex;
  569. width: 718rpx;
  570. height: 80rpx;
  571. background: #FFFFFF;
  572. border: 1px solid #EEEEEE;
  573. border-radius: 16rpx;
  574. align-items: center;
  575. .text {
  576. flex:1;
  577. display: flex;
  578. align-items: center;
  579. }
  580. }
  581. }
  582. }
  583. .modal_wrap {
  584. position: absolute;
  585. left: 0;
  586. width: 100%;
  587. top: 0;
  588. height: 100%;
  589. background: rgba(0, 0, 0, 0.3);
  590. }
  591. }
  592. .activesty {
  593. background: #007aff !important;
  594. color: #fff !important;
  595. }
  596. </style>