| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- import { c as h, R as r, C as i, I as c } from './validate.598a2b58.js'
- import {
- d as f,
- s,
- f as g,
- g as d,
- h as C,
- i as T,
- j as y,
- k as t,
- l as a,
- B as m
- } from './index.879f7421.js'
- import { C as S } from './index.4aec72fa.js'
- import { C as D } from './index.fe392820.js'
- import { F as u } from './index.00975bf6.js'
- import './index.c463dbd0.js'
- import './index.9a3a3b84.js'
- const w = '_login_y7mb5_1',
- _ = '_loginTitle_y7mb5_7',
- b = '_codeText_y7mb5_15',
- F = '_margin34_y7mb5_18',
- x = '_formTitle_y7mb5_21'
- var o = { login: w, loginTitle: _, codeText: b, margin34: F, formTitle: x },
- N = f({
- name: 'login',
- data() {
- return {
- loginType: 'SMS',
- username: '',
- password: '',
- smsCode: '',
- countDownStatus: !0,
- countDownTime: 1e3 * 120,
- imgCodeStatus: !1
- }
- },
- computed: {
- codeDisable() {
- let e = !0
- return (
- this.loginType === 'PWD'
- ? this.username && this.password && (e = !1)
- : this.username && this.smsCode && (e = !1),
- e
- )
- },
- appName() {
- return {
- STUDENT: '\u5B66\u751F\u7AEF',
- TEACHER: '\u8001\u5E08\u7AEF',
- SCHOOL: '\u7BA1\u7406\u7AEF'
- }[s.platformType]
- }
- },
- mounted() {
- g(), this.directNext()
- },
- methods: {
- directNext() {
- if (s.user.status === 'login' || s.user.status === 'error') {
- const { returnUrl: e, isRegister: l, ...n } = this.$route.query
- this.$router.replace({ path: e, query: { ...n } })
- }
- },
- async onLogin() {
- try {
- const e = {
- username: this.username,
- client_id: s.clientId[s.platformType],
- client_secret: s.clientId[s.platformType]
- }
- this.loginType === 'PWD'
- ? ((e.password = this.password),
- (e.loginType = 'PASSWORD'),
- (e.grant_type = 'PASSWORD'))
- : ((e.password = this.smsCode), (e.loginType = 'SMS'), (e.grant_type = 'SMS'))
- const { data: l } = await d.post('/api-oauth/userlogin', {
- requestType: 'form',
- data: { ...e }
- })
- C(l.token_type + ' ' + l.access_token)
- const n = await d.get(s.platformApi + '/user/getUserInfo', { initRequest: !0 })
- if (s.platformType === 'SCHOOL') {
- const p = n.data.schoolInfos ? n.data.schoolInfos[0] : {}
- n.data.school = p
- }
- T(n.data), this.directNext()
- } catch {}
- },
- async onSendCode() {
- if (!h(this.username))
- return y('\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801')
- this.imgCodeStatus = !0
- },
- onCodeSend() {
- ;(this.countDownStatus = !1),
- this.$nextTick(() => {
- this.$refs.countDownRef.start()
- })
- },
- onFinished() {
- ;(this.countDownStatus = !0), this.$refs.countDownRef.reset()
- },
- onChange() {
- this.loginType === 'PWD'
- ? (this.loginType = 'SMS')
- : this.loginType === 'SMS' && (this.loginType = 'PWD')
- }
- },
- render() {
- return t('div', { class: o.login }, [
- t('div', { class: o.loginTitle }, [
- a('\u60A8\u597D\uFF0C'),
- t('br', null, null),
- a(' \u6B22\u8FCE\u4F7F\u7528\u7BA1\u4E50\u56E2'),
- this.appName
- ]),
- t(
- S,
- { class: o.margin34, border: !1 },
- {
- default: () => [
- t(
- r,
- { style: { marginBottom: '16px' } },
- {
- default: () => [
- t(
- i,
- { span: 24, class: o.formTitle },
- { default: () => [a('\u624B\u673A\u53F7')] }
- ),
- t(
- i,
- { span: 24, class: 'van-hairline--bottom' },
- {
- default: () => [
- t(
- u,
- {
- modelValue: this.username,
- 'onUpdate:modelValue': (e) => (this.username = e),
- name: '\u624B\u673A\u53F7',
- placeholder: '\u8BF7\u8F93\u5165\u60A8\u7684\u624B\u673A\u53F7',
- type: 'tel',
- maxlength: 11
- },
- null
- )
- ]
- }
- )
- ]
- }
- ),
- this.loginType === 'PWD'
- ? t(r, null, {
- default: () => [
- t(
- i,
- { span: 24, class: o.formTitle },
- { default: () => [a('\u5BC6\u7801')] }
- ),
- t(
- i,
- { span: 24, class: 'van-hairline--bottom' },
- {
- default: () => [
- t(
- u,
- {
- modelValue: this.password,
- 'onUpdate:modelValue': (e) => (this.password = e),
- type: 'password',
- name: '\u5BC6\u7801',
- placeholder: '\u8BF7\u8F93\u5165\u5BC6\u7801'
- },
- null
- )
- ]
- }
- )
- ]
- })
- : t(r, null, {
- default: () => [
- t(
- i,
- { span: 24, class: o.formTitle },
- { default: () => [a('\u9A8C\u8BC1\u7801')] }
- ),
- t(
- i,
- { span: 24, class: 'van-hairline--bottom' },
- {
- default: () => [
- t(
- u,
- {
- modelValue: this.smsCode,
- 'onUpdate:modelValue': (e) => (this.smsCode = e),
- name: '\u9A8C\u8BC1\u7801',
- placeholder: '\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801',
- type: 'tel',
- maxlength: 6
- },
- {
- button: () =>
- this.countDownStatus
- ? t('span', { class: o.codeText, onClick: this.onSendCode }, [
- a('\u83B7\u53D6\u9A8C\u8BC1\u7801')
- ])
- : t(
- D,
- {
- ref: 'countDownRef',
- 'auto-start': !1,
- time: this.countDownTime,
- onFinish: this.onFinished,
- format: 'ss\u79D2'
- },
- null
- )
- }
- )
- ]
- }
- )
- ]
- })
- ]
- }
- ),
- t('div', { class: o.margin34 }, [
- t(
- m,
- {
- round: !0,
- block: !0,
- type: 'primary',
- disabled: this.codeDisable,
- onClick: this.onLogin
- },
- { default: () => [a('\u63D0\u4EA4')] }
- ),
- t(
- m,
- { block: !0, round: !0, color: '#F5F7FB', onClick: this.onChange },
- {
- default: () => [
- this.loginType === 'PWD'
- ? '\u9A8C\u8BC1\u7801\u767B\u5F55'
- : '\u5BC6\u7801\u767B\u5F55'
- ]
- }
- )
- ]),
- this.imgCodeStatus
- ? t(
- c,
- {
- value: this.imgCodeStatus,
- 'onUpdate:value': (e) => (this.imgCodeStatus = e),
- phone: this.username,
- onClose: () => {
- this.imgCodeStatus = !1
- },
- onSendCode: this.onCodeSend
- },
- null
- )
- : null
- ])
- }
- })
- export { N as default }
|