index.tsx 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907
  1. import {
  2. computed,
  3. defineComponent,
  4. nextTick,
  5. onMounted,
  6. reactive,
  7. ref
  8. } from 'vue';
  9. import styles from './index.module.less';
  10. // import infoTitle from '../images/info-title.png';
  11. import {
  12. Button,
  13. CountDown,
  14. Field,
  15. Form,
  16. Picker,
  17. Popup,
  18. Radio,
  19. RadioGroup,
  20. Tag,
  21. showToast
  22. } from 'vant';
  23. import OWxTip from '@/components/m-wx-tip';
  24. // import MProtocol from '@/components/m-protocol';
  25. import MImgCode from '@/components/m-img-code';
  26. import { browser, checkPhone } from '@/helpers/utils';
  27. import request from '@/helpers/request';
  28. import { useStudentRegisterStore } from '@/store/modules/student-register-store';
  29. // import { setLoginInit, state } from '@/state';
  30. // import iconGift from '../images/icon-gift.png';
  31. import { useRoute, useRouter } from 'vue-router';
  32. import MSticky from '@/components/m-sticky';
  33. // import registerBgIcon from '../images/register-bg.png';
  34. import vipGiftIcon from '../images/vip-gift-icon.png';
  35. // import agreeYes from '../images/agree-yes.png';
  36. // import agreeNo from '../images/agree-no.png';
  37. import MMessageTip from '@/components/m-message-tip';
  38. import SelectStudent from '../modal/select-student';
  39. const classList: any = [];
  40. for (let i = 1; i <= 40; i++) {
  41. classList.push({ text: i + '班', value: i });
  42. }
  43. export default defineComponent({
  44. name: 'register-new',
  45. emits: ['close', 'submit'],
  46. setup() {
  47. const route = useRoute();
  48. const studentRegisterStore = useStudentRegisterStore();
  49. // 初始化学校编号
  50. studentRegisterStore.setShoolId(route.query.sId as any);
  51. const countDownRef = ref();
  52. const gradeList = computed(() => {
  53. let tempList: any = [];
  54. const five = [
  55. { text: '一年级', value: 1 },
  56. { text: '二年级', value: 2 },
  57. { text: '三年级', value: 3 },
  58. { text: '四年级', value: 4 },
  59. { text: '五年级', value: 5 }
  60. ];
  61. const one = [{ text: '六年级', value: 6 }];
  62. const three = [
  63. { text: '七年级', value: 7 },
  64. { text: '八年级', value: 8 },
  65. { text: '九年级', value: 9 }
  66. ];
  67. if (forms.gradeYear === 'FIVE_YEAR_SYSTEM') {
  68. tempList.push([...five]);
  69. } else if (forms.gradeYear === 'SIX_YEAR_SYSTEM') {
  70. tempList.push([...five, ...one]);
  71. } else if (forms.gradeYear === 'THREE_YEAR_SYSTEM') {
  72. tempList.push([...three]);
  73. } else if (forms.gradeYear === 'FORE_YEAR_SYSTEM') {
  74. tempList.push([...one, ...three]);
  75. } else {
  76. tempList.push([...five, ...one, ...three]);
  77. }
  78. return tempList;
  79. });
  80. const forms = reactive({
  81. countDownStatus: true,
  82. countDownTime: 1000 * 120, // 倒计时时间
  83. modelValue: false, // 是否选中协议
  84. imgCodeStatus: false,
  85. gradeNumText: '',
  86. currentClassText: '',
  87. multi_user_limit: 1, // 限制注册学生数量
  88. gradeStatus: false,
  89. classStatus: false,
  90. loading: false,
  91. schoolId: route.query.sId as any,
  92. showSelectStudent: false, // 选择学生
  93. studentList: [], // 手机号关联学生列表
  94. studentItem: {} as any, // 选择的学生
  95. isRegister: 'create' as 'create' | 'update' | '', // 是否注册学生
  96. isTipRegister: true, // 是否显示名字不一致 - 默认显示
  97. isChangeSchool: false, // 是否切换学校
  98. details: {} as any,
  99. gradeYear: null,
  100. schoolType: null,
  101. giftVipDay: null as any,
  102. showTips: false,
  103. showButton: false,
  104. showMessage: '请使用微信打开',
  105. gradePopupShow: false,
  106. gradePopupIndex: [] as any, // 年级下拉索引
  107. classPopupShow: false,
  108. classPopupIndex: [] as any // 班级下拉索引
  109. });
  110. const otherParams = reactive({
  111. showOtherSchool: false,
  112. showCloseButton: true, // 是否显示关闭按钮
  113. showOtherMessage: '',
  114. /** limit 超限制,change 更换学生,nickname 名称不一致 */
  115. otherType: '' as 'limit' | 'change' | 'nickname',
  116. showCancelButton: true,
  117. cancelButtonColor: '',
  118. cancelButtonText: '取消',
  119. showConfirmButton: true,
  120. confirmButtonColor: '',
  121. confirmButtonText: '确定',
  122. messageAlign: 'left' as 'center' | 'left' | 'right'
  123. });
  124. const isAgree = ref(false);
  125. const studentInfo = reactive({
  126. autoRegister: true,
  127. multiUser: true, // 是否为多用户
  128. client_id: 'cooleshow-student',
  129. client_secret: 'cooleshow-student',
  130. extra: {
  131. nickname: '',
  132. currentGradeNum: '',
  133. currentClass: '',
  134. gender: 1,
  135. registerType: '', // 报名类型
  136. giftVipDay: 0, // 赠送会员天数
  137. clientType: 'TEACHER'
  138. },
  139. grant_type: 'password',
  140. loginType: 'SMS',
  141. password: '',
  142. username: ''
  143. });
  144. const onCodeSend = () => {
  145. forms.countDownStatus = false;
  146. nextTick(() => {
  147. countDownRef.value.start();
  148. });
  149. };
  150. // 格式化提示状态
  151. const changeTipStatus = (register: boolean, school: boolean) => {
  152. forms.isTipRegister = register;
  153. forms.isChangeSchool = school;
  154. };
  155. const onSendCode = () => {
  156. // 发送验证码
  157. if (!checkPhone(studentInfo.username)) {
  158. return showToast('请输入正确的手机号码');
  159. }
  160. forms.imgCodeStatus = true;
  161. };
  162. // const getUserInfos = async () => {
  163. // if (
  164. // studentInfo.password.length !== 6 ||
  165. // !checkPhone(studentInfo.username)
  166. // ) {
  167. // return;
  168. // }
  169. // try {
  170. // const { data } = await request.get(
  171. // `/edu-app/open/student/studentInfo?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
  172. // );
  173. // if (data) {
  174. // if (!studentInfo.extra.nickname) {
  175. // studentInfo.extra.nickname = data.nickname;
  176. // }
  177. // if (!studentInfo.extra.currentGradeNum) {
  178. // studentInfo.extra.currentGradeNum = data.currentGradeNum;
  179. // }
  180. // if (!studentInfo.extra.currentClass) {
  181. // studentInfo.extra.currentClass = data.currentClass;
  182. // }
  183. // // if (!studentInfo.extra.gender) {
  184. // studentInfo.extra.gender =
  185. // studentInfo.extra.gender !== data.gender
  186. // ? data.gender
  187. // : studentInfo.extra.gender;
  188. // // studentInfo.username = data.nickname;
  189. // classList.forEach((i: any) => {
  190. // if (i.value === data.currentClass) {
  191. // forms.currentClassText = i.text;
  192. // }
  193. // });
  194. // const tempGrade: any = gradeList.value[0] || [];
  195. // tempGrade?.forEach((i: any) => {
  196. // if (i.value === data.currentGradeNum) {
  197. // forms.gradeNumText = i.text;
  198. // }
  199. // });
  200. // }
  201. // } catch {
  202. // //
  203. // }
  204. // };
  205. const getUserInfos = async () => {
  206. if (
  207. studentInfo.password.length !== 6 ||
  208. !checkPhone(studentInfo.username)
  209. ) {
  210. return;
  211. }
  212. try {
  213. const { data } = await request.get(
  214. `/edu-app/open/student/studentInfo?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER`
  215. );
  216. forms.studentList = data || [];
  217. if (forms.studentList.length > 0) {
  218. const firstStudent: any = forms.studentList[0];
  219. forms.studentItem = firstStudent;
  220. studentInfo.extra.nickname = firstStudent.nickname;
  221. const tempGrade: any = gradeList.value[0] || [];
  222. tempGrade?.forEach((i: any) => {
  223. if (i.value === firstStudent.currentGradeNum) {
  224. // forms.instrumentCode = i.instrumentCode;
  225. forms.gradeNumText = i.text;
  226. studentInfo.extra.currentGradeNum = firstStudent.currentGradeNum;
  227. // if (forms.schoolInstrumentSetType === 'CLASS') {
  228. // forms.classList = i.classList;
  229. // }
  230. }
  231. });
  232. classList.forEach((i: any) => {
  233. if (i.value === firstStudent.currentClass) {
  234. forms.currentClassText = i.text;
  235. studentInfo.extra.currentClass = firstStudent.currentClass;
  236. }
  237. });
  238. studentInfo.extra.gender = firstStudent.gender;
  239. forms.isRegister = 'update';
  240. changeTipStatus(true, false);
  241. } else {
  242. forms.isRegister = 'create';
  243. changeTipStatus(true, false);
  244. forms.studentItem = [];
  245. }
  246. } catch {
  247. //
  248. }
  249. };
  250. const validatePhone = computed(() => {
  251. return checkPhone(studentInfo.username) ? true : false;
  252. });
  253. const onFinished = () => {
  254. forms.countDownStatus = true;
  255. countDownRef.value.reset();
  256. };
  257. //
  258. const checkSubmit = () => {
  259. const { extra } = studentInfo;
  260. if (
  261. forms.studentItem.nickname !== extra.nickname &&
  262. forms.isTipRegister
  263. ) {
  264. otherParams.showOtherMessage =
  265. '学生姓名与上次提交信息不一致,请确认修改学生信息或创建新的学生账号';
  266. otherParams.showOtherSchool = true;
  267. otherParams.showCancelButton = true;
  268. otherParams.showCloseButton = true;
  269. otherParams.cancelButtonColor =
  270. 'linear-gradient( 224deg, #3FE1E6 0%, #00CDD4 100%)';
  271. otherParams.cancelButtonText = '新建学生';
  272. otherParams.confirmButtonColor =
  273. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  274. otherParams.confirmButtonText = '修改信息';
  275. otherParams.otherType = 'nickname';
  276. otherParams.messageAlign = 'left';
  277. return true;
  278. }
  279. // 判断新建学员是否上限了
  280. if (
  281. forms.isRegister === 'create' &&
  282. forms.studentList.length >= forms.multi_user_limit
  283. ) {
  284. otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
  285. otherParams.showOtherSchool = true;
  286. otherParams.showCancelButton = false;
  287. otherParams.showCloseButton = true;
  288. otherParams.confirmButtonColor =
  289. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  290. otherParams.confirmButtonText = '我知道了';
  291. otherParams.otherType = 'limit';
  292. otherParams.messageAlign = 'center';
  293. return true;
  294. }
  295. // 判断是否为同一个学校
  296. if (
  297. forms.studentItem.schoolId !== forms.details.id &&
  298. !forms.isChangeSchool &&
  299. forms.isRegister === 'update'
  300. ) {
  301. otherParams.showOtherMessage = `您已绑定【${
  302. forms.studentItem?.schoolName || ''
  303. }】,提交后将更换到【${forms.details.name || ''}】,是否确认提交?`;
  304. otherParams.showOtherSchool = true;
  305. otherParams.showCancelButton = true;
  306. otherParams.showCloseButton = false;
  307. otherParams.cancelButtonColor = '';
  308. otherParams.cancelButtonText = '取消';
  309. otherParams.confirmButtonColor = '';
  310. otherParams.confirmButtonText = '确定';
  311. otherParams.otherType = 'change';
  312. otherParams.messageAlign = 'left';
  313. return true;
  314. }
  315. return false;
  316. };
  317. const onSubmit = async () => {
  318. try {
  319. if (checkForm() || checkSubmit()) return;
  320. forms.loading = true;
  321. // await request.get('/edu-app/open/student/schoolQuery', {
  322. // params: {
  323. // schoolId: forms.schoolId,
  324. // mobile: studentInfo.username
  325. // }
  326. // });
  327. // const { extra, ...res } = studentInfo;
  328. const { extra, loginType, autoRegister, password, multiUser, ...res } =
  329. studentInfo;
  330. let tLoginType = loginType,
  331. tAutoRegister = autoRegister,
  332. tPassword = password,
  333. tMultiUser = multiUser;
  334. if (forms.isRegister === 'update') {
  335. tLoginType = 'TOKEN';
  336. tAutoRegister = false;
  337. tPassword = forms.studentItem.token;
  338. tMultiUser = false;
  339. }
  340. const result = await request.post('/edu-app/userlogin', {
  341. hideLoading: false,
  342. requestType: 'form',
  343. data: {
  344. loginType: tLoginType,
  345. autoRegister: tAutoRegister,
  346. password: tPassword,
  347. multiUser: tMultiUser,
  348. ...res,
  349. extra: JSON.stringify({
  350. ...extra,
  351. schoolId: forms.schoolId
  352. })
  353. }
  354. });
  355. if (result.code === 5435 || result.code === 5436) {
  356. forms.showTips = true;
  357. forms.showMessage = '报名信息更新,请刷新后重新提交';
  358. forms.showButton = true;
  359. } else {
  360. setTimeout(() => {
  361. showToast('报名成功');
  362. // router.push('/download');
  363. }, 100);
  364. setTimeout(() => {
  365. if (browser().weixin) {
  366. // 关闭微信
  367. (window as any).WeixinJSBridge.call('closeWindow');
  368. }
  369. }, 1000);
  370. }
  371. } catch {
  372. // 重置信息 - 如果是新建则不提示
  373. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  374. } finally {
  375. forms.loading = false;
  376. }
  377. };
  378. const checkForm = () => {
  379. if (!checkPhone(studentInfo.username)) {
  380. showToast('请输入正确的手机号码');
  381. return true;
  382. } else if (!studentInfo.password) {
  383. showToast('请输入验证码');
  384. return true;
  385. } else if (!studentInfo.extra.nickname) {
  386. showToast('请输入学生姓名');
  387. return true;
  388. } else if (!studentInfo.extra.currentGradeNum) {
  389. showToast('请选择所在年级');
  390. return true;
  391. } else if (!studentInfo.extra.currentClass) {
  392. showToast('请选择所在班级');
  393. return true;
  394. }
  395. return false;
  396. };
  397. const getRegisterGoods = async () => {
  398. try {
  399. const { data } = await request.get('/edu-app/open/school/detail', {
  400. params: {
  401. id: forms.schoolId
  402. },
  403. noAuthorization: true // 是否请求接口的时候添加toekn
  404. });
  405. forms.giftVipDay = data.giftVipDay;
  406. forms.schoolType = data.schoolType;
  407. forms.gradeYear = data.gradeYear;
  408. forms.details = data;
  409. studentInfo.extra.giftVipDay = data.giftVipDay;
  410. studentInfo.extra.registerType = data.registerType;
  411. if (browser().weixin) {
  412. if (data.status === 0) {
  413. forms.showTips = true;
  414. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  415. forms.showButton = false;
  416. }
  417. } else {
  418. forms.showTips = true;
  419. }
  420. } catch {}
  421. };
  422. onMounted(async () => {
  423. try {
  424. // 获取支付类型
  425. const { data } = await request.get(
  426. '/edu-app/open/paramConfig/queryByParamNameList',
  427. {
  428. requestType: 'form',
  429. params: {
  430. paramNames: 'multi_user_limit'
  431. }
  432. }
  433. );
  434. if (data && Array.isArray(data)) {
  435. data.forEach((item: any) => {
  436. if (item.paramName === 'multi_user_limit') {
  437. forms.multi_user_limit = item.paramValue
  438. ? Number(item.paramValue)
  439. : 1;
  440. }
  441. });
  442. }
  443. await getRegisterGoods();
  444. } catch {}
  445. });
  446. return () => (
  447. <div class={styles.registerModal}>
  448. {/* {forms.giftVipDay ? (
  449. <div class={styles.memberNumer}>
  450. <img src={iconGift} class={styles.iconGift} />
  451. <p>
  452. 现在报名立即赠送乐器AI学练工具有效期{' '}
  453. <span>{forms.giftVipDay}</span> 天
  454. </p>
  455. </div>
  456. ) : (
  457. ''
  458. )} */}
  459. <div class={styles.studentRegisterContainer}>
  460. <div
  461. class={[
  462. styles.studentSection,
  463. styles.studentSectionForm,
  464. styles.noSendDay
  465. ]}>
  466. <div class={styles.title3}></div>
  467. <Form labelAlign="left" class={styles.registerForm}>
  468. <Field
  469. clearable={false}
  470. label="联系方式(直接监护人)"
  471. placeholder="请输入手机号码"
  472. type="tel"
  473. required
  474. autocomplete="off"
  475. inputAlign="right"
  476. class={styles.username}
  477. v-model={studentInfo.username}
  478. border={false}
  479. maxlength={11}>
  480. {{
  481. label: () => (
  482. <div>
  483. 联系方式
  484. <p class={styles.tips}>(直接监护人)</p>
  485. </div>
  486. )
  487. }}
  488. </Field>
  489. <div class={['van-hairline--bottom', styles.fieldTipsGroup]}>
  490. <div class={[styles.fieldTips]}>
  491. 手机号是音乐数字课堂的唯一登录账户
  492. </div>
  493. </div>
  494. <Field
  495. center
  496. clearable={false}
  497. required
  498. inputAlign="right"
  499. label="验证码"
  500. placeholder="请输入验证码"
  501. autocomplete="off"
  502. type="number"
  503. v-model={studentInfo.password}
  504. maxlength={6}
  505. onUpdate:modelValue={(val: any) => {
  506. getUserInfos();
  507. }}>
  508. {{
  509. button: () =>
  510. forms.countDownStatus ? (
  511. <span
  512. class={[
  513. styles.codeText,
  514. !validatePhone.value ? styles.codeTextDisabled : ''
  515. ]}
  516. onClick={onSendCode}>
  517. 获取验证码
  518. </span>
  519. ) : (
  520. <CountDown
  521. ref={(el: any) => (countDownRef.value = el)}
  522. auto-start={false}
  523. class={styles.countDown}
  524. time={forms.countDownTime}
  525. onFinish={onFinished}
  526. format="ss秒后重试"
  527. />
  528. )
  529. }}
  530. </Field>
  531. </Form>
  532. </div>
  533. <div
  534. class={[
  535. styles.studentSection,
  536. styles.studentSectionForm,
  537. forms.giftVipDay <= 0 && styles.noSendDay
  538. ]}>
  539. <div class={styles.title1}></div>
  540. <Form labelAlign="left" class={styles.registerForm}>
  541. {/* 大于等于2,则可以切换学生 */}
  542. {forms.studentList.length > 1 && (
  543. <div
  544. class={[
  545. styles.selectStudentGroup,
  546. forms.showSelectStudent && styles.selectStudentGroupChecked
  547. ]}
  548. onClick={() => (forms.showSelectStudent = true)}>
  549. <i
  550. class={[
  551. styles.studentIcon,
  552. !forms.studentItem.userId && styles.studentIconAdd
  553. ]}></i>
  554. <span>
  555. {forms.studentItem.userId
  556. ? forms.studentItem.nickname
  557. : '新增学生'}
  558. </span>
  559. </div>
  560. )}
  561. <Field
  562. clearable={false}
  563. label="学生姓名"
  564. placeholder="请输入学生姓名"
  565. autocomplete="off"
  566. maxlength={14}
  567. v-model={studentInfo.extra.nickname}
  568. required
  569. input-align="right"
  570. />
  571. <Field
  572. clearable={false}
  573. label="学生性别"
  574. placeholder="请选择性别"
  575. autocomplete="off"
  576. required
  577. input-align="right"
  578. // v-model={studentInfo.extra.nickname}
  579. >
  580. {{
  581. input: () => (
  582. <RadioGroup
  583. checked-color="#ffcb75"
  584. v-model={studentInfo.extra.gender}
  585. direction="horizontal">
  586. <Tag
  587. size="large"
  588. type="primary"
  589. color={
  590. !(studentInfo.extra.gender === 1)
  591. ? '#F5F6FA'
  592. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  593. }
  594. textColor={
  595. !(studentInfo.extra.gender === 1) ? '#626264' : '#fff'
  596. }
  597. class={styles.radioSection}
  598. round>
  599. <Radio class={styles.radioItem} name={1}></Radio>男
  600. </Tag>
  601. <Tag
  602. size="large"
  603. type="primary"
  604. color={
  605. !(studentInfo.extra.gender === 0)
  606. ? '#F5F6FA'
  607. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  608. }
  609. textColor={
  610. !(studentInfo.extra.gender === 0) ? '#626264' : '#fff'
  611. }
  612. class={styles.radioSection}
  613. round>
  614. <Radio class={styles.radioItem} name={0}></Radio>女
  615. </Tag>
  616. </RadioGroup>
  617. )
  618. }}
  619. </Field>
  620. <Field
  621. clearable={false}
  622. label="所在年级"
  623. placeholder="请选择年级"
  624. isLink
  625. readonly
  626. clickable={false}
  627. modelValue={forms.gradeNumText}
  628. onClick={() => {
  629. forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  630. forms.gradeStatus = true;
  631. }}
  632. required
  633. input-align="right"
  634. />
  635. <Field
  636. clearable={false}
  637. label="所在班级"
  638. placeholder="请选择班级"
  639. isLink
  640. readonly
  641. clickable={false}
  642. modelValue={forms.currentClassText}
  643. onClick={() => {
  644. forms.classPopupIndex = [studentInfo.extra.currentClass];
  645. forms.classStatus = true;
  646. }}
  647. required
  648. input-align="right"
  649. />
  650. {studentInfo.extra.registerType === 'GIFT_VIP_DAY' &&
  651. forms.giftVipDay &&
  652. Number(forms.giftVipDay) > 0 ? (
  653. <div class={styles.giftTips}>
  654. <img src={vipGiftIcon} />
  655. <span>
  656. 注册成功即可获得乐器AI学练工具<i>{forms.giftVipDay}</i>
  657. 天有效期
  658. </span>
  659. </div>
  660. ) : null}
  661. </Form>
  662. </div>
  663. </div>
  664. {/* <div class={styles.agreeColumn}>
  665. <img src={isAgree.value ? agreeYes : agreeNo} onClick={() => (isAgree.value = !isAgree.value)} />
  666. <p onClick={(e: MouseEvent) => {
  667. e.stopPropagation();
  668. router.push('/preview-protocol');
  669. }}>我已阅读并同意<i>《音乐数字课堂学生端》</i>注册协议</p>
  670. </div> */}
  671. {/* <MProtocol
  672. center
  673. v-model:modelValue={forms.modelValue}
  674. prototcolType="REGISTER"
  675. /> */}
  676. <MSticky position="bottom">
  677. <div class={styles.paymentContainer}>
  678. <div class={styles.traditionBtn}>
  679. <Button
  680. type="primary"
  681. class={styles.submitBtn}
  682. color="linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)"
  683. round
  684. onClick={() => onSubmit()}
  685. disabled={forms.loading}
  686. loading={forms.loading}>
  687. 提交注册
  688. </Button>
  689. </div>
  690. </div>
  691. </MSticky>
  692. {forms.imgCodeStatus ? (
  693. <MImgCode
  694. v-model:value={forms.imgCodeStatus}
  695. phone={studentInfo.username}
  696. type="REGISTER"
  697. onClose={() => {
  698. forms.imgCodeStatus = false;
  699. }}
  700. onSendCode={onCodeSend}
  701. />
  702. ) : null}
  703. {/* 年级 */}
  704. <Popup
  705. v-model:show={forms.gradeStatus}
  706. position="bottom"
  707. round
  708. safeAreaInsetBottom
  709. lazyRender={false}
  710. class={'popupBottomSearch'}
  711. onOpen={() => {
  712. forms.gradePopupShow = true;
  713. }}
  714. onClosed={() => {
  715. forms.gradePopupShow = false;
  716. }}>
  717. {forms.gradePopupShow && (
  718. <Picker
  719. showToolbar
  720. v-model={forms.gradePopupIndex}
  721. columns={gradeList.value as any}
  722. onCancel={() => (forms.gradeStatus = false)}
  723. onConfirm={(val: any) => {
  724. const selectedOption = val.selectedOptions[0];
  725. studentInfo.extra.currentGradeNum = selectedOption.value;
  726. forms.gradeNumText = selectedOption.text;
  727. forms.gradeStatus = false;
  728. }}
  729. />
  730. )}
  731. </Popup>
  732. {/* 班级 */}
  733. <Popup
  734. v-model:show={forms.classStatus}
  735. position="bottom"
  736. round
  737. class={'popupBottomSearch'}
  738. onOpen={() => {
  739. forms.classPopupShow = true;
  740. }}
  741. onClosed={() => {
  742. forms.classPopupShow = false;
  743. }}>
  744. {forms.classPopupShow && (
  745. <Picker
  746. showToolbar
  747. v-model={forms.classPopupIndex}
  748. columns={classList}
  749. onCancel={() => (forms.classStatus = false)}
  750. onConfirm={(val: any) => {
  751. const selectedOption = val.selectedOptions[0];
  752. studentInfo.extra.currentClass = selectedOption.value;
  753. forms.currentClassText = selectedOption.text;
  754. forms.classStatus = false;
  755. }}
  756. />
  757. )}
  758. </Popup>
  759. {/* 是否在微信中打开 */}
  760. <OWxTip
  761. v-model:show={forms.showTips}
  762. message={forms.showMessage}
  763. showButton={forms.showButton}
  764. buttonText="刷新"
  765. onConfirm={async () => {
  766. forms.showTips = false;
  767. await getRegisterGoods();
  768. studentInfo.password = '';
  769. window.scrollTo({
  770. top: 0,
  771. behavior: 'smooth'
  772. });
  773. }}
  774. />
  775. <MMessageTip
  776. show={otherParams.showOtherSchool}
  777. showCloseButton={otherParams.showCloseButton}
  778. messageAlign={otherParams.messageAlign}
  779. message={otherParams.showOtherMessage}
  780. showCancelButton={otherParams.showCancelButton}
  781. cancelButtonColor={otherParams.cancelButtonColor}
  782. cancelButtonText={otherParams.cancelButtonText}
  783. confirmButtonColor={otherParams.confirmButtonColor}
  784. confirmButtonText={otherParams.confirmButtonText}
  785. onClose={() => (otherParams.showOtherSchool = false)}
  786. onCancel={() => {
  787. otherParams.showOtherSchool = false;
  788. if (otherParams.otherType === 'nickname') {
  789. forms.isRegister = 'create'; // 新建
  790. changeTipStatus(false, false);
  791. onSubmit();
  792. } else if (otherParams.otherType === 'limit') {
  793. }
  794. }}
  795. onConfirm={() => {
  796. otherParams.showOtherSchool = false;
  797. // 名字
  798. if (otherParams.otherType === 'nickname') {
  799. forms.isRegister = 'update'; // 修改
  800. changeTipStatus(false, false);
  801. // 直接注册
  802. onSubmit();
  803. } else if (otherParams.otherType === 'change') {
  804. // 学校更换
  805. forms.isChangeSchool = true;
  806. // 直接注册
  807. onSubmit();
  808. } else if (otherParams.otherType === 'limit') {
  809. // 人数超限制
  810. changeTipStatus(
  811. forms.isRegister === 'create' && !forms.studentItem.userId
  812. ? false
  813. : true,
  814. false
  815. );
  816. }
  817. }}
  818. />
  819. <Popup
  820. v-model:show={forms.showSelectStudent}
  821. round
  822. position="bottom"
  823. safeAreaInsetBottom
  824. closeable>
  825. <SelectStudent
  826. studentItem={forms.studentItem}
  827. list={forms.studentList}
  828. onClose={() => (forms.showSelectStudent = false)}
  829. onConfirm={(val: any) => {
  830. forms.studentItem = val;
  831. if (val.userId) {
  832. const firstStudent = val;
  833. studentInfo.extra.nickname = firstStudent.nickname;
  834. const tempGrade: any = gradeList.value[0] || [];
  835. tempGrade?.forEach((i: any) => {
  836. if (i.value === firstStudent.currentGradeNum) {
  837. // forms.instrumentCode = i.instrumentCode;
  838. forms.gradeNumText = i.text;
  839. studentInfo.extra.currentGradeNum =
  840. firstStudent.currentGradeNum;
  841. // if (forms.schoolInstrumentSetType === 'CLASS') {
  842. // forms.classList = i.classList;
  843. // }
  844. }
  845. });
  846. classList.forEach((i: any) => {
  847. if (i.value === firstStudent.currentClass) {
  848. forms.currentClassText = i.text;
  849. studentInfo.extra.currentClass = firstStudent.currentClass;
  850. }
  851. });
  852. studentInfo.extra.gender = firstStudent.gender;
  853. forms.isRegister = 'update';
  854. changeTipStatus(true, false);
  855. } else {
  856. forms.isRegister = 'create';
  857. changeTipStatus(false, false);
  858. studentInfo.extra.nickname = '';
  859. studentInfo.extra.currentGradeNum = '';
  860. studentInfo.extra.currentClass = '';
  861. studentInfo.extra.gender = 1;
  862. forms.currentClassText = '';
  863. forms.gradeNumText = '';
  864. }
  865. }}
  866. />
  867. </Popup>
  868. </div>
  869. );
  870. }
  871. });