index.tsx 51 KB

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