feat: 更新登录页面与API逻辑

This commit is contained in:
pikachu1995@126.com
2026-07-06 15:59:14 +08:00
parent 235362d5b0
commit e13ca6281d
3 changed files with 335 additions and 123 deletions

View File

@@ -21,9 +21,9 @@ export const postVerifyImg = (params) => {
};
// 获取系统基础信息
// 获取系统基础信息(登录页等场景无需 token
export const getBaseSite = () => {
return getRequest(`${commonUrl}/common/common/site`);
return getRequestWithNoToken(`${commonUrl}/common/common/site`);
};
// 上传文件

View File

@@ -1,9 +1,28 @@
<template>
<div class="login" @click="$refs.verify.show = false">
<el-row class="flex" @keyup.enter="submitLogin">
<el-col style="width: 368px">
<div class="login-brand">
<div class="brand-inner">
<p class="brand-name">LILISHOP</p>
<h1 class="brand-title">企业级电商运营管理平台</h1>
<p class="brand-desc">为平台运营团队提供稳定高效可扩展的管理能力</p>
<ul class="brand-features">
<li>全渠道订单与售后协同处理</li>
<li>商品营销会员一体化运营</li>
<li>多店铺管理与经营数据分析</li>
</ul>
</div>
<p class="brand-copyright">Copyright © {{ year }} Lilishop</p>
</div>
<div class="login-panel" @keyup.enter="submitLogin">
<div class="login-wrap">
<Header />
<el-row style="flex-direction: column">
<div class="login-intro">
<h2 class="login-title">账号登录</h2>
<p class="login-subtitle">请使用管理员账号登录运营后台</p>
</div>
<el-form
ref="usernameLoginForm"
:model="form"
@@ -39,20 +58,17 @@
</el-form-item>
</el-form>
<el-row>
<el-button
class="login-btn"
type="primary"
size="large"
:loading="loading"
style="width: 100%"
@click="submitLogin"
>
<span v-if="!loading">{{ $t("login") }}</span>
<span v-else>{{ $t("logining") }}</span>
</el-button>
</el-row>
</el-row>
<verify
ref="verify"
class="verify-con"
@@ -60,8 +76,8 @@
@change="verifyChange"
/>
<Footer />
</el-col>
</el-row>
</div>
</div>
</div>
</template>
@@ -84,6 +100,7 @@ export default {
},
data() {
return {
year: new Date().getFullYear(),
loading: false,
form: {
username: "",
@@ -152,28 +169,172 @@ export default {
<style lang="scss" scoped>
.login {
display: flex;
min-height: 100vh;
width: 100%;
box-sizing: border-box;
background-color: #fff;
background-image: url("../assets/background.png");
background-repeat: no-repeat;
background-position: center bottom;
background-size: cover;
background: #fff;
}
.login-brand {
position: relative;
flex: 0 0 46%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 56px 64px;
color: #fff;
background: linear-gradient(160deg, #1b2a41 0%, #243a5c 52%, #1a2f4d 100%);
overflow: hidden;
&::before {
content: "";
position: absolute;
inset: 0;
background:
radial-gradient(circle at 18% 22%, rgba($theme_color, 0.22), transparent 36%),
radial-gradient(circle at 82% 78%, rgba(255, 255, 255, 0.08), transparent 30%);
pointer-events: none;
}
&::after {
content: "";
position: absolute;
left: 0;
top: 0;
width: 4px;
height: 100%;
background: linear-gradient(180deg, $theme_color 0%, $warning_color 100%);
}
.brand-inner {
position: relative;
z-index: 1;
max-width: 460px;
margin-top: 8vh;
}
.brand-name {
margin: 0 0 18px;
font-size: 14px;
font-weight: 600;
letter-spacing: 4px;
color: rgba(255, 255, 255, 0.72);
}
.brand-title {
margin: 0;
font-size: 34px;
line-height: 1.35;
font-weight: 600;
letter-spacing: 1px;
}
.brand-desc {
margin: 18px 0 0;
font-size: 15px;
line-height: 1.7;
color: rgba(255, 255, 255, 0.72);
}
.brand-features {
margin: 36px 0 0;
padding: 0;
list-style: none;
li {
position: relative;
padding-left: 18px;
margin-bottom: 14px;
font-size: 14px;
line-height: 1.6;
color: rgba(255, 255, 255, 0.86);
&::before {
content: "";
position: absolute;
left: 0;
top: 9px;
width: 6px;
height: 6px;
border-radius: 50%;
background: $theme_color;
}
}
}
.brand-copyright {
position: relative;
z-index: 1;
margin: 0;
font-size: 13px;
color: rgba(255, 255, 255, 0.45);
}
}
.login-panel {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 48px 32px;
background: #f7f9fc;
}
:deep(.el-input__wrapper) {
.login-wrap {
position: relative;
width: 400px;
padding: 40px 42px 32px;
background: #fff;
border: 1px solid #e8edf3;
border-radius: 12px;
box-shadow: 0 12px 32px rgba(31, 45, 61, 0.06);
}
:deep(.header) {
margin-bottom: 0;
justify-content: flex-start !important;
}
:deep(.logo) {
width: 168px !important;
height: auto !important;
}
.login-intro {
margin: 28px 0 32px;
.login-title {
margin: 0;
font-size: 24px;
font-weight: 600;
color: #1f2329;
}
.login-subtitle {
margin: 10px 0 0;
font-size: 14px;
color: #8a9199;
}
}
:deep(.el-input__wrapper) {
background-color: #fff !important;
box-shadow: 0 0 0 1px var(--el-border-color) inset !important;
box-shadow: 0 0 0 1px #dce3eb inset !important;
border-radius: 8px;
padding: 4px 14px;
transition: box-shadow 0.2s ease;
&.is-focus {
box-shadow: 0 0 0 1px var(--el-border-color) inset !important;
}
box-shadow: 0 0 0 1px $theme_color inset,
0 0 0 3px rgba($theme_color, 0.12) !important;
}
}
:deep(.el-input__inner) {
:deep(.el-input__prefix) {
color: #a0a7b0;
}
:deep(.el-input__inner) {
background-color: transparent !important;
&:-webkit-autofill,
@@ -186,28 +347,91 @@ export default {
caret-color: #606266;
transition: background-color 99999s ease-out;
}
}
}
.verify-con {
:deep(.el-form-item) {
margin-bottom: 22px;
}
.verify-con {
position: absolute;
top: 150px;
z-index: 10;
left: 20px;
}
.form {
padding-top: 2px;
}
.login-btn {
width: 100%;
height: 44px;
margin-top: 4px;
border: none;
border-radius: 8px;
font-size: 15px;
letter-spacing: 2px;
background: $theme_color;
box-shadow: none;
transition: background-color 0.2s ease, opacity 0.2s ease;
&:hover {
background: darken($theme_color, 4%);
opacity: 1;
}
.form {
padding-top: 1vh;
}
:deep(.foot) {
position: static;
width: 100%;
margin-top: 28px;
color: #9aa3ad;
}
:deep(.foot .item),
:deep(.foot .href) {
color: #9aa3ad !important;
}
:deep(.foot .item:hover) {
color: #6b7280 !important;
}
@media (max-width: 992px) {
.login {
flex-direction: column;
}
.login-btn {
background: linear-gradient(135deg, $theme_color 0%, $warning_color 100%);
height: 40px;
border: none;
.login-brand {
flex: none;
padding: 36px 28px 28px;
.brand-inner {
margin-top: 0;
}
.login-btn:hover {
opacity: 0.9;
.brand-title {
font-size: 26px;
}
.brand-features {
margin-top: 24px;
}
.brand-copyright {
display: none;
}
}
.login-panel {
padding: 24px 20px 40px;
}
.login-wrap {
width: 100%;
max-width: 400px;
padding: 32px 24px 24px;
}
}
.flex {
justify-content: center;
}
</style>

View File

@@ -1,7 +1,7 @@
<template>
<div>
<el-row class="header">
<img :src="domainLogo" class="logo" width="220px" />
<img v-if="domainLogo" :src="domainLogo" class="logo" width="220px" />
</el-row>
</div>
</template>
@@ -12,26 +12,12 @@ import { getBaseSite } from "@/api/common.js";
export default {
data() {
return {
domainLogo: require("@/assets/logo.png"),
domainLogo: "",
};
},
methods: {
init() {
if (
!localStorage.getItem("icon") ||
!localStorage.getItem("title") ||
!localStorage.getItem("icontitle_expiration_time")
) {
this.getSite();
} else if (new Date() > localStorage.getItem("icontitle_expiration_time")) {
this.getSite();
} else {
this.domainLogo = localStorage.getItem("icon");
this.applyFavicon(localStorage.getItem("icon"));
window.document.title = localStorage.getItem("title") + " - 运营后台";
}
},
applyFavicon(href) {
if (!href) return;
let link =
document.querySelector("link[rel*='icon']") ||
document.createElement("link");
@@ -46,20 +32,22 @@ export default {
const { domainLogo, domainIcon, siteName } = JSON.parse(
res.result.settingValue
);
this.domainLogo = domainLogo;
this.domainLogo = domainLogo || "";
const expirationTime = new Date().setHours(new Date().getHours() + 1);
localStorage.setItem("icontitle_expiration_time", expirationTime);
localStorage.setItem("icon", domainLogo);
localStorage.setItem("domainIcon", domainIcon);
localStorage.setItem("title", siteName);
localStorage.setItem("icon", domainLogo || "");
localStorage.setItem("domainIcon", domainIcon || "");
localStorage.setItem("title", siteName || "");
this.applyFavicon(domainIcon || domainLogo);
if (siteName) {
window.document.title = siteName + " - 运营后台";
}
}
});
},
},
mounted() {
this.init();
this.getSite();
},
};
</script>