style(mobile-uni): 优化员工端首页与登录页UI交互,更名为银城帮道

This commit is contained in:
2026-07-23 00:42:51 +08:00
parent 4ab0fccc73
commit 333c365c6f
3 changed files with 591 additions and 221 deletions
+210 -97
View File
@@ -4,7 +4,7 @@
<view class="brand-lockup">
<image class="login-logo" src="/static/brand-logo.png" mode="aspectFit" />
<view class="brand-copy">
<text class="brand-name">银城物业</text>
<text class="brand-name">银城帮道</text>
<text class="brand-divider">·</text>
<text class="login-eyebrow">数字师傅</text>
</view>
@@ -12,8 +12,8 @@
<view class="mentor-block">
<image class="mentor-image" src="/static/mentor-female-bust.png" mode="aspectFit" />
<view class="mentor-bubble">
<text class="mentor-bubble-text">手机号登录,一分钟上手</text>
<view class="mentor-bubble spring-pop">
<text class="mentor-bubble-text">手机号登录,立刻上手</text>
</view>
</view>
@@ -63,15 +63,27 @@
:styles="inputStyles"
/>
</view>
<button class="secondary-button code-button" :disabled="sending" @click="sendCode">
{{ sending ? '发送中' : '获取验证码' }}
<button
class="secondary-button code-button"
:disabled="sending || countdown > 0"
@click="sendCode"
>
{{ sending ? '发送中' : countdown > 0 ? `${countdown}s 后重发` : '获取验证码' }}
</button>
</view>
</uni-forms-item>
</uni-forms>
<view class="dev-hint-pill" @click="fillDevCredentials">
<uni-icons type="info-filled" size="14" color="#d97706" />
<text class="dev-hint-text">测试验证码: 123456</text>
<text class="dev-fill-btn">快捷填入</text>
</view>
<button class="primary-button login-submit" :disabled="loggingIn" @click="login">
{{ loggingIn ? '登录中' : '登录' }}
{{ loggingIn ? '登录中…' : '登录' }}
</button>
<uni-notice-bar
v-if="message"
:text="message"
@@ -81,14 +93,19 @@
/>
</view>
<text class="agreement">登录即同意《服务协议》与《隐私政策》</text>
<view class="agreement-row" @click="agreed = !agreed">
<view class="checkbox-box" :class="{ checked: agreed }">
<uni-icons v-if="agreed" type="checkmarkempty" size="12" color="#ffffff" />
</view>
<text class="agreement-text">已阅读并同意《服务协议》与《隐私政策》</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import { reactive, ref, onUnmounted } from 'vue';
import { onHide, onShow, onUnload } from '@dcloudio/uni-app';
import type { LoginResult } from '@/types/api';
import { apiRequest } from '@/services/api';
import { consumeLoginRedirect, getAuth, isLoggedIn, phoneKey, saveAuth } from '@/services/auth';
@@ -117,13 +134,42 @@ const formRules = {
};
const sending = ref(false);
const loggingIn = ref(false);
const countdown = ref(0);
const agreed = ref(true);
const message = ref('');
let timer: ReturnType<typeof setInterval> | null = null;
const inputStyles = {
color: '#25282d',
borderColor: 'transparent',
backgroundColor: 'transparent'
};
const stopTimer = () => {
if (timer) {
clearInterval(timer);
timer = null;
}
};
const startCountdown = () => {
stopTimer();
countdown.value = 60;
timer = setInterval(() => {
if (countdown.value > 1) {
countdown.value -= 1;
} else {
countdown.value = 0;
stopTimer();
}
}, 1000);
};
const fillDevCredentials = () => {
formData.smsCode = '123456';
message.value = '已自动填入测试验证码 123456';
};
const normalizeDigits = (value: string | number, maxLength: number) =>
String(value || '')
.replace(/\D/g, '')
@@ -143,7 +189,7 @@ const goAfterLogin = async () => {
};
const sendCode = async () => {
if (sending.value) return;
if (sending.value || countdown.value > 0) return;
try {
await loginForm.value?.validateField(['phone']);
} catch {
@@ -159,6 +205,7 @@ const sendCode = async () => {
auth: false
});
message.value = '验证码已发送';
startCountdown();
} catch (error) {
message.value = error instanceof Error ? error.message : '验证码发送失败';
} finally {
@@ -168,6 +215,10 @@ const sendCode = async () => {
const login = async () => {
if (loggingIn.value) return;
if (!agreed.value) {
message.value = '请先勾选同意《服务协议》与《隐私政策》';
return;
}
try {
await loginForm.value?.validate();
} catch {
@@ -205,6 +256,18 @@ onShow(() => {
void goAfterLogin();
}
});
onHide(() => {
stopTimer();
});
onUnload(() => {
stopTimer();
});
onUnmounted(() => {
stopTimer();
});
</script>
<style scoped>
@@ -299,6 +362,7 @@ onShow(() => {
width: 128px;
height: 130px;
flex: none;
filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.08));
}
.mentor-bubble {
@@ -306,14 +370,23 @@ onShow(() => {
margin-top: 20px;
padding: 12px 16px;
border: 1px solid rgba(225, 227, 232, 0.9);
border-radius: 14px;
border-radius: 16px;
background: #ffffff;
box-shadow: 0 6px 16px rgba(29, 31, 35, 0.08);
box-shadow: 0 6px 18px rgba(29, 31, 35, 0.08);
}
.mentor-bubble.spring-pop {
animation: springPop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes springPop {
0% { transform: scale(0.85); opacity: 0; }
100% { transform: scale(1); opacity: 1; }
}
.mentor-bubble::before {
position: absolute;
top: 22px;
top: 20px;
left: -6px;
width: 10px;
height: 10px;
@@ -326,9 +399,9 @@ onShow(() => {
.mentor-bubble-text {
color: #25282d;
font-size: 16px;
font-weight: 600;
line-height: 1.5;
font-size: 15px;
font-weight: 700;
line-height: 1.4;
}
.login-card {
@@ -338,18 +411,18 @@ onShow(() => {
gap: 18px;
max-width: 720px;
margin: 0 auto;
padding: 28px 20px 28px;
padding: 24px 20px 24px;
border: 1px solid rgba(225, 227, 232, 0.95);
border-top: 4px solid #e60012;
border-radius: 18px;
border-radius: 20px;
background: rgba(255, 255, 255, 0.96);
box-shadow: 0 12px 28px rgba(29, 31, 35, 0.12), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
box-shadow: 0 12px 32px rgba(29, 31, 35, 0.08), 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}
.login-card::before {
position: absolute;
inset: 0;
border-radius: 18px;
border-radius: 20px;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 26%);
content: '';
pointer-events: none;
@@ -365,40 +438,40 @@ onShow(() => {
}
.login-form :deep(.uni-forms-item) {
margin-bottom: 22px;
margin-bottom: 18px;
}
.login-form :deep(.uni-forms-item:last-child) {
margin-bottom: 7px;
margin-bottom: 4px;
}
.login-form :deep(.uni-forms-item__label) {
padding-bottom: 4px;
padding-bottom: 6px;
color: #20242b;
font-size: 15px;
font-weight: 700;
}
.login-form :deep(.uni-forms-item__error) {
margin-top: 9px;
font-size: 13px;
margin-top: 6px;
font-size: 12px;
}
.field-shell {
display: flex;
align-items: center;
min-height: 56px;
min-height: 52px;
padding: 0 14px;
border: 1px solid #d8dce3;
border-radius: 8px;
border-radius: 12px;
background: #ffffff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.02);
transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field-shell:focus-within {
border-color: #e60012;
box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.08);
box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.12);
}
.field-shell :deep(.uni-easyinput) {
@@ -425,75 +498,114 @@ onShow(() => {
.field-shell :deep(.uni-easyinput__placeholder-class) {
color: #b5b8c1;
font-size: 15px;
font-size: 14px;
}
.field-icon {
margin-right: 12px;
margin-right: 10px;
flex: none;
}
.code-row {
display: grid;
grid-template-columns: minmax(0, 1fr) 84px;
align-items: stretch;
gap: 12px;
}
.code-shell,
.code-input {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
gap: 10px;
width: 100%;
}
.code-shell {
padding-right: 10px;
flex: 1;
min-width: 0;
padding-right: 8px;
padding-left: 12px;
}
.code-shell .field-icon {
margin-right: 9px;
}
.code-shell :deep(.uni-easyinput__content-input),
.code-shell :deep(.uni-easyinput__placeholder-class) {
font-size: 13px;
}
.code-button {
display: flex;
align-items: center;
justify-content: center;
width: 100%;
min-height: 56px;
padding: 0 4px;
width: 116px;
min-width: 116px;
height: 52px;
flex: 0 0 116px;
padding: 0 6px;
border: 1px solid #e60012;
border-radius: 8px;
background: linear-gradient(180deg, #ffffff 0%, #fffdfd 100%);
border-radius: 12px;
background: #ffffff;
color: #e60012;
font-size: 12px;
font-size: 13px;
font-weight: 700;
line-height: 1;
white-space: nowrap;
box-shadow: 0 6px 14px rgba(242, 11, 26, 0.06);
box-shadow: 0 4px 12px rgba(230, 0, 18, 0.08);
transition: transform 0.15s ease, background 0.15s ease;
}
.code-button:active {
transform: scale(0.96);
background: #fff8f8;
}
.code-button:disabled {
border-color: #e5e7eb;
background: #f9fafb;
color: #9ca3af;
box-shadow: none;
}
.dev-hint-pill {
display: inline-flex;
align-items: center;
align-self: center;
gap: 6px;
padding: 6px 14px;
border-radius: 20px;
background: #fffdf5;
border: 1px dashed #f59e0b;
cursor: pointer;
transition: transform 0.15s ease, background 0.15s ease;
}
.dev-hint-pill:active {
transform: scale(0.96);
background: #fff8e6;
}
.dev-hint-text {
color: #b45309;
font-size: 12px;
font-weight: 600;
}
.dev-fill-btn {
color: var(--employee-primary, #e60012);
font-size: 12px;
font-weight: 800;
text-decoration: underline;
}
.login-submit {
display: flex;
width: 100%;
min-height: 60px;
min-height: 54px;
margin-top: 4px;
align-items: center;
justify-content: center;
align-self: stretch;
padding: 0 20px;
border-radius: 14px;
background: #e60012;
background: linear-gradient(135deg, #ff4d4f 0%, #e60012 100%);
color: #ffffff;
font-size: 22px;
font-size: 20px;
font-weight: 800;
letter-spacing: 2px;
box-shadow: 0 8px 18px rgba(230, 0, 18, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.24);
box-shadow: 0 8px 20px rgba(230, 0, 18, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.login-submit:active {
transform: scale(0.97);
box-shadow: 0 4px 10px rgba(230, 0, 18, 0.2);
}
.login-card :deep(.uni-noticebar) {
@@ -501,50 +613,51 @@ onShow(() => {
border-radius: 10px;
}
.agreement {
display: block;
.agreement-row {
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
max-width: 720px;
margin: 16px auto 0;
color: #a4a8b0;
margin: 18px auto 0;
cursor: pointer;
}
.checkbox-box {
display: flex;
align-items: center;
justify-content: center;
width: 18px;
height: 18px;
border: 1.5px solid #bdc1c9;
border-radius: 5px;
background: #ffffff;
transition: all 0.15s ease;
flex: none;
}
.checkbox-box.checked {
border-color: var(--employee-primary, #e60012);
background: var(--employee-primary, #e60012);
}
.agreement-text {
color: #8c9098;
font-size: 12px;
line-height: 1.5;
text-align: center;
font-weight: 500;
line-height: 1.4;
}
@media (max-width: 375px) {
.login-shell {
padding-right: 32px;
padding-left: 32px;
}
.brand-name,
.brand-divider,
.login-eyebrow {
font-size: 17px;
}
.mentor-image {
width: 112px;
height: 114px;
}
.code-row {
grid-template-columns: minmax(0, 1fr) 80px;
gap: 10px;
padding-right: 20px;
padding-left: 20px;
}
.code-button {
width: 100%;
min-height: 56px;
width: 104px;
min-width: 104px;
flex-basis: 104px;
}
}
html[data-aihr-font-size='extra-large'] .code-row {
grid-template-columns: minmax(0, 1fr);
}
html[data-aihr-font-size='extra-large'] .code-button {
min-height: 52px;
font-size: 15px;
}
</style>