feat: improve login and express company management

This commit is contained in:
wushumin
2026-05-27 11:29:22 +08:00
parent 231c26bd32
commit 4cadf1298b
4 changed files with 551 additions and 269 deletions

View File

@@ -3,7 +3,8 @@
{
"path": "pages/auth/login",
"style": {
"navigationBarTitleText": "登录"
"navigationBarTitleText": "登录",
"navigationStyle": "custom"
}
},
{

View File

@@ -29,6 +29,7 @@ const wechatMessage = ref("");
const countdown = ref(0);
const redirect = ref("");
const sendCodeErrorMessage = ref("");
const agreementAccepted = ref(false);
const appraisalStore = useAppraisalStore();
const form = reactive({
@@ -39,17 +40,20 @@ const form = reactive({
let countdownTimer: ReturnType<typeof setInterval> | null = null;
const browserHint = computed(() =>
isWechatBrowser()
? "微信内将自动使用公众号授权登录;授权失败时也可继续用手机号登录。"
: "当前为非微信浏览器环境,可直接使用手机号验证码或密码登录。",
);
const sendButtonText = computed(() => (countdown.value > 0 ? `${countdown.value}s 后重发` : "发送验证码"));
const countdownHint = computed(() =>
countdown.value > 0 ? `${countdown.value} 秒后可重新发送验证码` : "验证码有效期 5 分钟,请注意查收短信。",
);
function openAgreement(keyword: "privacy" | "service") {
const query = encodeURIComponent(keyword === "privacy" ? "隐私政策" : "服务协议");
uni.navigateTo({ url: `/pages/help/index?q=${query}` });
}
function toggleAgreement() {
agreementAccepted.value = !agreementAccepted.value;
}
function resolveSendCodeError(error: unknown) {
const message = error instanceof Error ? error.message : String(error || "");
@@ -139,10 +143,6 @@ function validateMobile() {
return true;
}
function goHome() {
uni.reLaunch({ url: "/pages/home/index" });
}
function currentQueryValue(key: string) {
// #ifdef H5
const url = new URL(window.location.href);
@@ -303,6 +303,10 @@ async function handleSendCode() {
async function handleSubmit() {
if (submitting.value) return;
if (!agreementAccepted.value) {
showInfoToast("请先阅读并同意隐私权政策和用户协议");
return;
}
if (!validateMobile()) return;
submitting.value = true;
@@ -361,379 +365,430 @@ onUnmounted(clearCountdown);
<template>
<view class="auth-page">
<view class="auth-backdrop auth-backdrop--gold"></view>
<view class="auth-backdrop auth-backdrop--mist"></view>
<view class="auth-shell">
<view class="auth-hero">
<view class="auth-brand-row">
<view class="auth-brand-mark"></view>
<view>
<view class="auth-brand-title">安心验</view>
<view class="auth-brand-subtitle">独立第三方奢侈品鉴定平台</view>
</view>
<view class="auth-visual">
<view class="auth-visual__shade"></view>
<view class="auth-brand">
<view class="auth-brand__name">
<text class="auth-brand__emblem"></text>
<text>心验</text>
<text class="auth-brand__registered">®</text>
</view>
<view class="auth-brand__subtitle">鉴真守正 · 安心之选</view>
</view>
</view>
<view class="auth-title">手机号登录</view>
<view class="auth-desc">{{ browserHint }}</view>
<view class="auth-feature-list">
<view class="auth-feature">订单进度自动同步</view>
<view class="auth-feature">报告与验真统一管理</view>
<view class="auth-feature">工单地址消息集中查看</view>
<view class="auth-panel">
<view class="auth-switch">
<view :class="['auth-switch__item', mode === 'code' ? 'auth-switch__item--active' : '']" @click="mode = 'code'">
验证码登录
</view>
<view :class="['auth-switch__item', mode === 'password' ? 'auth-switch__item--active' : '']" @click="mode = 'password'">
账号密码
</view>
</view>
<view class="auth-panel">
<view v-if="wechatProcessing || wechatMessage" class="auth-wechat-status">
<view class="auth-wechat-status__icon"></view>
<view>
<view class="auth-wechat-status__title">{{ wechatProcessing ? "微信授权登录" : "微信授权提示" }}</view>
<view class="auth-wechat-status__desc">{{ wechatMessage || "正在打开微信授权" }}</view>
<view v-if="wechatProcessing || wechatMessage" class="auth-wechat-status">
<view class="auth-wechat-status__icon"></view>
<view>
<view class="auth-wechat-status__title">{{ wechatProcessing ? "微信授权登录" : "微信授权提示" }}</view>
<view class="auth-wechat-status__desc">{{ wechatMessage || "正在打开微信授权" }}</view>
</view>
</view>
<view class="auth-form">
<view class="auth-field">
<view class="auth-input-wrap">
<input v-model="form.mobile" class="auth-input" maxlength="11" type="number" placeholder="请输入手机号" />
</view>
</view>
<view class="auth-switch">
<view :class="['auth-switch__item', mode === 'code' ? 'auth-switch__item--active' : '']" @click="mode = 'code'">
验证码登录
<view v-if="mode === 'code'" class="auth-field">
<view class="auth-input-wrap auth-code-field">
<input v-model="form.code" class="auth-input" maxlength="6" type="number" placeholder="请输入验证码" />
<view :class="['auth-code-btn', countdown > 0 || sending ? 'auth-code-btn--disabled' : '']" @click="handleSendCode">
{{ sending ? "发送中..." : sendButtonText }}
</view>
</view>
<view :class="['auth-switch__item', mode === 'password' ? 'auth-switch__item--active' : '']" @click="mode = 'password'">
账号密码登录
<view v-if="sendCodeErrorMessage" class="auth-error-banner">
{{ sendCodeErrorMessage }}
</view>
<view class="auth-field__hint auth-field__hint--countdown">{{ countdownHint }}</view>
</view>
<view class="auth-form">
<view class="auth-field">
<view class="auth-field__label">手机号</view>
<view class="auth-input-wrap">
<input v-model="form.mobile" class="auth-input" maxlength="11" type="number" placeholder="请输入登录手机号" />
</view>
</view>
<view v-if="mode === 'code'" class="auth-field">
<view class="auth-field__label">验证码</view>
<view class="auth-code-row">
<view class="auth-input-wrap auth-code-row__input">
<input v-model="form.code" class="auth-input" maxlength="6" type="number" placeholder="请输入 6 位验证码" />
</view>
<view :class="['auth-code-btn', countdown > 0 ? 'auth-code-btn--disabled' : '']" @click="handleSendCode">
{{ sending ? "发送中..." : sendButtonText }}
</view>
</view>
<view v-if="sendCodeErrorMessage" class="auth-error-banner">
{{ sendCodeErrorMessage }}
</view>
<view class="auth-field__hint auth-field__hint--countdown">{{ countdownHint }}</view>
</view>
<view v-else class="auth-field">
<view class="auth-field__label">登录密码</view>
<view class="auth-input-wrap">
<input v-model="form.password" class="auth-input" password placeholder="请输入登录密码" />
</view>
<view class="auth-field__hint">如果当前账号还未设置密码请先使用验证码登录后设置 - 登录与安全中设置密码</view>
<view v-else class="auth-field">
<view class="auth-input-wrap">
<input v-model="form.password" class="auth-input" password placeholder="请输入登录密码" />
</view>
<view class="auth-field__hint">未设置密码时请先使用验证码登录后到设置中创建密码</view>
</view>
</view>
<view class="auth-note">
登录后即可查看订单报告消息地址和售后工单扫码打开的公开报告页与验真页无需登录
</view>
<view :class="['auth-submit', submitting ? 'auth-submit--disabled' : '']" @click="handleSubmit">
{{ submitting ? "登录中..." : "登录" }}
</view>
<view class="auth-actions">
<view class="btn btn--secondary auth-actions__button" @click="goHome">返回首页</view>
<view :class="['btn', 'btn--primary', 'auth-actions__button', submitting ? 'btn--disabled' : '']" @click="handleSubmit">
{{ submitting ? "登录中..." : "立即登录" }}
</view>
<view class="auth-agreement" @click="toggleAgreement">
<view :class="['auth-agreement__check', agreementAccepted ? 'auth-agreement__check--active' : '']"></view>
<view class="auth-agreement__text">
登录及同意
<text class="auth-agreement__link" @click.stop="openAgreement('privacy')">隐私权政策</text>
<text class="auth-agreement__link" @click.stop="openAgreement('service')">用户协议</text>
</view>
</view>
</view>
<view class="auth-home-indicator"></view>
</view>
</template>
<style lang="scss" scoped>
.auth-page {
position: relative;
display: flex;
flex-direction: column;
min-height: 100vh;
overflow: hidden;
padding: 36rpx 28rpx 48rpx;
background: #f2f2f4;
}
.auth-backdrop {
display: none;
}
.auth-backdrop--gold {
top: -120rpx;
right: -60rpx;
width: 360rpx;
height: 360rpx;
background: radial-gradient(circle, rgba(237, 189, 0, 0.28), transparent 68%);
}
.auth-backdrop--mist {
left: -80rpx;
bottom: 140rpx;
width: 320rpx;
height: 320rpx;
background: radial-gradient(circle, rgba(21, 21, 21, 0.08), transparent 70%);
}
.auth-shell {
position: relative;
display: grid;
gap: 28rpx;
}
.auth-hero {
padding: 36rpx 34rpx;
border-radius: 16rpx;
background: #ffffff;
color: #252527;
border: 1px solid var(--card-border);
box-shadow: var(--shadow-sm);
color: #282a31;
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}
.auth-brand-row {
display: flex;
align-items: center;
gap: 18rpx;
.auth-page,
.auth-page view,
.auth-page text,
.auth-page input {
box-sizing: border-box;
}
.auth-brand-mark {
width: 78rpx;
height: 78rpx;
border-radius: 16rpx;
background: #edbd00;
color: #ffffff;
font-size: 36rpx;
font-weight: 700;
line-height: 78rpx;
text-align: center;
box-shadow: var(--shadow-sm);
}
.auth-brand-title {
font-size: 38rpx;
font-weight: 700;
line-height: 1.1;
}
.auth-brand-subtitle {
margin-top: 8rpx;
color: #777;
font-size: 22rpx;
line-height: 1.6;
}
.auth-title {
margin-top: 30rpx;
font-size: 52rpx;
font-weight: 800;
line-height: 1.08;
}
.auth-desc {
margin-top: 16rpx;
color: #666;
font-size: 28rpx;
line-height: 1.7;
}
.auth-feature-list {
display: grid;
gap: 14rpx;
margin-top: 28rpx;
}
.auth-feature {
.auth-visual {
position: relative;
padding-left: 26rpx;
color: #666;
font-size: 24rpx;
line-height: 1.7;
flex: 0 0 690rpx;
width: 100vw;
overflow: hidden;
background-image: url("../../static/home/home-reference.jpg");
background-size: 1400rpx auto;
background-position: center top;
background-repeat: no-repeat;
}
.auth-feature::before {
content: "";
.auth-visual__shade {
position: absolute;
left: 0;
top: 14rpx;
width: 10rpx;
height: 10rpx;
border-radius: 50%;
background: #edbd00;
inset: 0;
background:
linear-gradient(180deg, rgba(0, 0, 0, 0.18) 0%, rgba(8, 8, 9, 0.12) 42%, rgba(50, 22, 8, 0.5) 100%),
linear-gradient(90deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.02) 50%, rgba(0, 0, 0, 0.18));
}
.auth-brand {
position: absolute;
left: 50%;
top: calc(172rpx + env(safe-area-inset-top));
z-index: 1;
width: 520rpx;
transform: translateX(-50%);
color: #ffffff;
text-align: center;
text-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.34);
}
.auth-brand__name {
display: inline-flex;
align-items: flex-end;
justify-content: center;
color: #ffffff;
font-size: 66rpx;
font-weight: 900;
line-height: 1;
letter-spacing: 0;
}
.auth-brand__emblem {
display: inline-flex;
align-items: center;
justify-content: center;
width: 72rpx;
height: 72rpx;
margin-right: 6rpx;
border: 6rpx solid #ffffff;
border-radius: 10rpx 10rpx 20rpx 20rpx;
background: rgba(237, 189, 0, 0.94);
color: #ffffff;
font-size: 34rpx;
font-weight: 900;
line-height: 1;
text-shadow: none;
box-shadow: 0 8rpx 22rpx rgba(0, 0, 0, 0.24);
}
.auth-brand__registered {
align-self: flex-start;
margin-left: 4rpx;
font-size: 18rpx;
line-height: 1;
}
.auth-brand__subtitle {
margin-top: 18rpx;
color: rgba(255, 255, 255, 0.92);
font-size: 25rpx;
font-weight: 700;
line-height: 1.2;
}
.auth-panel {
padding: 30rpx 28rpx;
border: 1px solid var(--card-border);
border-radius: 16rpx;
position: relative;
z-index: 2;
flex: 1;
width: 100vw;
min-height: calc(100vh - 612rpx);
margin-top: -78rpx;
padding: 0 40rpx calc(58rpx + env(safe-area-inset-bottom));
border-radius: 34rpx 34rpx 0 0;
background: #ffffff;
box-shadow: var(--shadow-sm);
box-shadow: 0 -14rpx 34rpx rgba(0, 0, 0, 0.08);
}
.auth-wechat-status {
display: flex;
align-items: center;
gap: 18rpx;
margin-bottom: 22rpx;
padding: 20rpx 22rpx;
gap: 16rpx;
margin-top: 24rpx;
padding: 18rpx 20rpx;
border-radius: 16rpx;
background: #edf7f0;
border: 1px solid rgba(47, 107, 79, 0.14);
background: #eef8f1;
border: 1rpx solid rgba(47, 107, 79, 0.14);
}
.auth-wechat-status__icon {
width: 64rpx;
height: 64rpx;
border-radius: 16rpx;
flex-shrink: 0;
width: 58rpx;
height: 58rpx;
border-radius: 14rpx;
background: #2f6b4f;
color: #ffffff;
font-size: 26rpx;
font-weight: 700;
line-height: 64rpx;
font-size: 24rpx;
font-weight: 800;
line-height: 58rpx;
text-align: center;
flex-shrink: 0;
}
.auth-wechat-status__title {
color: #244f3b;
font-size: 26rpx;
font-weight: 700;
font-size: 24rpx;
font-weight: 800;
}
.auth-wechat-status__desc {
margin-top: 6rpx;
margin-top: 4rpx;
color: #4f7662;
font-size: 22rpx;
line-height: 1.6;
font-size: 21rpx;
line-height: 1.45;
}
.auth-switch {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 14rpx;
padding: 10rpx;
border-radius: 16rpx;
background: #f4f4f6;
gap: 0;
height: 78rpx;
border-radius: 34rpx 34rpx 0 0;
overflow: hidden;
}
.auth-switch__item {
min-height: 82rpx;
border-radius: 22rpx;
color: #666;
position: relative;
color: #8a8b8f;
font-size: 26rpx;
font-weight: 600;
line-height: 82rpx;
font-weight: 800;
line-height: 78rpx;
text-align: center;
}
.auth-switch__item--active {
background: #252527;
color: #ffffff;
box-shadow: var(--shadow-sm);
color: #2b2d33;
}
.auth-switch__item--active::after {
content: "";
position: absolute;
left: 50%;
bottom: 6rpx;
width: 30rpx;
height: 6rpx;
border-radius: 8rpx;
background: #edbd00;
transform: translateX(-50%);
}
.auth-form {
display: grid;
gap: 24rpx;
margin-top: 28rpx;
}
.auth-field__label {
margin-bottom: 12rpx;
color: #252527;
font-size: 24rpx;
font-weight: 600;
gap: 28rpx;
margin-top: 54rpx;
}
.auth-field__hint {
margin-top: 12rpx;
margin-top: 14rpx;
color: #777;
font-size: 22rpx;
line-height: 1.7;
line-height: 1.55;
}
.auth-field__hint--countdown {
color: #c89b00;
color: #b78f00;
}
.auth-error-banner {
margin-top: 14rpx;
padding: 18rpx 20rpx;
border-radius: 20rpx;
padding: 16rpx 18rpx;
border-radius: 14rpx;
background: rgba(159, 59, 50, 0.08);
border: 1px solid rgba(159, 59, 50, 0.16);
border: 1rpx solid rgba(159, 59, 50, 0.16);
color: #9f3b32;
font-size: 22rpx;
line-height: 1.7;
line-height: 1.55;
}
.auth-input-wrap {
display: flex;
align-items: center;
min-height: 92rpx;
width: 100%;
height: 72rpx;
padding: 0 24rpx;
border: 1px solid #ededf0;
border-radius: 16rpx;
background: #fff;
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
border-radius: 14rpx;
background: #f5f6f8;
border: 1rpx solid transparent;
}
.auth-input {
flex: 1;
width: 100%;
color: #252527;
font-size: 28rpx;
font-size: 27rpx;
font-weight: 700;
line-height: 72rpx;
}
.auth-code-row {
display: grid;
grid-template-columns: minmax(0, 1fr) 212rpx;
gap: 14rpx;
align-items: center;
.auth-input::placeholder {
color: #b4b7be;
font-weight: 500;
}
.auth-code-row__input {
min-width: 0;
.auth-code-field {
gap: 16rpx;
}
.auth-code-btn {
display: flex;
align-items: center;
justify-content: center;
min-height: 92rpx;
border-radius: 16rpx;
background: rgba(237, 189, 0, 0.12);
color: #c89b00;
font-size: 24rpx;
font-weight: 600;
border: 1px solid rgba(237, 189, 0, 0.24);
flex-shrink: 0;
min-width: 136rpx;
height: 48rpx;
padding: 0 18rpx;
border-radius: 12rpx;
background: #ffffff;
color: #edbd00;
font-size: 21rpx;
font-weight: 800;
line-height: 48rpx;
}
.auth-code-btn--disabled {
opacity: 0.52;
color: #b8a86a;
opacity: 0.7;
}
.auth-note {
margin-top: 26rpx;
padding: 22rpx 24rpx;
border-radius: 16rpx;
background: #f7f7f8;
color: #666;
font-size: 22rpx;
line-height: 1.8;
border: 1px solid rgba(228, 219, 200, 0.72);
.auth-submit {
display: flex;
align-items: center;
justify-content: center;
height: 68rpx;
margin-top: 58rpx;
border-radius: 14rpx;
background: #edbd00;
color: #ffffff;
font-size: 27rpx;
font-weight: 800;
line-height: 68rpx;
box-shadow: 0 10rpx 20rpx rgba(237, 189, 0, 0.22);
}
.auth-actions {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 16rpx;
margin-top: 28rpx;
.auth-submit--disabled {
opacity: 0.58;
box-shadow: none;
}
.auth-actions__button {
min-width: 0;
.auth-agreement {
display: flex;
align-items: flex-start;
justify-content: center;
gap: 9rpx;
margin-top: 164rpx;
padding: 0 8rpx;
}
.auth-agreement__check {
flex-shrink: 0;
width: 22rpx;
height: 22rpx;
margin-top: 4rpx;
border: 3rpx solid #edbd00;
border-radius: 50%;
background: #ffffff;
}
.auth-agreement__check--active {
border-width: 6rpx;
background: #ffffff;
box-shadow: inset 0 0 0 5rpx #edbd00;
}
.auth-agreement__text {
color: #a0a2a8;
font-size: 20rpx;
line-height: 1.45;
}
.auth-agreement__link {
color: #e0ad00;
font-weight: 700;
}
.auth-home-indicator {
position: fixed;
left: 50%;
bottom: calc(16rpx + env(safe-area-inset-bottom));
z-index: 3;
width: 216rpx;
height: 7rpx;
border-radius: 999rpx;
background: rgba(0, 0, 0, 0.86);
transform: translateX(-50%);
pointer-events: none;
}
@media (max-width: 360px) {
.auth-visual {
flex-basis: 650rpx;
}
.auth-panel {
min-height: calc(100vh - 578rpx);
margin-top: -72rpx;
padding-left: 32rpx;
padding-right: 32rpx;
}
.auth-form {
margin-top: 42rpx;
}
.auth-submit {
margin-top: 46rpx;
}
.auth-agreement {
margin-top: 116rpx;
}
}
</style>