index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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" 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 }}
  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. },
  375. tabChange(e) {
  376. if (this.activeName == e.name) {
  377. return;
  378. }
  379. this.activeName = e.name;
  380. if (this.activeName == "1") {
  381. this.tabIndex = 0;
  382. this.result = "";
  383. this.param.pageNum = 1;
  384. this.subscribeStatus = 1;
  385. this.exceedExamExpend = 2;
  386. this.getApplylist();
  387. } else {
  388. this.resultIndex = 0;
  389. this.result = 1;
  390. this.param.pageNum = 1;
  391. this.subscribeStatus = "";
  392. this.exceedExamExpend = "";
  393. this.getApplylist();
  394. }
  395. },
  396. resultChange(item, index) {
  397. if (this.resultIndex == index) return;
  398. this.resultIndex = index;
  399. this.result = item.result;
  400. this.param.pageNum = 1;
  401. this.subscribeStatus = "";
  402. this.exceedExamExpend = "";
  403. this.getApplylist();
  404. },
  405. examChange(item, index) {
  406. if (this.tabIndex == index) return;
  407. this.tabIndex = index;
  408. this.subscribeStatus = item.subscribeStatus;
  409. this.exceedExamExpend = item.exceedExamExpend;
  410. this.param.pageNum = 1;
  411. this.getApplylist();
  412. },
  413. getApplylist() {
  414. this.$request
  415. .getApplylist({
  416. pageNum: this.param.pageNum,
  417. pageSize: this.param.pageSize,
  418. subscribeStatus: this.subscribeStatus,
  419. exceedExamExpend: this.exceedExamExpend,
  420. result: this.result,
  421. })
  422. .then((res) => {
  423. this.listData = res.rows;
  424. this.total = res.total;
  425. });
  426. },
  427. isShowFun(item) {
  428. var timestamp = parseInt(new Date().getTime() / 1000);
  429. var newDataAge = parseInt(
  430. new Date(new Date().toLocaleDateString()).getTime() / 1000
  431. );
  432. //报名开放时间”过了“结束时间点”,【取消预约】按钮隐藏
  433. if (item.applyEndTime <= timestamp) {
  434. return false;
  435. } else {
  436. //报名开放时间-进行中,【前培标记:已开通】,【取消预约】按钮隐藏
  437. if (item.beforeStatus === 1) {
  438. console.log(1);
  439. return false;
  440. } else if (item.examStatus !== 0) {
  441. console.log(2);
  442. return false;
  443. } else if (item.applySiteExamTime < newDataAge) {
  444. console.log(3);
  445. return false;
  446. } else if (item.applySiteExamTime > newDataAge) {
  447. console.log(4);
  448. return true;
  449. } else if (item.applySiteExamTime == newDataAge) {
  450. console.log(5);
  451. var hours = new Date().getHours();
  452. var mins = new Date().getMinutes();
  453. var arrays = item.applySiteStartTime.split(":").map(Number);
  454. if (arrays[0] > hours) {
  455. return true;
  456. } else if (arrays[0] < hours) {
  457. return false;
  458. } else {
  459. if (arrays[1] <= mins) {
  460. return false;
  461. } else {
  462. return true;
  463. }
  464. }
  465. } else {
  466. return true;
  467. }
  468. }
  469. },
  470. cancel(item) {
  471. const confirmText = [
  472. "每次考试均有名额限制,",
  473. "取消预约后,您可能无法再次预约本次考试。",
  474. "请慎重考虑。",
  475. "您确定要取消本次考试预约吗?",
  476. ];
  477. const newDatas = [];
  478. const h = this.$createElement;
  479. for (const i in confirmText) {
  480. newDatas.push(h("p", null, confirmText[i]));
  481. }
  482. this.$confirm(h("div", null, newDatas), "温馨提示", {
  483. confirmButtonText: "确定",
  484. cancelButtonText: "取消",
  485. closeOnClickModal: false,
  486. closeOnPressEscape: false,
  487. distinguishCancelAndClose: false,
  488. showClose: false,
  489. })
  490. .then((_) => {
  491. var bols = this.isShowFun(item);
  492. console.log(bols);
  493. if (!bols) {
  494. this.$message({
  495. type: "warning",
  496. message: "当前已无法取消预约",
  497. });
  498. return;
  499. }
  500. this.$request
  501. .editApply({
  502. subscribeId: item.subscribeId,
  503. subscribeStatus: 2,
  504. })
  505. .then((res) => {
  506. this.$request
  507. .getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 })
  508. .then((res) => {
  509. this.listData = res.rows;
  510. this.getApplylist();
  511. this.getCount();
  512. });
  513. });
  514. })
  515. .catch((_) => {
  516. console.log(_);
  517. });
  518. },
  519. currentChange(e) {
  520. this.param.pageNum = e;
  521. this.getApplylist();
  522. },
  523. },
  524. };
  525. </script>
  526. <!-- Add "scoped" attribute to limit CSS to this component only -->
  527. <style scoped lang="scss">
  528. .my-examination {
  529. &__header {
  530. /deep/ .el-tabs__header {
  531. margin-bottom: 0;
  532. }
  533. }
  534. &__body {
  535. .tabs-list {
  536. border-bottom: 1px solid #eee;
  537. font-size: 0;
  538. &__item {
  539. cursor: pointer;
  540. display: inline-block;
  541. padding: 0 30px;
  542. height: 40px;
  543. line-height: 40px;
  544. font-size: 14px;
  545. font-family: Microsoft YaHei;
  546. font-weight: 400;
  547. color: #666666;
  548. &--active {
  549. color: #3f8dfd;
  550. }
  551. }
  552. }
  553. .content-list {
  554. margin-top: 10px;
  555. &__item {
  556. margin-bottom: 24px;
  557. height: 320px;
  558. background: #fafbfc;
  559. border: 1px solid #eeeeee;
  560. box-shadow: 0px 0px 7px 1px rgba(0, 0, 0, 0.04);
  561. border-radius: 8px;
  562. &__header {
  563. height: 64px;
  564. display: flex;
  565. align-items: center;
  566. padding: 0 14px;
  567. border-bottom: 1px solid #eee;
  568. .text {
  569. flex: 1;
  570. .title {
  571. font-size: 16px;
  572. font-family: Microsoft YaHei;
  573. font-weight: bold;
  574. color: #333333;
  575. }
  576. .desc {
  577. margin-top: 8px;
  578. font-size: 12px;
  579. font-family: Microsoft YaHei;
  580. font-weight: 400;
  581. color: #999999;
  582. }
  583. }
  584. .btn {
  585. width: 122px;
  586. height: 32px;
  587. border-radius: 16px;
  588. padding: 0;
  589. text-align: center;
  590. line-height: 32px;
  591. font-size: 16px;
  592. }
  593. }
  594. &__body {
  595. .left-box,
  596. .center-box,
  597. .right-box {
  598. float: left;
  599. width: 300px;
  600. padding: 0 14px;
  601. .title {
  602. font-size: 16px;
  603. font-family: Microsoft YaHei;
  604. font-weight: 400;
  605. color: #3f8dfd;
  606. padding: 0 14px;
  607. margin: 14px 0;
  608. border-left: 2px solid #3f8dfd;
  609. }
  610. .desc-list {
  611. &__item {
  612. line-height: 28px;
  613. font-size: 16px;
  614. font-family: Microsoft YaHei;
  615. font-weight: 400;
  616. color: #333333;
  617. &--red {
  618. color: #ff3b30;
  619. }
  620. .note {
  621. font-size: 16px;
  622. font-family: Microsoft YaHei;
  623. font-weight: 400;
  624. color: #666666;
  625. &--success {
  626. color: #56dc68;
  627. }
  628. &--error {
  629. color: #ff3b30;
  630. }
  631. }
  632. }
  633. }
  634. }
  635. .center-box {
  636. width: 500px;
  637. }
  638. .right-box {
  639. width: 300px;
  640. }
  641. }
  642. }
  643. }
  644. .no-data {
  645. text-align: center;
  646. padding: 50px 0;
  647. color: #666;
  648. font-size: 16px;
  649. }
  650. .pagination {
  651. padding: 30px 0;
  652. text-align: center;
  653. }
  654. }
  655. }
  656. </style>