schoolRegister.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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" :color="!(forms.schoolNature === 'PUBLIC') ? '#EAEAEA' : '#64A9FF'"
  57. :text-color="!(forms.schoolNature === 'PUBLIC') ? '#AAA' : '#FFF'" class="radioSection" round>
  58. <van-radio class="radioItem" name="PUBLIC"></van-radio>公办
  59. </van-tag>
  60. <van-tag size="large" type="primary" :color="!(forms.schoolNature === 'PRIVATE') ? '#EAEAEA' : '#64A9FF'"
  61. :text-color="!(forms.schoolNature === 'PRIVATE') ? '#AAA' : '#FFF'" class="radioSection" round>
  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"
  71. :color="!(forms.schoolSystem === 'fiveYearSystem') ? '#EAEAEA' : '#64A9FF'"
  72. :text-color="!(forms.schoolSystem === 'fiveYearSystem') ? '#AAA' : '#FFF'" class="radioSection" round>
  73. <van-radio class="radioItem" name="fiveYearSystem"></van-radio>五年制
  74. </van-tag>
  75. <van-tag size="large" type="primary"
  76. :color="!(forms.schoolSystem === 'sixYearSystem') ? '#EAEAEA' : '#64A9FF'"
  77. :text-color="!(forms.schoolSystem === 'sixYearSystem') ? '#AAA' : '#FFF'" class="radioSection" round>
  78. <van-radio class="radioItem" name="sixYearSystem"></van-radio>六年制
  79. </van-tag>
  80. </van-radio-group>
  81. </template>
  82. </van-field>
  83. <van-field required label="邮箱地址" v-model="forms.email"
  84. :rules="[{ required: true, message: '请输入学校邮箱地址' }, { pattern: emailPattern, message: '输入邮箱地址有误' }]"
  85. name="email" placeholder="请输入学校邮箱地址">
  86. </van-field>
  87. </van-cell-group>
  88. <div class="cell_title">负责人</div>
  89. <van-cell-group inset class="cell-group">
  90. <van-field required label="负责人姓名" v-model="forms.emergencyContact" maxlength="20"
  91. :rules="[{ required: true, message: '请输入负责人姓名' }]" :maxlength="20" name="emergencyContact"
  92. placeholder="请输入负责人姓名">
  93. </van-field>
  94. <van-field required type="tel" v-model="forms.emergencyContactPhone" maxlength="11" minlength="11"
  95. label="负责人手机号" name="emergencyContactPhone"
  96. :rules="[{ required: true, message: '请输入负责人手机号' },{ pattern, message: '输入负责人手机号有误' }]"
  97. placeholder="请输入负责人手机号码">
  98. </van-field>
  99. <van-field required label="在校职位" v-model="forms.emergencyContactPosition" maxlength="20"
  100. :rules="[{ required: true, message: '请输入负责人在校职位' }]" name="emergencyContactPosition" placeholder="请输入负责人在校职位">
  101. </van-field>
  102. </van-cell-group>
  103. <div class="cell_title">乐团管理老师</div>
  104. <van-cell-group inset class="cell-group">
  105. <van-field required label="管理老师姓名" v-model="forms.educationalAdministrationUsername" maxlength="20"
  106. :rules="[{ required: true, message: '请输入管理老师姓名' }]" name="educationalAdministrationUsername"
  107. placeholder="请输入管理老师姓名">
  108. </van-field>
  109. <van-field required type="tel" v-model="forms.educationalAdministrationPhone" maxlength="11" minlength="11"
  110. label="管理老师手机号" name="educationalAdministrationPhone"
  111. :rules="[{ required: true, message: '请输入管理老师手机号' },{ pattern, message: '输入管理老师手机号有误' }]"
  112. placeholder="请输入管理老师手机号">
  113. </van-field>
  114. <van-field required label="在校职位" v-model="forms.educationalAdministrationPosition" maxlength="20"
  115. :rules="[{ required: true, message: '请输入乐团管理老师在校职位' }]" name="educationalAdministrationPosition"
  116. placeholder="请输入乐团管理老师在校职位">
  117. </van-field>
  118. </van-cell-group>
  119. <van-button size="large" block round class="btn-submit" color="#64A9FF" :loading="btnLoading"
  120. native-type="submit">完成</van-button>
  121. </van-form>
  122. <van-popup v-model:show="showPicker" position="bottom" round>
  123. <van-picker show-toolbar :columns="columns" @cancel="showPicker = false" @confirm="onConfirm"
  124. :columns-field-names="{ text: 'name', value: 'code', children: 'areas' }" />
  125. </van-popup>
  126. <van-popup v-model:show="submitStatus" round style="width: 100%;background-color: transparent;"
  127. :close-on-click-overlay="false">
  128. <div class="submit-container">
  129. <p class="submit-title">提交成功</p>
  130. <p class="submit-tips">感谢您的参与!</p>
  131. <div @click="onLinkUrl" class="submit-btn"></div>
  132. </div>
  133. </van-popup>
  134. </div>
  135. <!-- 引入 Vue 和 Vant 的 JS 文件 -->
  136. <script src="./js/vue.global.min.js"></script>
  137. <script src="./js/vant.min.js"></script>
  138. <!-- <script src="https://cdn.jsdelivr.net/npm/umi-request@1.4.0/dist/index.min.js"></script> -->
  139. <script src="./js/axios.js"></script>
  140. <script type="text/javascript" src="./js/utils.js"></script>
  141. <!-- <script type="text/javascript" src="./js/area.js"></script> -->
  142. <script>
  143. // 乐团交付,乐团停止或关闭,有新的交付团;则不允许报名
  144. var classList = []
  145. for (var i = 1; i <= 40; i++) {
  146. classList.push({ text: i + '班', value: i })
  147. }
  148. var app = Vue.createApp({
  149. data() {
  150. return {
  151. showPicker: false,
  152. submitStatus: false,
  153. pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,
  154. emailPattern: /^\w+@([\da-z\.-]+)\.([a-z]+|[\u2E80-\u9FFF]+)$/,
  155. columns: [],
  156. pickerType: null, // 下拉类型
  157. forms: {
  158. name: null,
  159. regionCode: null,
  160. cityCode: null,
  161. cityCodeName: '',
  162. provinceCode: null,
  163. schoolSystem: null,
  164. schoolNature: null,
  165. email: null,
  166. educationalAdministrationUsername: null,
  167. educationalAdministrationPosition: null,
  168. educationalAdministrationPhone: null,
  169. emergencyContact: null,
  170. emergencyContactPhone: null,
  171. emergencyContactPosition: null
  172. },
  173. btnLoading: false,
  174. checkPhone: false
  175. }
  176. },
  177. async mounted() {
  178. if (document.querySelector('#m_loading')) {
  179. document.querySelector('#m_loading').remove()
  180. }
  181. try {
  182. this.setLoading(true)
  183. // console.log(areas)
  184. // const tempareas = []
  185. // areas.forEach(item => {
  186. // const temp = {
  187. // name: item.name,
  188. // code: item.code,
  189. // areas: []
  190. // }
  191. // if (item.areas && item.areas.length > 0) {
  192. // item.areas.forEach(child => {
  193. // temp.areas.push({
  194. // name: child.name,
  195. // code: child.code,
  196. // })
  197. // })
  198. // }
  199. // tempareas.push(temp)
  200. // })
  201. // this.columns = tempareas || []
  202. var res = await axios.get('/api-school/open/sysArea/queryAllProvince')
  203. if (res.data.code === 200) {
  204. this.columns = res.data.data || []
  205. }
  206. } catch {
  207. vant.showDialog({
  208. message: '信息获取失败,请联系老师',
  209. theme: 'round-button',
  210. confirmButtonColor: '#64A9FF'
  211. })
  212. }
  213. this.setLoading(false)
  214. },
  215. methods: {
  216. onLinkUrl() {
  217. this.submitStatus = false
  218. window.location.href = window.location.origin + '/orchestra-student/#/download?type=manage'
  219. },
  220. async onSubmit() {
  221. this.btnLoading = true
  222. try {
  223. var forms = this.forms
  224. var res = await axios.post('/api-school/open/school/save', {
  225. ...forms
  226. })
  227. if (res.data.code === 200) {
  228. this.submitStatus = true
  229. } else {
  230. vant.showToast(res.data.message)
  231. }
  232. } catch {
  233. vant.showToast('保存失败,请重试')
  234. }
  235. this.btnLoading = false
  236. },
  237. setLoading(status) {
  238. if (status) {
  239. vant.showLoadingToast({
  240. duration: 0, // 持续展示 toast
  241. message: '加载中...',
  242. forbidClick: true,
  243. loadingType: 'spinner',
  244. })
  245. } else {
  246. vant.closeToast()
  247. }
  248. },
  249. onSelectCity() {
  250. this.showPicker = true
  251. },
  252. onConfirm(val) {
  253. const selectedOptions = val.selectedOptions[1]
  254. this.forms.cityCode = selectedOptions.code
  255. const selectedFirst = val.selectedOptions[0]
  256. this.forms.provinceCode = selectedFirst.code
  257. this.forms.cityCodeName = selectedFirst.name + '/' + selectedOptions.name
  258. const selectTwo = val.selectedOptions[2]
  259. if (selectTwo) {
  260. this.forms.regionCode = selectTwo.code
  261. this.forms.cityCodeName += '/' + selectTwo.name
  262. }
  263. this.showPicker = false
  264. }
  265. }
  266. })
  267. app.use(vant)
  268. app.mount('#app')
  269. </script>
  270. </body>
  271. </html>