detail.tsx 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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 styles from './detail.module.less';
  30. import MSticky from '@/components/m-sticky';
  31. // import MVideo from '@/components/m-video';
  32. import { useRoute, useRouter } from 'vue-router';
  33. import request from '@/helpers/request';
  34. import loginSuccess from './images/login-success.png';
  35. import SelectStudent from '@/views/student-register/modal/select-student';
  36. const classList: any = [];
  37. for (let i = 1; i <= 40; i++) {
  38. classList.push({ text: i + '班', value: i });
  39. }
  40. const GRADE_ENUM = {
  41. '1': '一年级',
  42. '2': '二年级',
  43. '3': '三年级',
  44. '4': '四年级',
  45. '5': '五年级',
  46. '6': '六年级',
  47. '7': '七年级',
  48. '8': '八年级',
  49. '9': '九年级'
  50. } as any;
  51. const getGradeList = (gradeYear?: string, instrumentCode?: string) => {
  52. let tempList: any = [];
  53. const five = [
  54. { text: '一年级', value: 1, instrumentCode },
  55. { text: '二年级', value: 2, instrumentCode },
  56. { text: '三年级', value: 3, instrumentCode },
  57. { text: '四年级', value: 4, instrumentCode },
  58. { text: '五年级', value: 5, instrumentCode }
  59. ];
  60. const one = [{ text: '六年级', value: 6, instrumentCode }];
  61. const three = [
  62. { text: '七年级', value: 7, instrumentCode },
  63. { text: '八年级', value: 8, instrumentCode },
  64. { text: '九年级', value: 9, instrumentCode }
  65. ];
  66. if (gradeYear === 'FIVE_YEAR_SYSTEM') {
  67. tempList.push(...[...five]);
  68. } else if (gradeYear === 'SIX_YEAR_SYSTEM') {
  69. tempList.push(...[...five, ...one]);
  70. } else if (gradeYear === 'THREE_YEAR_SYSTEM') {
  71. tempList.push(...[...three]);
  72. } else if (gradeYear === 'FORE_YEAR_SYSTEM') {
  73. tempList.push(...[...one, ...three]);
  74. } else {
  75. tempList.push(...[...five, ...one, ...three]);
  76. }
  77. return tempList;
  78. };
  79. export default defineComponent({
  80. name: 'activation-register',
  81. setup() {
  82. const route = useRoute();
  83. const forms = reactive({
  84. activationCodeRecordId: route.query.activationCodeRecordId,
  85. statusShow: false,
  86. schoolId: null as any,
  87. schoolAreaId: null, // 学校区域编号
  88. activationCode: route.query.code as any, // 互通码
  89. paymentType: '', // 支付类型
  90. paymentChannel: '',
  91. multi_user_limit: 1, // 限制注册学生数量
  92. // popupShow: false,
  93. registerDetails: {} as any,
  94. details: [] as any[],
  95. // schoolType: '', // 学校类型
  96. gradeYear: '', // 学制
  97. schoolInstrumentSetType: null as any,
  98. submitLoading: false,
  99. showSelectStudent: false, // 选择学生
  100. studentList: [], // 手机号关联学生列表
  101. studentItem: {} as any // 选择的学生
  102. // bugGoods: false, // 是否购买AI
  103. });
  104. const studentInfo = reactive({
  105. autoRegister: true,
  106. multiUser: true, // 是否为多用户
  107. client_id: 'cooleshow-student',
  108. client_secret: 'cooleshow-student',
  109. extra: {
  110. nickname: '',
  111. currentGradeNum: '' as any,
  112. currentClass: '' as any,
  113. gender: 1 as any,
  114. registerType: null as any, // 报名类型
  115. giftVipDay: 0 // 赠送会员天数
  116. },
  117. grant_type: 'password',
  118. loginType: 'SMS',
  119. password: '',
  120. username: ''
  121. });
  122. const getDetail = async () => {
  123. try {
  124. const { data } = await request.post(
  125. '/edu-app/open/instrumentRegister/instrumentUseRegister',
  126. {
  127. requestType: 'form',
  128. data: {
  129. activationCodeRecordId: forms.activationCodeRecordId
  130. }
  131. }
  132. );
  133. } catch {
  134. //
  135. }
  136. };
  137. onMounted(() => {
  138. getDetail();
  139. });
  140. return () => (
  141. <div class={styles['student-register']}>
  142. <div class={styles.studentRegisterContainer}>
  143. <div class={[styles.studentSection]}>
  144. <Form labelAlign="left" class={styles.registerForm}>
  145. <Field
  146. clearable={false}
  147. required
  148. inputAlign="right"
  149. label="学生姓名"
  150. placeholder="请输入学生姓名"
  151. autocomplete="off"
  152. readonly
  153. maxlength={14}
  154. v-model={studentInfo.extra.nickname}>
  155. {{
  156. extra: () =>
  157. forms.studentList.length > 1 && (
  158. <div
  159. class={[
  160. styles.selectStudentGroup,
  161. forms.showSelectStudent &&
  162. styles.selectStudentGroupChecked
  163. ]}
  164. onClick={() => (forms.showSelectStudent = true)}>
  165. <span>切换学生</span>
  166. </div>
  167. )
  168. }}
  169. </Field>
  170. <Field
  171. clearable={false}
  172. required
  173. inputAlign="right"
  174. label="学生性别"
  175. placeholder="请选择性别"
  176. autocomplete="off">
  177. {{
  178. input: () => (
  179. <RadioGroup
  180. checked-color="linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)"
  181. v-model={studentInfo.extra.gender}
  182. direction="horizontal"
  183. disabled>
  184. <Tag
  185. size="large"
  186. type="primary"
  187. color={
  188. !(studentInfo.extra.gender === 1)
  189. ? '#F5F6FA'
  190. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  191. }
  192. textColor={
  193. !(studentInfo.extra.gender === 1) ? '#626264' : '#fff'
  194. }
  195. class={styles.radioSection}>
  196. <Radio class={styles.radioItem} name={1}></Radio>男
  197. </Tag>
  198. <Tag
  199. size="large"
  200. type="primary"
  201. color={
  202. !(studentInfo.extra.gender === 0)
  203. ? '#F5F6FA'
  204. : 'linear-gradient( 135deg, #31C7FF 0%, #007AFE 100%)'
  205. }
  206. textColor={
  207. !(studentInfo.extra.gender === 0) ? '#626264' : '#fff'
  208. }
  209. class={styles.radioSection}>
  210. <Radio class={styles.radioItem} name={0}></Radio>女
  211. </Tag>
  212. </RadioGroup>
  213. )
  214. }}
  215. </Field>
  216. <Field
  217. clearable={false}
  218. required
  219. inputAlign="right"
  220. label="所在地区"
  221. placeholder="请选择地区"
  222. readonly
  223. clickable={false}
  224. // modelValue={forms.gradeNumText}
  225. // onClick={() => {
  226. // if (forms.isRegister !== 'update') {
  227. // forms.gradePopupIndex = [studentInfo.extra.currentGradeNum];
  228. // forms.gradeStatus = true;
  229. // }
  230. // }}
  231. />
  232. <Field
  233. clearable={false}
  234. required
  235. inputAlign="right"
  236. label="互通学校"
  237. placeholder="请选择互通学校"
  238. readonly
  239. clickable={false}
  240. // modelValue={forms.gradeNumText}
  241. />
  242. <Field
  243. clearable={false}
  244. required
  245. inputAlign="right"
  246. label="所在班级"
  247. placeholder="请选择班级"
  248. readonly
  249. clickable={false}
  250. // modelValue={forms.currentClassText}
  251. />
  252. </Form>
  253. </div>
  254. <MSticky position="bottom">
  255. <div class={styles.paymentContainer}>
  256. <Button
  257. onClick={() => {
  258. // onSubmit();
  259. // if (checkForm() || checkSubmit()) {
  260. // forms.submitLoading = false;
  261. // return;
  262. // }
  263. // forms.showConfirmPopup = true;
  264. }}
  265. round
  266. block
  267. disabled={forms.submitLoading}
  268. loading={forms.submitLoading}>
  269. 登记
  270. </Button>
  271. </div>
  272. </MSticky>
  273. </div>
  274. <Popup
  275. v-model:show={forms.showSelectStudent}
  276. round
  277. position="bottom"
  278. safeAreaInsetBottom
  279. closeable>
  280. <SelectStudent
  281. studentItem={forms.studentItem}
  282. list={forms.studentList}
  283. onClose={() => (forms.showSelectStudent = false)}
  284. onConfirm={(val: any) => {}}
  285. />
  286. </Popup>
  287. <Popup
  288. show={forms.statusShow}
  289. style={{
  290. background: 'transparent',
  291. overflow: 'visible !important'
  292. }}>
  293. <div class={styles.popupContainer}>
  294. <img class={styles.title} src={loginSuccess} />
  295. <div class={styles.content}>
  296. <span>李木子</span>已登记成功,乐器将在开课时发至学生
  297. </div>
  298. <div class={styles.pBtnGroup}>
  299. <Button
  300. round
  301. block
  302. onClick={() => (forms.statusShow = false)}
  303. color="linear-gradient( 305deg, #40C8FF 0%, #3192FF 100%)">
  304. 我知道了
  305. </Button>
  306. </div>
  307. </div>
  308. </Popup>
  309. </div>
  310. );
  311. }
  312. });