49 lines
1.9 KiB
JavaScript
49 lines
1.9 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__name: "login",
|
|
setup(__props) {
|
|
const username = common_vendor.ref("");
|
|
const password = common_vendor.ref("");
|
|
const rememberMe = common_vendor.ref(false);
|
|
const login = () => {
|
|
if (!username.value) {
|
|
common_vendor.index.showToast({ title: "请输入用户名", icon: "none" });
|
|
return;
|
|
}
|
|
if (!password.value) {
|
|
common_vendor.index.showToast({ title: "请输入密码", icon: "none" });
|
|
return;
|
|
}
|
|
if (username.value === "admin" && password.value === "123456") {
|
|
common_vendor.index.setStorageSync("admin_login", true);
|
|
common_vendor.index.showToast({ title: "登录成功", icon: "success" });
|
|
setTimeout(() => {
|
|
common_vendor.index.redirectTo({ url: "/pages/admin/index" });
|
|
}, 1500);
|
|
} else {
|
|
common_vendor.index.showToast({ title: "用户名或密码错误", icon: "none" });
|
|
}
|
|
};
|
|
const forgotPassword = () => {
|
|
common_vendor.index.showToast({ title: "请联系管理员重置密码", icon: "none" });
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: username.value,
|
|
b: common_vendor.o(($event) => username.value = $event.detail.value),
|
|
c: password.value,
|
|
d: common_vendor.o(($event) => password.value = $event.detail.value),
|
|
e: rememberMe.value
|
|
}, rememberMe.value ? {} : {}, {
|
|
f: rememberMe.value ? 1 : "",
|
|
g: common_vendor.o(($event) => rememberMe.value = !rememberMe.value),
|
|
h: common_vendor.o(login),
|
|
i: common_vendor.o(forgotPassword)
|
|
});
|
|
};
|
|
}
|
|
});
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6b759fa6"]]);
|
|
wx.createPage(MiniProgramPage);
|