修复:将前端宽屏布局改为响应式
This commit is contained in:
@@ -4,13 +4,6 @@
|
|||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<BottomNav v-if="!isHiddenNav" />
|
<BottomNav v-if="!isHiddenNav" />
|
||||||
<div class="page-content" :class="{ 'no-nav-padding': isHiddenNav }">
|
<div class="page-content" :class="{ 'no-nav-padding': isHiddenNav }">
|
||||||
<div
|
|
||||||
class="page-renderer"
|
|
||||||
:class="{
|
|
||||||
'centered-user-shell': shouldCenterUserContent,
|
|
||||||
'admin-renderer': isAdminRoute
|
|
||||||
}"
|
|
||||||
>
|
|
||||||
<router-view v-slot="{ Component }">
|
<router-view v-slot="{ Component }">
|
||||||
<transition name="page-fade" mode="out-in">
|
<transition name="page-fade" mode="out-in">
|
||||||
<component :is="Component" :key="route.path" />
|
<component :is="Component" :key="route.path" />
|
||||||
@@ -18,7 +11,6 @@
|
|||||||
</router-view>
|
</router-view>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</ConfigProvider>
|
</ConfigProvider>
|
||||||
</el-config-provider>
|
</el-config-provider>
|
||||||
</template>
|
</template>
|
||||||
@@ -40,16 +32,6 @@ const isHiddenNav = computed(() => {
|
|||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
const isAdminRoute = computed(() => route.matched.some(r => r.meta.isAdmin))
|
|
||||||
|
|
||||||
const shouldCenterUserContent = computed(() => {
|
|
||||||
if (isAdminRoute.value) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return route.name !== 'auth' && route.name !== 'not-found'
|
|
||||||
})
|
|
||||||
|
|
||||||
// 全局购物车数量状态
|
// 全局购物车数量状态
|
||||||
const cartCount = ref(0)
|
const cartCount = ref(0)
|
||||||
|
|
||||||
@@ -116,16 +98,6 @@ loadCartCount()
|
|||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-renderer {
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page-renderer.centered-user-shell > * {
|
|
||||||
width: 100%;
|
|
||||||
max-width: var(--frontend-page-max-width);
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 当导航栏隐藏时,移除底部 padding */
|
/* 当导航栏隐藏时,移除底部 padding */
|
||||||
.page-content.no-nav-padding {
|
.page-content.no-nav-padding {
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
|
|||||||
@@ -113,9 +113,9 @@ const handleNavClick = (tab: string) => {
|
|||||||
.bottom-nav {
|
.bottom-nav {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 50%;
|
left: 0;
|
||||||
right: auto;
|
right: 0;
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
width: 100%;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
background: white;
|
background: white;
|
||||||
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.08);
|
||||||
@@ -126,7 +126,7 @@ const handleNavClick = (tab: string) => {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
backface-visibility: hidden;
|
backface-visibility: hidden;
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
transform: translateX(-50%) translateZ(0);
|
transform: translateZ(0);
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,6 +136,8 @@ const handleNavClick = (tab: string) => {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
max-width: 560px;
|
||||||
|
margin: 0 auto;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
--text-secondary: #999999;
|
--text-secondary: #999999;
|
||||||
--border-radius-base: 10px;
|
--border-radius-base: 10px;
|
||||||
--border-radius-large: 30px;
|
--border-radius-large: 30px;
|
||||||
--frontend-page-max-width: 480px;
|
--frontend-page-max-width: 1280px;
|
||||||
|
--frontend-content-max-width: 1120px;
|
||||||
--admin-content-max-width: 1440px;
|
--admin-content-max-width: 1440px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,7 +25,7 @@ body {
|
|||||||
|
|
||||||
.mobile-container {
|
.mobile-container {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
max-width: 375px;
|
max-width: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
background-color: var(--bg-color);
|
background-color: var(--bg-color);
|
||||||
@@ -32,7 +33,7 @@ body {
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.mobile-container {
|
.mobile-container {
|
||||||
max-width: var(--frontend-page-max-width);
|
max-width: var(--frontend-page-max-width);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,12 +121,11 @@ onMounted(loadOrders)
|
|||||||
.line { margin-top: 4px; color: #666; font-size: 13px; }
|
.line { margin-top: 4px; color: #666; font-size: 13px; }
|
||||||
.appointment { color: #1890ff; }
|
.appointment { color: #1890ff; }
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header {
|
.content {
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
max-width: 980px;
|
||||||
left: 50%;
|
margin: 0 auto;
|
||||||
right: auto;
|
padding: 24px;
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -540,13 +540,11 @@ onMounted(async () => {
|
|||||||
.artist-option img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
|
.artist-option img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
|
||||||
.time-picker { border-radius: 8px; }
|
.time-picker { border-radius: 8px; }
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header,
|
.content {
|
||||||
.footer {
|
max-width: 980px;
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
margin: 0 auto;
|
||||||
left: 50%;
|
padding: 24px 24px 140px;
|
||||||
right: auto;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -284,12 +284,11 @@ onMounted(() => {
|
|||||||
color: #ff4d4f;
|
color: #ff4d4f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header {
|
.coupon-section {
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
max-width: 960px;
|
||||||
left: 50%;
|
margin: 0 auto;
|
||||||
right: auto;
|
padding: 24px;
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -457,7 +457,6 @@ const handleProductClick = (item: any) => {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
border-radius: 16px;
|
border-radius: 16px;
|
||||||
object-fit: stretch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 轮播指示器样式 */
|
/* 轮播指示器样式 */
|
||||||
@@ -681,4 +680,38 @@ const handleProductClick = (item: any) => {
|
|||||||
color: #999;
|
color: #999;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media (min-width: 992px) {
|
||||||
|
.header,
|
||||||
|
.search-section,
|
||||||
|
.section {
|
||||||
|
max-width: var(--frontend-content-max-width);
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-container {
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.banner-carousel {
|
||||||
|
aspect-ratio: 16 / 6;
|
||||||
|
max-height: 340px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.horizontal-scroll {
|
||||||
|
overflow: visible;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-card {
|
||||||
|
flex: 1 1 calc(25% - 12px);
|
||||||
|
width: calc(25% - 12px);
|
||||||
|
min-width: 180px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-grid {
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -120,12 +120,11 @@ onMounted(loadOrders)
|
|||||||
.line { margin-top: 4px; color: #666; font-size: 13px; }
|
.line { margin-top: 4px; color: #666; font-size: 13px; }
|
||||||
.appointment { color: #1890ff; }
|
.appointment { color: #1890ff; }
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header {
|
.content {
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
max-width: 980px;
|
||||||
left: 50%;
|
margin: 0 auto;
|
||||||
right: auto;
|
padding: 24px;
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -561,12 +561,20 @@ onMounted(() => {
|
|||||||
border-radius: 22px;
|
border-radius: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.action-buttons {
|
.product-image-container,
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
.product-info {
|
||||||
left: 50%;
|
max-width: 1040px;
|
||||||
right: auto;
|
margin: 0 auto;
|
||||||
transform: translateX(-50%);
|
}
|
||||||
|
|
||||||
|
.product-image-container {
|
||||||
|
padding: 28px 28px 18px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-info {
|
||||||
|
margin-top: 0;
|
||||||
|
padding: 24px 28px 96px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -569,12 +569,29 @@ onMounted(async () => {
|
|||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header {
|
.main-content {
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
min-height: calc(100vh - 60px);
|
||||||
left: 50%;
|
height: auto;
|
||||||
right: auto;
|
}
|
||||||
transform: translateX(-50%);
|
|
||||||
|
.category-sidebar {
|
||||||
|
width: 128px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-section {
|
||||||
|
padding: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.product-grid {
|
||||||
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 1280px) {
|
||||||
|
.product-grid {
|
||||||
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1028,13 +1028,19 @@ const loadWishlistCount = async () => {
|
|||||||
color: #8b8b9a;
|
color: #8b8b9a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header-bg,
|
.profile-info,
|
||||||
.header {
|
.stats-section,
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
.menu-section,
|
||||||
left: 50%;
|
.logout-section,
|
||||||
right: auto;
|
.content-card {
|
||||||
transform: translateX(-50%);
|
max-width: 1040px;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-card {
|
||||||
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -387,13 +387,11 @@ onMounted(() => {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
@media (min-width: 992px) {
|
||||||
.header-bg,
|
.shop-content {
|
||||||
.header {
|
max-width: 1040px;
|
||||||
width: min(100%, var(--frontend-page-max-width));
|
margin: 0 auto;
|
||||||
left: 50%;
|
padding: 100px 24px 24px;
|
||||||
right: auto;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# 2026-03-24 Frontend 宽屏适配改为响应式布局
|
||||||
|
|
||||||
|
## 本次目标
|
||||||
|
|
||||||
|
修正上一轮电脑端宽屏适配过于“窄框居中”的问题,改为正常的响应式桌面布局:页面背景仍保持自然铺满,主要内容在宽屏下限制合理最大宽度,并按桌面断点优化排版比例。
|
||||||
|
|
||||||
|
## 主要改动
|
||||||
|
|
||||||
|
- 撤回 `App.vue` 中前台页面的统一窄壳包裹逻辑,不再把用户端页面做成居中的窄列
|
||||||
|
- 将前台全局最大宽度调整为更自然的桌面宽度 `1280px`
|
||||||
|
- 新增前台内容区变量 `1120px`,用于首页等页面的主要内容收口
|
||||||
|
- 底部导航恢复为全宽底栏,只把导航项内容居中,不再形成悬浮窄条
|
||||||
|
- 首页改为真正的桌面响应式:
|
||||||
|
- 头部、搜索区、内容区在宽屏下收口
|
||||||
|
- Banner 调整为更适合桌面的宽屏比例
|
||||||
|
- 修正 Banner 图片被拉伸的问题
|
||||||
|
- 精选作品区支持宽屏换行展示
|
||||||
|
- 热门作品区宽屏下增加列数
|
||||||
|
- 作品列表页在宽屏下增加分类栏宽度,并将作品网格扩展为 3 到 4 列
|
||||||
|
- 购物车、订单、优惠券、店铺详情、作品详情、个人中心等页面在宽屏下增加独立内容最大宽度,但不再把固定头部硬性缩成窄条
|
||||||
|
|
||||||
|
## 涉及文件
|
||||||
|
|
||||||
|
- [App.vue](/E:/code/xiaowang/Frontend/src/App.vue)
|
||||||
|
- [style.css](/E:/code/xiaowang/Frontend/src/style.css)
|
||||||
|
- [BottomNav.vue](/E:/code/xiaowang/Frontend/src/components/BottomNav.vue)
|
||||||
|
- [HomeView.vue](/E:/code/xiaowang/Frontend/src/views/HomeView.vue)
|
||||||
|
- [ProductListView.vue](/E:/code/xiaowang/Frontend/src/views/ProductListView.vue)
|
||||||
|
- [CouponView.vue](/E:/code/xiaowang/Frontend/src/views/CouponView.vue)
|
||||||
|
- [ProfileView.vue](/E:/code/xiaowang/Frontend/src/views/ProfileView.vue)
|
||||||
|
- [CartView.vue](/E:/code/xiaowang/Frontend/src/views/CartView.vue)
|
||||||
|
- [ShopDetailView.vue](/E:/code/xiaowang/Frontend/src/views/ShopDetailView.vue)
|
||||||
|
- [ProductDetailView.vue](/E:/code/xiaowang/Frontend/src/views/ProductDetailView.vue)
|
||||||
|
- [OrderView.vue](/E:/code/xiaowang/Frontend/src/views/OrderView.vue)
|
||||||
|
- [ArtistOrderView.vue](/E:/code/xiaowang/Frontend/src/views/ArtistOrderView.vue)
|
||||||
|
|
||||||
|
## 验证情况
|
||||||
|
|
||||||
|
- 执行前端构建:`npm run build`
|
||||||
|
- 构建结果通过
|
||||||
|
- 本次无 SQL 变更
|
||||||
|
|
||||||
|
## 说明
|
||||||
|
|
||||||
|
- 本轮重点是把“电脑端最大宽度控制”改成“正常响应式桌面布局”,避免出现假手机框、窄条头部、底部导航悬浮过窄等问题
|
||||||
|
- 后台 `AdminLayout` 的宽屏内容壳保留不变
|
||||||
Reference in New Issue
Block a user