index.tsx 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. import ColHeader from '@/components/col-header'
  2. import ColSearch from '@/components/col-search'
  3. import { Sticky, Image, List, Popup, Icon, Area, Field, Form, CellGroup, Button, Toast, Picker, DatetimePicker, Overlay } from 'vant'
  4. import { defineComponent, onMounted, reactive } from 'vue'
  5. import styles from './index.module.less'
  6. import bg from './images/teacherBg.png'
  7. import rejectLogo from './images/rejectLogo.png'
  8. import rejectSchool from './images/rejest-school.png'
  9. import subTitle from './images/subTitle.png'
  10. import centerLogo from './images/center.png'
  11. import studentText from './images/studentText.png'
  12. import { useRoute } from 'vue-router'
  13. import icon_arrow from './images/icon_arrow.png'
  14. import rejectBtn from './images/rejectBtn.png'
  15. import teacherSuccess from './images/teacherSuccess.png'
  16. import SubjectModel from './modals/chioseSuond'
  17. import request from '@/helpers/request'
  18. import dayjs from 'dayjs'
  19. export default defineComponent({
  20. name: 'tenantStudentRejest',
  21. setup() {
  22. const route = useRoute();
  23. const forms = reactive({
  24. idCardNo: '',
  25. username: '',
  26. realName: '',
  27. phone: '',
  28. subjectId: '',
  29. tenantId: '',
  30. birthdate: '',
  31. code: ''
  32. });
  33. const data = reactive({
  34. schoolName: route.query.name || '',
  35. cityName: '', // 所属城市
  36. showArea: false,
  37. checked: true,
  38. success: false,
  39. areaList: {} as any,
  40. sendMsg: '获取验证码',
  41. imgCodeStatus: false,
  42. subjectList: [],
  43. searchStatus: false,
  44. openStatus: false,
  45. dateState: false,
  46. showSuccess: false,
  47. selectedSubjectList: [] as any,
  48. choiceSubjectIds: [] as any
  49. });
  50. const handleSubmit = () => {
  51. console.log(forms, 'forms')
  52. if (!forms.username) {
  53. Toast('请输入老师昵称')
  54. }
  55. if (!forms.phone) {
  56. Toast('请输入手机号')
  57. }
  58. if (!forms.code) {
  59. Toast('请输入验证码')
  60. }
  61. if (!forms.realName) {
  62. Toast('请输入真实姓名')
  63. }
  64. if (!forms.idCardNo) {
  65. Toast('请输入身份证号')
  66. }
  67. if (!forms.subjectId) {
  68. Toast('请选择声部')
  69. }
  70. }
  71. const getSubjectList = async () => {
  72. try {
  73. const res = await request.get('/api-tenant/open/subject/queryPage', { data: { page: 1, rows: 9999 } })
  74. // const res = await request.post('/api-tenant/open/subject/queryPageTree', { data: { page: 1, rows: 9999 } })
  75. data.subjectList = res.data.rows || []
  76. /**
  77. * .map((item: any) => {
  78. return {
  79. text: item.name,
  80. value: item.id
  81. }
  82. })
  83. *
  84. */
  85. } catch (e) {
  86. console.log(e)
  87. }
  88. }
  89. const confirmSubject = (val: any) => {
  90. console.log(val, 'confirmSubject')
  91. }
  92. const confirmDate = (val: any) => {
  93. forms.birthdate = dayjs(val).format('YYYY-MM-DD')
  94. data.dateState = false
  95. }
  96. onMounted(() => {
  97. console.log(
  98. route.query
  99. )
  100. getSubjectList()
  101. })
  102. /** 发送验证码 */
  103. const onSendSms = async () => {
  104. if (!forms.phone) {
  105. Toast('请输入手机号码');
  106. return;
  107. }
  108. if (!/^1[3456789]\d{9}$/.test(forms.phone)) {
  109. Toast('手机号码格式不正确');
  110. return;
  111. }
  112. await request.post('/api-student/code/sendSmsCode', {
  113. requestType: 'form',
  114. data: {
  115. mobile: forms.phone,
  116. type: 'LOGIN'
  117. }
  118. })
  119. onCountDown()
  120. setTimeout(() => {
  121. Toast('验证码已发送')
  122. }, 100)
  123. };
  124. const onCountDown = () => {
  125. data.sendMsg = '60s'
  126. let count = 60;
  127. const timer = setInterval(() => {
  128. count--;
  129. data.sendMsg = `${count}s`
  130. if (count <= 0) {
  131. data.sendMsg = '获取验证码'
  132. clearInterval(timer);
  133. }
  134. }, 1000);
  135. }
  136. const downApp = () => {
  137. data.showSuccess = false
  138. }
  139. const onChoice = (val: any) => {
  140. data.searchStatus = false
  141. data.selectedSubjectList = [val]
  142. }
  143. return () =>
  144. <>< div class={styles.videoClass} >
  145. <ColHeader
  146. class={styles.classHeader}
  147. border={false}
  148. isFixed={false}
  149. background="#fff"
  150. />
  151. <div class={styles.resjetStudentWrap}>
  152. <img src={rejectLogo} class={styles.rejectLogo} alt="" />
  153. <img src={studentText} class={styles.studentText} alt="" />
  154. <img src={bg} class={styles.bgWrap} alt="" />
  155. <div class={styles.schoolNameWrap}>
  156. <img src={rejectSchool} class={styles.rejectSchool} alt="" />
  157. <p>{data.schoolName}</p>
  158. </div>
  159. <img class={styles.centerLogo} src={centerLogo} alt="" />
  160. <div class={styles.infoWrap}>
  161. <div class={styles.infoWrapCore}>
  162. <img src={subTitle} class={styles.subTitle} alt="" />
  163. <Form onSubmit={() => handleSubmit()}>
  164. <CellGroup class={styles.group} border={false}>
  165. <Field
  166. class={styles.noArrow}
  167. inputAlign="right"
  168. label="老师昵称"
  169. placeholder="请输入老师昵称"
  170. maxlength={20}
  171. v-model={forms.username}
  172. // onUpdate: modelValue={(val: string) => {
  173. // forms.nickname = val.trim();
  174. // }}
  175. />
  176. <Field
  177. inputAlign="right"
  178. label="手机号"
  179. class={styles.noArrow}
  180. maxlength={11}
  181. placeholder="请输入手机号码"
  182. v-model={forms.phone}
  183. />
  184. <div class={styles.tips}>
  185. 手机号码为酷乐秀学院登录账号
  186. </div>
  187. <Field
  188. class={styles.inputCode}
  189. inputAlign="left"
  190. label="请输入验证码"
  191. labelWidth={0}
  192. v-model={forms.code}
  193. maxlength={6}>
  194. {{
  195. button: () => (
  196. <Button
  197. disabled={data.sendMsg.includes('s')}
  198. class={styles.sendBtn}
  199. onClick={() => onSendSms()}>
  200. {data.sendMsg}
  201. </Button>
  202. )
  203. }}
  204. </Field>
  205. <Field
  206. class={styles.noArrow}
  207. inputAlign="right"
  208. label="真实姓名"
  209. placeholder="请输入真实姓名"
  210. maxlength={20}
  211. v-model={forms.realName}
  212. // onUpdate: modelValue={(val: string) => {
  213. // forms.nickname = val.trim();
  214. // }}
  215. />
  216. <Field
  217. class={styles.noArrow}
  218. inputAlign="right"
  219. label="身份证号"
  220. placeholder="请输入身份证号"
  221. maxlength={20}
  222. v-model={forms.idCardNo}
  223. // onUpdate: modelValue={(val: string) => {
  224. // forms.nickname = val.trim();
  225. // }}
  226. />
  227. <Field
  228. border={false}
  229. inputAlign="right"
  230. label="声部"
  231. placeholder="请选择声部"
  232. readonly
  233. v-model={data.cityName}
  234. onClick={() => (data.searchStatus = true)}>
  235. {{
  236. button: () => (
  237. <img
  238. style={{
  239. display: 'block',
  240. width: '12px',
  241. height: '12px',
  242. }}
  243. src={icon_arrow}
  244. />
  245. )
  246. }}
  247. </Field>
  248. </CellGroup>
  249. </Form>
  250. </div>
  251. <img src={rejectBtn} onClick={() => { handleSubmit() }} class={styles.rejectBtn} alt="" />
  252. </div>
  253. </div>
  254. {/* <Popup
  255. show={data.searchStatus}
  256. position="bottom"
  257. round
  258. columns-field-names={{ text: '' }}
  259. safe-area-inset-bottom
  260. onClose={() => (data.searchStatus = false)}
  261. onClosed={() => (data.openStatus = false)}
  262. >
  263. <Picker columns={data.subjectList} onCancel={() => { data.searchStatus = false }} onConfirm={confirmSubject}></Picker>
  264. </Popup> */}
  265. <Popup
  266. show={data.searchStatus}
  267. round
  268. closeable
  269. position="bottom"
  270. style={{ height: '60%' }}
  271. teleport="body"
  272. onUpdate: show={val => (data.searchStatus = val)}
  273. >
  274. <SubjectModel
  275. subjectList={data.subjectList}
  276. choiceSubjectIds={data.choiceSubjectIds}
  277. onChoice={onChoice}
  278. single={true}
  279. selectType="Checkbox"
  280. />
  281. </Popup>
  282. </div >
  283. <Overlay show={data.showSuccess} z-index={1000}>
  284. <div class={styles.showWrap}>
  285. <img class={styles.showWrapTop} src={teacherSuccess} alt="" />
  286. <h2>恭喜您已成功登记为</h2>
  287. <h4>{data.schoolName} <span>【音乐老师】</span> </h4>
  288. <p>请下载酷乐秀机构版APP进行学习</p>
  289. <div class={styles.downApp} onClick={downApp}>立即下载</div>
  290. </div>
  291. </Overlay>
  292. </>
  293. }
  294. })