From 592b1d7afbfd7427167602da8e902ca98a561a3b Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Thu, 13 Nov 2025 09:40:44 +0800
Subject: [PATCH] feat:登录添加空判断
---
src/pages/login/index.vue | 33 +++++++++++++++++++++++++--------
1 files changed, 25 insertions(+), 8 deletions(-)
diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index 4495aca..cf1707a 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -20,10 +20,10 @@
</label>
</div>
- <button class="login-btn" :style="[inputStyle]" @tap="submit">
+ <button class="login-btn" :style="[inputStyle]" @tap="submit">
登录
</button>
-
+
<image class="lowerRightCorner" :src="droneSvg" />
</view>
</template>
@@ -67,6 +67,23 @@
}
async function submit() {
+ if (!loginForm.value.username.trim()) {
+ uni.showToast({
+ title: "请输入用户名",
+ icon: "none",
+ duration: 2000
+ });
+ return;
+ }
+
+ if (!loginForm.value.password.trim()) {
+ uni.showToast({
+ title: "请输入密码",
+ icon: "none",
+ duration: 2000
+ });
+ return;
+ }
let userInfo = {
tenantId: "000000",
deptId: "",
@@ -86,7 +103,7 @@
} else {
uni.removeStorageSync('rememberedUser');
}
-
+
try {
const res = await loginByUsername(
userInfo.tenantId,
@@ -126,7 +143,7 @@
redirect = decodeURIComponent(options.redirect);
}
});
-
+
</script>
<style lang="scss" scoped>
@@ -204,10 +221,10 @@
margin-left: 62rpx;
margin-right: 58rpx;
margin-top: 20rpx;
-
+
color: #666;
font-size: 28rpx;
-
+
label {
display: flex;
align-items: center;
@@ -226,7 +243,7 @@
.login-btn {
z-index: 1;
@apply flex items-center justify-center py-12rpx px-0 text-30rpx border-none;
- background: #5a93e6;
+ background: #1D6FE9;
color: white;
width: 590rpx;
height: 76rpx;
@@ -261,4 +278,4 @@
color: $u-warning;
}
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.9.3