login.c7a7b0d6.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. import { c as m, R as i, C as a, I as h } from './validate.598a2b58.js'
  2. import {
  3. d as c,
  4. aK as p,
  5. aL as r,
  6. aM as l,
  7. aN as f,
  8. aO as C,
  9. j as g,
  10. k as e,
  11. aP as s,
  12. l as o,
  13. B as S
  14. } from './index.879f7421.js'
  15. import { C as y } from './index.4aec72fa.js'
  16. import { F as d } from './index.00975bf6.js'
  17. import { C as D } from './index.fe392820.js'
  18. import './index.c463dbd0.js'
  19. import './index.9a3a3b84.js'
  20. var A = c({
  21. name: 'login-music',
  22. data() {
  23. return {
  24. loginType: 'SMS',
  25. username: '',
  26. password: '',
  27. smsCode: '',
  28. countDownStatus: !0,
  29. countDownTime: 1e3 * 120,
  30. imgCodeStatus: !1
  31. }
  32. },
  33. computed: {
  34. codeDisable() {
  35. let t = !0
  36. return this.username && this.smsCode && (t = !1), t
  37. }
  38. },
  39. mounted() {
  40. p(), this.directNext()
  41. },
  42. methods: {
  43. directNext() {
  44. if (r.user.status === 'login' || r.user.status === 'error') {
  45. const { returnUrl: t, isRegister: n, ...u } = this.$route.query
  46. this.$router.replace({ path: t, query: { ...u } })
  47. }
  48. },
  49. async onLogin() {
  50. try {
  51. const t = {
  52. username: this.username,
  53. client_id: 'jmedu-student',
  54. client_secret: 'jmedu-student',
  55. autoRegister: !0,
  56. password: this.smsCode,
  57. loginType: 'SMS',
  58. grant_type: 'SMS'
  59. },
  60. { data: n } = await l.post('/api-oauth/userlogin', {
  61. requestType: 'form',
  62. data: { ...t }
  63. })
  64. f(n.token_type + ' ' + n.access_token)
  65. const u = await l.get('/api-student/user/getUserInfo', { initRequest: !0 })
  66. C(u.data), this.directNext()
  67. } catch {}
  68. },
  69. async onSendCode() {
  70. if (!m(this.username))
  71. return g('\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801')
  72. this.imgCodeStatus = !0
  73. },
  74. onCodeSend() {
  75. ;(this.countDownStatus = !1),
  76. this.$nextTick(() => {
  77. this.$refs.countDownRef.start()
  78. })
  79. },
  80. onFinished() {
  81. ;(this.countDownStatus = !0), this.$refs.countDownRef.reset()
  82. },
  83. onChange() {
  84. this.loginType === 'PWD'
  85. ? (this.loginType = 'SMS')
  86. : this.loginType === 'SMS' && (this.loginType = 'PWD')
  87. }
  88. },
  89. render() {
  90. return e('div', { class: s.login }, [
  91. e('div', { class: s.loginTitle }, [
  92. o('\u60A8\u597D\uFF0C'),
  93. e('br', null, null),
  94. o(' \u6B22\u8FCE\u4F7F\u7528\u7BA1\u4E50\u56E2\u5B66\u751F\u7AEF')
  95. ]),
  96. e(
  97. y,
  98. { class: s.margin34, border: !1 },
  99. {
  100. default: () => [
  101. e(
  102. i,
  103. { style: { marginBottom: '16px' } },
  104. {
  105. default: () => [
  106. e(
  107. a,
  108. { span: 24, class: s.formTitle },
  109. { default: () => [o('\u624B\u673A\u53F7')] }
  110. ),
  111. e(
  112. a,
  113. { span: 24, class: 'van-hairline--bottom' },
  114. {
  115. default: () => [
  116. e(
  117. d,
  118. {
  119. modelValue: this.username,
  120. 'onUpdate:modelValue': (t) => (this.username = t),
  121. name: '\u624B\u673A\u53F7',
  122. placeholder: '\u8BF7\u8F93\u5165\u60A8\u7684\u624B\u673A\u53F7',
  123. type: 'tel',
  124. maxlength: 11
  125. },
  126. null
  127. )
  128. ]
  129. }
  130. )
  131. ]
  132. }
  133. ),
  134. e(i, null, {
  135. default: () => [
  136. e(
  137. a,
  138. { span: 24, class: s.formTitle },
  139. { default: () => [o('\u9A8C\u8BC1\u7801')] }
  140. ),
  141. e(
  142. a,
  143. { span: 24, class: 'van-hairline--bottom' },
  144. {
  145. default: () => [
  146. e(
  147. d,
  148. {
  149. modelValue: this.smsCode,
  150. 'onUpdate:modelValue': (t) => (this.smsCode = t),
  151. name: '\u9A8C\u8BC1\u7801',
  152. placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801',
  153. type: 'tel',
  154. maxlength: 6
  155. },
  156. {
  157. button: () =>
  158. this.countDownStatus
  159. ? e('span', { class: s.codeText, onClick: this.onSendCode }, [
  160. o('\u83B7\u53D6\u9A8C\u8BC1\u7801')
  161. ])
  162. : e(
  163. D,
  164. {
  165. ref: 'countDownRef',
  166. 'auto-start': !1,
  167. time: this.countDownTime,
  168. onFinish: this.onFinished,
  169. format: 'ss\u79D2'
  170. },
  171. null
  172. )
  173. }
  174. )
  175. ]
  176. }
  177. )
  178. ]
  179. })
  180. ]
  181. }
  182. ),
  183. e('div', { class: s.margin34 }, [
  184. e(
  185. S,
  186. {
  187. round: !0,
  188. block: !0,
  189. type: 'primary',
  190. disabled: this.codeDisable,
  191. onClick: this.onLogin
  192. },
  193. { default: () => [o('\u63D0\u4EA4')] }
  194. )
  195. ]),
  196. this.imgCodeStatus
  197. ? e(
  198. h,
  199. {
  200. value: this.imgCodeStatus,
  201. 'onUpdate:value': (t) => (this.imgCodeStatus = t),
  202. phone: this.username,
  203. onClose: () => {
  204. this.imgCodeStatus = !1
  205. },
  206. onSendCode: this.onCodeSend
  207. },
  208. null
  209. )
  210. : null
  211. ])
  212. }
  213. })
  214. export { A as default }