123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806 |
- import {
- c as R,
- a as t,
- d as _,
- n as E,
- r as H,
- u as $,
- p as X,
- L as j,
- m as M,
- b as N,
- t as p,
- e as Y,
- w as U,
- f as Z,
- g as ee,
- v as te,
- h as oe,
- i as se,
- s as ne,
- T as ae,
- j as re,
- H as le,
- k as W,
- B as ie,
- l as ue,
- o as ce,
- q as de,
- x as he,
- y as me,
- z as ge,
- I as fe,
- A as m,
- C as k,
- F as ye,
- D as v,
- E as x,
- G as V,
- J as K,
- K as q,
- M as F,
- N as L,
- O as z
- } from './index-0b3380a9.js';
- import { O as Ae } from './index-ca2ff73d.js';
- import { C as G } from './index-a7cda64a.js';
- import { F as O } from './index-451fefb3.js';
- import './base-aba1ba3e.js';
- import './index-e2c278c3.js';
- const [pe, S] = R('key'),
- we = t('svg', { class: S('collapse-icon'), viewBox: '0 0 30 24' }, [
- t(
- 'path',
- {
- d: 'M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z',
- fill: 'currentColor'
- },
- null
- )
- ]),
- Ce = t('svg', { class: S('delete-icon'), viewBox: '0 0 32 22' }, [
- t(
- 'path',
- {
- d: 'M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z',
- fill: 'currentColor'
- },
- null
- )
- ]);
- var D = _({
- name: pe,
- props: {
- type: String,
- text: E,
- color: String,
- wider: Boolean,
- large: Boolean,
- loading: Boolean
- },
- emits: ['press'],
- setup(e, { emit: n, slots: r }) {
- const o = H(!1),
- l = $(),
- g = u => {
- l.start(u), (o.value = !0);
- },
- f = u => {
- l.move(u), l.direction.value && (o.value = !1);
- },
- i = u => {
- o.value &&
- (r.default || X(u), (o.value = !1), n('press', e.text, e.type));
- },
- y = () => {
- if (e.loading) return t(j, { class: S('loading-icon') }, null);
- const u = r.default ? r.default() : e.text;
- switch (e.type) {
- case 'delete':
- return u || Ce;
- case 'extra':
- return u || we;
- default:
- return u;
- }
- };
- return () =>
- t(
- 'div',
- {
- class: S('wrapper', { wider: e.wider }),
- onTouchstartPassive: g,
- onTouchmovePassive: f,
- onTouchend: i,
- onTouchcancel: i
- },
- [
- t(
- 'div',
- {
- role: 'button',
- tabindex: 0,
- class: S([
- e.color,
- { large: e.large, active: o.value, delete: e.type === 'delete' }
- ])
- },
- [y()]
- )
- ]
- );
- }
- });
- const [ve, A] = R('number-keyboard'),
- Se = {
- show: Boolean,
- title: String,
- theme: M('default'),
- zIndex: E,
- teleport: [String, Object],
- maxlength: N(1 / 0),
- modelValue: M(''),
- transition: p,
- blurOnClose: p,
- showDeleteKey: p,
- randomKeyOrder: Boolean,
- closeButtonText: String,
- deleteButtonText: String,
- closeButtonLoading: Boolean,
- hideOnClickOutside: p,
- safeAreaInsetBottom: p,
- extraKey: { type: [String, Array], default: '' }
- };
- function _e(e) {
- for (let n = e.length - 1; n > 0; n--) {
- const r = Math.floor(Math.random() * (n + 1)),
- o = e[n];
- (e[n] = e[r]), (e[r] = o);
- }
- return e;
- }
- var Te = _({
- name: ve,
- inheritAttrs: !1,
- props: Se,
- emits: [
- 'show',
- 'hide',
- 'blur',
- 'input',
- 'close',
- 'delete',
- 'update:modelValue'
- ],
- setup(e, { emit: n, slots: r, attrs: o }) {
- const l = H(),
- g = () => {
- const s = Array(9)
- .fill('')
- .map((c, d) => ({ text: d + 1 }));
- return e.randomKeyOrder && _e(s), s;
- },
- f = () => [
- ...g(),
- { text: e.extraKey, type: 'extra' },
- { text: 0 },
- {
- text: e.showDeleteKey ? e.deleteButtonText : '',
- type: e.showDeleteKey ? 'delete' : ''
- }
- ],
- i = () => {
- const s = g(),
- { extraKey: c } = e,
- d = Array.isArray(c) ? c : [c];
- return (
- d.length === 1
- ? s.push({ text: 0, wider: !0 }, { text: d[0], type: 'extra' })
- : d.length === 2 &&
- s.push(
- { text: d[0], type: 'extra' },
- { text: 0 },
- { text: d[1], type: 'extra' }
- ),
- s
- );
- },
- y = Y(() => (e.theme === 'custom' ? i() : f())),
- u = () => {
- e.show && n('blur');
- },
- h = () => {
- n('close'), e.blurOnClose && u();
- },
- T = () => n(e.show ? 'show' : 'hide'),
- w = (s, c) => {
- if (s === '') {
- c === 'extra' && u();
- return;
- }
- const d = e.modelValue;
- c === 'delete'
- ? (n('delete'), n('update:modelValue', d.slice(0, d.length - 1)))
- : c === 'close'
- ? h()
- : d.length < +e.maxlength &&
- (n('input', s), n('update:modelValue', d + s));
- },
- b = () => {
- const { title: s, theme: c, closeButtonText: d } = e,
- P = r['title-left'],
- I = d && c === 'default';
- if (s || I || P)
- return t('div', { class: A('header') }, [
- P && t('span', { class: A('title-left') }, [P()]),
- s && t('h2', { class: A('title') }, [s]),
- I &&
- t(
- 'button',
- { type: 'button', class: [A('close'), le], onClick: h },
- [d]
- )
- ]);
- },
- B = () =>
- y.value.map(s => {
- const c = {};
- return (
- s.type === 'delete' && (c.default = r.delete),
- s.type === 'extra' && (c.default = r['extra-key']),
- t(
- D,
- {
- key: s.text,
- text: s.text,
- type: s.type,
- wider: s.wider,
- color: s.color,
- onPress: w
- },
- c
- )
- );
- }),
- J = () => {
- if (e.theme === 'custom')
- return t('div', { class: A('sidebar') }, [
- e.showDeleteKey &&
- t(
- D,
- {
- large: !0,
- text: e.deleteButtonText,
- type: 'delete',
- onPress: w
- },
- { delete: r.delete }
- ),
- t(
- D,
- {
- large: !0,
- text: e.closeButtonText,
- type: 'close',
- color: 'blue',
- loading: e.closeButtonLoading,
- onPress: w
- },
- null
- )
- ]);
- };
- return (
- U(
- () => e.show,
- s => {
- e.transition || n(s ? 'show' : 'hide');
- }
- ),
- e.hideOnClickOutside && Z(l, u, { eventName: 'touchstart' }),
- () => {
- const s = b(),
- c = t(
- ae,
- { name: e.transition ? 'van-slide-up' : '' },
- {
- default: () => [
- ee(
- t(
- 'div',
- oe(
- {
- ref: l,
- style: se(e.zIndex),
- class: A({
- unfit: !e.safeAreaInsetBottom,
- 'with-title': !!s
- }),
- onAnimationend: T,
- onTouchstartPassive: ne
- },
- o
- ),
- [
- s,
- t('div', { class: A('body') }, [
- t('div', { class: A('keys') }, [B()]),
- J()
- ])
- ]
- ),
- [[te, e.show]]
- )
- ]
- }
- );
- return e.teleport
- ? t(re, { to: e.teleport }, { default: () => [c] })
- : c;
- }
- );
- }
- });
- const be = W(Te),
- [Be, C] = R('password-input'),
- xe = {
- info: String,
- mask: p,
- value: M(''),
- gutter: E,
- length: N(6),
- focused: Boolean,
- errorInfo: String
- };
- var Pe = _({
- name: Be,
- props: xe,
- emits: ['focus'],
- setup(e, { emit: n }) {
- const r = l => {
- l.stopPropagation(), n('focus', l);
- },
- o = () => {
- const l = [],
- { mask: g, value: f, gutter: i, focused: y } = e,
- u = +e.length;
- for (let h = 0; h < u; h++) {
- const T = f[h],
- w = h !== 0 && !i,
- b = y && h === f.length;
- let B;
- h !== 0 && i && (B = { marginLeft: ce(i) }),
- l.push(
- t(
- 'li',
- { class: [{ [ue]: w }, C('item', { focus: b })], style: B },
- [
- g
- ? t(
- 'i',
- { style: { visibility: T ? 'visible' : 'hidden' } },
- null
- )
- : T,
- b && t('div', { class: C('cursor') }, null)
- ]
- )
- );
- }
- return l;
- };
- return () => {
- const l = e.errorInfo || e.info;
- return t('div', { class: C() }, [
- t(
- 'ul',
- {
- class: [C('security'), { [ie]: !e.gutter }],
- onTouchstartPassive: r
- },
- [o()]
- ),
- l && t('div', { class: C(e.errorInfo ? 'error-info' : 'info') }, [l])
- ]);
- };
- }
- });
- const De = W(Pe),
- Q = '' + new URL('login-logo-11b6718f.png', import.meta.url).href,
- Me =
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAPFBMVEUAAACnsMylrsymr8ymsMymrsymsMynsM2or8+ms8ynsM2nsM2mr8yosc6nr8ulscyissmkrcimr82mr8xoS1BYAAAAE3RSTlMAqlX5zaSca0wN5MK3cmNBIRyPF9bpcQAAAHRJREFUOMvt1LEOgCAMRVEriKiIKP//r4JlMIK+RCcT7kTDCRttan1H59Ry4yZ/bS6/57PEWoKdz9MlSHwnXThrwUP7AO0xGAxVPA8jhl4SUXAQchVW+AIKQzEJoU6TQnBIk0VwY+kkw0/fFS8AvFLwkvpXO7wRJHHiDd4WAAAAAElFTkSuQmCC',
- ke =
- 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAZlBMVEUAAACmr82mr8ynsMyjssqnr8ymr8yksdKmr8ymr8ynsM2nr8ynsM2lr86qtc2msMyosc6nsc6msdOmsM2msM2nsM2nr82nsM2msMunsMynsc6or8ytrc6nsMymsMylsM2krcqmr8w5Qv39AAAAIXRSTlMArFWqIN6KBvv1oe+lShjWOzQL5bB5cmldWU1GD8SblDU92uELAAAAt0lEQVQ4y+3RyQ6DIBSFYVRAQUHrrLXDef+XbGp0I0NJXHTjv7oJX8gNkKs1Pbwkn9NfLOUZvrHY7+oH9jovTAC0o+pLAL47KyBbz1MJMM+eEuDbriWg3JABdBt7gLuhgNhHBUg3zJDv4x0ozsKa0gyCbo1AS7XNdQJmrDLcDGt5bT6hPWV+nr3YA8tnHgTFQqYgyAi5/Qk2hFRBENNSeKHRScgd8H2EurG6iBhpnkTHiiElVyF9ALhVMzsJy5oXAAAAAElFTkSuQmCC',
- Ve = '_login_1id51_1',
- Ke = '_arrowLeft_1id51_26',
- Re = '_loginContainer_1id51_35',
- Ee = '_container_1id51_40',
- Ie = '_logo_1id51_48',
- Fe = '_iconPhone_1id51_63',
- Le = '_iconPassword_1id51_64',
- ze = '_btnGroup_1id51_75',
- Oe = '_primaryButton_1id51_78',
- He = '_protocol_1id51_90',
- Ne = '_iconChecked_1id51_99',
- Ue = '_active_1id51_107',
- We = '_codePhone_1id51_127',
- qe = '_btnWrap_1id51_144',
- Ge = '_btnSend_1id51_148',
- a = {
- login: Ve,
- arrowLeft: Ke,
- loginContainer: Re,
- container: Ee,
- logo: Ie,
- 'input-group': '_input-group_1id51_54',
- iconPhone: Fe,
- iconPassword: Le,
- btnGroup: ze,
- primaryButton: Oe,
- 'login-change': '_login-change_1id51_79',
- protocol: He,
- iconChecked: Ne,
- active: Ue,
- 'code-title': '_code-title_1id51_121',
- codePhone: We,
- btnWrap: qe,
- btnSend: Ge
- },
- Qe = _({
- name: 'layout-code',
- props: {
- phone: { type: String, default: '' },
- isRegister: { type: String, default: '' }
- },
- emits: ['close', 'confirm'],
- setup(e, { emit: n }) {
- const r = de(),
- o = he({
- smsCode: '',
- showKeyboard: !1,
- countDownStatus: !0,
- countDownTime: 120,
- countTimer: null
- }),
- l = async () => {
- try {
- await v.post('/edu-app/open/sendSms', {
- requestType: 'form',
- data: {
- clientId: 'cooleshow-student',
- type: e.isRegister ? 'REGISTER' : 'LOGIN',
- mobile: e.phone
- }
- }),
- g(),
- setTimeout(() => {
- x('验证码已发送');
- }, 100);
- } catch (i) {
- o.countDownStatus = !0;
- }
- },
- g = () => {
- (o.countDownStatus = !1),
- (o.countTimer = setInterval(() => {
- o.countDownTime > 0
- ? o.countDownTime--
- : ((o.countDownStatus = !0), clearInterval(o.countTimer));
- }, 1e3));
- },
- f = async () => {
- try {
- const i = {
- username: e.phone,
- client_id: 'cooleshow-student',
- client_secret: 'cooleshow-student',
- password: o.smsCode,
- grant_type: 'password',
- loginType: 'SMS'
- },
- { data: y } = await v.post('/edu-app/userlogin', {
- requestType: 'form',
- data: { ...i }
- });
- V.set(K, y.token_type + ' ' + y.access_token);
- const u = await v.get('/edu-app/user/getUserInfo', {
- initRequest: !0
- });
- q(u.data), r.back(), n('confirm');
- } catch (i) {}
- };
- return (
- U(
- () => o.smsCode,
- i => {
- i && i.length === 6 && f();
- }
- ),
- me(() => {
- ge(async () => {
- await l();
- });
- }),
- () =>
- t('div', { class: [a.login] }, [
- t(
- fe,
- {
- name: 'arrow-left',
- class: a.arrowLeft,
- onClick: () => n('close')
- },
- null
- ),
- t('div', { class: a.loginContainer }, [
- t('img', { src: Q, class: a.logo }, null),
- t(
- G,
- { class: a.container, border: !1 },
- {
- default: () => [
- t('h2', { class: a['code-title'] }, [m('输入验证码')]),
- t('p', { class: a.codePhone }, [
- m('已发送6位验证码至'),
- t('span', null, [e.phone])
- ]),
- t(
- De,
- {
- value: o.smsCode,
- onFocus: () => {
- o.showKeyboard = !0;
- },
- focused: o.showKeyboard,
- length: 6,
- gutter: 12
- },
- null
- ),
- t(
- be,
- {
- modelValue: o.smsCode,
- 'onUpdate:modelValue': i => (o.smsCode = i),
- show: o.showKeyboard,
- maxlength: 6,
- onBlur: () => {
- o.showKeyboard = !1;
- }
- },
- null
- ),
- t('div', { class: a.btnWrap }, [
- t(
- k,
- {
- type: 'primary',
- round: !0,
- onClick: l,
- class: a.btnSend,
- disabled: !o.countDownStatus
- },
- {
- default: () => [
- m('重新发送'),
- !o.countDownStatus &&
- t(ye, null, [m('('), o.countDownTime, m(')')])
- ]
- }
- )
- ])
- ]
- }
- )
- ])
- ])
- );
- }
- }),
- tt = _({
- name: 'layout-login',
- data() {
- const { isRegister: e } = this.$route.query;
- return {
- isRegister: e,
- loginType: 'SMS',
- username: '',
- password: '',
- smsCode: '',
- countDownStatus: !0,
- countDownTime: 1e3 * 120,
- imgCodeStatus: !1,
- isAgree: !0
- };
- },
- mounted() {
- V.remove(K), this.directNext();
- },
- methods: {
- directNext() {
- if (F.user.status === 'login' || F.user.status === 'error') {
- const { returnUrl: e, isRegister: n, ...r } = this.$route.query;
- this.$router.replace({ path: e, query: { ...r } });
- }
- },
- async onLogin() {
- try {
- if (!L(this.username)) return x('请输入正确的手机号码');
- const e = {
- username: this.username,
- client_id: 'cooleshow-student',
- client_secret: 'cooleshow-student',
- password: this.loginType === 'PWD' ? this.password : this.smsCode,
- grant_type: 'password',
- loginType: this.loginType === 'PWD' ? 'PASSWORD' : 'SMS'
- },
- { data: n } = await v.post('/edu-app/userlogin', {
- requestType: 'form',
- data: { ...e }
- });
- V.set(K, n.token_type + ' ' + n.access_token);
- const r = await v.get('/edu-app/user/getUserInfo', {
- initRequest: !0
- });
- q(r.data), this.directNext();
- } catch (e) {
- console.log(e);
- }
- },
- async onSendCode() {
- if (!this.isAgree) return x('请阅读并同意以下协议');
- if (!L(this.username)) return x('请输入正确的手机号码');
- this.imgCodeStatus = !0;
- },
- onChange() {
- this.loginType === 'PWD'
- ? (this.loginType = 'SMS')
- : this.loginType === 'SMS' && (this.loginType = 'PWD');
- }
- },
- render() {
- return t('div', { class: [a.login] }, [
- t('div', { class: a.loginContainer }, [
- t('img', { src: Q, class: a.logo }, null),
- t(
- G,
- { class: a.container, border: !1 },
- {
- default: () => [
- t(
- O,
- {
- modelValue: this.username,
- 'onUpdate:modelValue': e => (this.username = e),
- name: '手机号',
- placeholder: '请输入您的手机号',
- type: 'tel',
- class: a['input-group'],
- maxlength: 11,
- autocomplete: 'off',
- border: !1
- },
- {
- 'left-icon': () =>
- t('img', { src: Me, class: a.iconPhone }, null)
- }
- ),
- this.loginType === 'PWD' &&
- t(
- O,
- {
- modelValue: this.password,
- 'onUpdate:modelValue': e => (this.password = e),
- type: 'password',
- name: '密码',
- class: a['input-group'],
- placeholder: '请输入密码',
- autocomplete: 'off',
- border: !1
- },
- {
- 'left-icon': () =>
- t('img', { src: ke, class: a.iconPassword }, null)
- }
- ),
- t('div', { class: a.btnGroup }, [
- t(
- k,
- {
- round: !0,
- block: !0,
- class: a.primaryButton,
- onClick: () => {
- this.loginType === 'PWD'
- ? this.onLogin()
- : this.onSendCode();
- }
- },
- {
- default: () => [
- this.loginType === 'PWD' ? '登录' : '获取短信验证码'
- ]
- }
- ),
- t(
- k,
- {
- round: !0,
- block: !0,
- type: 'default',
- class: a['login-change'],
- onClick: this.onChange
- },
- {
- default: () => [
- this.loginType === 'PWD' ? '短信登录' : '密码登录'
- ]
- }
- )
- ]),
- this.loginType === 'SMS' &&
- t(
- 'div',
- {
- class: a.protocol,
- onClick: () => (this.isAgree = !this.isAgree)
- },
- [
- t(
- 'i',
- {
- class: [a.iconChecked, this.isAgree ? a.active : '']
- },
- null
- ),
- m('我已阅读并同意'),
- t(
- 'span',
- {
- onClick: e => {
- e.stopPropagation(), z.push('/preview-protocol');
- }
- },
- [m('《用户注册协议》')]
- ),
- m('和'),
- t(
- 'span',
- {
- onClick: e => {
- e.stopPropagation(), z.push('/privacy-protocol');
- }
- },
- [m('《隐私政策》')]
- )
- ]
- )
- ]
- }
- )
- ]),
- t(
- Ae,
- {
- modelValue: this.imgCodeStatus,
- 'onUpdate:modelValue': e => (this.imgCodeStatus = e)
- },
- {
- default: () => [
- t(
- Qe,
- {
- phone: this.username,
- isRegister: this.isRegister,
- onClose: () => (this.imgCodeStatus = !1),
- onConfirm: this.directNext
- },
- null
- )
- ]
- }
- )
- ]);
- }
- });
- export { tt as default };
|