index.vue 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <div class="exam-select">
  3. <h1>请选择考试批次</h1>
  4. <t-form
  5. ref="form"
  6. :data="formData"
  7. :label-width="0"
  8. class="form"
  9. :rules="rules"
  10. >
  11. <t-form-item name="examId">
  12. <t-select
  13. v-model="formData.examId"
  14. placeholder="请选择考试"
  15. :options="options"
  16. filterable
  17. :onChange="examChange"
  18. />
  19. </t-form-item>
  20. </t-form>
  21. <div class="btns">
  22. <a class="confirm" @click="confirm">确 定</a>
  23. <a class="cancel" @click="cancel">退 出</a>
  24. </div>
  25. </div>
  26. </template>
  27. <script setup name="Login">
  28. import { ref, reactive } from 'vue';
  29. import { useRouter } from 'vue-router';
  30. const form = ref(null);
  31. const router = useRouter();
  32. const { replace } = router;
  33. const formData = reactive({
  34. examId: '',
  35. });
  36. const examChange = () => {};
  37. const rules = {
  38. examId: [
  39. { required: true, message: '请选择考试', type: 'error', trigger: 'change' },
  40. ],
  41. };
  42. const options = ref([]);
  43. const confirm = () => {
  44. form.value.validate().then(async (result) => {
  45. if (result === true) {
  46. }
  47. setTimeout(() => {
  48. router.push('/');
  49. }, 100);
  50. });
  51. };
  52. const cancel = () => {
  53. replace('/login');
  54. };
  55. </script>
  56. <style lang="less" scoped>
  57. .exam-select {
  58. position: absolute;
  59. left: 0;
  60. top: 0;
  61. width: 100%;
  62. height: 100%;
  63. padding: 95px 130px;
  64. z-index: 10;
  65. .btns {
  66. margin-top: 40px;
  67. }
  68. .btns a {
  69. display: inline-block;
  70. width: 160px;
  71. height: 54px;
  72. text-align: center;
  73. line-height: 54px;
  74. border-radius: 26px;
  75. font-size: 20px;
  76. color: #fff;
  77. font-weight: 700;
  78. cursor: pointer;
  79. &.confirm {
  80. background-image: linear-gradient(to right, #88d3fc, #66ade8);
  81. }
  82. &.cancel {
  83. background: #c7cacc;
  84. margin-left: 5px;
  85. }
  86. }
  87. .form {
  88. margin-top: 40px;
  89. }
  90. & > h1 {
  91. font-size: 23px;
  92. text-align: center;
  93. }
  94. }
  95. </style>