| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 | <!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/initiation.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="banner">      <img src="./images/initiation/banner.png" alt="">    </div> -->    <div class="title" v-clock>      {{ orchestraName }} 启蒙登记表    </div>    <van-form validate-first scroll-to-error @submit="onSubmit" ref='form' class="form">      <div class="top-tips">科学的教育与关爱,足以改变世界。我们希望,学生的未来会因您和我们的共同努力而更加光辉灿烂!</div>      <van-cell-group inset class="cell-group">        <van-field required type="tel" @blur='checkchangePhone' maxlength="11" minlength="11" label="联系电话(直接监护人)"          v-model="stu.phone" name="phone" :rules="[{ pattern, message: '输入监护人手机号码有误' }]" placeholder="请输入监护人手机号码">        </van-field>        <van-field required label="学员姓名" :rules="[{ validator, message }]" name="username" v-model="stu.username"          placeholder="请填写学员真实姓名" :disabled='checkPhone'></van-field>        <van-field required label="性别" name="sex" :disabled='checkPhone'          :rules="[{ required: true, message: '请选择性别' }]">          <template #input>            <van-radio-group v-model="stu.sex" :disabled='checkPhone' checked-color="#FF8057" direction="horizontal">              <van-tag size="large" type="primary" :color="!(stu.sex === 1) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.sex === 1) || checkPhone ? '#AAA' : '#FFF'" class="radioSection" round>                <van-radio class="radioItem" :name="1"></van-radio>男生              </van-tag>              <van-tag size="large" type="primary" :color="!(stu.sex === 0) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.sex === 0) || checkPhone ? '#AAA' : '#FFF'" class="radioSection" round>                <van-radio class="radioItem" :name="0"></van-radio>女生              </van-tag>            </van-radio-group>          </template>        </van-field>        <van-field required label="在读年级" :disabled='checkPhone' v-model="stu.currentGrade" readonly name="currentGrade"          :rules="[{ required: true, message: '请选择在读年级', trigger: 'onChange' }]" @click="() => showPicker = true"          placeholder="请选择在读年级" clickable>          <template #right-icon>            <van-icon name="arrow" :color="checkPhone ? '#aaa' : '#323233'" size="16"></van-icon>          </template>        </van-field>        <van-field v-show="false" v-model="stu.currentGradeNum" name="currentGradeNum" readonly></van-field>        <van-field required label="所在班级" :disabled='checkPhone' v-model="stu.currentClass" readonly name="currentClass"          :rules="[{ required: true, message: '请选择所在班级', trigger: 'onChange' }]" @click="() => classPicker = true"          placeholder="请选择所在班级">          <template #right-icon>            <van-icon name="arrow" :color="checkPhone ? '#aaa' : '#323233'" size="16"></van-icon>          </template>        </van-field>        <van-field required label="孩子是否有学习过乐器" :disabled='checkPhone' name="musicalInstrumentsLearning"          :rules="[{ required: true, message: '请选择孩子是否有学习过乐器' }]">          <template #input>            <van-radio-group v-model="stu.hasLearningExperience" :disabled='checkPhone' checked-color="#FF8057"              direction="horizontal">              <van-tag size="large" type="primary"                :color="!(stu.hasLearningExperience === 1) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.hasLearningExperience === 1) || checkPhone ? '#AAA' : '#FFF'" class="radioSection"                round>                <van-radio class="radioItem" :name="1"></van-radio>是              </van-tag>              <van-tag size="large" type="primary"                :color="!(stu.hasLearningExperience === 0) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.hasLearningExperience === 0) || checkPhone ? '#AAA' : '#FFF'" class="radioSection"                @click="() => stu.learningSubjectName = ''" round>                <van-radio class="radioItem" :name="0"></van-radio>否              </van-tag>            </van-radio-group>          </template>        </van-field>        <van-field label="所学乐器" :disabled='checkPhone' v-if="stu.hasLearningExperience==1" name="learningSubjectName"          v-model="stu.learningSubjectName" placeholder="请选择所学乐器"></van-field>        <van-field required label="是否报名参加管乐团家长会了解相关情况" :disabled='checkPhone' name="joinParentMeeting"          :rules="[{ required: true, message: '请选择是否报名参加管乐团家长会了解相关情况' }]">          <template #input>            <van-radio-group v-model="stu.joinParentMeeting" :disabled='checkPhone' checked-color="#FF8057"              direction="horizontal">              <van-tag size="large" type="primary"                :color="!(stu.joinParentMeeting === 1) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.joinParentMeeting === 1) || checkPhone ? '#AAA' : '#FFF'" class="radioSection" round>                <van-radio class="radioItem" :name="1"></van-radio>是              </van-tag>              <van-tag size="large" type="primary"                :color="!(stu.joinParentMeeting === 0) || checkPhone ? '#EAEAEA' : '#FF8057'"                :text-color="!(stu.joinParentMeeting === 0) || checkPhone ? '#AAA' : '#FFF'" class="radioSection" round>                <van-radio class="radioItem" :name="0"></van-radio>否              </van-tag>            </van-radio-group>          </template>        </van-field>        <van-field :border="true" label="您对校管乐团的组建有什么建议" :disabled='checkPhone' type="textarea" rows="3"          name="personalSuggestion" v-model="stu.personalSuggestion" placeholder="请填写您的建议内容">        </van-field>      </van-cell-group>      <van-button size="large" block round class="btn-submit" color="#FF8057" :loading="btnLoading"        native-type="submit">提交</van-button>    </van-form>    <van-popup v-model:show="showPicker" position="bottom" round>      <van-picker show-toolbar :columns="currentGrade" @cancel="showPicker = false" @confirm="onConfirm" />    </van-popup>    <van-popup v-model:show="classPicker" position="bottom" round>      <van-picker show-toolbar :columns="classList" @cancel="classPicker = false" @confirm="onConfirmClass" />    </van-popup>    <van-popup v-model:show="submitStatus" round style="width: 100%;background-color: transparent;"      :close-on-click-overlay="false">      <div class="submit-container">        <p class="submit-title">提交成功</p>        <p class="submit-tips">您已完成乐团启蒙调查</p>        <div @click="onLinkUrl" class="submit-btn"></div>      </div>    </van-popup>  </div>  <!-- 引入 Vue 和 Vant 的 JS 文件 -->  <script src="./js/vue.global.min.js"></script>  <script src="./js/vant.min.js"></script>  <script src="./js/axios.js"></script>  <script type="text/javascript" src="./js/utils.js"></script>  <script>    // 乐团交付,乐团停止或关闭,有新的交付团;则不允许报名    var classList = []    for (var i = 1; i <= 40; i++) {      classList.push({ text: i + '班', value: i })    }    var app = Vue.createApp({      data() {        return {          orchestraId: getQueryVariable('orchestraId'),          orchestraName: null,          schoolId: null,          showPicker: false,          classPicker: false,          submitStatus: false,          pattern: /^1(3|4|5|6|7|8|9)\d{9}$/,          nameReg: /^[\u4E00-\u9FA5]+$/,          currentGrade: [            { text: '一年级', value: 1 },            { text: '二年级', value: 2 },            { text: '三年级', value: 3 },            { text: '四年级', value: 4 },            { text: '五年级', value: 5 },          ], // 年级数组列表          classList: classList,          columns: [],          pickerType: null, // 下拉类型          stu: {            username: null, // 姓名            sex: null, // 性别            phone: null, // 电话            currentGrade: '', // 年级            currentGradeNum: null, // 年级编号            currentClass: '', // 班级            currentClassNum: null, // 年级编号            learningSubjectName: null,            hasLearningExperience: null, // 是否有学习经验            personalSuggestion: null, // 个人建议            joinParentMeeting: null          },          btnLoading: false,          checkPhone: true        }      },      async mounted() {        if (document.querySelector('#m_loading')) {          document.querySelector('#m_loading').remove()        }        if (!this.orchestraId) {          vant.showToast('信息获取失败,请联系老师')        }        try {          this.setLoading(true)          var schoolDetail = await axios.post('/api-student/open/school/detail', {            orchestraId: this.orchestraId          })          if (schoolDetail.data.code === 200 && schoolDetail.data.data) {            var schoolSystem = schoolDetail.data.data.schoolSystem || 'sixYearSystem'            this.schoolId = schoolDetail.data.data.id            if (schoolSystem === 'sixYearSystem') {              this.currentGrade.push({ text: '六年级', value: 6 })            }          }          var orchestraDetail = await axios.get('/api-student/open/orchestra/detail/' + this.orchestraId)          if (orchestraDetail.data.code === 200 && orchestraDetail.data.data) {            this.orchestraName = orchestraDetail.data.data.name || ''          }        } catch {          vant.showDialog({            message: '信息获取失败,请联系老师',            theme: 'round-button',            confirmButtonColor: '#FF8057'          })        }        this.setLoading(false)      },      methods: {        onLinkUrl() {          this.submitStatus = false          window.location.href = window.location.origin + '/orchestra-student/#/download'        },        async checkchangePhone(val) {          try {            await this.$refs.form.validate('phone')            this.checkPhone = false            //  查询老数据            let tempValues = {}            this.setLoading(true)            tempValues.orchestraId = this.orchestraId            tempValues.phone = this.stu.phone            var user = await axios.get('/api-student/open/orchestraInitiationSurvey/detailByPhone', {              params: {                ...tempValues              }            })            console.log(user.data.code)            if (user.data.code === 200 && user.data.data) {              var detail = user.data.data              console.log(detail, 'detail')              var grade = this.currentGrade.find(item => item.value == detail.currentGrade)              var cls = this.classList.find(item => item.value == detail.currentClass)              this.stu = {                username: detail.username, // 姓名                sex: detail.sex ? 1 : 0, // 性别                phone: detail.phone, // 电话                currentGrade: grade.text, // 年级                currentGradeNum: detail.currentGrade, // 年级编号                currentClass: cls.text, // 班级                currentClassNum: detail.currentClass, // 年级编号                learningSubjectName: detail.learningSubjectName,                hasLearningExperience: detail.hasLearningExperience ? 1 : 0, // 是否有学习经验                personalSuggestion: detail.personalSuggestion, // 个人建议                joinParentMeeting: detail.joinParentMeeting ? 1 : 0              }            }          } catch { }          this.setLoading(false)        },        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() {          this.btnLoading = true          try {            var stu = this.stu            var res = await axios.post('/api-student/open/orchestraInitiationSurvey/save', {              orchestraId: this.orchestraId,              schoolId: this.schoolId,              ...stu,              currentClass: stu.currentClassNum,              currentGrade: stu.currentGradeNum            })            console.log(res)            if (res.data.code === 200) {              this.submitStatus = true            } 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()          }        },        onConfirm(options) {          var stu = this.stu          stu.currentGrade = options.selectedOptions[0].text          stu.currentGradeNum = options.selectedOptions[0].value          this.showPicker = false        },        onConfirmClass(options) {          var stu = this.stu          stu.currentClass = options.selectedOptions[0].text          stu.currentClassNum = options.selectedOptions[0].value          this.classPicker = false        }      }    })    app.use(vant)    app.mount('#app')  </script></body></html>
 |