index.vue 17 KB

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