index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <div class="my-examination">
  3. <div class="my-examination__header">
  4. <el-tabs :value="activeName" @tab-click="tabChange">
  5. <el-tab-pane label="考试预约" name="1"></el-tab-pane>
  6. <el-tab-pane label="考试成绩和证书" name="2"></el-tab-pane>
  7. </el-tabs>
  8. </div>
  9. <div class="my-examination__body">
  10. <!-- 考试预约 -->
  11. <template v-if="activeName == 1">
  12. <div class="tabs-list">
  13. <div
  14. class="tabs-list__item"
  15. :class="{ 'tabs-list__item--active': tabIndex == index }"
  16. v-for="(item, index) in examList"
  17. :key="index"
  18. @click="examChange(item, index)"
  19. >
  20. {{ item.label }} {{ item.count ? `(${item.count})` : "" }}
  21. </div>
  22. </div>
  23. <template v-if="listData.length == 0">
  24. <div class="no-data" v-if="listData.length == 0">
  25. 您暂无相关考试预约哦~
  26. </div>
  27. </template>
  28. <template v-else>
  29. <div class="content-list">
  30. <div
  31. class="content-list__item"
  32. v-for="(item, index) in listData"
  33. :key="index"
  34. >
  35. <div class="content-list__item__header">
  36. <div class="text">
  37. <div class="title">{{ item.goodsName }}</div>
  38. <div class="desc">
  39. {{ $tools.timestampToTime(item.createTime, false) }}
  40. </div>
  41. </div>
  42. <el-button
  43. v-if="isShowFun(item)"
  44. type="primary"
  45. plain
  46. round
  47. class="btn"
  48. @click="cancel(item)"
  49. >取消预约</el-button
  50. >
  51. </div>
  52. <div class="content-list__item__body clearfix">
  53. <div class="left-box">
  54. <div class="title">报考学员信息</div>
  55. <div class="desc-list">
  56. <div class="desc-list__item">
  57. 姓名:<span class="note">{{ item.realname }}</span>
  58. </div>
  59. <div class="desc-list__item">
  60. 身份证:<span class="note">{{ item.idCard }}</span>
  61. </div>
  62. <div class="desc-list__item">
  63. 考试身份:<span class="note">{{
  64. item.studentType == 1
  65. ? "非补考学员"
  66. : item.studentType == 2
  67. ? "补考学员"
  68. : ""
  69. }}</span>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="center-box">
  74. <div class="title">考试预约信息</div>
  75. <div class="desc-list">
  76. <div class="desc-list__item desc-list__item--red">
  77. 报名开放时间:
  78. {{ $tools.timestampToTime(item.applyStartTime) }} ~
  79. {{ $tools.timestampToTime(item.applyEndTime) }}
  80. </div>
  81. <div class="desc-list__item">
  82. 报考专业:<span class="note"
  83. >{{ item.categoryName }}专业</span
  84. >
  85. </div>
  86. <div class="desc-list__item">
  87. 考试地点:<span class="note">{{
  88. item.applySiteAddress
  89. }}</span>
  90. </div>
  91. <div class="desc-list__item">
  92. 考试时间:<span class="note"
  93. >{{ $tools.timestampToTime(item.applySiteExamTime) }}
  94. {{ item.applySiteStartTime }} ~
  95. {{ item.applySiteEndTime }}</span
  96. >
  97. </div>
  98. <div class="desc-list__item">
  99. 考前培训地点:<span class="note">{{
  100. item.applySiteAddressTrain
  101. }}</span>
  102. </div>
  103. <div
  104. class="desc-list__item"
  105. v-if="
  106. item.applySiteExamTrainTime &&
  107. item.applySiteStartTrainTime &&
  108. item.applySiteEndTrainTime
  109. "
  110. >
  111. 考前培训时间:<span class="note"
  112. >{{
  113. $tools.timestampToTime(item.applySiteExamTrainTime)
  114. }}
  115. {{ item.applySiteStartTrainTime }} ~
  116. {{ item.applySiteEndTrainTime }}</span
  117. >
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. <div class="pagination">
  125. <el-pagination
  126. @current-change="currentChange"
  127. background
  128. layout="prev, pager, next"
  129. :total="total"
  130. :pager-count="5"
  131. >
  132. </el-pagination>
  133. </div>
  134. </template>
  135. </template>
  136. <!-- 考试成绩和证书 -->
  137. <template v-if="activeName == 2">
  138. <div class="tabs-list">
  139. <div
  140. class="tabs-list__item"
  141. :class="{ 'tabs-list__item--active': resultIndex == index }"
  142. v-for="(item, index) in resultList"
  143. :key="index"
  144. @click="resultChange(item, index)"
  145. >
  146. {{ item.label }}
  147. </div>
  148. </div>
  149. <template v-if="listData.length == 0">
  150. <div class="no-data" v-if="listData.length == 0">
  151. 您暂无相关考试成绩和证书哦~
  152. </div>
  153. </template>
  154. <template v-else>
  155. <div class="content-list">
  156. <div
  157. class="content-list__item"
  158. v-for="(item, index) in listData"
  159. :key="index"
  160. >
  161. <div class="content-list__item__header">
  162. <div class="text">
  163. <div class="title">{{ item.goodsName }}</div>
  164. <div class="desc">
  165. {{ $tools.timestampToTime(item.createTime, false) }}
  166. </div>
  167. </div>
  168. <!-- <div class="btn">取消预约</div> -->
  169. </div>
  170. <div class="content-list__item__body clearfix">
  171. <div class="left-box">
  172. <div class="title">报考学员信息</div>
  173. <div class="desc-list">
  174. <div class="desc-list__item">
  175. 姓名:<span class="note">{{ item.goodsName }}</span>
  176. </div>
  177. <div class="desc-list__item">
  178. 身份证:<span class="note">{{ item.idCard }}</span>
  179. </div>
  180. <div class="desc-list__item">
  181. 考试身份:<span class="note">{{
  182. item.studentType == 1
  183. ? "非补考学员"
  184. : item.studentType == 2
  185. ? "补考学员"
  186. : ""
  187. }}</span>
  188. </div>
  189. </div>
  190. </div>
  191. <div class="center-box">
  192. <div class="title">考试预约信息</div>
  193. <div class="desc-list">
  194. <div class="desc-list__item desc-list__item--red">
  195. 报名开放时间:
  196. {{ $tools.timestampToTime(item.applyStartTime) }} ~
  197. {{ $tools.timestampToTime(item.applyEndTime) }}
  198. </div>
  199. <div class="desc-list__item">
  200. 报考专业:<span class="note">{{
  201. item.categoryName
  202. }}</span>
  203. </div>
  204. <div class="desc-list__item">
  205. 考试地点:<span class="note">{{
  206. item.applySiteAddress
  207. }}</span>
  208. </div>
  209. <div class="desc-list__item">
  210. 考试时间:<span class="note"
  211. >{{ $tools.timestampToTime(item.applySiteExamTime) }}
  212. {{ item.applySiteStartTime }} ~
  213. {{ item.applySiteEndTime }}</span
  214. >
  215. </div>
  216. <div
  217. class="desc-list__item"
  218. v-if="item.applySiteAddressTrain"
  219. >
  220. 考前培训地点:<span class="note">{{
  221. item.applySiteAddressTrain
  222. }}</span>
  223. </div>
  224. <div
  225. class="desc-list__item"
  226. v-if="
  227. item.applySiteExamTrainTime &&
  228. item.applySiteStartTrainTime &&
  229. item.applySiteEndTrainTime
  230. "
  231. >
  232. 考前培训时间:<span class="note">{{
  233. $tools.timestampToTime(item.applySiteExamTrainTime) +
  234. " " +
  235. item.applySiteStartTrainTime +
  236. "~" +
  237. item.applySiteEndTrainTime
  238. }}</span>
  239. </div>
  240. </div>
  241. </div>
  242. <div class="right-box">
  243. <div class="title">考试成绩和证书信息</div>
  244. <div class="desc-list">
  245. <div class="desc-list__item">
  246. 考试成绩:<span class="note"
  247. >{{ item.performance }}分</span
  248. >
  249. </div>
  250. <div class="desc-list__item">
  251. 考试结果:<span
  252. class="note note--success"
  253. v-if="item.result === 1"
  254. >通过</span
  255. >
  256. <span class="note note--error" v-if="item.result === 0"
  257. >未通过</span
  258. >
  259. </div>
  260. <div class="desc-list__item" v-if="item.result === 1">
  261. 证书编号:<span class="note">{{
  262. item.certificateCode
  263. }}</span>
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. </div>
  269. </div>
  270. <div class="pagination">
  271. <el-pagination
  272. @current-change="currentChange"
  273. background
  274. layout="prev, pager, next"
  275. :total="total"
  276. :pager-count="5"
  277. >
  278. </el-pagination>
  279. </div>
  280. </template>
  281. </template>
  282. </div>
  283. </div>
  284. </template>
  285. <script>
  286. export default {
  287. name: "MyExamination",
  288. data() {
  289. return {
  290. subscribeStatus: 1,
  291. exceedExamExpend: 2,
  292. result: "",
  293. tabIndex: 0,
  294. resultIndex: 0,
  295. activeName: "1",
  296. resultList: [
  297. {
  298. label: "通过",
  299. count: 0,
  300. result: 1,
  301. },
  302. {
  303. label: "未通过",
  304. count: 0,
  305. result: 0,
  306. },
  307. ],
  308. examList: [
  309. {
  310. label: "已预约",
  311. count: 0,
  312. subscribeStatus: 1,
  313. exceedExamExpend: 2,
  314. },
  315. {
  316. label: "已取消",
  317. count: 0,
  318. subscribeStatus: 2,
  319. exceedExamExpend: "",
  320. },
  321. {
  322. label: "已过期",
  323. count: 0,
  324. subscribeStatus: 1,
  325. exceedExamExpend: 1,
  326. },
  327. ],
  328. total: 0,
  329. param: {
  330. pageNum: 1,
  331. pageSize: 10,
  332. },
  333. listData: [],
  334. };
  335. },
  336. mounted() {
  337. this.getApplylist();
  338. this.getCount();
  339. },
  340. methods: {
  341. getCount() {
  342. this.$request
  343. .getApplylist({
  344. pageNum: 1,
  345. pageSize: 1,
  346. subscribeStatus: 1,
  347. exceedExamExpend: 2,
  348. })
  349. .then((res) => {
  350. this.examList[0].count = res.total;
  351. });
  352. this.$request
  353. .getApplylist({
  354. pageNum: 1,
  355. pageSize: 1,
  356. subscribeStatus: 2,
  357. exceedExamExpend: "",
  358. })
  359. .then((res) => {
  360. this.examList[1].count = res.total;
  361. });
  362. this.$request
  363. .getApplylist({
  364. pageNum: 1,
  365. pageSize: 1,
  366. subscribeStatus: 1,
  367. exceedExamExpend: 1,
  368. })
  369. .then((res) => {
  370. this.examList[2].count = res.total;
  371. });
  372. },
  373. tabChange(e) {
  374. if (this.activeName == e.name) {
  375. return;
  376. }
  377. this.activeName = e.name;
  378. if (this.activeName == "1") {
  379. this.tabIndex = 0;
  380. this.result = "";
  381. this.param.pageNum = 1;
  382. this.subscribeStatus = 1;
  383. this.exceedExamExpend = 2;
  384. this.getApplylist();
  385. } else {
  386. this.resultIndex = 0;
  387. this.result = 1;
  388. this.param.pageNum = 1;
  389. this.subscribeStatus = "";
  390. this.exceedExamExpend = "";
  391. this.getApplylist();
  392. }
  393. },
  394. resultChange(item, index) {
  395. if (this.resultIndex == index) return;
  396. this.resultIndex = index;
  397. this.result = item.result;
  398. this.param.pageNum = 1;
  399. this.subscribeStatus = "";
  400. this.exceedExamExpend = "";
  401. this.getApplylist();
  402. },
  403. examChange(item, index) {
  404. if (this.tabIndex == index) return;
  405. this.tabIndex = index;
  406. this.subscribeStatus = item.subscribeStatus;
  407. this.exceedExamExpend = item.exceedExamExpend;
  408. this.param.pageNum = 1;
  409. this.getApplylist();
  410. },
  411. getApplylist() {
  412. this.$request
  413. .getApplylist({
  414. pageNum: this.param.pageNum,
  415. pageSize: this.param.pageSize,
  416. subscribeStatus: this.subscribeStatus,
  417. exceedExamExpend: this.exceedExamExpend,
  418. result: this.result,
  419. })
  420. .then((res) => {
  421. this.listData = res.rows;
  422. this.total = res.total;
  423. });
  424. },
  425. isShowFun(item) {
  426. var timestamp = parseInt(new Date().getTime() / 1000);
  427. var newDataAge = parseInt(
  428. new Date(new Date().toLocaleDateString()).getTime() / 1000
  429. );
  430. //报名开放时间”过了“结束时间点”,【取消预约】按钮隐藏
  431. if (item.applyEndTime <= timestamp) {
  432. return false;
  433. } else {
  434. //报名开放时间-进行中,【前培标记:已开通】,【取消预约】按钮隐藏
  435. if (item.beforeStatus === 1) {
  436. console.log(1);
  437. return false;
  438. } else if (item.examStatus !== 0) {
  439. console.log(2);
  440. return false;
  441. } else if (item.applySiteExamTime < newDataAge) {
  442. console.log(3);
  443. return false;
  444. } else if (item.applySiteExamTime > newDataAge) {
  445. console.log(4);
  446. return true;
  447. } else if (item.applySiteExamTime == newDataAge) {
  448. console.log(5);
  449. var hours = new Date().getHours();
  450. var mins = new Date().getMinutes();
  451. var arrays = item.applySiteStartTime.split(":").map(Number);
  452. if (arrays[0] > hours) {
  453. return true;
  454. } else if (arrays[0] < hours) {
  455. return false;
  456. } else {
  457. if (arrays[1] <= mins) {
  458. return false;
  459. } else {
  460. return true;
  461. }
  462. }
  463. } else {
  464. return true;
  465. }
  466. }
  467. },
  468. cancel(item) {
  469. const confirmText = [
  470. "每次考试均有名额限制,",
  471. "取消预约后,您可能无法再次预约本次考试。",
  472. "请慎重考虑。",
  473. "您确定要取消本次考试预约吗?",
  474. ];
  475. const newDatas = [];
  476. const h = this.$createElement;
  477. for (const i in confirmText) {
  478. newDatas.push(h("p", null, confirmText[i]));
  479. }
  480. this.$confirm(h("div", null, newDatas), "温馨提示", {
  481. confirmButtonText: "确定",
  482. cancelButtonText: "取消",
  483. closeOnClickModal: false,
  484. closeOnPressEscape: false,
  485. distinguishCancelAndClose: false,
  486. showClose: false,
  487. })
  488. .then((_) => {
  489. var bols = this.isShowFun(item);
  490. console.log(bols);
  491. if (!bols) {
  492. this.$message({
  493. type: "warning",
  494. message: "当前已无法取消预约",
  495. });
  496. return;
  497. }
  498. this.$request
  499. .editApply({
  500. subscribeId: item.subscribeId,
  501. subscribeStatus: 2,
  502. })
  503. .then((res) => {
  504. this.$request
  505. .getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 })
  506. .then((res) => {
  507. this.listData = res.rows;
  508. this.getApplylist();
  509. this.getCount();
  510. });
  511. });
  512. })
  513. .catch((_) => {
  514. console.log(_);
  515. });
  516. },
  517. currentChange(e) {
  518. this.param.pageNum = e;
  519. this.getApplylist();
  520. },
  521. },
  522. };
  523. </script>
  524. <!-- Add "scoped" attribute to limit CSS to this component only -->
  525. <style scoped lang="scss">
  526. .my-examination {
  527. &__header {
  528. /deep/ .el-tabs__header {
  529. margin-bottom: 0;
  530. }
  531. }
  532. &__body {
  533. .tabs-list {
  534. border-bottom: 1px solid #eee;
  535. font-size: 0;
  536. &__item {
  537. cursor: pointer;
  538. display: inline-block;
  539. padding: 0 30px;
  540. height: 40px;
  541. line-height: 40px;
  542. font-size: 14px;
  543. font-family: Microsoft YaHei;
  544. font-weight: 400;
  545. color: #666666;
  546. &--active {
  547. color: #3f8dfd;
  548. }
  549. }
  550. }
  551. .content-list {
  552. margin-top: 10px;
  553. &__item {
  554. margin-bottom: 24px;
  555. height: 320px;
  556. background: #fafbfc;
  557. border: 1px solid #eeeeee;
  558. box-shadow: 0px 0px 7px 1px rgba(0, 0, 0, 0.04);
  559. border-radius: 8px;
  560. &__header {
  561. height: 64px;
  562. display: flex;
  563. align-items: center;
  564. padding: 0 14px;
  565. border-bottom: 1px solid #eee;
  566. .text {
  567. flex: 1;
  568. .title {
  569. font-size: 16px;
  570. font-family: Microsoft YaHei;
  571. font-weight: bold;
  572. color: #333333;
  573. }
  574. .desc {
  575. margin-top: 8px;
  576. font-size: 12px;
  577. font-family: Microsoft YaHei;
  578. font-weight: 400;
  579. color: #999999;
  580. }
  581. }
  582. .btn {
  583. width: 122px;
  584. height: 32px;
  585. border-radius: 16px;
  586. padding: 0;
  587. text-align: center;
  588. line-height: 32px;
  589. font-size: 16px;
  590. }
  591. }
  592. &__body {
  593. .left-box,
  594. .center-box,
  595. .right-box {
  596. float: left;
  597. width: 300px;
  598. padding: 0 14px;
  599. .title {
  600. font-size: 16px;
  601. font-family: Microsoft YaHei;
  602. font-weight: 400;
  603. color: #3f8dfd;
  604. padding: 0 14px;
  605. margin: 14px 0;
  606. border-left: 2px solid #3f8dfd;
  607. }
  608. .desc-list {
  609. &__item {
  610. line-height: 28px;
  611. font-size: 16px;
  612. font-family: Microsoft YaHei;
  613. font-weight: 400;
  614. color: #333333;
  615. &--red {
  616. color: #ff3b30;
  617. }
  618. .note {
  619. font-size: 16px;
  620. font-family: Microsoft YaHei;
  621. font-weight: 400;
  622. color: #666666;
  623. &--success {
  624. color: #56dc68;
  625. }
  626. &--error {
  627. color: #ff3b30;
  628. }
  629. }
  630. }
  631. }
  632. }
  633. .center-box {
  634. width: 500px;
  635. }
  636. .right-box {
  637. width: 300px;
  638. }
  639. }
  640. }
  641. }
  642. .no-data {
  643. text-align: center;
  644. padding: 50px 0;
  645. color: #666;
  646. font-size: 16px;
  647. }
  648. .pagination {
  649. padding: 30px 0;
  650. text-align: center;
  651. }
  652. }
  653. }
  654. </style>