schoolRegister.html 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  8. <meta name="format-detection" content="telephone=no">
  9. <meta name="mobile-web-app-capable" content="yes">
  10. <meta name="msapplication-tap-highlight" content="no">
  11. <meta name="fragment" content="!">
  12. <meta name="viewport"
  13. content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover">
  14. <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  15. <meta http-equiv="Pragma" content="no-cache" />
  16. <meta http-equiv="Expires" content="0" />
  17. <meta http-equiv="Cache" content="no-cache">
  18. <meta name="description" content="">
  19. <link rel="icon" href="../favicon.ico">
  20. <title>管乐团入驻学校登记</title>
  21. <!-- 引入样式文件 -->
  22. <link rel="stylesheet" href="./js/vant-index.css" />
  23. <link rel="stylesheet" href="./css/schoolRegister.css">
  24. <script src="./js/flexible.js"></script>
  25. </head>
  26. <body>
  27. <style>
  28. </style>
  29. <div id="m_loading" class="m-toast m-toast--middle m-toast--loading" style="z-index: 2001;">
  30. <div class="m-loading m-loading--circular m-toast__loading"><span
  31. class="m-loading__spinner m-loading__spinner--circular"><svg viewBox="25 25 50 50" class="m-loading__circular">
  32. <circle cx="50" cy="50" r="20" fill="none"></circle>
  33. </svg></span></div>
  34. <div class="m-toast__text">加载中...</div>
  35. </div>
  36. <div id="app">
  37. <div class="title">
  38. 欢迎使用管乐团双师训练系统
  39. <p class="tips">办乐团就用管乐团!</p>
  40. </div>
  41. <van-form validate-first scroll-to-error @submit="onSubmit" ref='form' class="form">
  42. <div class="cell_title">学校信息</div>
  43. <van-cell-group inset class="cell-group">
  44. <van-field required label="学校全称" v-model="forms.name" :rules="[{ required: true, message: '请填写学校全称' }]"
  45. name="name" placeholder="请填写学校全称" maxlength="50">
  46. </van-field>
  47. <van-field required label="所在城市" v-model="forms.cityCodeName" readonly name="cityCodeName" @click="onSelectCity"
  48. :rules="[{ required: true, message: '请选择所在城市', trigger: 'onChange' }]" placeholder="请选择所在城市">
  49. <template #right-icon>
  50. <van-icon name="arrow" :color="checkPhone ? '#aaa' : '#323233'" size="16"></van-icon>
  51. </template>
  52. </van-field>
  53. <van-field required label="办学性质" name="schoolNature" :rules="[{ required: true, message: '请选择办学性质' }]">
  54. <template #input>
  55. <van-radio-group checked-color="#64A9FF" v-model="forms.schoolNature" direction="horizontal">
  56. <van-tag size="large" type="primary" :plain="!(forms.schoolNature === 'PUBLIC')" color="#64A9FF"
  57. class="radioSection">
  58. <van-radio class="radioItem" name="PUBLIC"></van-radio>公办
  59. </van-tag>
  60. <van-tag size="large" type="primary" :plain="!(forms.schoolNature === 'PRIVATE')" color="#64A9FF"
  61. class="radioSection">
  62. <van-radio class="radioItem" name="PRIVATE"></van-radio>民办
  63. </van-tag>
  64. </van-radio-group>
  65. </template>
  66. </van-field>
  67. <van-field required label="学年制" name="schoolSystem" :rules="[{ required: true, message: '请选择学年制' }]">
  68. <template #input>
  69. <van-radio-group checked-color="#64A9FF" v-model="forms.schoolSystem" direction="horizontal">
  70. <van-tag size="large" type="primary" :plain="!(forms.schoolSystem === 'fiveYearSystem')" color="#64A9FF"
  71. class="radioSection">
  72. <van-radio class="radioItem" name="fiveYearSystem"></van-radio>六年制
  73. </van-tag>
  74. <van-tag size="large" type="primary" :plain="!(forms.schoolSystem === 'sixYearSystem')" color="#64A9FF"
  75. class="radioSection">
  76. <van-radio class="radioItem" name="sixYearSystem"></van-radio>五年制
  77. </van-tag>
  78. </van-radio-group>
  79. </template>
  80. </van-field>
  81. <van-field required label="邮箱地址" v-model="forms.email" :rules="[{ required: true, message: '请输入学校邮箱地址' }]"
  82. name="email" placeholder="请输入学校邮箱地址">
  83. </van-field>
  84. </van-cell-group>
  85. <div class="cell_title">负责人</div>
  86. <van-cell-group inset class="cell-group">
  87. <van-field required label="负责人姓名" v-model="forms.emergencyContact" maxlength="20"
  88. :rules="[{ required: true, message: '请输入负责人姓名' }]" :maxlength="20" name="emergencyContact"
  89. placeholder="请输入负责人姓名">
  90. </van-field>
  91. <van-field required type="tel" v-model="forms.emergencyContactPhone" maxlength="11" minlength="11"
  92. label="负责人手机号" name="emergencyContactPhone"
  93. :rules="[{ required: true, message: '请输入负责人手机号' },{ pattern, message: '输入负责人手机号有误' }]"
  94. placeholder="请输入负责人手机号码">
  95. </van-field>
  96. <van-field required label="在校职位" v-model="forms.emergencyContactPosition" maxlength="20"
  97. :rules="[{ required: true, message: '请输入负责人在校职位' }]" name="emergencyContactPosition" placeholder="请输入负责人在校职位">
  98. </van-field>
  99. </van-cell-group>
  100. <div class="cell_title">乐团管理老师</div>
  101. <van-cell-group inset class="cell-group">
  102. <van-field required label="管理老师姓名" v-model="forms.educationalAdministrationUsername" maxlength="20"
  103. :rules="[{ required: true, message: '请输入管理老师姓名' }]" name="educationalAdministrationUsername"
  104. placeholder="请输入管理老师姓名">
  105. </van-field>
  106. <van-field required type="tel" v-model="forms.educationalAdministrationPhone" maxlength="11" minlength="11"
  107. label="管理老师手机号" name="educationalAdministrationPhone"
  108. :rules="[{ required: true, message: '请输入管理老师手机号' },{ pattern, message: '输入管理老师手机号有误' }]"
  109. placeholder="请输入管理老师手机号">
  110. </van-field>
  111. <van-field required label="在校职位" v-model="forms.educationalAdministrationPosition" maxlength="20"
  112. :rules="[{ required: true, message: '请输入乐团管理老师在校职位' }]" name="educationalAdministrationPosition"
  113. placeholder="请输入乐团管理老师在校职位">
  114. </van-field>
  115. </van-cell-group>
  116. <van-button size="large" block round class="btn-submit" color="#64A9FF" :loading="btnLoading"
  117. native-type="submit">完成</van-button>
  118. </van-form>
  119. <van-popup v-model:show="showPicker" position="bottom" round>
  120. <van-picker show-toolbar :columns="columns" @cancel="showPicker = false" @confirm="onConfirm"
  121. :columns-field-names="{ text: 'name', value: 'code', children: 'areas' }" />
  122. </van-popup>
  123. <van-popup v-model:show="submitStatus" round style="width: 75%" :close-on-click-overlay="false">
  124. <div class="submit-container">
  125. <img class="icon-close" src="./images/initiation/icon-close.png" @click="submitStatus = false" />
  126. <img src="./images/initiation/popup-submit.png" class="submit-img" />
  127. <p class="submit-tips">提交成功,感谢您的参与!</p>
  128. <van-button type="primary" color="#64A9FF" block round @click="submitStatus = false">确认</van-button>
  129. </div>
  130. </van-popup>
  131. </div>
  132. <!-- 引入 Vue 和 Vant 的 JS 文件 -->
  133. <script src="./js/vue.global.min.js"></script>
  134. <script src="./js/vant.min.js"></script>
  135. <!-- <script src="https://cdn.jsdelivr.net/npm/umi-request@1.4.0/dist/index.min.js"></script> -->
  136. <script src="./js/axios.js"></script>
  137. <script type="text/javascript" src="./js/utils.js"></script>
  138. <script type="text/javascript" src="./js/area.js"></script>
  139. <script>
  140. // 乐团交付,乐团停止或关闭,有新的交付团;则不允许报名
  141. var classList = []
  142. for (var i = 1; i <= 40; i++) {
  143. classList.push({ text: i + '班', value: i })
  144. }
  145. var app = Vue.createApp({
  146. data() {
  147. return {
  148. showPicker: false,
  149. submitStatus: false,
  150. pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
  151. columns: [],
  152. pickerType: null, // 下拉类型
  153. forms: {
  154. name: null,
  155. cityCode: null,
  156. cityCodeName: '',
  157. schoolSystem: null,
  158. schoolNature: null,
  159. email: null,
  160. educationalAdministrationUsername: null,
  161. educationalAdministrationPosition: null,
  162. educationalAdministrationPhone: null,
  163. emergencyContact: null,
  164. emergencyContactPhone: null,
  165. emergencyContactPosition: null
  166. },
  167. btnLoading: false,
  168. checkPhone: false
  169. }
  170. },
  171. async mounted() {
  172. if (document.querySelector('#m_loading')) {
  173. document.querySelector('#m_loading').remove()
  174. }
  175. if (!this.orchestraId) {
  176. vant.showToast('信息获取失败,请联系老师')
  177. }
  178. try {
  179. this.setLoading(true)
  180. console.log(areas)
  181. const tempareas = []
  182. areas.forEach(item => {
  183. const temp = {
  184. name: item.name,
  185. code: item.code,
  186. areas: []
  187. }
  188. if (item.areas && item.areas.length > 0) {
  189. item.areas.forEach(child => {
  190. temp.areas.push({
  191. name: child.name,
  192. code: child.code,
  193. })
  194. })
  195. }
  196. tempareas.push(temp)
  197. })
  198. this.columns = tempareas || []
  199. } catch {
  200. vant.showDialog({
  201. message: '信息获取失败,请联系老师',
  202. theme: 'round-button',
  203. confirmButtonColor: '#64A9FF'
  204. })
  205. }
  206. this.setLoading(false)
  207. },
  208. methods: {
  209. async onSubmit() {
  210. this.btnLoading = true
  211. try {
  212. var forms = this.forms
  213. var res = await axios.post('/api-school/open/school/save', {
  214. ...forms
  215. })
  216. if (res.data.code === 200) {
  217. this.submitStatus = true
  218. } else {
  219. vant.showToast(res.data.message)
  220. }
  221. } catch {
  222. vant.showToast('保存失败,请重试')
  223. }
  224. this.btnLoading = false
  225. },
  226. setLoading(status) {
  227. if (status) {
  228. vant.showLoadingToast({
  229. duration: 0, // 持续展示 toast
  230. message: '加载中...',
  231. forbidClick: true,
  232. loadingType: 'spinner',
  233. })
  234. } else {
  235. vant.closeToast()
  236. }
  237. },
  238. onSelectCity() {
  239. this.showPicker = true
  240. },
  241. onConfirm(val) {
  242. const selectedOptions = val.selectedOptions[1]
  243. this.forms.cityCode = selectedOptions.code
  244. this.forms.cityCodeName = selectedOptions.name
  245. this.showPicker = false
  246. }
  247. }
  248. })
  249. app.use(vant)
  250. app.mount('#app')
  251. </script>
  252. </body>
  253. </html>