xsbm.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!DOCTYPE html>
  2. <html lang="zh-Hans">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>学生报名</title>
  7. <script src="../config.js"></script>
  8. <!-- 引入样式文件 -->
  9. <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/vant@4/lib/index.css" />
  10. <!-- 引入 Vue 和 Vant 的 JS 文件 -->
  11. <script src="https://fastly.jsdelivr.net/npm/vue@3"></script>
  12. <script src="https://fastly.jsdelivr.net/npm/vant@4/lib/vant.min.js"></script>
  13. <!-- <script src="https://cdn.tailwindcss.com"></script> -->
  14. <style>
  15. body {
  16. margin: 0;
  17. padding: 0;
  18. background: #eff2f5;
  19. }
  20. #app {
  21. width: 100vw;
  22. height: 100vh;
  23. padding: 20px 6px;
  24. box-sizing: border-box;
  25. /* display: flex;
  26. justify-content: center;
  27. align-items: center; */
  28. }
  29. .mt-10 {
  30. margin-top: 10px;
  31. }
  32. .mt-20 {
  33. margin-top: 10px;
  34. }
  35. </style>
  36. </head>
  37. <body>
  38. <div id="app">
  39. <div v-if="finished" style="display: flex;flex-direction: column;align-items: center;justify-content: center;padding-top: 30px;">
  40. <van-icon name="checked" color="#0f0" size="96"></van-icon>
  41. <div style="font-size: 22px;margin-top: 32px;" >已提交报名申请,请等待审核</div>
  42. </div>
  43. <van-form v-else @submit="onSubmit">
  44. <van-cell-group inset>
  45. <van-field v-model="form.xkx_xjh" name="学籍号" label="学籍号" placeholder="请填写学籍号"
  46. :rules="[{ required: true, message: '请填写学籍号' }]"></van-field>
  47. <van-field v-model="form.xkx_xsxm" name="学生姓名" label="学生姓名" placeholder="请填写学生姓名"
  48. :rules="[{ required: true, message: '请填写学生姓名' }]" class="mt-10"></van-field>
  49. </van-cell-group>
  50. <div class="mt-10" style="margin: 16px;">
  51. <van-button round block type="primary" native-type="submit">
  52. 报名
  53. </van-button>
  54. </div>
  55. </van-form>
  56. </div>
  57. <script>
  58. // get location search object
  59. function getSearchObj(){
  60. const search = window.location.search
  61. const searchObj = {}
  62. if(search){
  63. const searchArr = search.slice(1).split('&')
  64. searchArr.forEach(item => {
  65. const [key, value] = item.split('=')
  66. searchObj[key] = value
  67. })
  68. }
  69. return searchObj
  70. }
  71. const searchObj = getSearchObj()
  72. // get time YYYY-MM-DD HH:mm:ss 不足两位补0
  73. function getTime(time) {
  74. const year = time.getFullYear()
  75. const month = time.getMonth() + 1
  76. const day = time.getDate()
  77. const hour = time.getHours()
  78. const minute = time.getMinutes()
  79. const second = time.getSeconds()
  80. return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day} ${hour < 10 ? '0' + hour : hour}:${minute < 10 ? '0' + minute : minute}:${second < 10 ? '0' + second : second}`
  81. }
  82. const App = {
  83. data() {
  84. return {
  85. form: {
  86. xkx_xjh: '',
  87. xkx_xsxm: ''
  88. },
  89. finished: false,
  90. };
  91. },
  92. methods: {
  93. onSubmit() {
  94. fetch(
  95. window.GLOBAL_CONFIG.api + '/xdjx/khfw_xs/add',
  96. {
  97. method: 'POST',
  98. headers: {
  99. 'Content-Type': 'application/x-www-form-urlencoded'
  100. },
  101. body: JSON.stringify({
  102. api: 'json',
  103. issubmit: '1',
  104. nocheck: 1,
  105. xdjx_khfw_xs: {
  106. ...this.form,
  107. xkt_datetime: getTime(new Date()),
  108. xkk_id: searchObj.xkk_id
  109. }
  110. })
  111. }).then(res => res.json())
  112. .then(res => {
  113. if (res.code == '1') {
  114. // vant.showSuccessToast('报名成功');
  115. this.finished = true
  116. } else {
  117. vant.showFailToast(res.msg);
  118. }
  119. }
  120. )
  121. },
  122. },
  123. };
  124. const app = Vue.createApp(App);
  125. app.use(vant);
  126. app.mount("#app");
  127. </script>
  128. </body>
  129. </html>