feat: migrate static pages to native tabbar

This commit is contained in:
2026-04-23 21:25:24 +08:00
parent f3cd0c3a98
commit cd30f57f2c
116 changed files with 7143 additions and 311 deletions

View File

@@ -0,0 +1,61 @@
const { ROUTES, openStaticRoute } = require('../../../../utils/static-ux/route-map')
const SEARCH_CATALOG = Object.freeze([
{
key: 'classic-a',
title: '滴天髓',
subtitle: '命理经典结果',
aliases: ['滴天', '天髓'],
route: `${ROUTES.mingli.bookDetail}?scene=classic-a`
},
{
key: 'classic-b',
title: '穷通宝鉴',
subtitle: '格局与用神',
aliases: ['穷通', '宝鉴'],
route: `${ROUTES.mingli.bookDetail}?scene=classic-b`
}
])
function createMingliSearchBooksPageData(keyword) {
const normalizedKeyword = (keyword || '').trim()
const results = normalizedKeyword
? SEARCH_CATALOG.filter(item => {
return (
item.title.includes(normalizedKeyword) ||
item.aliases.some(alias => alias.includes(normalizedKeyword))
)
}).map(item => ({ ...item }))
: []
return {
title: '搜索易学典籍',
keyword: normalizedKeyword,
history: ['滴天髓', '穷通宝鉴', '子平真诠'],
results
}
}
function showNavigate(route) {
openStaticRoute(route, wx)
}
Page({
data: createMingliSearchBooksPageData(''),
onLoad(options) {
this.setData(createMingliSearchBooksPageData(options.keyword || options.q))
},
handleHistoryTap(event) {
this.setData(createMingliSearchBooksPageData(event.currentTarget.dataset.keyword))
},
handleResultTap(event) {
showNavigate(event.currentTarget.dataset.route)
}
})
module.exports = {
createMingliSearchBooksPageData
}

View File

@@ -0,0 +1,5 @@
{
"navigationBarTitleText": "搜索易学典籍",
"navigationBarBackgroundColor": "#f8f0ee",
"navigationBarTextStyle": "black"
}

View File

@@ -0,0 +1,21 @@
<view class="mingli-search-page">
<view class="section-card">
<text class="section-card__title">{{title}}</text>
<text class="section-card__item" wx:for="{{history}}" wx:key="index" data-keyword="{{item}}" bindtap="handleHistoryTap">
{{item}}
</text>
</view>
<view wx:if="{{results.length}}" class="section-card">
<text class="section-card__title">搜索结果</text>
<view
class="section-card__item"
wx:for="{{results}}"
wx:key="key"
data-route="{{item.route}}"
bindtap="handleResultTap"
>
{{item.title}} · {{item.subtitle}}
</view>
</view>
</view>

View File

@@ -0,0 +1,43 @@
page {
min-height: 100%;
background: linear-gradient(180deg, #f9f7f5 0%, #f3ebe8 100%);
}
.mingli-search-page {
box-sizing: border-box;
min-height: 100vh;
padding: 28rpx 20rpx 72rpx;
}
.section-card {
margin-top: 18rpx;
padding: 24rpx;
border: 1rpx solid rgba(139, 59, 49, 0.08);
border-radius: 28rpx;
background: rgba(255, 252, 248, 0.94);
box-shadow: 0 10rpx 26rpx rgba(139, 59, 49, 0.06);
}
.section-card:first-child {
margin-top: 0;
}
.section-card__title {
display: block;
color: #2c2621;
font-family: 'STSong', 'Songti SC', serif;
font-size: 34rpx;
font-weight: 700;
line-height: 1.3;
}
.section-card__item {
display: block;
margin-top: 14rpx;
padding: 18rpx 20rpx;
border-radius: 20rpx;
background: rgba(139, 59, 49, 0.08);
color: #8b3b31;
font-size: 24rpx;
line-height: 1.6;
}