搜索功能增强 + 设置页自动提现 + 部署规则

## 小程序
1. 搜索页面:添加热门章节推荐
2. 我的页面:点击ID可复制
3. 设置页面:添加自动提现开关

## 后台
1. 新增热门章节API (/api/book/hot)
2. 章节保存时自动去掉Markdown标题

## 规则
1. .cursorrules添加完整部署流程
This commit is contained in:
卡若
2026-01-29 12:18:51 +08:00
parent 6a556c2470
commit 0f50fb7c3b
12 changed files with 402 additions and 8 deletions

View File

@@ -12,14 +12,36 @@ Page({
loading: false,
searched: false,
total: 0,
// 热门搜索
hotKeywords: ['私域', '电商', '流量', '赚钱', '创业', 'Soul', '抖音']
// 热门搜索关键词
hotKeywords: ['私域', '电商', '流量', '赚钱', '创业', 'Soul', '抖音', '变现'],
// 热门章节推荐
hotChapters: [
{ id: '1.1', title: '荷包:电动车出租的被动收入模式', tag: '免费', part: '真实的人' },
{ id: '9.12', title: '美业整合:一个人的公司如何月入十万', tag: '热门', part: '真实的赚钱' },
{ id: '3.1', title: '3000万流水如何跑出来', tag: '热门', part: '真实的行业' },
{ id: '8.1', title: '流量杠杆:抖音、Soul、飞书', tag: '推荐', part: '真实的赚钱' },
{ id: '9.13', title: 'AI工具推广一个隐藏的高利润赛道', tag: '最新', part: '真实的赚钱' }
]
},
onLoad() {
this.setData({
statusBarHeight: app.globalData.statusBarHeight || 44
})
// 加载热门章节
this.loadHotChapters()
},
// 加载热门章节(从服务器获取点击量高的章节)
async loadHotChapters() {
try {
const res = await app.request('/api/book/hot')
if (res && res.success && res.chapters?.length > 0) {
this.setData({ hotChapters: res.chapters })
}
} catch (e) {
console.log('加载热门章节失败,使用默认数据')
}
},
// 输入关键词

View File

@@ -40,6 +40,27 @@
>{{item}}</view>
</view>
</view>
<!-- 热门章节推荐(未搜索时显示) -->
<view class="hot-chapters" wx:if="{{!searched && hotChapters.length > 0}}">
<text class="section-title">热门章节</text>
<view class="chapter-list">
<view
class="chapter-item"
wx:for="{{hotChapters}}"
wx:key="id"
bindtap="goToRead"
data-id="{{item.id}}"
>
<view class="chapter-rank">{{index + 1}}</view>
<view class="chapter-info">
<text class="chapter-title">{{item.title}}</text>
<text class="chapter-part">{{item.part}}</text>
</view>
<view class="chapter-tag {{item.tag === '免费' ? 'tag-free' : item.tag === '热门' ? 'tag-hot' : 'tag-new'}}">{{item.tag}}</view>
</view>
</view>
</view>
<!-- 搜索结果 -->
<view class="results-section" wx:if="{{searched}}">

View File

@@ -110,6 +110,77 @@
border: 1rpx solid rgba(0, 206, 209, 0.3);
}
/* 热门章节 */
.hot-chapters {
padding: 32rpx 0;
margin-top: 16rpx;
}
.chapter-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.chapter-item {
display: flex;
align-items: center;
background: rgba(255,255,255,0.05);
border-radius: 20rpx;
padding: 24rpx;
gap: 20rpx;
}
.chapter-rank {
width: 48rpx;
height: 48rpx;
background: linear-gradient(135deg, #00CED1 0%, #20B2AA 100%);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 26rpx;
font-weight: 600;
color: #000;
flex-shrink: 0;
}
.chapter-item:nth-child(1) .chapter-rank { background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%); }
.chapter-item:nth-child(2) .chapter-rank { background: linear-gradient(135deg, #C0C0C0 0%, #A9A9A9 100%); }
.chapter-item:nth-child(3) .chapter-rank { background: linear-gradient(135deg, #CD7F32 0%, #8B4513 100%); }
.chapter-info {
flex: 1;
min-width: 0;
}
.chapter-title {
font-size: 28rpx;
color: #fff;
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.chapter-part {
font-size: 22rpx;
color: rgba(255,255,255,0.4);
margin-top: 6rpx;
display: block;
}
.chapter-tag {
padding: 8rpx 16rpx;
border-radius: 16rpx;
font-size: 22rpx;
flex-shrink: 0;
}
.chapter-tag.tag-free { background: rgba(76, 175, 80, 0.2); color: #4CAF50; }
.chapter-tag.tag-hot { background: rgba(255, 87, 34, 0.2); color: #FF5722; }
.chapter-tag.tag-new { background: rgba(233, 30, 99, 0.2); color: #E91E63; }
/* 搜索结果 */
.results-section {
padding: 16rpx 0;