From a241484705a7c3d974eefd04ffab772aed140e9a Mon Sep 17 00:00:00 2001 From: hantao Date: Thu, 3 Jul 2025 18:33:25 +0800 Subject: [PATCH] filter --- pages/index/index.js | 1 + pages/index/index.wxss | 57 +++++++++++++++++++++++++++++++------ project.private.config.json | 2 +- utils/request.js | 4 ++- 4 files changed, 54 insertions(+), 10 deletions(-) diff --git a/pages/index/index.js b/pages/index/index.js index df2d634..53b8db1 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,6 +1,7 @@ const request = require('../../utils/request'); Page({ data: { + bannerList: [ 'http://192.168.1.11:8089/uploads/20250630/054c53776891b766c6f1bd65059a5b27.jpg', 'http://192.168.1.11:8089/uploads/20250630/c7f45ec56c19eac42a23c5e987cacc93.jpg' diff --git a/pages/index/index.wxss b/pages/index/index.wxss index 26f4183..63d948b 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -62,29 +62,51 @@ page { .company-actions { display: flex; - gap: 16rpx; + gap: 12rpx; + width: 100%; + text-align: center; } .company-actions .van-button { flex: 1; - background: rgba(255, 255, 255, 0.15); - border: 2rpx solid rgba(255, 255, 255, 0.3); + min-width: 0; /* 允许按钮缩小 */ + + max-width: calc(50% - 6rpx); /* 确保不超过一半宽度 */ + background: rgba(255, 255, 255, 0.15) !important; + border: 2rpx solid rgba(255, 255, 255, 0.3) !important; color: #ffffff !important; backdrop-filter: blur(10rpx); - border-radius: 16rpx; - font-weight: 500; + border-radius: 16rpx !important; + font-weight: 500 !important; + font-size: 26rpx !important; + padding: 12rpx 8rpx !important; + height: auto !important; + line-height: 1.2 !important; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + box-sizing: border-box; } .company-actions .van-button:hover { - background: rgba(255, 255, 255, 0.25); + background: rgba(255, 255, 255, 0.25) !important; +} + +/* 按钮内容样式调整 */ +.company-actions .van-button .van-button__text { + font-size: 26rpx !important; + color: #ffffff !important; +} + +.company-actions .van-button .van-icon { + font-size: 28rpx !important; + margin-right: 6rpx !important; } /* 筛选栏样式 */ .sticky-filter { background: #ffffff; box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.08); - border-radius: 24rpx 24rpx 0 0; - margin: 0 24rpx; overflow: hidden; position: sticky; top: 0; @@ -326,6 +348,12 @@ page { @media (max-width: 750rpx) { .company-actions { flex-direction: column; + gap: 8rpx; + } + + .company-actions .van-button { + max-width: 100%; + min-height: 64rpx; } .filter-tags { @@ -339,6 +367,19 @@ page { } } +/* 更小屏幕的额外优化 */ +@media (max-width: 600rpx) { + .company-actions .van-button { + font-size: 24rpx !important; + padding: 10rpx 6rpx !important; + } + + .company-actions .van-button .van-icon { + font-size: 24rpx !important; + margin-right: 4rpx !important; + } +} + /* 动画效果 */ @keyframes fadeInUp { from { diff --git a/project.private.config.json b/project.private.config.json index 3a36956..2552ad5 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -3,7 +3,7 @@ "projectname": "car_front", "setting": { "compileHotReLoad": true, - "urlCheck": false, + "urlCheck": true, "coverView": true, "lazyloadPlaceholderEnable": false, "skylineRenderEnable": false, diff --git a/utils/request.js b/utils/request.js index f044fd0..069916d 100644 --- a/utils/request.js +++ b/utils/request.js @@ -1,4 +1,4 @@ -const BASE_URL = 'http://127.0.0.1:8089/'; // 👈 换成你的后端地址 +const BASE_URL = 'https://car.cherrybless.com'; // 👈 换成你的后端地址 function request({ url, method = 'GET', data = {}, header = {} }) { const token = ''; @@ -10,6 +10,7 @@ function request({ url, method = 'GET', data = {}, header = {} }) { data, header: { 'Content-Type': 'application/json', + 'Accept': 'application/json', 'Authorization': token ? `Bearer ${token}` : '', ...header }, @@ -23,6 +24,7 @@ function request({ url, method = 'GET', data = {}, header = {} }) { } }, fail(err) { + console.log(err) wx.showToast({ title: '网络错误', icon: 'none' }); reject(err); }