更新了登陆页面的css样式,没那么抽象了

This commit is contained in:
Kunagisa 2025-06-14 14:27:41 +08:00
parent 8c69f3c29f
commit 0317061c4d
3 changed files with 48 additions and 145 deletions

View File

@ -83,52 +83,6 @@ const showError = ref(false)
const errorTitle = ref('错误提示') const errorTitle = ref('错误提示')
const errorMessage = ref('') const errorMessage = ref('')
const validateUsername = () => {
if (!username.value) {
usernameError.value = '请输入QQ号码'
return false
}
if (!/^[/\d/g]+$/.test(username.value)) {
usernameError.value = 'QQ号码只能包含数字'
return false
}
if (username.value.length < 4) {
usernameError.value = 'QQ号码长度不能小于4个字符'
return false
}
usernameError.value = ''
return true
}
const validatePassword = () => {
if (!password.value) {
passwordError.value = '请输入密码'
return false
}
if (password.value.length < 4) {
passwordError.value = '密码长度不能小于4个字符'
return false
}
if (password.value.length > 20) {
passwordError.value = '密码长度不能超过20个字符'
return false
}
passwordError.value = ''
return true
}
const validateCaptcha = () => {
if (!captcha.value) {
captchaError.value = '请输入验证码'
return false
}
if (captcha.value.length !== 4) {
captchaError.value = '验证码长度不正确'
return false
}
captchaError.value = ''
return true
}
const isFormValid = computed(() => { const isFormValid = computed(() => {
return !usernameError.value && return !usernameError.value &&

View File

@ -90,60 +90,6 @@ const showErrorMessage = (message, title = '错误提示') => {
showError.value = true showError.value = true
} }
//
const validateUsername = () => {
if (!username.value) {
usernameError.value = '请输入QQ号码'
return false
}
//
if (!/^\d+$/.test(username.value)) {
usernameError.value = 'QQ号只能包含数字'
return false
}
usernameError.value = ''
return true
}
const validatePassword = () => {
if (!password.value) {
passwordError.value = '请输入密码'
return false
}
if (password.value.length < 6) {
passwordError.value = '密码长度不能小于6个字符'
return false
}
passwordError.value = ''
return true
}
const validateConfirmPassword = () => {
if (!confirmPassword.value) {
confirmPasswordError.value = '请再次输入密码'
return false
}
if (confirmPassword.value !== password.value) {
confirmPasswordError.value = '两次输入的密码不一致'
return false
}
confirmPasswordError.value = ''
return true
}
const validateCaptcha = () => {
if (!captcha.value) {
captchaError.value = '请输入验证码'
return false
}
if (captcha.value.length !== 4) {
captchaError.value = '验证码长度不正确'
return false
}
captchaError.value = ''
return true
}
const refreshCaptcha = async () => { const refreshCaptcha = async () => {
try { try {
const response = await getCaptcha() const response = await getCaptcha()

View File

@ -7,13 +7,13 @@
<p>© Byz解忧杂货铺</p> <p>© Byz解忧杂货铺</p>
</div> </div>
<div class="content-container"> <div class="content-container">
<div class="login-right">
<button class="back-btn" @click="handleBack" title="返回主界面"> <button class="back-btn" @click="handleBack" title="返回主界面">
返回主界面 返回主界面
</button> </button>
<LoginModule v-if="!showRegister" @register="showRegister = true" /> <div class="form-content">
<RegisterModule v-else @login="showRegister = false" /> <LoginModule v-if="!showRegister" @register="showRegister = true" />
</div> <RegisterModule v-else @login="showRegister = false" />
</div>
</div> </div>
</div> </div>
</template> </template>
@ -64,35 +64,30 @@ const handleBack = () => {
} }
.content-container { .content-container {
position: absolute; position: relative;
top: 0; top: 50%;
right: 0; left: 50%;
transform: translate(-50%, -50%);
width: 25%; width: 25%;
min-width: 320px; min-width: 320px;
height: 100%;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: flex-start;
z-index: 2; z-index: 2;
} padding: 2rem;
background: rgba(255, 255, 255, 0.2);
.login-right { border-radius: 16px;
position: relative; box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
width: 100%; backdrop-filter: blur(5px);
height: calc(100vh - 120px); -webkit-backdrop-filter: blur(5px);
margin: 0; border: 1px solid rgba(255, 255, 255, 0.3);
background: linear-gradient(135deg, #afe9ef 0%, #a0c4ff 100%);
border-radius: 16px 0 0 20px;
box-shadow: -8px 0 25px rgba(0, 0, 0, 0.51);
display: flex;
align-items: center;
justify-content: center;
} }
.back-btn { .back-btn {
position: absolute; position: absolute;
top: 18px; top: 18px;
left: 28px; left: 18px;
background: #e6f7ff; background: #e6f7ff;
color: #409eff; color: #409eff;
border: none; border: none;
@ -113,41 +108,49 @@ const handleBack = () => {
color: #1976d2; color: #1976d2;
} }
.form-content {
width: 100%;
margin-top: 48px;
display: flex;
flex-direction: column;
align-items: center;
}
@media (max-width: 900px) { @media (max-width: 900px) {
.content-container { .content-container {
width: 40%; width: 40%;
min-width: 220px; min-width: 220px;
} }
.login-right {
}
.login-form {
max-width: 220px;
}
} }
@media (max-width: 600px) { @media (max-width: 600px) {
.content-container { .content-container {
width: 100%; width: 100vw;
min-width: 0;
left: 0;
right: 0;
}
.login-right {
border-radius: 0;
margin: 0;
height: 100vh; height: 100vh;
min-width: 0; min-width: 0;
max-width: 100vw; left: 0;
box-shadow: none; top: 0;
background: linear-gradient(135deg, #afe9ef 0%, #b6d0ff 100%); right: 0;
} bottom: 0;
.login-form { transform: none;
width: 96%; border-radius: 0;
min-width: 0; background: rgba(0,0,0,0.18);
max-width: 100vw; backdrop-filter: blur(16px);
-webkit-backdrop-filter: blur(16px);
padding: 0 8px;
justify-content: flex-start;
} }
.back-btn { .back-btn {
display: none; top: 18px;
left: 18px;
border-radius: 16px;
font-size: 15px;
padding: 6px 14px;
}
.form-content {
margin-top: 64px;
width: 100%;
align-items: center;
} }
} }