123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <meta name="format-detection" content="telephone=no">
- <meta name="mobile-web-app-capable" content="yes">
- <meta name="msapplication-tap-highlight" content="no">
- <meta name="fragment" content="!">
- <meta name="viewport"
- content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover">
- <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
- <meta http-equiv="Pragma" content="no-cache" />
- <meta http-equiv="Expires" content="0" />
- <meta http-equiv="Cache" content="no-cache">
- <meta name="description" content="">
- <link rel="icon" href="../favicon.ico">
- <title>管乐团报名申请</title>
- <!-- 引入样式文件 -->
- <link rel="stylesheet" href="./js/vant-index.css" />
- <link rel="stylesheet" href="./css/preRegister.css">
- <script src="./js/flexible.js"></script>
- </head>
- <body>
- <style>
- .m-toast {
- position: fixed;
- top: 50%;
- left: 50%;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- -webkit-box-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
- box-sizing: content-box;
- width: 88px;
- max-width: 70%;
- min-height: 88px;
- padding: 16px;
- color: #fff;
- font-size: 14px;
- line-height: 20px;
- white-space: pre-wrap;
- text-align: center;
- word-wrap: break-word;
- background-color: rgba(50, 50, 51, 0.88);
- border-radius: 4px;
- -webkit-transform: translate3d(-50%, -50%, 0);
- transform: translate3d(-50%, -50%, 0);
- z-index: 2002
- }
- .m-loading {
- position: relative;
- color: #fff;
- font-size: 0;
- vertical-align: middle;
- padding: 4px
- }
- .m-loading__spinner {
- position: relative;
- display: inline-block;
- width: 30px;
- max-width: 100%;
- height: 30px;
- max-height: 100%;
- vertical-align: middle;
- -webkit-animation: m-rotate .8s linear infinite;
- animation: m-rotate .8s linear infinite
- }
- .m-loading__spinner--circular {
- -webkit-animation-duration: 2s;
- animation-duration: 2s
- }
- .m-loading__circular {
- display: block;
- width: 100%;
- height: 100%
- }
- .m-loading__circular circle {
- -webkit-animation: m-circular 1.5s ease-in-out infinite;
- animation: m-circular 1.5s ease-in-out infinite;
- stroke: currentColor;
- stroke-width: 3;
- stroke-linecap: round
- }
- .m-loading__text {
- display: inline-block;
- margin-left: 8px;
- color: #969799;
- font-size: 14px;
- vertical-align: middle
- }
- .m-loading--vertical {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center
- }
- .m-loading--vertical .m-loading__text {
- margin: 8px 0 0
- }
- @-webkit-keyframes m-circular {
- 0% {
- stroke-dasharray: 1, 200;
- stroke-dashoffset: 0
- }
- 50% {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -40
- }
- 100% {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -120
- }
- }
- @keyframes m-circular {
- 0% {
- stroke-dasharray: 1, 200;
- stroke-dashoffset: 0
- }
- 50% {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -40
- }
- 100% {
- stroke-dasharray: 90, 150;
- stroke-dashoffset: -120
- }
- }
- .m-toast__text {
- margin-top: 8px
- }
- .van-field--error .van-field__control,
- .van-field--error .van-field__control::placeholder {
- color: #c8c9cc;
- -webkit-text-fill-color: currentColor;
- }
- </style>
- <div id="m_loading" class="m-toast m-toast--middle m-toast--loading" style="z-index: 2001;">
- <div class="m-loading m-loading--circular m-toast__loading"><span
- class="m-loading__spinner m-loading__spinner--circular"><svg viewBox="25 25 50 50" class="m-loading__circular">
- <circle cx="50" cy="50" r="20" fill="none"></circle>
- </svg></span></div>
- <div class="m-toast__text">加载中...</div>
- </div>
- <div id="app">
- <div class="title" v-clock v-html="(orchestraName || '') + '管乐团报名申请'"></div>
- <van-form validate-first scroll-to-error @submit="onSubmit" ref='form' class="form">
- <div class="top-tips">
- 1、为了保障乐团顺利组建,避免名额浪费;请家长与孩子以自愿为原则,在确认意向后填写相关信息;专业老师将根据家长的相关填报,确认孩子是否能够加入乐团;<br />
- 2、自用乐器及课后练习,家长自愿选择准备方式。
- </div>
- <van-cell-group inset class="cell-group">
- <van-field label="性别" name="sex" :rules="[{ required: true, message: '请选择性别' }]">
- <template #input>
- <van-radio-group v-model="stu.sex" checked-color="#57ABF8" direction="horizontal">
- <van-tag size="large" type="primary" :color="!(stu.sex === 1) ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.sex === 1) ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" :name="1"></van-radio>男生
- </van-tag>
- <van-tag size="large" type="primary" :color="!(stu.sex === 0) ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.sex === 0) ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" :name="0"></van-radio>女生
- </van-tag>
- </van-radio-group>
- </template>
- </van-field>
- <van-field label="孩子是否有学习过的乐器(有请备注)" v-model="stu.learningSubjectName" name="learningSubjectName"
- placeholder="请输入学习过的乐器" maxlength="10">
- </van-field>
- <van-field label="选报乐器1" v-model="stu.registerSubjectId" readonly name="registerSubjectId"
- :rules="[{ required: true, message: '请选择选报乐器1', trigger: 'onChange' }]" @click="pickerChange2"
- placeholder="请选择">
- <template #right-icon>
- <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
- </template>
- </van-field>
- <van-field label="选报乐器2" v-model="stu.standbyRegisterSubjectId" readonly name="standbyRegisterSubjectId"
- :rules="[{ required: true, message: '请选择选报乐器2', trigger: 'onChange' }]" @click="pickerChange3"
- placeholder="请选择">
- <template #right-icon>
- <van-icon name="arrow" :color="'#323233'" size="16"></van-icon>
- </template>
- </van-field>
- <van-field label="是否服从调配" name="adjust" :rules="[{ required: true, message: '请选择是否服从调配' }]">
- <template #input>
- <div>
- <p class="otherSubject">(如果自选声部名额已满,是否愿意接受安排其他声部?)</p>
- <van-radio-group v-model="stu.adjust" checked-color="#57ABF8" direction="horizontal">
- <van-tag size="large" type="primary" :color="!(stu.adjust === 1) ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.adjust === 1) ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" :name='1'></van-radio>愿意
- </van-tag>
- <van-tag size="large" type="primary" :color="!(stu.adjust === 0) ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.adjust === 0) ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" :name='0'></van-radio>不愿意
- </van-tag>
- </van-radio-group>
- </div>
- </template>
- </van-field>
- </van-cell-group>
- <van-cell-group inset class="cell-group">
- <van-field label="乐器参考表&Ai练习参考表" :border="false" style="padding-bottom: 0;">
- <template #input>
- <img :src="instrumentPriceImg" style="width: 100%" @click="showImg = true" />
- </template>
- </van-field>
- <van-field label="乐器准备方式" name="instrumentsPrepareMode" :rules="[{ required: true, message: '请选择乐器准备方式' }]">
- <template #input>
- <van-radio-group v-model="stu.instrumentsPrepareMode" checked-color="#57ABF8" direction="horizontal">
- <van-tag size="large" type="primary"
- :color="!(stu.instrumentsPrepareMode === 'ONESELF') ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.instrumentsPrepareMode === 'ONESELF') ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" name="ONESELF"></van-radio>自行购置
- </van-tag>
- <van-tag size="large" type="primary"
- :color="!(stu.instrumentsPrepareMode === 'GROUP_PURCHASE') ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.instrumentsPrepareMode === 'GROUP_PURCHASE') ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" name="GROUP_PURCHASE"></van-radio>希望基金会提供渠道购置
- </van-tag>
- </van-radio-group>
- </template>
- </van-field>
- <van-field label="乐团学习系统准备方式" name="learningSystemPrepareMode"
- :rules="[{ required: true, message: '请选择乐团学习系统准备方式' }]">
- <template #input>
- <van-radio-group v-model="stu.learningSystemPrepareMode" checked-color="#57ABF8" direction="horizontal">
- <van-tag size="large" type="primary"
- :color="!(stu.learningSystemPrepareMode === 'ONESELF') ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.learningSystemPrepareMode === 'ONESELF') ? '#AAA' : '#FFF'" class="radioSection">
- <van-radio class="radioItem" name="ONESELF"></van-radio>自行购置
- </van-tag>
- <van-tag size="large" type="primary"
- :color="!(stu.learningSystemPrepareMode === 'GROUP_PURCHASE') ? '#EAEAEA' : '#57ABF8'"
- :text-color="!(stu.learningSystemPrepareMode === 'GROUP_PURCHASE') ? '#AAA' : '#FFF'" :color="'#57ABF8'"
- class="radioSection">
- <van-radio class="radioItem" name="GROUP_PURCHASE"></van-radio>希望基金会提供渠道购置
- </van-tag>
- </van-radio-group>
- </template>
- </van-field>
- <van-field type="tel" maxlength="11" minlength="11" label="联系电话(直接监护人)" v-model="stu.phone" name="phone"
- :rules="[{ pattern, message: '输入监护人手机号码有误' }]" placeholder="请输入监护人手机号码">
- </van-field>
- </van-cell-group>
- <van-button size="large" block round class="btn-submit" :loading="btnLoading" native-type="submit"></van-button>
- </van-form>
- <van-popup v-model:show="subjectPicker" position="bottom" round>
- <van-picker show-toolbar :columns="subjectList" @cancel="subjectPicker = false" @confirm="onConfirmSubject" />
- </van-popup>
- <van-popup v-model:show="subjectPicker2" position="bottom" round>
- <van-picker show-toolbar :columns="subjectList" @cancel="subjectPicker2 = false" @confirm="onConfirmSubject2" />
- </van-popup>
- <van-image-preview v-model:show="showImg" :images="[instrumentPriceImg]">
- </van-image-preview>
- <!-- <van-popup v-model:show="submitStatus" round
- style="width: 100%;background-color: transparent;transform: translateY(-60%);" :close-on-click-overlay="false">
- <div class="submit-container">
- <p class="submit-title">提交成功</p>
- <p class="submit-tips">谢谢您的参与,请留意乐团的<br />后续通知!</p>
- <div @click="onLinkUrl" class="submit-btn"></div>
- </div>
- </van-popup> -->
- <van-popup v-model:show="showPopup" round style="width: 88%" :close-on-click-overlay="false" class="wxPopupDialog">
- <div class="popupContainer">
- <p class="title1">温馨提示</p>
- <p class="popupTips">请使用微信打开</p>
- </div>
- </van-popup>
- </div>
- <!-- 引入 Vue 和 Vant 的 JS 文件 -->
- <script src="./js/vue.global.min.js"></script>
- <script src="./js/vant.min.js"></script>
- <!-- <script src="https://fastly.jsdelivr.net/npm/vant@4/lib/vant.min.js"></script> -->
- <!-- <script src="https://cdn.jsdelivr.net/npm/umi-request@1.4.0/dist/index.min.js"></script> -->
- <script src="./js/axios.js"></script>
- <script type="text/javascript" src="./js/utils.js"></script>
- <script>
- // 乐团交付,乐团停止或关闭,有新的交付团;则不允许报名
- var app = Vue.createApp({
- data() {
- return {
- orchestraId: getQueryVariable('orchestraId'),
- openId: getQueryVariable('openId'),
- orchestraName: null,
- schoolId: null,
- subjectPickerType: 'first',
- subjectPicker: false,
- subjectPicker2: false,
- submitStatus: false,
- 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}$/,
- nameReg: /^[\u4E00-\u9FA5]+$/,
- subjectList: [{ text: '听从老师安排', value: 999 }],
- columns: [],
- pickerType: null, // 下拉类型
- stu: {
- sex: 1, // 性别
- phone: null, // 电话
- learningSubjectName: null,
- registerSubjectId: '', // 首选声部
- registerSubjectNum: null, // 所在声部
- standbyRegisterSubjectId: '', // 次选声部
- adjust: 1,
- standbyRegisterSubjectNum: '', // 次选声部
- instrumentsPrepareMode: 'ONESELF',
- learningSystemPrepareMode: 'ONESELF',
- },
- showImg: false,
- instrumentPriceImg: '',
- btnLoading: false,
- checkPhone: true,
- showPopup: false,
- code: '',
- canSignUp: ''
- }
- },
- async mounted() {
- if (document.querySelector('#m_loading')) {
- document.querySelector('#m_loading').remove()
- }
- // 判断是否是微信,只能微信中打开
- if (!browser().weixin) {
- this.showPopup = true
- return
- }
- // 判断是在微信中,并且没有openId
- if (browser().weixin && !this.openId) {
- //授权
- const code = getUrlCode()
- console.log(code)
- if (!code) {
- this.getAppIdAndCode(window.location.href)
- return
- } else {
- this.code = code
- }
- }
- if (!this.orchestraId) {
- vant.showToast('信息获取失败,请联系老师')
- }
- try {
- this.setLoading(true)
- var schoolDetail = await axios.post('/api-student/open/school/detail', {
- orchestraId: this.orchestraId
- })
- // console.log(schoolDetail)
- if (schoolDetail.data.code === 200) {
- var schoolSystem = schoolDetail.data.data.schoolSystem || 'sixYearSystem'
- this.schoolId = schoolDetail.data.data.id
- }
- var subjects = await axios.post('/api-student/open/orchestraSubjectConfig/pageByOrchestraId', {
- orchestraId: this.orchestraId,
- page: 1,
- rows: 100
- })
- if (subjects.data.code === 200) {
- var rows = subjects.data.data.rows || []
- rows.forEach(item => {
- this.subjectList.push({
- text: item.name,
- value: item.subjectId
- })
- })
- }
- var orchestraDetail = await axios.get('/api-student/open/orchestra/detail/' + this.orchestraId)
- if (orchestraDetail.data.code === 200) {
- this.orchestraName = orchestraDetail.data.data.name || ''
- this.instrumentPriceImg = orchestraDetail.data.data.instrumentPriceImg || ''
- this.canSignUp = orchestraDetail.data.data.status
- if (orchestraDetail.data.data.status !== 'PRE_REGISTER') {
- vant.showToast('家长会调查问卷已结束')
- return
- }
- }
- } catch {
- vant.showDialog({
- message: '信息获取失败,请联系老师',
- theme: 'round-button',
- confirmButtonColor: '#57ABF8'
- })
- }
- this.setLoading(false)
- },
- methods: {
- async getAppIdAndCode(url) {
- try {
- var res = await axios.get('/api-school/open/paramConfig/wechatAppId')
- // 判断是否有微信appId
- if (res.data.code === 200 && res.data.data) {
- vant.closeToast()
- if (/online.lexiaoya/.test(location.href)) {
- this.goAuth(res.data.data, url)
- } else {
- this.goTestAuth(res.data.data, url)
- }
- }
- } catch {
- //
- }
- },
- goTestAuth(wxAppId, urlString) {
- const replaceUrl =
- `https://online.lexiaoya.cn/getWxCode?appid=${wxAppId || 'wx8654c671631cfade'}&state=STATE&redirect_uri=` +
- encodeURIComponent(urlString || window.location.href)
- window.location.replace(replaceUrl)
- },
- goAuth(wxAppId, urlString) {
- // 用户授权
- console.log(urlString || window.location.href, 'urlString || window.location.href')
- const urlNow = encodeURIComponent(urlString || window.location.href)
- console.log(urlNow, 'urlNow')
- const scope = 'snsapi_base' //snsapi_userinfo //静默授权 用户无感知
- const appid = wxAppId || 'wx8654c671631cfade'
- 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`
- window.location.replace(url)
- },
- onLinkUrl() {
- this.submitStatus = false
- window.location.href = window.location.origin + '/orchestra-student/#/download'
- },
- validator(val) {
- // 校验函数返回 true 表示校验通过,false 表示不通过
- return this.nameReg.test(val) && (val.length >= 2 && val.length <= 15);
- },
- message(value) {
- if (!value) {
- return '请填写学员真实姓名'
- } else if (!this.nameReg.test(value)) {
- return '学员姓名必须为中文'
- } else if (value.length < 2 || value.length > 15) {
- return '学员姓名必须为2~15个字'
- }
- },
- async onSubmit() {
- if (this.canSignUp !== 'PRE_REGISTER') {
- vant.showToast('乐团预报名阶段已结束')
- return
- }
- this.btnLoading = true
- try {
- var stu = this.stu
- var res = await axios.post('/api-student/open/orchestraPreRegister/save', {
- orchestraId: this.orchestraId,
- schoolId: this.schoolId,
- openId: this.openId,
- ...stu,
- registerSubjectId: stu.registerSubjectNum,
- standbyRegisterSubjectId: stu.standbyRegisterSubjectNum,
- code: this.code
- })
- if (res.data.code === 200) {
- // this.submitStatus = true
- window.location.href =
- 'https://mp.weixin.qq.com/s?__biz=MzkxMDMwOTI5Nw==&mid=2247485362&idx=3&sn=9b265d36b5dabe7f9393fc679c367540&chksm=c12c256cf65bac7ae2a865435b950f6e1285afd226356db0ffde815b1ee345f29cfcdb798cc9#rd'
- } else {
- vant.showToast(res.data.message)
- }
- } catch {
- // vant.showToast('保存失败,请重试')
- }
- this.btnLoading = false
- },
- setLoading(status) {
- if (status) {
- vant.showLoadingToast({
- duration: 0, // 持续展示 toast
- message: '加载中...',
- forbidClick: true,
- loadingType: 'spinner',
- })
- } else {
- vant.closeToast()
- }
- },
- pickerChange2(type) {
- let tempId = this.stu.standbyRegisterSubjectNum
- this.subjectList.forEach((item) => {
- if (item.value == tempId && tempId != 999) {
- item.disabled = true
- } else {
- item.disabled = false
- }
- })
- this.subjectPicker = true
- },
- pickerChange3() {
- let tempId = this.stu.registerSubjectNum
- this.subjectList.forEach((item) => {
- if (item.value == tempId && tempId != 999) {
- item.disabled = true
- } else {
- item.disabled = false
- }
- })
- this.subjectPicker2 = true
- },
- onConfirmSubject(options) {
- var stu = this.stu
- stu.registerSubjectId = options.selectedOptions[0].text
- stu.registerSubjectNum = options.selectedOptions[0].value
- this.subjectPicker = false
- },
- onConfirmSubject2(options) {
- var stu = this.stu
- stu.standbyRegisterSubjectId = options.selectedOptions[0].text
- stu.standbyRegisterSubjectNum = options.selectedOptions[0].value
- this.subjectPicker2 = false
- }
- }
- })
- app.use(vant)
- app.mount('#app')
- </script>
- </body>
- </html>
|