quick-admin-vue3-core
Version:
以快(计算机执行效率、开发效率)为核心的后台管理系统开发模板
139 lines (138 loc) • 4.47 kB
JavaScript
import { defineComponent as y, ref as f, reactive as S, computed as C, resolveComponent as _, createElementBlock as P, openBlock as A, createElementVNode as u, createVNode as p, toDisplayString as E, unref as r, isRef as B, withCtx as c, createTextVNode as v } from "vue";
import { u as I, Q as L } from "./index-C0qRtkRj.js";
import { _ as N } from "./FindPassword.vue_vue_type_script_setup_true_lang-b77j6sLC.js";
import { _ as T } from "./Register.vue_vue_type_script_setup_true_lang-Bbt8D5w3.js";
import q from "./Captcha-Dw7alBpH.js";
import { w as U } from "./platform-DsTwHxm6.js";
import { u as z } from "./index-KDj-4JiF.js";
/* empty css */
import { _ as F } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const M = { VITE_APP_NAME: "Quick Admin Vue3" }, $ = { class: "wrap f-c-c" }, D = { class: "bounce-in login-box" }, O = { class: "head f-c-c" }, Q = { class: "foot f-sb-c" }, R = /* @__PURE__ */ y({
name: "Login",
__name: "index",
setup(G) {
const { VITE_APP_NAME: b } = M, { openPopup: m } = I(), h = z(), i = f(!1), d = f([]), a = U.getItem("rememberAccount");
let o = S({
phone: (a == null ? void 0 : a.phone) ?? "18483221518",
password: (a == null ? void 0 : a.password) ?? "role0123456",
captcha: "",
remember: !!a
});
const g = C(() => [
{
tpl: /^\d/.test(o.phone) ? "T_Phone" : void 0,
prop: "phone",
label: "账号",
required: !0,
type: "autocomplete",
attrs: {
placeholder: "请输入账号 / 手机号",
autocomplete: "off",
onSelect: x,
fetchSuggestions: k
}
},
{
tpl: "T_Password",
prop: "password",
label: "密码",
required: !0,
attrs: {
type: "password",
autocomplete: "off"
},
quickAttrs: {}
},
{
prop: "captcha",
label: "验证码",
type: "slot",
required: !0
},
{
prop: "remember",
label: "记住我",
type: "checkbox"
// size: "small",
}
]);
w();
function w() {
L().then((t) => {
d.value = t.map((e) => {
const { account: n, ...l } = e;
return { value: n, ...l };
});
});
}
function V(t) {
i.value = !0, h.handleLoginIn(t).finally(() => {
i.value = !1;
});
}
function k(t, e) {
let n = d.value;
t && (n = d.value.filter((l) => (s) => s.value.toLowerCase().indexOf(l.toLowerCase()) === 0)), e(n);
}
function x(t) {
o.password = t.password;
}
return (t, e) => {
const n = _("BaseForm"), l = _("el-button");
return A(), P("div", $, [
u("div", D, [
u("h1", O, E(r(b)), 1),
p(n, {
class: "body",
modelValue: r(o),
"onUpdate:modelValue": e[1] || (e[1] = (s) => B(o) ? o.value = s : o = s),
size: "large",
loading: i.value,
fields: g.value,
onSubmit: V,
submitBtn: "登录",
ref: "formRef"
}, {
captcha: c(() => [
p(q, {
modelValue: r(o).captcha,
"onUpdate:modelValue": e[0] || (e[0] = (s) => r(o).captcha = s),
prop: "captcha"
}, null, 8, ["modelValue"])
]),
_: 1
}, 8, ["modelValue", "loading", "fields"]),
u("div", Q, [
p(l, {
onClick: e[2] || (e[2] = (s) => r(m)({ title: "免费注册", direction: "ltr" }, T, "drawer")),
class: "btn",
type: "info",
size: "small",
link: ""
}, {
default: c(() => e[4] || (e[4] = [
v(" 免费注册 ")
])),
_: 1
}),
p(l, {
onClick: e[3] || (e[3] = (s) => r(m)("找回密码", N, "drawer")),
class: "btn",
type: "info",
size: "small",
link: ""
}, {
default: c(() => e[5] || (e[5] = [
v(" 找回密码 ")
])),
_: 1
})
])
])
]);
};
}
}), oe = /* @__PURE__ */ F(R, [["__scopeId", "data-v-9d271d83"]]);
export {
oe as default
};