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,63 @@
const { resolveScene } = require('../../../../utils/static-ux/shared')
const { ROUTES, openStaticRoute } = require('../../../../utils/static-ux/route-map')
const BOOK_SURFACES = Object.freeze({
'classic-a': {
coverText: '滴',
title: '滴天髓',
subtitle: '命理经典研习入口',
route: `${ROUTES.mingli.section}?scene=reader-a`,
catalog: ['总论', '天干地支', '格局取法'],
recommends: [{ key: 'classic-b', title: '穷通宝鉴', route: `${ROUTES.mingli.bookDetail}?scene=classic-b` }]
},
'classic-b': {
coverText: '穷',
title: '穷通宝鉴',
subtitle: '格局与用神的静态阅读入口',
route: `${ROUTES.mingli.section}?scene=reader-b`,
catalog: ['四时旺衰', '五行喜忌', '命局评析'],
recommends: [{ key: 'classic-a', title: '滴天髓', route: `${ROUTES.mingli.bookDetail}?scene=classic-a` }]
}
})
function createMingliBookDetailPageData(rawScene) {
const scene = resolveScene(rawScene, ['classic-a', 'classic-b'], 'classic-a')
const surface = BOOK_SURFACES[scene]
return {
title: '易学典籍详情',
scene,
coverText: surface.coverText,
book: {
title: surface.title,
subtitle: surface.subtitle
},
catalog: [...surface.catalog],
primaryRoute: surface.route,
recommends: surface.recommends.map(item => ({ ...item }))
}
}
function showNavigate(route) {
openStaticRoute(route, wx)
}
Page({
data: createMingliBookDetailPageData('classic-a'),
onLoad(options) {
this.setData(createMingliBookDetailPageData(options.scene))
},
handlePrimaryTap() {
showNavigate(this.data.primaryRoute)
},
handleRecommendTap(event) {
showNavigate(event.currentTarget.dataset.route)
}
})
module.exports = {
createMingliBookDetailPageData
}

View File

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

View File

@@ -0,0 +1,28 @@
<view class="mingli-book-page">
<view class="hero-card">
<view class="hero-card__cover">{{coverText}}</view>
<view class="hero-card__body">
<text class="hero-card__title">{{book.title}}</text>
<text class="hero-card__subtitle">{{book.subtitle}}</text>
<view class="hero-card__button" bindtap="handlePrimaryTap">进入阅读</view>
</view>
</view>
<view class="section-card">
<text class="section-card__title">目录预览</text>
<text class="section-card__item" wx:for="{{catalog}}" wx:key="index">{{item}}</text>
</view>
<view class="section-card">
<text class="section-card__title">相关推荐</text>
<view
class="section-card__recommend"
wx:for="{{recommends}}"
wx:key="key"
data-route="{{item.route}}"
bindtap="handleRecommendTap"
>
{{item.title}}
</view>
</view>
</view>

View File

@@ -0,0 +1,75 @@
page {
min-height: 100%;
background: linear-gradient(180deg, #f9f7f5 0%, #f3ebe8 100%);
}
.mingli-book-page {
box-sizing: border-box;
min-height: 100vh;
padding: 28rpx 20rpx 72rpx;
}
.hero-card,
.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);
}
.hero-card {
display: flex;
align-items: flex-start;
margin-top: 0;
}
.hero-card__cover {
width: 110rpx;
height: 150rpx;
border-radius: 22rpx;
background: rgba(139, 59, 49, 0.12);
color: #8b3b31;
font-family: 'STSong', 'Songti SC', serif;
font-size: 38rpx;
font-weight: 700;
line-height: 150rpx;
text-align: center;
}
.hero-card__body {
flex: 1;
margin-left: 18rpx;
}
.hero-card__title,
.section-card__title {
display: block;
color: #2c2621;
font-family: 'STSong', 'Songti SC', serif;
font-size: 34rpx;
font-weight: 700;
line-height: 1.3;
}
.hero-card__subtitle,
.section-card__item {
display: block;
margin-top: 10rpx;
color: #7a6f64;
font-size: 24rpx;
line-height: 1.6;
}
.hero-card__button,
.section-card__recommend {
margin-top: 16rpx;
padding: 18rpx 22rpx;
border-radius: 20rpx;
background: rgba(139, 59, 49, 0.08);
color: #8b3b31;
font-size: 24rpx;
line-height: 1;
text-align: center;
}