api
tj
2025-05-29 05d1310a6ec27656712c0c5e5e57b3365d3faf56
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<template>
    <view class="search-page">
        <!-- 搜索框 -->
        <view class="search-bar">
            <up-search v-model="searchValue" placeholder="新疆本地小团" show-action @search="onSearch" />
        </view>
 
        <!-- 历史记录 -->
        <view class="section">
            <view class="section-title">
                <text>历史记录</text>
                <up-icon name="trash" size="20" @click="onClearHistory" class="delete-icon" />
 
            </view>
            <view class="tag-list">
                <up-tag v-for="(item, index) in historyTags" :key="index" plain size="mini" class="tag" shape="circle"
                    borderColor="#E9E9E9" color="#333333" textSize="20rpx">{{ item }}</up-tag>
            </view>
        </view>
 
        <!-- 猜你想搜 -->
        <view class="section">
            <view class="section-title">
                <text>猜你想搜</text>
                <view class="icon-list">
                    <up-icon name="reload" size="20" @click="onClearHistory" />
                    <up-icon name="more-dot-fill" size="20" @click="onClearHistory" />
                </view>
            </view>
            <view class="suggest-list">
                <view class="suggest-column">
                    <text v-for="(item, index) in guessList.filter((_, i) => i % 2 === 0)" :key="'left-' + index"
                        class="suggest">
                        {{ item }}
                    </text>
                </view>
                <view class="suggest-column">
                    <text v-for="(item, index) in guessList.filter((_, i) => i % 2 === 1)" :key="'right-' + index"
                        class="suggest">
                        {{ item }}
                    </text>
                </view>
            </view>
        </view>
 
        <!-- 热门榜单 -->
        <view class="section">
            <view class="section-title hot-title">
                🔥 热点
            </view>
            <view class="hot-list">
                <view v-for="(item, index) in hotList" :key="index" class="hot-item">
                    <view>
                        <text class="hot-index" :class="[
                            index === 0 ? 'gradient-red' :
                                index === 1 ? 'gradient-orange' :
                                    index === 2 ? 'gradient-yellow' : ''
                        ]">{{ index + 1 }}</text>
                        <text class="hot-text">{{ item.title }}</text>
                        <up-tag v-if="item.tag"
                            :type="item.tag === '热' ? 'error' : item.tag === '荐' ? 'warning' : 'primary'" size="mini"
                            class="tag">
                            {{ item.tag }}
                        </up-tag>
                    </view>
                    <text class="hot-views">{{ item.views }}</text>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script setup lang="ts">
import { ref } from 'vue'
import { onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app'
 
const searchValue = ref('')
 
const historyTags = ref<string[]>([
    '新疆靠谱旅行社', '重庆往返乌鲁木齐', '旅游行程安排文案', '旅游行程安排表'
])
 
 
const guessList = [
    '新疆本地小团', '旺旺就是朱旺旺离职',
    '新疆北疆路线攻略', '职称评审'
]
 
const hotList = [
    { title: '在最穷的时候遇上了最想买的皮肤', tag: '热', views: '922.3万' },
    { title: '陈奕迅辟谣去世传闻后首露面', views: '716万' },
    { title: '你不认识我们但一定见过我们画的猫', tag: '荐', views: '683.1万' },
    { title: '迪丽热巴 蓝玫瑰油画妆', tag: '热', views: '664.9万' },
    { title: '起猛了看到小狗的朋友圈了', views: '653万' },
    { title: '藏海传让我来演', tag: '荐', views: '652.9万' },
    { title: '郑晓龙拍戏 眼泪往上擦', tag: '热', views: '648万' },
    { title: '我的小红书被小乔包围了', tag: '独家', views: '612.3万' },
    { title: '小米15周年新品发布会', views: '605.5万' },
    { title: '你可能不认识汪 but 一定看过汪', tag: '荐', views: '603.5万' }
]
 
function onSearch(val: string) {
    console.log('搜索内容:', val)
}
 
function onClearHistory() {
    console.log('清除历史记录')
    // 这里可以清空 historyTags 或调用实际删除逻辑
    historyTags.value.length = 0
 
}
 
</script>
 
<style lang="scss" scoped>
.search-page {
    padding: 20rpx;
 
    .search-bar {
        margin-bottom: 20rpx;
    }
 
    .section {
        margin-top: 30rpx;
 
        .section-title {
            font-size: 28rpx;
            font-weight: bold;
            margin-bottom: 16rpx;
            display: flex;
            justify-content: space-between;
            align-items: center;
 
            .delete-icon {
                color: #999;
            }
 
            .icon-list {
                display: flex;
                gap: 10rpx;
            }
        }
 
        .hot-title {
            color: #f43f3b;
        }
 
        .tag-list {
            display: flex;
            flex-wrap: wrap;
            gap: 10rpx;
 
            .tag {
                padding: 6rpx 20rpx;
            }
        }
 
        .suggest-list {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            padding: 0 20rpx;
 
            .suggest-column {
                display: flex;
                flex-direction: column;
                gap: 20rpx; // 每行间距
 
                .suggest {
                    font-size: 28rpx;
                    color: #333;
                }
            }
        }
 
        .hot-list {
            .hot-item {
                display: flex;
                align-items: center;
                margin-bottom: 20rpx;
                justify-content: space-between;
 
 
                .hot-index {
                    font-size: 30rpx;
                    font-weight: bold;
                    width: 40rpx;
                }
 
                .hot-text {
                    font-weight: bold;
                    font-size: 28rpx;
                    margin-left: 10rpx;
                    max-width: 400rpx;
                    display: inline-block;
                    vertical-align: middle;
                    white-space: nowrap;
                    overflow: hidden;
                    text-overflow: ellipsis;
                }
 
                .gradient-red {
                    background: linear-gradient(to right, #f43f5e, #fb7185);
                    -webkit-background-clip: text;
                    color: transparent;
                }
 
                .gradient-orange {
                    background: linear-gradient(to right, #f97316, #facc15);
                    -webkit-background-clip: text;
                    color: transparent;
                }
 
                .gradient-yellow {
                    background: linear-gradient(to right, #fcd34d, #fde68a);
                    -webkit-background-clip: text;
                    color: transparent;
                }
 
                .tag {
                    margin-left: 10rpx;
                }
 
                .hot-views {
                    margin-left: 10rpx;
                    font-size: 24rpx;
                    color: #999;
                }
            }
        }
    }
}
</style>