gree_leran/unpackage/dist/dev/mp-weixin/pages/user/login.js

89 lines
3.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
const _easycom_up_text2 = common_vendor.resolveComponent("up-text");
const _easycom_up_input2 = common_vendor.resolveComponent("up-input");
const _easycom_up_button2 = common_vendor.resolveComponent("up-button");
(_easycom_up_text2 + _easycom_up_input2 + _easycom_up_button2)();
}
const _easycom_up_text = () => "../../node-modules/uview-plus/components/u-text/u-text.js";
const _easycom_up_input = () => "../../node-modules/uview-plus/components/u-input/u-input.js";
const _easycom_up_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
if (!Math) {
(_easycom_up_text + _easycom_up_input + _easycom_up_button)();
}
const _sfc_main = {
__name: "login",
setup(__props) {
const username = common_vendor.ref("");
const password = common_vendor.ref("");
const style = common_vendor.reactive({
height: "70rpx",
margin: "10rpx",
textAlign: "center",
backgroundColor: "#fff",
boxShadow: "0 4px 8px rgba(0, 0, 0, 0.1)"
});
const usernameError = common_vendor.ref(false);
const passwordError = common_vendor.ref(false);
const isButtonDisabled = common_vendor.ref(true);
function validateUsername() {
usernameError.value = username.value.trim() === "";
checkFormValidity();
}
function validatePassword() {
passwordError.value = password.value.trim() === "";
checkFormValidity();
}
function checkFormValidity() {
isButtonDisabled.value = usernameError.value || passwordError.value || username.value.trim() === "" || password.value.trim() === "";
}
async function login() {
if (isButtonDisabled.value)
return;
}
return (_ctx, _cache) => {
return {
a: common_vendor.p({
lines: 1,
text: "登录",
bold: "true",
size: " 60rpx",
align: "cente"
}),
b: common_vendor.o(validateUsername),
c: common_vendor.o(($event) => username.value = $event),
d: common_vendor.p({
placeholder: "请输入账号",
border: "surround",
error: usernameError.value,
fontSize: 15,
["error-message"]: "账号不能为空",
customStyle: style,
modelValue: username.value
}),
e: common_vendor.o(validatePassword),
f: common_vendor.o(($event) => password.value = $event),
g: common_vendor.p({
placeholder: "请输入密码",
border: "surround",
type: "password",
error: passwordError.value,
fontSize: 15,
customStyle: style,
["error-message"]: "密码不能为空",
modelValue: password.value
}),
h: common_vendor.o(login),
i: common_vendor.p({
type: "primary",
text: "登录",
disabled: isButtonDisabled.value
})
};
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6163e5ce"], ["__file", "D:/uniapp1/gree_leran/pages/user/login.vue"]]);
wx.createPage(MiniProgramPage);