index.vue 21 KB

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