feat: migrate static pages to native tabbar
This commit is contained in:
57
packages/mingli/pages/section/index.js
Normal file
57
packages/mingli/pages/section/index.js
Normal file
@@ -0,0 +1,57 @@
|
||||
const { resolveScene } = require('../../../../utils/static-ux/shared')
|
||||
const { ROUTES, openStaticRoute } = require('../../../../utils/static-ux/route-map')
|
||||
|
||||
const READER_SURFACES = Object.freeze({
|
||||
'reader-a': {
|
||||
title: '滴天髓 · 总论',
|
||||
passages: ['欲识三元万法宗,先观帝载与神功。', '气机流转之间,先看格局成败。']
|
||||
},
|
||||
'reader-b': {
|
||||
title: '穷通宝鉴 · 四时旺衰',
|
||||
passages: ['论命之法,首重月令。', '得时得地者旺,失时失地者衰。']
|
||||
}
|
||||
})
|
||||
|
||||
function createMingliSectionPageData(rawScene) {
|
||||
const scene = resolveScene(rawScene, ['reader-a', 'reader-b'], 'reader-a')
|
||||
const surface = READER_SURFACES[scene]
|
||||
|
||||
return {
|
||||
title: '易学阅读',
|
||||
scene,
|
||||
chapterTitle: surface.title,
|
||||
passages: [...surface.passages],
|
||||
actions: [
|
||||
{
|
||||
key: 'interpret',
|
||||
title: '打开命理解读',
|
||||
route: ROUTES.mingli.interpret
|
||||
},
|
||||
{
|
||||
key: 'hall',
|
||||
title: '返回易学阁',
|
||||
route: ROUTES.mingli.hall
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
function showNavigate(route) {
|
||||
openStaticRoute(route, wx)
|
||||
}
|
||||
|
||||
Page({
|
||||
data: createMingliSectionPageData('reader-a'),
|
||||
|
||||
onLoad(options) {
|
||||
this.setData(createMingliSectionPageData(options.scene))
|
||||
},
|
||||
|
||||
handleActionTap(event) {
|
||||
showNavigate(event.currentTarget.dataset.route)
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
createMingliSectionPageData
|
||||
}
|
||||
5
packages/mingli/pages/section/index.json
Normal file
5
packages/mingli/pages/section/index.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"navigationBarTitleText": "易学阅读",
|
||||
"navigationBarBackgroundColor": "#f8f0ee",
|
||||
"navigationBarTextStyle": "black"
|
||||
}
|
||||
19
packages/mingli/pages/section/index.wxml
Normal file
19
packages/mingli/pages/section/index.wxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<view class="mingli-section-page">
|
||||
<view class="hero-card">
|
||||
<text class="hero-card__title">{{chapterTitle}}</text>
|
||||
</view>
|
||||
|
||||
<view class="passage-card">
|
||||
<text class="passage-card__item" wx:for="{{passages}}" wx:key="index">{{item}}</text>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="action-button"
|
||||
wx:for="{{actions}}"
|
||||
wx:key="key"
|
||||
data-route="{{item.route}}"
|
||||
bindtap="handleActionTap"
|
||||
>
|
||||
{{item.title}}
|
||||
</view>
|
||||
</view>
|
||||
56
packages/mingli/pages/section/index.wxss
Normal file
56
packages/mingli/pages/section/index.wxss
Normal file
@@ -0,0 +1,56 @@
|
||||
page {
|
||||
min-height: 100%;
|
||||
background: linear-gradient(180deg, #f9f7f5 0%, #f3ebe8 100%);
|
||||
}
|
||||
|
||||
.mingli-section-page {
|
||||
box-sizing: border-box;
|
||||
min-height: 100vh;
|
||||
padding: 28rpx 20rpx 72rpx;
|
||||
}
|
||||
|
||||
.hero-card,
|
||||
.passage-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 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.hero-card__title {
|
||||
display: block;
|
||||
color: #2c2621;
|
||||
font-family: 'STSong', 'Songti SC', serif;
|
||||
font-size: 34rpx;
|
||||
font-weight: 700;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.passage-card__item {
|
||||
display: block;
|
||||
margin-top: 16rpx;
|
||||
color: #453730;
|
||||
font-size: 28rpx;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.passage-card__item:first-child {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.action-button {
|
||||
margin-top: 16rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 22rpx;
|
||||
background: rgba(139, 59, 49, 0.08);
|
||||
color: #8b3b31;
|
||||
font-size: 26rpx;
|
||||
line-height: 1;
|
||||
text-align: center;
|
||||
}
|
||||
Reference in New Issue
Block a user