feat: 实现响应式布局优化,适配移动端设备

- 修改主页和其他页面的宽度为百分比布局,添加最大宽度限制
- 增加媒体查询规则,针对不同屏幕尺寸调整布局和样式
- 优化导航栏、卡片和列表在移动端的显示效果
- 添加滚动条隐藏样式,提升移动端用户体验
This commit is contained in:
DESKTOP-RQ919RC\Pc
2025-12-25 19:09:30 +08:00
parent acafc9792a
commit 82e67b2a0b
6 changed files with 1254 additions and 10 deletions

View File

@@ -1,6 +1,9 @@
#homepage-me {
width: 1200px;
width: 100%;
max-width: 1200px;
margin: 0 auto;
box-sizing: border-box;
padding: 0 10px;
.matter {
align-items: flex-start;
@@ -18,7 +21,7 @@
margin-right: 20px;
position: sticky;
top: 10px;
.avatar-box {
position: relative;
margin-bottom: 20px;
@@ -29,6 +32,8 @@
border-radius: 8px;
}
.pen-box {
width: 24px;
height: 24px;
@@ -347,7 +352,8 @@
}
.list-area {
width: 860px;
width: 100%;
box-sizing: border-box;
background-color: rgba(255, 255, 255, 1);
border: 1px solid rgba(233, 238, 242, 1);
border-radius: 10px;
@@ -394,6 +400,16 @@
padding-bottom: 23px;
padding-left: 95px;
padding-right: 40px;
overflow-x: auto;
justify-content: flex-start;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar {
display: none;
}
scrollbar-width: none;
.item {
width: 50px;
height: 32px;
@@ -472,3 +488,182 @@
}
}
}
/* 响应式布局优化 */
@media screen and (max-width: 880px) {
.head-top {
margin: 10px auto 15px !important;
}
.head-navigation {
display: none !important;
}
#homepage-me {
width: 100%;
padding: 0;
.matter {
flex-direction: column;
align-items: stretch;
.card-user {
width: auto;
margin: 0 0 15px 0;
padding: 30px 20px;
position: static;
align-items: center;
border-radius: 0;
border-left: none;
border-right: none;
.avatar-box {
margin-bottom: 15px;
.pen-box {
right: 50%;
margin-right: -60px;
}
}
.name-area {
text-align: center;
margin-bottom: 25px;
}
.bi-box {
margin-bottom: 25px;
}
.medal-area {
margin: 0;
align-self: center;
.list {
justify-content: center;
}
}
}
.matter-content {
width: 100%;
.message-box {
width: auto;
margin: 0 0 15px 0;
padding: 20px;
border-radius: 0;
border-left: none;
border-right: none;
.header {
padding-top: 0;
text-align: center;
.avatar { display: none; }
.username { font-size: 16px; font-weight: 600; }
}
.info-list {
padding-top: 15px;
.item {
width: 50%;
padding-right: 10px;
box-sizing: border-box;
}
}
.tags {
justify-content: center;
}
}
.list-area {
border-radius: 0;
border-left: none;
border-right: none;
.operation-box {
padding: 15px 20px;
overflow-x: auto;
white-space: nowrap;
display: flex;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar { display: none; }
scrollbar-width: none;
.operation-item {
flex-shrink: 0;
&:not(:last-child) { margin-right: 30px; }
}
}
.classify {
padding: 10px 20px 20px;
overflow-x: auto;
white-space: nowrap;
display: flex;
justify-content: flex-start;
-webkit-overflow-scrolling: touch;
&::-webkit-scrollbar { display: none; }
scrollbar-width: none;
.item {
flex-shrink: 0;
width: auto;
padding: 0 15px;
}
}
.issue-data {
padding: 0 20px 15px;
}
.list-box {
padding: 0 20px;
}
.empty {
width: auto;
height: auto;
min-height: 200px;
margin: 20px;
padding: 40px 0;
.empty-icon {
width: 60px;
height: 60px;
}
}
.load-more {
margin-bottom: 30px;
}
}
}
}
}
}
@media screen and (max-width: 480px) {
#homepage-me .matter {
.card-user {
.bi-box {
width: 100%;
max-width: 320px;
.bi-masking { width: 100%; background-size: 100% 100%; }
}
}
.matter-content {
.message-box {
.info-list {
.item {
width: 100%;
margin-bottom: 12px;
justify-content: space-between;
.label { width: auto; }
}
}
}
}
}
}