diff --git a/app/common.php b/app/common.php index a1d1317..f722b12 100644 --- a/app/common.php +++ b/app/common.php @@ -754,11 +754,18 @@ function filterAndExtractWords(array $result) */ function highlightKeywords($title, $searchTitle) { + $originalTitle = $title; // 保存原始标题 + // 使用正则表达式来高亮所有关键词 foreach ($searchTitle as $keyword) { $title = preg_replace('/(' . preg_quote($keyword, '/') . ')/i', '$1', $title); } + // 如果有关键词被高亮,添加
标签 + if ($title !== $originalTitle) { + $title = '
' . $title . '
'; + } + return $title; } diff --git a/public/static/index/css/app.css b/public/static/index/css/app.css index a7798ca..e75faf7 100644 --- a/public/static/index/css/app.css +++ b/public/static/index/css/app.css @@ -477,8 +477,12 @@ a:hover { font-weight: bold; padding-right: 42px; padding-bottom: 4px; + color: var(--theme-theme); } -.listBox .left .list .item .title span{ +.listBox .left .list .item .title p{ + color: var(--theme-color); +} +.listBox .left .list .item .title p span{ color: var(--theme-theme); } .listBox .left .list .item .btns{ @@ -489,11 +493,11 @@ a:hover { .listBox .left .list .item .btns .btn{ position: relative; margin-right: 35px; - color: var(--theme-theme); - opacity: .95; cursor: pointer; display: inline-flex; align-items: center; + font-weight: 500; + color: var(--theme-color); } .listBox .left .list .item .btns .btn .iconfont{ font-size: 18px;