From 7d93c48a1ea0f9b8b17cd293664159807227e322 Mon Sep 17 00:00:00 2001
From: zzp <34701892@qq.com>
Date: Fri, 12 Sep 2025 09:57:38 +0800
Subject: [PATCH] =?UTF-8?q?refactor(=E6=90=9C=E7=B4=A2=E9=A1=B5=E9=9D=A2):?=
=?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E5=B8=83=E5=B1=80=E5=92=8C=E4=BA=A4=E4=BA=92=E9=80=BB=E8=BE=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
重构搜索页面样式,调整搜索框宽度和样式
添加搜索按钮并实现搜索确认功能
修改搜索结果为空时的显示样式
优化搜索结果跳转逻辑,增加登录判断
移除无用代码和注释
---
src/pages/sreachReq/index.vue | 166 ++++++++++++++++++++++++----------
1 file changed, 118 insertions(+), 48 deletions(-)
diff --git a/src/pages/sreachReq/index.vue b/src/pages/sreachReq/index.vue
index 6cec609..c5ed0f4 100644
--- a/src/pages/sreachReq/index.vue
+++ b/src/pages/sreachReq/index.vue
@@ -1,64 +1,66 @@
+
+
+
-
-
-
-
-
+
+ :border="false" />
+ 搜索
-
+
- 加载更多
+
-
+
+
+
-
+
-
+
@@ -82,6 +84,13 @@ function goBack() {
uni.navigateBack();
}
+// 导航栏路由返回
+const handleBack = () => {
+ uni.navigateBack({
+ delta: 1,
+ });
+};
+
// login 弹框是否显示
const LoginShow = ref(false);
@@ -99,6 +108,7 @@ const handleSub = async () => {
if (item.type === itemType) {
item.needpay = false;
}
+
return item;
});
articleList.value = articleResult;
@@ -140,14 +150,23 @@ const handleShowPay = (type) => {
// 点击轮播图进入详情
const handleSwiperJump = (item: any) => {
console.log("item ===>", item);
- if (item.needpay) {
- // 需要先弹出订阅的弹框
- handleShowPay(item.type);
+ if (uni.getStorageSync("token")) {
+ uni.navigateTo({
+ url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`,
+ });
} else {
uni.navigateTo({
- url: `/pages/detail/index?id=${item.id}&type=${item.type}`,
+ url: "/pages/login/indexMini",
});
}
+ // if (item.needpay) {
+ // // 需要先弹出订阅的弹框
+ // handleShowPay(item.type);
+ // } else {
+ // uni.navigateTo({
+ // url: `/pages/detail/indexNewsInfo?id=${item.id}&type=${item.type}`,
+ // });
+ // }
};
const handleChange = (val: string) => {
@@ -188,16 +207,14 @@ const getData = async () => {
screenResult = res.data.filter((item) => {
item.newType = "search";
item.time = formatTimestamp(item.time);
- item.MarkInRedTitle = item.title.replace(
- new RegExp(inputValue.value, "gi"),
- `$&`
- );
+ item.MarkInRedTitle = item.title.replace(new RegExp(inputValue.value, "gi"), `$&`);
+
+ item.title = item.title.replace(keyWord.value, '' + keyWord.value + "");
+ console.log("🚀 ~ getData ~ item.title :", item.title);
+
item.MarkInRedContent =
item.contentText &&
- extractText(item.contentText, inputValue.value).replace(
- new RegExp(inputValue.value, "gi"),
- `$&`
- );
+ extractText(item.contentText, inputValue.value).replace(new RegExp(inputValue.value, "gi"), `$&`);
return item;
});
if (screenList.value.length > 0) {
@@ -223,7 +240,7 @@ onShow(() => {
.sreachcss {
min-height: 100vh;
background-color: #ffffff;
- padding: 0 30rpx;
+ // padding: 0 30rpx;
.sreach {
display: flex;
@@ -244,6 +261,11 @@ onShow(() => {
height: 70%;
border-radius: 20rpx;
padding: 0 20rpx;
+ border-radius: 100rpx;
+ }
+
+ :deep(.u-input) {
+ background-color: rgba(118, 118, 128, 0.12);
}
.tabsListContainer {
@@ -260,11 +282,13 @@ onShow(() => {
align-items: center;
box-sizing: border-box;
padding: 21rpx 0;
+
.line {
width: 69rpx;
height: 3rpx;
background-color: #b9b9b9;
}
+
.text {
padding: 0 10rpx;
}
@@ -282,4 +306,50 @@ onShow(() => {
color: #828b92;
}
}
+
+.custom-bav-bar {
+ width: 100%;
+ height: 88rpx;
+ background-color: #fff;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ position: relative;
+
+ .back_icon {
+ width: 40rpx;
+ height: 40rpx;
+ }
+
+ .logo_icon {
+ width: 168rpx;
+ height: 40rpx;
+ margin-right: 6rpx;
+ }
+
+ .left {
+ position: absolute;
+ top: 24rpx;
+ left: 40rpx;
+ }
+
+ .center {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ // font-size: 28rpx;
+ font-size: var(--h2-font-size);
+ color: #333;
+ }
+}
+
+.serach_btn {
+ font-family: PingFangSC, PingFang SC;
+ font-weight: bold;
+ font-size: 32rpx;
+ color: #d13e3c;
+ line-height: 45rpx;
+ text-align: right;
+ font-style: normal;
+}