preRegister.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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/preRegister.css">
  24. <script src="./js/flexible.js"></script>
  25. </head>
  26. <body>
  27. <style>
  28. .m-toast {
  29. position: fixed;
  30. top: 50%;
  31. left: 50%;
  32. display: -webkit-box;
  33. display: -webkit-flex;
  34. display: flex;
  35. -webkit-box-orient: vertical;
  36. -webkit-box-direction: normal;
  37. -webkit-flex-direction: column;
  38. flex-direction: column;
  39. -webkit-box-align: center;
  40. -webkit-align-items: center;
  41. align-items: center;
  42. -webkit-box-pack: center;
  43. -webkit-justify-content: center;
  44. justify-content: center;
  45. box-sizing: content-box;
  46. width: 88px;
  47. max-width: 70%;
  48. min-height: 88px;
  49. padding: 16px;
  50. color: #fff;
  51. font-size: 14px;
  52. line-height: 20px;
  53. white-space: pre-wrap;
  54. text-align: center;
  55. word-wrap: break-word;
  56. background-color: rgba(50, 50, 51, 0.88);
  57. border-radius: 4px;
  58. -webkit-transform: translate3d(-50%, -50%, 0);
  59. transform: translate3d(-50%, -50%, 0);
  60. z-index: 2002
  61. }
  62. .m-loading {
  63. position: relative;
  64. color: #fff;
  65. font-size: 0;
  66. vertical-align: middle;
  67. padding: 4px
  68. }
  69. .m-loading__spinner {
  70. position: relative;
  71. display: inline-block;
  72. width: 30px;
  73. max-width: 100%;
  74. height: 30px;
  75. max-height: 100%;
  76. vertical-align: middle;
  77. -webkit-animation: m-rotate .8s linear infinite;
  78. animation: m-rotate .8s linear infinite
  79. }
  80. .m-loading__spinner--circular {
  81. -webkit-animation-duration: 2s;
  82. animation-duration: 2s
  83. }
  84. .m-loading__circular {
  85. display: block;
  86. width: 100%;
  87. height: 100%
  88. }
  89. .m-loading__circular circle {
  90. -webkit-animation: m-circular 1.5s ease-in-out infinite;
  91. animation: m-circular 1.5s ease-in-out infinite;
  92. stroke: currentColor;
  93. stroke-width: 3;
  94. stroke-linecap: round
  95. }
  96. .m-loading__text {
  97. display: inline-block;
  98. margin-left: 8px;
  99. color: #969799;
  100. font-size: 14px;
  101. vertical-align: middle
  102. }
  103. .m-loading--vertical {
  104. display: -webkit-box;
  105. display: -webkit-flex;
  106. display: flex;
  107. -webkit-box-orient: vertical;
  108. -webkit-box-direction: normal;
  109. -webkit-flex-direction: column;
  110. flex-direction: column;
  111. -webkit-box-align: center;
  112. -webkit-align-items: center;
  113. align-items: center
  114. }
  115. .m-loading--vertical .m-loading__text {
  116. margin: 8px 0 0
  117. }
  118. @-webkit-keyframes m-circular {
  119. 0% {
  120. stroke-dasharray: 1, 200;
  121. stroke-dashoffset: 0
  122. }
  123. 50% {
  124. stroke-dasharray: 90, 150;
  125. stroke-dashoffset: -40
  126. }
  127. 100% {
  128. stroke-dasharray: 90, 150;
  129. stroke-dashoffset: -120
  130. }
  131. }
  132. @keyframes m-circular {
  133. 0% {
  134. stroke-dasharray: 1, 200;
  135. stroke-dashoffset: 0
  136. }
  137. 50% {
  138. stroke-dasharray: 90, 150;
  139. stroke-dashoffset: -40
  140. }
  141. 100% {
  142. stroke-dasharray: 90, 150;
  143. stroke-dashoffset: -120
  144. }
  145. }
  146. .m-toast__text {
  147. margin-top: 8px
  148. }
  149. .van-field--error .van-field__control,
  150. .van-field--error .van-field__control::placeholder {
  151. color: #c8c9cc;
  152. -webkit-text-fill-color: currentColor;
  153. }
  154. </style>
  155. <div id="m_loading" class="m-toast m-toast--middle m-toast--loading" style="z-index: 2001;">
  156. <div class="m-loading m-loading--circular m-toast__loading"><span
  157. class="m-loading__spinner m-loading__spinner--circular"><svg viewBox="25 25 50 50" class="m-loading__circular">
  158. <circle cx="50" cy="50" r="20" fill="none"></circle>
  159. </svg></span></div>
  160. <div class="m-toast__text">加载中...</div>
  161. </div>
  162. <div id="app">
  163. <!-- <div class="banner">
  164. <img src="./images/initiation/banner.png" alt="">
  165. </div> -->
  166. <div class="title" v-clock v-html="(orchestraName || '') + '首轮报名'"></div>
  167. <van-form validate-first scroll-to-error @submit="onSubmit" ref='form' class="form">
  168. <div class="top-tips">科学的教育与关爱,足以改变世界。我们希望,学员的未来会因您和我们的共同努力而更加光辉灿烂!</div>
  169. <van-cell-group inset class="cell-group">
  170. <van-field type="tel" @blur='checkchangePhone' maxlength="11" minlength="11" label="联系电话(直接监护人)"
  171. v-model="stu.phone" name="phone" :rules="[{ pattern, message: '输入监护人手机号码有误' }]" placeholder="请输入监护人手机号码">
  172. </van-field>
  173. <van-field label="学员姓名" :rules="[{ validator, message }]" name="username" v-model="stu.username"
  174. placeholder="请填写学员真实姓名"></van-field>
  175. <van-field label="性别" name="sex" :rules="[{ required: true, message: '请选择性别' }]">
  176. <template #input>
  177. <van-radio-group v-model="stu.sex" checked-color="#9A64FF" direction="horizontal">
  178. <van-tag size="large" type="primary" :color="!(stu.sex === 1) ? '#EAEAEA' : '#9A64FF'"
  179. :text-color="!(stu.sex === 1) ? '#AAA' : '#FFF'" class="radioSection" round>
  180. <van-radio class="radioItem" :name="1"></van-radio>男生
  181. </van-tag>
  182. <van-tag size="large" type="primary" :color="!(stu.sex === 0) ? '#EAEAEA' : '#9A64FF'"
  183. :text-color="!(stu.sex === 0) ? '#AAA' : '#FFF'" class="radioSection" round>
  184. <van-radio class="radioItem" :name="0"></van-radio>女生
  185. </van-tag>
  186. </van-radio-group>
  187. </template>
  188. </van-field>
  189. <van-field label="在读年级" v-model="stu.currentGrade" readonly name="currentGrade"
  190. :rules="[{ required: true, message: '请选择在读年级', trigger: 'onChange' }]" @click="pickerChange"
  191. placeholder="请选择在读年级">
  192. <template #right-icon>
  193. <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
  194. </template>
  195. </van-field>
  196. <van-field label="所在班级" v-model="stu.currentClass" readonly name="currentClass"
  197. :rules="[{ required: true, message: '请选择所在班级', trigger: 'onChange' }]" @click="pickerChange1"
  198. placeholder="请选择所在班级">
  199. <template #right-icon>
  200. <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
  201. </template>
  202. </van-field>
  203. </van-cell-group>
  204. <van-cell-group inset class="cell-group">
  205. <van-field label="首选声部" v-model="stu.registerSubjectId" readonly name="registerSubjectId"
  206. :rules="[{ required: true, message: '请选择首选声部', trigger: 'onChange' }]" @click="pickerChange2"
  207. placeholder="请选择首选声部">
  208. <template #right-icon>
  209. <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
  210. </template>
  211. </van-field>
  212. <van-field label="次选声部" v-model="stu.standbyRegisterSubjectId" readonly name="standbyRegisterSubjectId"
  213. :rules="[{ required: true, message: '请选择次选声部', trigger: 'onChange' }]" @click="pickerChange3"
  214. placeholder="请选择次选声部">
  215. <template #right-icon>
  216. <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
  217. </template>
  218. </van-field>
  219. <van-field label="乐器准备方式" name="instrumentsPrepareMode" :rules="[{ required: true, message: '请选择乐器准备方式' }]">
  220. <template #input>
  221. <van-radio-group v-model="stu.instrumentsPrepareMode" checked-color="#9A64FF" direction="horizontal">
  222. <van-tag size="large" type="primary"
  223. :color="!(stu.instrumentsPrepareMode === 'GROUP_PURCHASE') ? '#EAEAEA' : '#9A64FF'"
  224. :text-color="!(stu.instrumentsPrepareMode === 'GROUP_PURCHASE') ? '#AAA' : '#FFF'" class="radioSection"
  225. round>
  226. <van-radio class="radioItem" name="GROUP_PURCHASE"></van-radio>团购
  227. </van-tag>
  228. <van-tag size="large" type="primary"
  229. :color="!(stu.instrumentsPrepareMode === 'ONESELF') ? '#EAEAEA' : '#9A64FF'"
  230. :text-color="!(stu.instrumentsPrepareMode === 'ONESELF') ? '#AAA' : '#FFF'" class="radioSection" round>
  231. <van-radio class="radioItem" name="ONESELF"></van-radio>自备
  232. </van-tag>
  233. </van-radio-group>
  234. </template>
  235. </van-field>
  236. <van-field label="乐团学习系统准备方式" name="learningSystemPrepareMode"
  237. :rules="[{ required: true, message: '请选择乐团学习系统准备方式' }]">
  238. <template #input>
  239. <van-radio-group v-model="stu.learningSystemPrepareMode" checked-color="#9A64FF" direction="horizontal">
  240. <van-tag size="large" type="primary"
  241. :color="!(stu.learningSystemPrepareMode === 'GROUP_PURCHASE') ? '#EAEAEA' : '#9A64FF'"
  242. :text-color="!(stu.learningSystemPrepareMode === 'GROUP_PURCHASE') ? '#AAA' : '#FFF'"
  243. class="radioSection" round>
  244. <van-radio class="radioItem" name="GROUP_PURCHASE"></van-radio>团购
  245. </van-tag>
  246. <van-tag size="large" type="primary"
  247. :color="!(stu.learningSystemPrepareMode === 'ONESELF') ? '#EAEAEA' : '#9A64FF'"
  248. :text-color="!(stu.learningSystemPrepareMode === 'ONESELF') ? '#AAA' : '#FFF'" :color="'#9A64FF'"
  249. class="radioSection" round>
  250. <van-radio class="radioItem" name="ONESELF"></van-radio>自备
  251. </van-tag>
  252. </van-radio-group>
  253. </template>
  254. </van-field>
  255. </van-cell-group>
  256. <van-button size="large" block round class="btn-submit" color="#9A64FF" :loading="btnLoading"
  257. native-type="submit">提交</van-button>
  258. </van-form>
  259. <van-popup v-model:show="showPicker" position="bottom" round>
  260. <van-picker show-toolbar :columns="currentGrade" @cancel="showPicker = false" @confirm="onConfirm" />
  261. </van-popup>
  262. <van-popup v-model:show="classPicker" position="bottom" round>
  263. <van-picker show-toolbar :columns="classList" @cancel="classPicker = false" @confirm="onConfirmClass" />
  264. </van-popup>
  265. <van-popup v-model:show="subjectPicker" position="bottom" round>
  266. <van-picker show-toolbar :columns="subjectList" @cancel="subjectPicker = false" @confirm="onConfirmSubject" />
  267. </van-popup>
  268. <van-popup v-model:show="subjectPicker2" position="bottom" round>
  269. <van-picker show-toolbar :columns="subjectList" @cancel="subjectPicker2 = false" @confirm="onConfirmSubject2" />
  270. </van-popup>
  271. <van-popup v-model:show="submitStatus" round
  272. style="width: 100%;background-color: transparent;transform: translateY(-60%);" :close-on-click-overlay="false">
  273. <div class="submit-container">
  274. <p class="submit-title">提交成功</p>
  275. <p class="submit-tips">您已完成乐团预报名</p>
  276. <div @click="onLinkUrl" class="submit-btn"></div>
  277. </div>
  278. </van-popup>
  279. <van-popup v-model:show="showPopup" round style="width: 88%" :close-on-click-overlay="false" class="wxPopupDialog">
  280. <div class="popupContainer">
  281. <p class="title1">温馨提示</p>
  282. <p class="popupTips">请使用微信打开</p>
  283. </div>
  284. </van-popup>
  285. </div>
  286. <!-- 引入 Vue 和 Vant 的 JS 文件 -->
  287. <script src="./js/vue.global.min.js"></script>
  288. <script src="./js/vant.min.js"></script>
  289. <!-- <script src="https://cdn.jsdelivr.net/npm/umi-request@1.4.0/dist/index.min.js"></script> -->
  290. <script src="./js/axios.js"></script>
  291. <script type="text/javascript" src="./js/utils.js"></script>
  292. <script>
  293. // 乐团交付,乐团停止或关闭,有新的交付团;则不允许报名
  294. var classList = []
  295. for (var i = 1; i <= 40; i++) {
  296. classList.push({ text: i + '班', value: i })
  297. }
  298. var app = Vue.createApp({
  299. data() {
  300. return {
  301. orchestraId: getQueryVariable('orchestraId'),
  302. orchestraName: null,
  303. schoolId: null,
  304. showPicker: false,
  305. classPicker: false,
  306. subjectPickerType: 'first',
  307. subjectPicker: false,
  308. subjectPicker2: false,
  309. submitStatus: false,
  310. 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}$/,
  311. nameReg: /^[\u4E00-\u9FA5]+$/,
  312. currentGrade: [
  313. { text: '一年级', value: 1 },
  314. { text: '二年级', value: 2 },
  315. { text: '三年级', value: 3 },
  316. { text: '四年级', value: 4 },
  317. { text: '五年级', value: 5 },
  318. ], // 年级数组列表
  319. classList: classList,
  320. subjectList: [],
  321. columns: [],
  322. pickerType: null, // 下拉类型
  323. stu: {
  324. username: null, // 姓名
  325. sex: 1, // 性别
  326. phone: null, // 电话
  327. currentGrade: '', // 年级
  328. currentGradeNum: null, // 年级编号
  329. currentClass: '', // 班级
  330. currentClassNum: null, // 年级编号
  331. registerSubjectId: '', // 首选声部
  332. registerSubjectNum: null, // 所在声部
  333. standbyRegisterSubjectId: '', // 次选声部
  334. standbyRegisterSubjectNum: '', // 次选声部
  335. instrumentsPrepareMode: 'GROUP_PURCHASE',
  336. learningSystemPrepareMode: 'GROUP_PURCHASE',
  337. },
  338. btnLoading: false,
  339. checkPhone: true,
  340. showPopup: false,
  341. code: '',
  342. canSignUp: ''
  343. }
  344. },
  345. async mounted() {
  346. if (document.querySelector('#m_loading')) {
  347. document.querySelector('#m_loading').remove()
  348. }
  349. // 判断是否是微信,只能微信中打开
  350. if (!browser().weixin) {
  351. this.showPopup = true
  352. return
  353. } else {
  354. //授权
  355. const code = getUrlCode()
  356. console.log(code)
  357. if (!code) {
  358. this.getAppIdAndCode(window.location.href)
  359. return
  360. } else {
  361. this.code = code
  362. }
  363. }
  364. if (!this.orchestraId) {
  365. vant.showToast('信息获取失败,请联系老师')
  366. }
  367. try {
  368. this.setLoading(true)
  369. var schoolDetail = await axios.post('/api-student/open/school/detail', {
  370. orchestraId: this.orchestraId
  371. })
  372. console.log(schoolDetail)
  373. if (schoolDetail.data.code === 200) {
  374. var schoolSystem = schoolDetail.data.data.schoolSystem || 'sixYearSystem'
  375. this.schoolId = schoolDetail.data.data.id
  376. if (schoolSystem === 'sixYearSystem') {
  377. this.currentGrade.push({ text: '六年级', value: 6 })
  378. }
  379. }
  380. var subjects = await axios.post('/api-student/open/orchestraSubjectConfig/pageByOrchestraId', {
  381. orchestraId: this.orchestraId,
  382. page: 1,
  383. rows: 100
  384. })
  385. if (subjects.data.code === 200) {
  386. var rows = subjects.data.data.rows || []
  387. rows.forEach(item => {
  388. this.subjectList.push({
  389. text: item.name,
  390. value: item.subjectId
  391. })
  392. })
  393. }
  394. var orchestraDetail = await axios.get('/api-student/open/orchestra/detail/' + this.orchestraId)
  395. if (orchestraDetail.data.code === 200) {
  396. this.orchestraName = orchestraDetail.data.data.name || ''
  397. this.canSignUp = orchestraDetail.data.data.status
  398. if (orchestraDetail.data.data.status !== 'PRE_REGISTER') {
  399. vant.showToast('乐团预报名阶段已结束')
  400. return
  401. }
  402. }
  403. } catch {
  404. vant.showDialog({
  405. message: '信息获取失败,请联系老师',
  406. theme: 'round-button',
  407. confirmButtonColor: '#9A64FF'
  408. })
  409. }
  410. this.setLoading(false)
  411. },
  412. methods: {
  413. async getAppIdAndCode(url) {
  414. try {
  415. var res = await axios.get('/api-school/open/paramConfig/wechatAppId')
  416. // 判断是否有微信appId
  417. if (res.data.code === 200 && res.data.data) {
  418. vant.closeToast()
  419. if ('online.lexiaoya.cn' === location.host) {
  420. this.goAuth(res.data.data, url)
  421. } else {
  422. this.goTestAuth(res.data.data, url)
  423. }
  424. }
  425. } catch {
  426. //
  427. }
  428. },
  429. goTestAuth(wxAppId, urlString) {
  430. const replaceUrl =
  431. `https://online.lexiaoya.cn/getWxCode?appid=${wxAppId || 'wx8654c671631cfade'}&state=STATE&redirect_uri=` +
  432. encodeURIComponent(urlString || window.location.href)
  433. window.location.replace(replaceUrl)
  434. },
  435. goAuth(wxAppId, urlString) {
  436. // 用户授权
  437. console.log(urlString || window.location.href, 'urlString || window.location.href')
  438. const urlNow = encodeURIComponent(urlString || window.location.href)
  439. console.log(urlNow, 'urlNow')
  440. const scope = 'snsapi_base' //snsapi_userinfo //静默授权 用户无感知
  441. const appid = wxAppId || 'wx8654c671631cfade'
  442. const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${urlNow}&response_type=code&scope=${scope}&state=STATE&connect_redirect=1#wechat_redirect`
  443. window.location.replace(url)
  444. },
  445. onLinkUrl() {
  446. this.submitStatus = false
  447. window.location.href = window.location.origin + '/orchestra-student/#/download'
  448. },
  449. async checkchangePhone(val) {
  450. try {
  451. await this.$refs.form.validate('phone')
  452. this.checkPhone = false
  453. // 查询老数据
  454. let tempValues = {}
  455. this.setLoading(true)
  456. tempValues.orchestraId = this.orchestraId
  457. tempValues.phone = this.stu.phone
  458. // 先从预报名中取数据
  459. var preRegister = await axios.get('/api-student/open/orchestraPreRegister/detailByPhone', {
  460. params: {
  461. ...tempValues
  462. }
  463. })
  464. if (preRegister.data.code === 200 && preRegister.data.data) {
  465. var detail = preRegister.data.data
  466. var grade = this.currentGrade.find(item => item.value == detail.currentGrade)
  467. var cls = this.classList.find(item => item.value == detail.currentClass)
  468. var subjects = this.subjectList.find(item => item.value == detail.registerSubjectId)
  469. var subjects2 = this.subjectList.find(item => item.value == detail.standbyRegisterSubjectId)
  470. this.stu = {
  471. username: detail.username, // 姓名
  472. sex: detail.sex ? 1 : 0, // 性别
  473. phone: detail.phone, // 电话
  474. currentGrade: grade.text, // 年级
  475. currentGradeNum: detail.currentGrade, // 年级编号
  476. currentClass: cls.text, // 班级
  477. currentClassNum: detail.currentClass, // 年级编号
  478. registerSubjectId: subjects.text, //
  479. registerSubjectNum: detail.registerSubjectId, //
  480. standbyRegisterSubjectId: subjects2.text,
  481. standbyRegisterSubjectNum: detail.standbyRegisterSubjectId,
  482. instrumentsPrepareMode: detail.instrumentsPrepareMode,
  483. learningSystemPrepareMode: detail.learningSystemPrepareMode,
  484. }
  485. this.setLoading(false)
  486. return
  487. }
  488. // 如果预报名中没有数据,则从启蒙报名中取数据
  489. var userDetail = await axios.get('/api-student/open/orchestraInitiationSurvey/detailByPhone', {
  490. params: {
  491. ...tempValues
  492. }
  493. })
  494. if (userDetail.data.code === 200 && userDetail.data.data) {
  495. var detail = userDetail.data.data
  496. var grade = this.currentGrade.find(item => item.value == detail.currentGrade)
  497. var cls = this.classList.find(item => item.value == detail.currentClass)
  498. this.stu.username = detail.username // 姓名
  499. this.stu.sex = detail.sex ? 1 : 0 // 性别
  500. this.stu.phone = detail.phone // 电话
  501. this.stu.currentGrade = grade.text // 年级
  502. this.stu.currentGradeNum = detail.currentGrade // 年级编号
  503. this.stu.currentClass = cls.text // 班级
  504. this.stu.currentClassNum = detail.currentClass // 年级编号
  505. }
  506. } catch { }
  507. this.setLoading(false)
  508. },
  509. validator(val) {
  510. // 校验函数返回 true 表示校验通过,false 表示不通过
  511. return this.nameReg.test(val) && (val.length >= 2 && val.length <= 15);
  512. },
  513. message(value) {
  514. if (!value) {
  515. return '请填写学员真实姓名'
  516. } else if (!this.nameReg.test(value)) {
  517. return '学员姓名必须为中文'
  518. } else if (value.length < 2 || value.length > 15) {
  519. return '学员姓名必须为2~15个字'
  520. }
  521. },
  522. async onSubmit() {
  523. if (this.canSignUp !== 'PRE_REGISTER') {
  524. vant.showToast('乐团预报名阶段已结束')
  525. return
  526. }
  527. this.btnLoading = true
  528. try {
  529. var stu = this.stu
  530. var res = await axios.post('/api-student/open/orchestraPreRegister/save', {
  531. orchestraId: this.orchestraId,
  532. schoolId: this.schoolId,
  533. ...stu,
  534. currentClass: stu.currentClassNum,
  535. currentGrade: stu.currentGradeNum,
  536. registerSubjectId: stu.registerSubjectNum,
  537. standbyRegisterSubjectId: stu.standbyRegisterSubjectNum,
  538. code: this.code
  539. })
  540. if (res.data.code === 200) {
  541. // this.submitStatus = true
  542. window.location.href =
  543. 'https://mp.weixin.qq.com/s?__biz=MzkxMDMwOTI5Nw==&mid=2247485362&idx=3&sn=9b265d36b5dabe7f9393fc679c367540&chksm=c12c256cf65bac7ae2a865435b950f6e1285afd226356db0ffde815b1ee345f29cfcdb798cc9#rd'
  544. } else {
  545. vant.showToast(res.data.message)
  546. }
  547. } catch {
  548. // vant.showToast('保存失败,请重试')
  549. }
  550. this.btnLoading = false
  551. },
  552. setLoading(status) {
  553. if (status) {
  554. vant.showLoadingToast({
  555. duration: 0, // 持续展示 toast
  556. message: '加载中...',
  557. forbidClick: true,
  558. loadingType: 'spinner',
  559. })
  560. } else {
  561. vant.closeToast()
  562. }
  563. },
  564. pickerChange(type) {
  565. this.showPicker = true
  566. },
  567. pickerChange1(type) {
  568. this.classPicker = true
  569. },
  570. pickerChange2(type) {
  571. let tempId = this.stu.standbyRegisterSubjectNum
  572. this.subjectList.forEach((item) => {
  573. if (item.value == tempId) {
  574. item.disabled = true
  575. } else {
  576. item.disabled = false
  577. }
  578. })
  579. this.subjectPicker = true
  580. },
  581. pickerChange3() {
  582. let tempId = this.stu.registerSubjectNum
  583. this.subjectList.forEach((item) => {
  584. if (item.value == tempId) {
  585. item.disabled = true
  586. } else {
  587. item.disabled = false
  588. }
  589. })
  590. this.subjectPicker2 = true
  591. },
  592. onConfirm(options) {
  593. var stu = this.stu
  594. stu.currentGrade = options.selectedOptions[0].text
  595. stu.currentGradeNum = options.selectedOptions[0].value
  596. this.showPicker = false
  597. },
  598. onConfirmClass(options) {
  599. var stu = this.stu
  600. stu.currentClass = options.selectedOptions[0].text
  601. stu.currentClassNum = options.selectedOptions[0].value
  602. this.classPicker = false
  603. },
  604. onConfirmSubject(options) {
  605. var stu = this.stu
  606. stu.registerSubjectId = options.selectedOptions[0].text
  607. stu.registerSubjectNum = options.selectedOptions[0].value
  608. this.subjectPicker = false
  609. },
  610. onConfirmSubject2(options) {
  611. var stu = this.stu
  612. stu.standbyRegisterSubjectId = options.selectedOptions[0].text
  613. stu.standbyRegisterSubjectNum = options.selectedOptions[0].value
  614. this.subjectPicker2 = false
  615. }
  616. }
  617. })
  618. app.use(vant)
  619. app.mount('#app')
  620. </script>
  621. </body>
  622. </html>