schoolRegister.html 12 KB

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