index.tsx 28 KB

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