index.tsx 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500
  1. import {
  2. Image,
  3. Cell,
  4. Tag,
  5. Button,
  6. Popup,
  7. showToast,
  8. Form,
  9. Field,
  10. CountDown,
  11. RadioGroup,
  12. Radio,
  13. Picker,
  14. closeToast,
  15. Popover,
  16. Area,
  17. CellGroup,
  18. showConfirmDialog
  19. } from 'vant';
  20. import {
  21. computed,
  22. defineComponent,
  23. nextTick,
  24. onMounted,
  25. onUnmounted,
  26. reactive,
  27. ref
  28. } from 'vue';
  29. import { setLogin, setLoginInit } from '@/state';
  30. import styles from './index.module.less';
  31. import MSticky from '@/components/m-sticky';
  32. // import MVideo from '@/components/m-video';
  33. import { useRoute, useRouter } from 'vue-router';
  34. import { useStudentRegisterStore } from '@/store/modules/student-register-store';
  35. import request from '@/helpers/request';
  36. import { browser, checkPhone, getUrlCode, moneyFormat } from '@/helpers/utils';
  37. // import deepClone from '@/helpers/deep-clone';
  38. import OWxTip from '@/components/m-wx-tip';
  39. import { useCountDown } from '@vant/use';
  40. import MImgCode from '@/components/m-img-code';
  41. import { useInterval, useIntervalFn } from '@vueuse/core';
  42. import MMessageTip from '@/components/m-message-tip';
  43. import SelectStudent from '@/views/student-register/modal/select-student';
  44. import { api_sysAreaQueryAllProvince } from '@/views/school-register/api';
  45. import CodeDialog from '../modal/code-dialog';
  46. import MSearch from '@/components/m-search';
  47. const classList: any = [];
  48. for (let i = 1; i <= 40; i++) {
  49. classList.push({ text: i + '班', value: i });
  50. }
  51. const GRADE_ENUM = {
  52. '1': '一年级',
  53. '2': '二年级',
  54. '3': '三年级',
  55. '4': '四年级',
  56. '5': '五年级',
  57. '6': '六年级',
  58. '7': '七年级',
  59. '8': '八年级',
  60. '9': '九年级'
  61. } as any;
  62. const getGradeList = (gradeYear?: string, instrumentCode?: string) => {
  63. let tempList: any = [];
  64. const five = [
  65. { text: '一年级', value: 1, instrumentCode },
  66. { text: '二年级', value: 2, instrumentCode },
  67. { text: '三年级', value: 3, instrumentCode },
  68. { text: '四年级', value: 4, instrumentCode },
  69. { text: '五年级', value: 5, instrumentCode }
  70. ];
  71. const one = [{ text: '六年级', value: 6, instrumentCode }];
  72. const three = [
  73. { text: '七年级', value: 7, instrumentCode },
  74. { text: '八年级', value: 8, instrumentCode },
  75. { text: '九年级', value: 9, instrumentCode }
  76. ];
  77. if (gradeYear === 'FIVE_YEAR_SYSTEM') {
  78. tempList.push(...[...five]);
  79. } else if (gradeYear === 'SIX_YEAR_SYSTEM') {
  80. tempList.push(...[...five, ...one]);
  81. } else if (gradeYear === 'THREE_YEAR_SYSTEM') {
  82. tempList.push(...[...three]);
  83. } else if (gradeYear === 'FORE_YEAR_SYSTEM') {
  84. tempList.push(...[...one, ...three]);
  85. } else {
  86. tempList.push(...[...five, ...one, ...three]);
  87. }
  88. return tempList;
  89. };
  90. export default defineComponent({
  91. name: 'activation-register',
  92. setup() {
  93. const route = useRoute();
  94. const studentRegisterStore = useStudentRegisterStore();
  95. const router = useRouter();
  96. // 初始化学校编号
  97. // studentRegisterStore.setShoolId(route.query.sId as any);
  98. const countDownRef = ref();
  99. const forms = reactive({
  100. isLoginRegister: false, // 是否已经登录或已注册
  101. schoolId: null as any,
  102. schoolAreaId: null, // 学校区域编号
  103. activationCode: null as any, // 互通码
  104. paymentType: '', // 支付类型
  105. paymentChannel: '',
  106. multi_user_limit: 1, // 限制注册学生数量
  107. // popupShow: false,
  108. registerDetails: {} as any,
  109. details: [] as any[],
  110. // schoolType: '', // 学校类型
  111. gradeYear: '', // 学制
  112. schoolInstrumentSetType: null as any,
  113. // bugGoods: false, // 是否购买AI
  114. isRegister: 'create' as 'create' | 'update' | '', // 是否注册学生
  115. isDisabled: false,
  116. isTipRegister: false, // 是否显示名字不一致 - 默认显示
  117. isChangeSchool: false, // 是否切换学校
  118. schoolStatus: false,
  119. schoolPopupShow: false,
  120. schoolLoading: false,
  121. schoolPopupIndex: [] as any,
  122. schoolAreaList: [] as any,
  123. provinceCode: null,
  124. cityCode: null,
  125. regionCode: null,
  126. showResultPopup: false,
  127. reslutPopupType: '' as any,
  128. resultPopupContent: '',
  129. registerType: '', // 报名类型
  130. detailVip: {} as any,
  131. giftVipDay: 0, // 赠送天数
  132. submitLoading: false,
  133. // showMore: true,
  134. showTips: false,
  135. showButton: false,
  136. showMessage: '请使用微信扫描二维码',
  137. countDownStatus: true,
  138. countDownTime: 1000 * 120, // 倒计时时间
  139. // modelValue: false, // 是否选中协议
  140. imgCodeStatus: false,
  141. gradeNumText: '',
  142. currentClassText: '',
  143. schoolName: '',
  144. areaName: '',
  145. gradeStatus: false,
  146. classStatus: false,
  147. loading: false,
  148. showConfirmPopup: false, // 二次确认用户信息
  149. showPicker: false,
  150. areaList: [] as any,
  151. tipStatus: true,
  152. dialogConfirmStatus: false,
  153. contract_sign: false, // 是否实名认证
  154. countDownTimePay: 60 * 1000,
  155. dialogConfig: {} as any,
  156. showSelectStudent: false, // 选择学生
  157. studentList: [], // 手机号关联学生列表
  158. studentItem: {} as any, // 选择的学生
  159. joinType: 'digitalize' as 'digitalize' | 'tradition',
  160. gradeList: [] as any,
  161. classList: [] as any,
  162. saveUserId: null as any,
  163. saveId: null as any,
  164. openId: null as any,
  165. code: null as any,
  166. registerExpireTime: null as any, // 结束时间
  167. instrumentCode: null as any, // 乐器编码
  168. activeOverTime: 0, // 活动结束时间
  169. activeOverStatus: true, // 活动是否结束 默认已结束
  170. gradePopupShow: false,
  171. gradePopupIndex: [] as any, // 年级下拉索引
  172. classPopupShow: false,
  173. classPopupIndex: [] as any // 班级下拉索引
  174. });
  175. const otherParams = reactive({
  176. showOtherSchool: false,
  177. showCloseButton: true, // 是否显示关闭按钮
  178. showOtherMessage: '',
  179. /** limit 超限制,change 更换学生,nickname 名称不一致 member 会员购买, payment 支付方式 */
  180. otherType: '' as 'limit' | 'change' | 'nickname' | 'member' | 'payment',
  181. showCancelButton: true,
  182. cancelButtonColor: '',
  183. cancelButtonText: '取消',
  184. showConfirmButton: true,
  185. confirmButtonColor: '',
  186. confirmButtonText: '确定',
  187. messageAlign: 'left' as 'center' | 'left' | 'right'
  188. });
  189. const state = reactive({
  190. showQrcode: false,
  191. qrCodeUrl: '',
  192. pay_channel: '',
  193. orderInfo: {} as any, // 订单信息
  194. authShow: false,
  195. orderNo: null as any,
  196. config: {} as any,
  197. paymentStatus: false,
  198. orderTimer: null as any
  199. });
  200. /*
  201. 新用户:
  202. autoRegister: true
  203. loginType: 'SMS'
  204. 已存在用户:
  205. autoRegister: false
  206. loginType: 'TOKEN'
  207. password: xxx
  208. */
  209. const studentInfo = reactive({
  210. autoRegister: true,
  211. multiUser: true, // 是否为多用户
  212. client_id: 'cooleshow-student',
  213. client_secret: 'cooleshow-student',
  214. extra: {
  215. nickname: '',
  216. currentGradeNum: '' as any,
  217. currentClass: '' as any,
  218. gender: 1 as any,
  219. registerType: null as any, // 报名类型
  220. giftVipDay: 0 // 赠送会员天数
  221. },
  222. grant_type: 'password',
  223. loginType: 'SMS',
  224. password: '',
  225. username: ''
  226. });
  227. // 页面定时
  228. const pageTimer = useInterval(1000, { controls: true });
  229. pageTimer.pause();
  230. const overCountDown = useCountDown({
  231. time: forms.activeOverTime,
  232. onFinish() {
  233. forms.activeOverStatus = true;
  234. if (forms.submitLoading) return;
  235. applyOver();
  236. }
  237. });
  238. /** 报名结束提示 */
  239. const applyOver = () => {
  240. forms.showTips = true;
  241. // forms.showMessage = '团购时间已截止,感谢您的参与';
  242. forms.showMessage =
  243. '<p style="color: #F44541">报名已截止,感谢您的参与</p>';
  244. forms.showButton = false;
  245. };
  246. const onCodeSend = () => {
  247. forms.countDownStatus = false;
  248. nextTick(() => {
  249. countDownRef.value.start();
  250. });
  251. };
  252. const onSendCode = () => {
  253. // 发送验证码
  254. if (!checkPhone(studentInfo.username)) {
  255. return showToast('请输入正确的手机号码');
  256. }
  257. forms.imgCodeStatus = true;
  258. };
  259. const validatePhone = computed(() => {
  260. return checkPhone(studentInfo.username) ? true : false;
  261. });
  262. const onFinished = () => {
  263. forms.countDownStatus = true;
  264. countDownRef.value.reset();
  265. };
  266. // 格式化提示状态
  267. const changeTipStatus = (register: boolean, school: boolean) => {
  268. forms.isTipRegister = register;
  269. forms.isChangeSchool = school;
  270. };
  271. const checkForm = (status = true) => {
  272. if (!checkPhone(studentInfo.username)) {
  273. status && showToast('请输入正确的手机号码');
  274. return true;
  275. } else if (!studentInfo.password) {
  276. status && showToast('请输入验证码');
  277. return true;
  278. } else if (!studentInfo.extra.nickname) {
  279. status && showToast('请输入学生姓名');
  280. return true;
  281. } else if (![0, 1].includes(studentInfo.extra.gender)) {
  282. status && showToast('请选择性别');
  283. return true;
  284. } else if (!studentInfo.extra.currentGradeNum) {
  285. status && showToast('请选择所在年级');
  286. return true;
  287. } else if (!studentInfo.extra.currentClass) {
  288. status && showToast('请选择所在班级');
  289. return true;
  290. } else if (!forms.activationCode) {
  291. status && showToast('请输入互通码');
  292. return true;
  293. }
  294. return false;
  295. };
  296. //
  297. const checkSubmit = () => {
  298. const { extra } = studentInfo;
  299. if (
  300. forms.studentItem.nickname !== extra.nickname &&
  301. forms.isTipRegister
  302. ) {
  303. otherParams.showOtherMessage =
  304. '学生姓名与上次提交信息不一致,请确认修改学生信息或创建新的学生账号';
  305. otherParams.showOtherSchool = true;
  306. otherParams.showCancelButton = true;
  307. otherParams.showCloseButton = true;
  308. otherParams.cancelButtonColor =
  309. 'linear-gradient( 224deg, #3FE1E6 0%, #00CDD4 100%)';
  310. otherParams.cancelButtonText = '新建学生';
  311. otherParams.confirmButtonColor =
  312. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  313. otherParams.confirmButtonText = '修改信息';
  314. otherParams.otherType = 'nickname';
  315. otherParams.messageAlign = 'left';
  316. return true;
  317. }
  318. // 判断新建学员是否上限了
  319. if (
  320. forms.isRegister === 'create' &&
  321. forms.studentList.length >= forms.multi_user_limit
  322. ) {
  323. otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
  324. otherParams.showOtherSchool = true;
  325. otherParams.showCancelButton = false;
  326. otherParams.showCloseButton = true;
  327. otherParams.confirmButtonColor =
  328. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  329. otherParams.confirmButtonText = '我知道了';
  330. otherParams.otherType = 'limit';
  331. otherParams.messageAlign = 'center';
  332. return true;
  333. }
  334. return false;
  335. };
  336. /**
  337. * 登记成功之后购买
  338. */
  339. const onSubmit = async () => {
  340. forms.submitLoading = true;
  341. try {
  342. if (checkForm() || checkSubmit()) {
  343. forms.submitLoading = false;
  344. return;
  345. }
  346. const { extra, loginType, autoRegister, password, multiUser, ...res } =
  347. studentInfo;
  348. /*
  349. 新用户:
  350. autoRegister: true
  351. loginType: 'SMS'
  352. 已存在用户:
  353. autoRegister: false
  354. loginType: 'TOKEN'
  355. password: xxx
  356. */
  357. let tLoginType = loginType,
  358. tAutoRegister = autoRegister,
  359. tPassword = password,
  360. tMultiUser = multiUser;
  361. if (forms.isRegister === 'update') {
  362. tLoginType = 'TOKEN';
  363. tAutoRegister = false;
  364. tPassword = forms.studentItem.token;
  365. tMultiUser = false;
  366. }
  367. if (forms.isLoginRegister) {
  368. tAutoRegister = false;
  369. }
  370. const result = await request.post('/edu-app/userlogin', {
  371. requestType: 'form',
  372. data: {
  373. loginType: tLoginType,
  374. autoRegister: tAutoRegister,
  375. password: tPassword,
  376. multiUser: tMultiUser,
  377. ...res,
  378. extra: JSON.stringify({
  379. ...extra,
  380. // giftVipDay:
  381. // forms.detailVip.membershipDays || 0 + forms.giftVipDay || 0,
  382. schoolId: forms.schoolId
  383. })
  384. }
  385. });
  386. if (result.code !== 200) {
  387. if (result.code === 5436) {
  388. forms.showTips = true;
  389. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  390. forms.showButton = false;
  391. } else if (result.code === 5435) {
  392. forms.showTips = true;
  393. forms.showMessage = result.message;
  394. forms.showButton = true;
  395. }
  396. // else if (result.code === 5437) {
  397. // forms.showTips = true;
  398. // forms.showMessage =
  399. // '<p style="color: #F44541">报名已截止,感谢您的参与</p>'; //result.message;
  400. // forms.showButton = false;
  401. // }
  402. } else {
  403. forms.isLoginRegister = true;
  404. studentRegisterStore.setToken(
  405. result.data.token_type + ' ' + result.data.access_token
  406. );
  407. setLoginInit();
  408. // let joinType = 'NOT_REGISTER';
  409. // if (forms.joinType === 'digitalize') {
  410. // joinType = 'SELECT_INSTRUMENT';
  411. // }
  412. // if (forms.joinType === 'tradition') {
  413. // joinType = 'NOT_BUY_INSTRUMENT';
  414. // }
  415. // 获取用户信息
  416. const res = await request.get('/edu-app/user/getUserInfo', {
  417. requestType: 'form'
  418. });
  419. setLogin(res.data);
  420. // await onRegisterSubmit();
  421. await updateStudentInfo();
  422. }
  423. } catch {
  424. // 重置信息 - 如果是新建则不提示
  425. changeTipStatus(forms.isRegister === 'create' ? false : true, false);
  426. } finally {
  427. forms.submitLoading = false;
  428. }
  429. };
  430. const updateStudentInfo = async () => {
  431. try {
  432. const { extra, username } = studentInfo;
  433. const registerResult = await request.post('/edu-app/student/register', {
  434. data: {
  435. clientType: 'STUDENT',
  436. ...extra,
  437. activationCode: forms.activationCode,
  438. schoolId: forms.schoolId,
  439. schoolAreaId: forms.schoolAreaId,
  440. // giftVipFlag: forms.registerDetails.giftVipFlag || false,
  441. // giftVipDay: forms.giftVipDay || 0,
  442. schoolVerify: false,
  443. // firstVipDay: forms.detailVip.membershipDays || 0,
  444. mobile: username,
  445. newRegUser: forms.isRegister === 'create' ? true : false
  446. }
  447. });
  448. if (registerResult.code !== 200) {
  449. if (registerResult.code === 5436) {
  450. forms.showTips = true;
  451. forms.showMessage = '二维码已经失效,详情请咨询学校老师';
  452. forms.showButton = false;
  453. } else if (registerResult.code === 5435) {
  454. forms.showTips = true;
  455. forms.showMessage = registerResult.message;
  456. forms.showButton = true;
  457. } else if (registerResult.code === 5437) {
  458. forms.showTips = true;
  459. forms.showMessage =
  460. '<p style="color: #F44541">报名已截止,感谢您的参与</p>'; //result.message;
  461. forms.showButton = false;
  462. } else if (
  463. registerResult.code === 5442 ||
  464. registerResult.code === 5443
  465. ) {
  466. forms.showResultPopup = true;
  467. forms.reslutPopupType = 'EXPIRED';
  468. forms.resultPopupContent = registerResult.message;
  469. }
  470. // else if (registerResult.code === 5443) {
  471. // forms.showResultPopup = true;
  472. // forms.reslutPopupType = 'CANCELLED';
  473. // forms.resultPopupContent = registerResult.message;
  474. // }
  475. return false;
  476. } else {
  477. forms.showResultPopup = true;
  478. forms.reslutPopupType = 'ACTIVATING';
  479. return true;
  480. }
  481. } catch {}
  482. };
  483. const getUserInfos = async () => {
  484. if (
  485. studentInfo.password.length !== 6 ||
  486. !checkPhone(studentInfo.username)
  487. ) {
  488. return;
  489. }
  490. try {
  491. // 15907120131;
  492. const { data } = await request.get(
  493. `/edu-app/open/student/studentInfo?mobile=${studentInfo.username}&code=${studentInfo.password}&type=REGISTER&activationCodeFlag=1`
  494. );
  495. forms.studentList = data || [];
  496. if (forms.studentList.length > 0) {
  497. const firstStudent: any = forms.studentList[0];
  498. forms.studentItem = firstStudent;
  499. studentInfo.extra.nickname = firstStudent.nickname;
  500. const tempArea = [] as any;
  501. if (firstStudent.provinceName) {
  502. tempArea.push(firstStudent.provinceName);
  503. forms.provinceCode = firstStudent.provinceCode;
  504. }
  505. if (firstStudent.cityName) {
  506. tempArea.push(firstStudent.cityName);
  507. forms.cityCode = firstStudent.cityCode;
  508. }
  509. if (firstStudent.regionName) {
  510. tempArea.push(firstStudent.regionName);
  511. forms.regionCode = firstStudent.regionCode;
  512. }
  513. forms.areaName = tempArea.join(' ');
  514. forms.schoolName = firstStudent.schoolName;
  515. forms.schoolId = firstStudent.schoolId;
  516. forms.schoolAreaId = firstStudent.schoolAreaId;
  517. const tempGrade: any = forms.gradeList || [];
  518. tempGrade?.forEach((i: any) => {
  519. if (i.value === firstStudent.currentGradeNum) {
  520. forms.instrumentCode = i.instrumentCode;
  521. forms.gradeNumText = i.text;
  522. studentInfo.extra.currentGradeNum = firstStudent.currentGradeNum;
  523. if (forms.schoolInstrumentSetType === 'CLASS') {
  524. forms.classList = i.classList;
  525. }
  526. }
  527. });
  528. forms.classList.forEach((i: any) => {
  529. if (i.value === firstStudent.currentClass) {
  530. forms.currentClassText = i.text;
  531. studentInfo.extra.currentClass = firstStudent.currentClass;
  532. }
  533. });
  534. studentInfo.extra.gender = firstStudent.gender;
  535. forms.isRegister = 'update';
  536. changeTipStatus(true, false);
  537. } else {
  538. forms.isRegister = 'create';
  539. changeTipStatus(false, false);
  540. forms.studentItem = [];
  541. }
  542. } catch {
  543. //
  544. }
  545. };
  546. /** 手机号变更时清空验证码信息,用户信息 */
  547. const phoneChangeEmptyInfo = () => {
  548. studentInfo.password = '';
  549. studentInfo.extra.nickname = '';
  550. studentInfo.extra.currentGradeNum = '';
  551. studentInfo.extra.currentClass = '';
  552. studentInfo.extra.gender = 1;
  553. forms.areaName = '';
  554. forms.schoolName = '';
  555. forms.currentClassText = '';
  556. forms.gradeNumText = '';
  557. forms.studentList = []; // 手机号关联学生列表
  558. forms.studentItem = {}; // 选择的学生
  559. forms.isRegister = 'create'; // 是否注册学生
  560. forms.isTipRegister = false; // 是否显示名字不一致 - 默认显示
  561. forms.isChangeSchool = false; // 是否切换学校
  562. };
  563. const formateArea = (area: any[]) => {
  564. const province_list: { [_: string]: string } = {};
  565. const city_list: { [_: string]: string } = {};
  566. const county_list: { [_: string]: string } = {};
  567. area.forEach((item: any) => {
  568. province_list[item.code] = item.name;
  569. });
  570. area.forEach((item: any) => {
  571. item.areas?.forEach((city: any) => {
  572. city_list[city.code] = city.name;
  573. });
  574. });
  575. area.forEach((item: any) => {
  576. item.areas?.forEach((city: any) => {
  577. city.areas?.forEach((county: any) => {
  578. county_list[county.code] = county.name;
  579. });
  580. });
  581. });
  582. return {
  583. province_list,
  584. city_list,
  585. county_list
  586. };
  587. };
  588. const getAreaList = () => {
  589. api_sysAreaQueryAllProvince().then(res => {
  590. if (res?.code === 200) {
  591. forms.areaList = formateArea(res.data);
  592. }
  593. });
  594. };
  595. const getSchoolAreaList = async (name?: string) => {
  596. forms.schoolLoading = true;
  597. try {
  598. const { data } = await request.post('/edu-app/open/schoolArea/list', {
  599. data: {
  600. name,
  601. testFlag: true,
  602. provinceCode: forms.provinceCode,
  603. cityCode: forms.cityCode,
  604. regionCode: forms.regionCode
  605. }
  606. });
  607. forms.schoolAreaList = data;
  608. } catch {
  609. //
  610. }
  611. forms.schoolLoading = false;
  612. };
  613. // 格式化互通码
  614. const maskMiddleDigits = (str: string) => {
  615. if (!str) {
  616. return '';
  617. }
  618. let numPart = str.match(/\d+/); // 提取数字部分
  619. if (numPart) {
  620. let start = str.indexOf(numPart[0]); // 数字部分的起始索引
  621. let end = start + numPart[0].length; // 数字部分的结束索引
  622. let maskedStr =
  623. str.substring(0, start) +
  624. '*'.repeat(numPart[0].length) +
  625. str.substring(end);
  626. return maskedStr;
  627. }
  628. return str;
  629. };
  630. // 获取地区学校详情
  631. const getSchoolAreaDetail = async () => {
  632. // open/schoolArea/detail/1815689916881935735
  633. try {
  634. const { data } = await request.get(
  635. '/edu-app/open/schoolArea/detail/' + forms.schoolAreaId
  636. );
  637. console.log(data, 'data');
  638. if (data.school) {
  639. const schoolInfo = data.school || {};
  640. const schoolInstrumentList = schoolInfo.schoolInstrumentList || [];
  641. forms.schoolInstrumentSetType = schoolInfo.instrumentSetType;
  642. if (schoolInfo.instrumentSetType === 'SCHOOL') {
  643. const instrumentCode = schoolInstrumentList[0]?.instrumentCode;
  644. forms.gradeList = getGradeList(
  645. schoolInfo.gradeYear,
  646. instrumentCode
  647. );
  648. forms.classList = classList;
  649. } else if (schoolInfo.instrumentSetType === 'GRADE') {
  650. schoolInstrumentList.forEach((item: any) => {
  651. forms.gradeList.push({
  652. text: GRADE_ENUM[item.gradeNum],
  653. value: item.gradeNum,
  654. instrumentId: item.instrumentId,
  655. instrumentCode: item.instrumentCode
  656. });
  657. });
  658. forms.gradeList.sort((a: any, b: any) => a.value - b.value);
  659. forms.classList = classList;
  660. } else if (schoolInfo.instrumentSetType === 'CLASS') {
  661. // 班级
  662. const tempGradeList: any[] = [];
  663. schoolInstrumentList.forEach((item: any) => {
  664. if (!tempGradeList.includes(item.gradeNum)) {
  665. tempGradeList.push(item.gradeNum);
  666. }
  667. });
  668. const lastGradeList: any[] = [];
  669. tempGradeList.forEach((temp: any) => {
  670. const list = {
  671. text: GRADE_ENUM[temp],
  672. value: temp,
  673. instrumentId: '',
  674. instrumentCode: '',
  675. instrumentName: '',
  676. classList: [] as any
  677. };
  678. schoolInstrumentList.forEach((item: any) => {
  679. if (temp === item.gradeNum) {
  680. list.instrumentId = item.instrumentId;
  681. list.instrumentCode = item.instrumentCode;
  682. list.instrumentName = item.instrumentName;
  683. list.classList.push({
  684. text: item.classNum + '班',
  685. value: item.classNum,
  686. instrumentCode: item.instrumentCode
  687. });
  688. }
  689. });
  690. // 排序班级
  691. list.classList.sort((a: any, b: any) => a.value - b.value);
  692. lastGradeList.push(list);
  693. });
  694. lastGradeList.sort((a: any, b: any) => a.value - b.value);
  695. forms.gradeList = lastGradeList;
  696. forms.classList = [];
  697. } else {
  698. forms.gradeList = getGradeList(schoolInfo.gradeYear);
  699. forms.classList = classList;
  700. }
  701. } else {
  702. forms.schoolInstrumentSetType = '';
  703. forms.gradeList = getGradeList();
  704. forms.classList = classList;
  705. }
  706. } catch {
  707. //
  708. }
  709. };
  710. onMounted(async () => {
  711. try {
  712. const code: any = route.query.code;
  713. if (code) {
  714. forms.activationCode = window.atob(code);
  715. }
  716. } catch {
  717. //
  718. }
  719. getAreaList();
  720. try {
  721. // 获取支付类型
  722. const { data } = await request.get(
  723. '/edu-app/open/paramConfig/queryByParamNameList',
  724. {
  725. requestType: 'form',
  726. params: {
  727. paramNames: 'multi_user_limit'
  728. }
  729. }
  730. );
  731. if (data && Array.isArray(data)) {
  732. data.forEach((item: any) => {
  733. if (item.paramName === 'multi_user_limit') {
  734. forms.multi_user_limit = item.paramValue
  735. ? Number(item.paramValue)
  736. : 1;
  737. }
  738. });
  739. }
  740. } catch {}
  741. forms.gradeList = getGradeList();
  742. forms.classList = classList;
  743. });
  744. return () => (
  745. <div
  746. class={[
  747. styles['student-register'],
  748. browser().isTablet ? styles.registrationContainerTablet : ''
  749. ]}>
  750. <div class={styles.studentRegisterContainer}>
  751. <div class={[styles.studentSection]}>
  752. <Form labelAlign="left" class={styles.registerForm}>
  753. <Field
  754. clearable={false}
  755. label="联系方式"
  756. placeholder="请输入手机号码"
  757. type="tel"
  758. required
  759. autocomplete="off"
  760. inputAlign="right"
  761. v-model={studentInfo.username}
  762. maxlength={11}
  763. onUpdate:modelValue={() => {
  764. phoneChangeEmptyInfo();
  765. }}></Field>
  766. <Field
  767. center
  768. clearable={false}
  769. required
  770. inputAlign="right"
  771. label="验证码"
  772. placeholder="请输入验证码"
  773. autocomplete="off"
  774. type="number"
  775. v-model={studentInfo.password}
  776. maxlength={6}
  777. onUpdate:modelValue={(val: any) => {
  778. getUserInfos();
  779. }}>
  780. {{
  781. button: () =>
  782. forms.countDownStatus ? (
  783. <span
  784. class={[
  785. styles.codeText,
  786. !validatePhone.value ? styles.codeTextDisabled : ''
  787. ]}
  788. onClick={onSendCode}>
  789. 获取验证码
  790. </span>
  791. ) : (
  792. <CountDown
  793. ref={(el: any) => (countDownRef.value = el)}
  794. auto-start={false}
  795. class={styles.countDown}
  796. time={forms.countDownTime}
  797. onFinish={onFinished}
  798. format="ss秒后重试"
  799. />
  800. )
  801. }}
  802. </Field>
  803. <Field
  804. clearable={false}
  805. required
  806. inputAlign="right"
  807. label="学生姓名"
  808. placeholder="请输入学生姓名"
  809. autocomplete="off"
  810. maxlength={14}
  811. readonly={forms.isRegister === 'update'}
  812. v-model={studentInfo.extra.nickname}>
  813. {{
  814. extra: () =>
  815. forms.studentList.length >= 1 && (
  816. <div
  817. class={[
  818. styles.selectStudentGroup,
  819. forms.showSelectStudent &&
  820. styles.selectStudentGroupChecked
  821. ]}
  822. onClick={() => (forms.showSelectStudent = true)}>
  823. <span>
  824. {forms.studentItem.userId ? '切换' : '新增'}
  825. </span>
  826. </div>
  827. )
  828. }}
  829. </Field>
  830. <Field
  831. clearable={false}
  832. required
  833. inputAlign="right"
  834. label="学生性别"
  835. placeholder="请选择性别"
  836. autocomplete="off">
  837. {{
  838. input: () => (
  839. <RadioGroup
  840. checked-color="linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)"
  841. v-model={studentInfo.extra.gender}
  842. direction="horizontal"
  843. disabled={forms.isRegister === 'update'}>
  844. <Tag
  845. size="large"
  846. type="primary"
  847. color={
  848. !(studentInfo.extra.gender === 1)
  849. ? '#F5F6FA'
  850. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  851. }
  852. textColor={
  853. !(studentInfo.extra.gender === 1) ? '#626264' : '#fff'
  854. }
  855. class={styles.radioSection}>
  856. <Radio class={styles.radioItem} name={1}></Radio>男
  857. </Tag>
  858. <Tag
  859. size="large"
  860. type="primary"
  861. color={
  862. !(studentInfo.extra.gender === 0)
  863. ? '#F5F6FA'
  864. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  865. }
  866. textColor={
  867. !(studentInfo.extra.gender === 0) ? '#626264' : '#fff'
  868. }
  869. class={styles.radioSection}>
  870. <Radio class={styles.radioItem} name={0}></Radio>女
  871. </Tag>
  872. </RadioGroup>
  873. )
  874. }}
  875. </Field>
  876. <Field
  877. clearable={false}
  878. required
  879. inputAlign="right"
  880. label="所在地区"
  881. placeholder="请选择地区"
  882. isLink={forms.isRegister !== 'update'}
  883. readonly
  884. clickable={false}
  885. modelValue={forms.areaName}
  886. onClick={() => {
  887. if (forms.isRegister !== 'update') forms.showPicker = true;
  888. // forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  889. }}
  890. />
  891. <Field
  892. clearable={false}
  893. required
  894. inputAlign="right"
  895. label="互通学校"
  896. placeholder="请选择学校"
  897. isLink={forms.isRegister !== 'update'}
  898. readonly
  899. clickable={false}
  900. modelValue={forms.schoolName}
  901. onClick={() => {
  902. if (forms.isRegister === 'update') return;
  903. if (!forms.areaName) {
  904. showToast('请选择地区');
  905. return;
  906. }
  907. forms.schoolStatus = true;
  908. if (forms.schoolAreaId) {
  909. forms.schoolPopupIndex = [forms.schoolAreaId];
  910. }
  911. // forms.gradeStatus = true;
  912. // forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  913. }}
  914. />
  915. <Field
  916. clearable={false}
  917. required
  918. inputAlign="right"
  919. label="所在年级"
  920. placeholder="请选择年级"
  921. isLink={forms.isRegister !== 'update'}
  922. readonly
  923. clickable={false}
  924. modelValue={forms.gradeNumText}
  925. onClick={() => {
  926. if (forms.isRegister !== 'update') {
  927. forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  928. forms.gradeStatus = true;
  929. }
  930. }}
  931. />
  932. <Field
  933. clearable={false}
  934. required
  935. inputAlign="right"
  936. label="所在班级"
  937. placeholder="请选择班级"
  938. isLink={forms.isRegister !== 'update'}
  939. readonly
  940. clickable={false}
  941. modelValue={forms.currentClassText}
  942. onClick={() => {
  943. if (forms.isRegister == 'update') {
  944. return;
  945. }
  946. if (
  947. forms.schoolInstrumentSetType === 'CLASS' &&
  948. forms.classList.length <= 0
  949. ) {
  950. showToast('请先选择年级');
  951. return;
  952. }
  953. forms.classPopupIndex = [studentInfo.extra.currentClass];
  954. forms.classStatus = true;
  955. }}
  956. />
  957. {/* maskMiddleDigits */}
  958. {route.query.code ? (
  959. <Field
  960. clearable={false}
  961. required
  962. inputAlign="right"
  963. label="互通码"
  964. readonly={route.query.code ? true : false}
  965. modelValue={maskMiddleDigits(forms.activationCode)}
  966. />
  967. ) : (
  968. <Field
  969. clearable={false}
  970. required
  971. inputAlign="right"
  972. label="互通码"
  973. placeholder="请输入互通码"
  974. autocomplete="off"
  975. v-model={forms.activationCode}
  976. />
  977. )}
  978. </Form>
  979. </div>
  980. <MSticky position="bottom">
  981. <div class={styles.paymentContainer}>
  982. <Button
  983. onClick={() => {
  984. // onSubmit();
  985. if (checkForm() || checkSubmit()) {
  986. forms.submitLoading = false;
  987. return;
  988. }
  989. forms.showConfirmPopup = true;
  990. }}
  991. round
  992. block
  993. disabled={forms.submitLoading}
  994. loading={forms.submitLoading}>
  995. 提交
  996. </Button>
  997. </div>
  998. </MSticky>
  999. </div>
  1000. {forms.imgCodeStatus ? (
  1001. <MImgCode
  1002. v-model:value={forms.imgCodeStatus}
  1003. phone={studentInfo.username}
  1004. type="REGISTER"
  1005. onClose={() => {
  1006. forms.imgCodeStatus = false;
  1007. }}
  1008. onSendCode={onCodeSend}
  1009. />
  1010. ) : null}
  1011. {/* 互通学校 */}
  1012. <Popup
  1013. v-model:show={forms.schoolStatus}
  1014. position="bottom"
  1015. round
  1016. safeAreaInsetBottom
  1017. lazyRender={false}
  1018. class={'popupBottomSearch'}
  1019. onOpen={() => {
  1020. forms.schoolPopupShow = true;
  1021. }}
  1022. onClosed={() => {
  1023. forms.schoolPopupShow = false;
  1024. }}>
  1025. {forms.schoolPopupShow && (
  1026. <div>
  1027. <Picker
  1028. showToolbar
  1029. v-model={forms.schoolPopupIndex}
  1030. columns={forms.schoolAreaList}
  1031. loading={forms.schoolLoading}
  1032. columnsFieldNames={{
  1033. text: 'name',
  1034. value: 'id'
  1035. }}
  1036. onCancel={() => (forms.schoolStatus = false)}
  1037. onConfirm={(val: any) => {
  1038. const selectedOption = val.selectedOptions[0];
  1039. forms.schoolId = selectedOption.schoolId || null;
  1040. forms.schoolAreaId = selectedOption.id;
  1041. forms.schoolName = selectedOption.name;
  1042. forms.schoolStatus = false;
  1043. forms.gradeNumText = '';
  1044. studentInfo.extra.currentGradeNum = null;
  1045. forms.currentClassText = '';
  1046. studentInfo.extra.currentClass = null;
  1047. getSchoolAreaDetail();
  1048. }}>
  1049. {{
  1050. 'columns-top': (
  1051. <MSearch
  1052. placeholder="请输入学校名称"
  1053. onSearch={(val: any) => {
  1054. getSchoolAreaList(val);
  1055. }}
  1056. />
  1057. )
  1058. }}
  1059. </Picker>
  1060. </div>
  1061. )}
  1062. </Popup>
  1063. {/* 年级 */}
  1064. <Popup
  1065. v-model:show={forms.gradeStatus}
  1066. position="bottom"
  1067. round
  1068. safeAreaInsetBottom
  1069. lazyRender={false}
  1070. class={'popupBottomSearch'}
  1071. onOpen={() => {
  1072. forms.gradePopupShow = true;
  1073. }}
  1074. onClosed={() => {
  1075. forms.gradePopupShow = false;
  1076. }}>
  1077. {forms.gradePopupShow && (
  1078. <Picker
  1079. showToolbar
  1080. v-model={forms.gradePopupIndex}
  1081. columns={forms.gradeList}
  1082. onCancel={() => (forms.gradeStatus = false)}
  1083. onConfirm={(val: any) => {
  1084. const selectedOption = val.selectedOptions[0];
  1085. studentInfo.extra.currentGradeNum = selectedOption.value;
  1086. forms.gradeNumText = selectedOption.text;
  1087. forms.gradeStatus = false;
  1088. if (
  1089. ['SCHOOL', 'GRADE'].includes(forms.schoolInstrumentSetType)
  1090. ) {
  1091. forms.instrumentCode = selectedOption.instrumentCode;
  1092. }
  1093. if (forms.schoolInstrumentSetType === 'CLASS') {
  1094. forms.classList = selectedOption.classList || [];
  1095. }
  1096. if (
  1097. ['CLASS', 'GRADE'].includes(forms.schoolInstrumentSetType)
  1098. ) {
  1099. forms.currentClassText = '';
  1100. studentInfo.extra.currentClass = '';
  1101. }
  1102. }}
  1103. />
  1104. )}
  1105. </Popup>
  1106. {/* 班级 */}
  1107. <Popup
  1108. v-model:show={forms.classStatus}
  1109. position="bottom"
  1110. round
  1111. class={'popupBottomSearch'}
  1112. onOpen={() => {
  1113. forms.classPopupShow = true;
  1114. }}
  1115. onClosed={() => {
  1116. forms.classPopupShow = false;
  1117. }}>
  1118. {forms.classPopupShow && (
  1119. <Picker
  1120. showToolbar
  1121. v-model={forms.classPopupIndex}
  1122. columns={forms.classList}
  1123. onCancel={() => (forms.classStatus = false)}
  1124. onConfirm={(val: any) => {
  1125. const selectedOption = val.selectedOptions[0];
  1126. studentInfo.extra.currentClass = selectedOption.value;
  1127. forms.currentClassText = selectedOption.text;
  1128. forms.classStatus = false;
  1129. if (['CLASS'].includes(forms.schoolInstrumentSetType)) {
  1130. forms.instrumentCode = selectedOption.instrumentCode;
  1131. }
  1132. }}
  1133. />
  1134. )}
  1135. </Popup>
  1136. {/* 是否在微信中打开 */}
  1137. <OWxTip
  1138. show={forms.showTips}
  1139. message={forms.showMessage}
  1140. showButton={forms.showButton}
  1141. buttonText="刷新"
  1142. onConfirm={() => window.location.reload()}
  1143. />
  1144. <MMessageTip
  1145. show={otherParams.showOtherSchool}
  1146. // showCloseButton={otherParams.showCloseButton}
  1147. messageAlign={otherParams.messageAlign}
  1148. message={otherParams.showOtherMessage}
  1149. showCancelButton={otherParams.showCancelButton}
  1150. cancelButtonColor={otherParams.cancelButtonColor}
  1151. cancelButtonText={otherParams.cancelButtonText}
  1152. confirmButtonColor={otherParams.confirmButtonColor}
  1153. confirmButtonText={otherParams.confirmButtonText}
  1154. onClose={() => (otherParams.showOtherSchool = false)}
  1155. onCancel={async () => {
  1156. otherParams.showOtherSchool = false;
  1157. if (otherParams.otherType === 'nickname') {
  1158. forms.isRegister = 'create'; // 新建
  1159. changeTipStatus(false, false);
  1160. onSubmit();
  1161. } else if (otherParams.otherType === 'member') {
  1162. const updateStatus = await updateStudentInfo();
  1163. if (!updateStatus) return;
  1164. //取消支付,判断是否有结束时间,是否已经结束
  1165. if (forms.registerExpireTime && forms.activeOverStatus) {
  1166. applyOver();
  1167. }
  1168. } else if (otherParams.otherType === 'payment') {
  1169. forms.joinType = 'tradition';
  1170. }
  1171. }}
  1172. onConfirm={async () => {
  1173. otherParams.showOtherSchool = false;
  1174. // 名字
  1175. if (otherParams.otherType === 'nickname') {
  1176. forms.isRegister = 'update'; // 修改
  1177. changeTipStatus(false, false);
  1178. // 直接注册
  1179. onSubmit();
  1180. } else if (otherParams.otherType === 'change') {
  1181. // 学校更换
  1182. forms.isChangeSchool = true;
  1183. // 直接注册
  1184. onSubmit();
  1185. } else if (otherParams.otherType === 'limit') {
  1186. // 人数超限制
  1187. changeTipStatus(
  1188. forms.isRegister === 'create' && !forms.studentItem.userId
  1189. ? false
  1190. : true,
  1191. false
  1192. );
  1193. } else if (otherParams.otherType === 'member') {
  1194. // await paymentContinue();
  1195. }
  1196. }}
  1197. />
  1198. <Popup
  1199. v-model:show={forms.showSelectStudent}
  1200. round
  1201. position="bottom"
  1202. safeAreaInsetBottom
  1203. closeable>
  1204. <SelectStudent
  1205. studentItem={forms.studentItem}
  1206. list={forms.studentList}
  1207. onClose={() => (forms.showSelectStudent = false)}
  1208. onConfirm={(val: any) => {
  1209. if (val.userId) {
  1210. forms.studentItem = val;
  1211. const firstStudent = val;
  1212. studentInfo.extra.nickname = firstStudent.nickname;
  1213. const tempGrade: any = forms.gradeList || [];
  1214. const tempArea = [] as any;
  1215. if (firstStudent.provinceName) {
  1216. tempArea.push(firstStudent.provinceName);
  1217. forms.provinceCode = firstStudent.provinceCode;
  1218. }
  1219. if (firstStudent.cityName) {
  1220. tempArea.push(firstStudent.cityName);
  1221. forms.cityCode = firstStudent.cityCode;
  1222. }
  1223. if (firstStudent.regionName) {
  1224. tempArea.push(firstStudent.regionName);
  1225. forms.regionCode = firstStudent.regionCode;
  1226. }
  1227. forms.areaName = tempArea.join(' ');
  1228. forms.schoolName = firstStudent.schoolName;
  1229. forms.schoolId = firstStudent.schoolId;
  1230. forms.schoolAreaId = firstStudent.schoolAreaId;
  1231. studentInfo.extra.currentGradeNum = null;
  1232. forms.gradeNumText = '';
  1233. forms.instrumentCode = '';
  1234. tempGrade?.forEach((i: any) => {
  1235. if (i.value === firstStudent.currentGradeNum) {
  1236. forms.instrumentCode = i.instrumentCode;
  1237. forms.gradeNumText = i.text;
  1238. studentInfo.extra.currentGradeNum =
  1239. firstStudent.currentGradeNum;
  1240. if (forms.schoolInstrumentSetType === 'CLASS') {
  1241. forms.classList = i.classList;
  1242. }
  1243. }
  1244. });
  1245. studentInfo.extra.currentClass = null;
  1246. forms.currentClassText = '';
  1247. forms.classList.forEach((i: any) => {
  1248. if (i.value === firstStudent.currentClass) {
  1249. forms.currentClassText = i.text;
  1250. studentInfo.extra.currentClass = firstStudent.currentClass;
  1251. }
  1252. });
  1253. studentInfo.extra.gender = firstStudent.gender;
  1254. forms.isRegister = 'update';
  1255. changeTipStatus(true, false);
  1256. forms.showSelectStudent = false;
  1257. } else {
  1258. // 判断新建学员是否上限了
  1259. if (forms.studentList.length >= forms.multi_user_limit) {
  1260. otherParams.showOtherMessage = `同一手机号最多创建${forms.multi_user_limit}个学生`;
  1261. otherParams.showOtherSchool = true;
  1262. otherParams.showCancelButton = false;
  1263. otherParams.showCloseButton = true;
  1264. otherParams.confirmButtonColor =
  1265. 'linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)';
  1266. otherParams.confirmButtonText = '我知道了';
  1267. otherParams.otherType = 'limit';
  1268. otherParams.messageAlign = 'center';
  1269. return true;
  1270. } else {
  1271. forms.studentItem = val;
  1272. forms.isRegister = 'create';
  1273. changeTipStatus(false, false);
  1274. forms.areaName = '';
  1275. forms.schoolName = '';
  1276. forms.schoolAreaId = null;
  1277. forms.schoolId = null;
  1278. studentInfo.extra.nickname = '';
  1279. studentInfo.extra.currentGradeNum = '';
  1280. studentInfo.extra.currentClass = '';
  1281. studentInfo.extra.gender = 1;
  1282. forms.currentClassText = '';
  1283. forms.gradeNumText = '';
  1284. forms.showSelectStudent = false;
  1285. }
  1286. }
  1287. }}
  1288. />
  1289. </Popup>
  1290. <Popup
  1291. v-model:show={forms.showPicker}
  1292. position="bottom"
  1293. round
  1294. class={'popupBottomSearch'}>
  1295. <Area
  1296. areaList={forms.areaList}
  1297. onCancel={() => (forms.showPicker = false)}
  1298. onConfirm={({ selectedOptions }) => {
  1299. forms.provinceCode = selectedOptions[0].value;
  1300. forms.cityCode = selectedOptions[1].value;
  1301. forms.regionCode = selectedOptions[2].value;
  1302. forms.areaName = selectedOptions
  1303. .map((item: any) => item.text)
  1304. .join(' ');
  1305. forms.showPicker = false;
  1306. forms.schoolId = null;
  1307. forms.schoolAreaId = null;
  1308. forms.schoolName = '';
  1309. forms.gradeNumText = '';
  1310. studentInfo.extra.currentGradeNum = null;
  1311. forms.currentClassText = '';
  1312. studentInfo.extra.currentClass = null;
  1313. getSchoolAreaList();
  1314. }}
  1315. />
  1316. </Popup>
  1317. <Popup
  1318. show={forms.showConfirmPopup}
  1319. style={{
  1320. background: 'transparent',
  1321. overflow: 'visible !important'
  1322. }}>
  1323. <CodeDialog type="INFO" showButton={false}>
  1324. <div class={styles.studentInfo}>
  1325. <Cell
  1326. border={false}
  1327. title="学生姓名"
  1328. value={studentInfo.extra.nickname}></Cell>
  1329. <Cell
  1330. border={false}
  1331. title="学生性别"
  1332. value={studentInfo.extra.gender === 1 ? '男' : '女'}></Cell>
  1333. <Cell
  1334. border={false}
  1335. title="所在地区"
  1336. value={forms.areaName}></Cell>
  1337. <Cell
  1338. border={false}
  1339. title="互通学校"
  1340. value={forms.schoolName}></Cell>
  1341. <Cell
  1342. border={false}
  1343. title="所在年级"
  1344. value={forms.gradeNumText}></Cell>
  1345. <Cell
  1346. border={false}
  1347. title="所在班级"
  1348. value={forms.currentClassText}></Cell>
  1349. {!route.query.code && (
  1350. <Cell
  1351. border={false}
  1352. title="互通码"
  1353. value={forms.activationCode}></Cell>
  1354. )}
  1355. </div>
  1356. <div class={styles.studentBtnGroup}>
  1357. <Button
  1358. round
  1359. block
  1360. onClick={() => (forms.showConfirmPopup = false)}>
  1361. 取消
  1362. </Button>
  1363. <Button
  1364. round
  1365. block
  1366. disabled={forms.submitLoading}
  1367. loading={forms.submitLoading}
  1368. color="linear-gradient( 305deg, #3192FF 0%, #40C8FF 100%)"
  1369. onClick={() => {
  1370. forms.showConfirmPopup = false;
  1371. onSubmit();
  1372. }}>
  1373. 提交
  1374. </Button>
  1375. </div>
  1376. </CodeDialog>
  1377. </Popup>
  1378. <Popup
  1379. show={forms.showResultPopup}
  1380. style={{
  1381. background: 'transparent',
  1382. overflow: 'visible !important'
  1383. }}>
  1384. <CodeDialog
  1385. type={forms.reslutPopupType}
  1386. btnText={
  1387. forms.reslutPopupType === 'ACTIVATING'
  1388. ? '立即下载激活'
  1389. : '我知道了'
  1390. }
  1391. onConfirm={() => {
  1392. //
  1393. if (forms.reslutPopupType === 'ACTIVATING') {
  1394. router.push('/download');
  1395. } else {
  1396. forms.showResultPopup = false;
  1397. }
  1398. }}>
  1399. {forms.reslutPopupType === 'ACTIVATING' && (
  1400. <p>
  1401. 请下载
  1402. <span style={{ color: '#2B85FF' }}>【音乐数字课堂App】</span>
  1403. ,使用手机号激活,实现音乐课堂互通互联
  1404. </p>
  1405. )}
  1406. {forms.reslutPopupType === 'CANCELLED' && (
  1407. <p style={{ textAlign: 'center', paddingTop: '5px' }}>
  1408. {forms.resultPopupContent}
  1409. </p>
  1410. )}
  1411. {forms.reslutPopupType === 'EXPIRED' && (
  1412. <p style={{ textAlign: 'center', paddingTop: '5px' }}>
  1413. {forms.resultPopupContent}
  1414. </p>
  1415. )}
  1416. </CodeDialog>
  1417. </Popup>
  1418. </div>
  1419. );
  1420. }
  1421. });