index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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 encode = encodeURIComponent(WEBVIEW_URL+'pages/live/index?token='+uni.getStorageSync('token')+'&userInfo='+JSON.stringify(this.userInfo)+'&channelId='+item.liveUrl)
  296. uni.navigateTo({
  297. url:`../../pages/webview/index?url=`+encode
  298. })
  299. },
  300. goExamCount(item,index) {
  301. if(this.goTest(item)) {
  302. uni.showToast({
  303. icon:'none',
  304. title:'不在考试时间'
  305. })
  306. return;
  307. }
  308. this.itemIndex = index;
  309. uni.navigateTo({
  310. 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)
  311. })
  312. },
  313. sort() {
  314. },
  315. appoint(item) {
  316. this.appointModal = true;
  317. },
  318. tab(state) {
  319. if(this.param.mockStatus == state) {
  320. return;
  321. }
  322. this.recordList = [];
  323. this.param.endTime = '';
  324. this.param.startTime = '';
  325. this.param.applyName = '';
  326. this.param.pageNum = 1;
  327. this.param.mockStatus = state;
  328. this.mockSubscribeListSubscribe()
  329. },
  330. bindDateFromChange(e) {
  331. this.param.startTime = e.detail.value
  332. this.param.pageNum = 1;
  333. this.param.applyName = '';
  334. this.recordList = []
  335. this.mockApplyListApplyName();
  336. },
  337. bindDateToChange(e) {
  338. this.param.endTime = e.detail.value
  339. this.param.pageNum = 1;
  340. this.param.applyName = '';
  341. this.recordList = []
  342. this.mockApplyListApplyName();
  343. },
  344. bindTitleChange(e) {
  345. if (this.listApplyName.length) {
  346. let index = e.detail.value;
  347. this.param.applyName = this.listApplyName[index].applyName
  348. } else {
  349. this.param.applyName =''
  350. }
  351. this.param.pageNum = 1;
  352. this.recordList = []
  353. this.mockSubscribeListSubscribe();
  354. }
  355. }
  356. };
  357. </script>
  358. <style>
  359. page {
  360. background: #eaeef1;
  361. }
  362. </style>
  363. <style lang="scss" scope>
  364. .animals{
  365. transition: all 0.3s;
  366. transform: rotate(180deg);
  367. }
  368. .tabs {
  369. position: fixed;
  370. left: 0;
  371. width: 100%;
  372. display: flex;
  373. z-index: 10;
  374. background: #ffffff;
  375. padding:18rpx 0;
  376. border-bottom:1px solid #eee;
  377. .tab {
  378. padding:0 18rpx;
  379. flex: 1;
  380. background: #ffffff;
  381. font-size: 32rpx;
  382. color: #999999;
  383. text-align: center;
  384. position:relative;
  385. &:nth-of-type(2) {
  386. border-right:1px solid #EEEEEE;
  387. }
  388. &.active {
  389. color: #333333;
  390. &::before{
  391. content:'';
  392. position:absolute;
  393. width: 24px;
  394. height: 4px;
  395. background: #007AFF;
  396. border-radius: 2px;
  397. left:50%;
  398. margin-left:-12px;
  399. bottom:-18rpx;
  400. }
  401. }
  402. }
  403. .sort {
  404. width:160rpx;
  405. text-align: center;
  406. font-size: 32rpx;
  407. font-weight: 500;
  408. color: #999999;
  409. }
  410. }
  411. .record {
  412. margin-top:80rpx;
  413. padding: 16rpx 16rpx;
  414. .examList {
  415. .main {
  416. background: #ffffff;
  417. border-radius: 16rpx;
  418. margin: 20rpx 0;
  419. }
  420. .top {
  421. height: 80rpx;
  422. text-align: center;
  423. line-height: 80rpx;
  424. font-size: 30rpx;
  425. color:#333333;
  426. font-weight: bold;
  427. border-bottom: 1px solid #eeeeee;
  428. }
  429. .item {
  430. display: flex;
  431. justify-content: space-between;
  432. align-items: center;
  433. margin-left: 31rpx;
  434. height: 80rpx;
  435. padding-right: 24rpx;
  436. border-bottom: 1px solid #eeeeee;
  437. font-size: 24rpx;
  438. color: #666666;
  439. .right {
  440. font-size: 28rpx;
  441. }
  442. }
  443. .btn-wrap {
  444. padding:24rpx 16rpx ;
  445. border-bottom:1px solid #EEEEEE;
  446. .btn-line {
  447. display: flex;
  448. align-items: center;
  449. justify-content: center;
  450. flex-wrap: wrap;
  451. }
  452. .text {
  453. width:100%;
  454. color:#F5222D;
  455. font-size: 24rpx;
  456. text-align: center;
  457. }
  458. .text-half {
  459. color:#666666;
  460. font-size: 24rpx;
  461. width:320rpx;
  462. margin:8rpx;
  463. }
  464. .btn {
  465. margin:8rpx;
  466. width: 528rpx;
  467. height: 64rpx;
  468. background: #007AFF;
  469. border-radius: 16rpx;
  470. text-align: center;
  471. line-height: 64rpx;
  472. color:#fff;
  473. &--half {
  474. width:320rpx;
  475. }
  476. &.border {
  477. background:#fff;
  478. color:#007AFF;
  479. border:1px solid #007AFF;
  480. }
  481. &.disabled {
  482. color:#D9D9D9;
  483. border-color:#D9D9D9;
  484. }
  485. &.test-disabled {
  486. color:#fff;
  487. background:#D9D9D9;
  488. }
  489. }
  490. }
  491. }
  492. }
  493. .modal {
  494. bottom:0;
  495. z-index: 199999999;
  496. position: fixed;
  497. left: 0;
  498. width: 100%;
  499. .content {
  500. overflow: hidden;
  501. position: relative;
  502. z-index: 10;
  503. background: #fff;
  504. padding: 20rpx 12rpx 16rpx;
  505. .item {
  506. &__title {
  507. padding:16rpx 0;
  508. font-size: 28rpx;
  509. color: #999999;
  510. }
  511. &__box {
  512. padding:0 16rpx;
  513. display: flex;
  514. width: 718rpx;
  515. height: 80rpx;
  516. background: #FFFFFF;
  517. border: 1px solid #EEEEEE;
  518. border-radius: 16rpx;
  519. align-items: center;
  520. .text {
  521. flex:1;
  522. display: flex;
  523. align-items: center;
  524. }
  525. }
  526. }
  527. }
  528. .modal_wrap {
  529. position: absolute;
  530. left: 0;
  531. width: 100%;
  532. top: 0;
  533. height: 100%;
  534. background: rgba(0, 0, 0, 0.3);
  535. }
  536. }
  537. .activesty {
  538. background: #007aff !important;
  539. color: #fff !important;
  540. }
  541. </style>