This commit is contained in:
大哥大哥的大哥哥
2026-09-09 14:47:29 +08:00
parent 4d9da40abd
commit 65755c9e96
832 changed files with 412085 additions and 0 deletions
@@ -0,0 +1,85 @@
const memoryCards = require('../../data/memoryCards')
const { chapterRoute } = require('../../utils/chapterRoute')
const MEMORY_CARD_ID_PATTERN = /^S\d{2}-C\d{2}-MC\d{2}$/
const INVALID_CARD_MESSAGE = '这回生活观察暂时没有找到。回到封面,还可以慢慢翻一回。'
function normalizeCardId(value) {
const raw = String(value || '').trim()
if (!raw || raw.length > 64) return ''
let decoded = raw
try {
decoded = decodeURIComponent(raw)
} catch (error) {
return ''
}
return MEMORY_CARD_ID_PATTERN.test(decoded) ? decoded : ''
}
function findReportCard(value) {
const cardId = normalizeCardId(value)
if (!cardId) return null
return memoryCards.find((card) => card.cardId === cardId) || null
}
function twoDigits(value) {
return String(value).padStart(2, '0')
}
Page({
data: {
reportCard: null,
chapterLabel: '',
invalidCard: false,
invalidCardMessage: INVALID_CARD_MESSAGE,
},
onLoad(options = {}) {
const reportCard = findReportCard(options.cardId)
if (!reportCard) {
this.setData({
reportCard: null,
chapterLabel: '',
invalidCard: true,
})
return
}
this.setData({
reportCard: { ...reportCard },
chapterLabel: `第${twoDigits(reportCard.chapterNumber)}回`,
invalidCard: false,
})
},
backToChapter() {
const reportCard = this.data.reportCard
if (!reportCard || !reportCard.chapterNumber) {
this.goHome()
return
}
const pages = typeof getCurrentPages === 'function'
? getCurrentPages()
: []
const previous = pages[pages.length - 2]
if (
previous
&& String(previous.route || '').endsWith('/pages/chapter/chapter')
&& typeof wx.navigateBack === 'function'
) {
wx.navigateBack({ delta: 1 })
return
}
wx.navigateTo({
url: chapterRoute(reportCard.chapterNumber),
})
},
goHome() {
const target = { url: '/pages/home/home' }
if (typeof wx.reLaunch === 'function') {
wx.reLaunch(target)
return
}
wx.redirectTo(target)
},
})
@@ -0,0 +1,4 @@
{
"navigationStyle": "custom",
"disableScroll": true
}
@@ -0,0 +1,81 @@
<view class="safe-shell report-shell">
<view wx:if="{{reportCard}}" class="report-book paper-panel">
<view class="report-identity">
<text class="report-kicker">桂香生活观察</text>
<view class="report-seal" aria-hidden="true">察</view>
<text class="report-chapter">{{chapterLabel}}</text>
<text class="report-title">{{reportCard.chapterTitle}}</text>
<view class="report-person-row">
<text class="report-person-label">这回人物</text>
<text class="report-person">{{reportCard.characterName}}</text>
</view>
<view class="report-local-note">
<text>这页只留在您的手机里。</text>
<text>不会发送答题记录,也不用于诊断。</text>
</view>
</view>
<view class="report-main">
<view class="report-capsule-safe-space" aria-hidden="true"></view>
<scroll-view
class="report-scroll"
scroll-y
enhanced
bounces="{{false}}"
show-scrollbar="{{true}}"
aria-label="{{chapterLabel}}桂香生活观察"
>
<text class="report-heading">这一回,咱们看见了什么</text>
<text class="report-disclaimer">本回生活观察,不是个人健康评估,也不替代诊断和个体化治疗</text>
<view class="report-observation-list">
<view class="report-observation-card">
<text class="report-observation-index" aria-hidden="true">1</text>
<view class="report-observation-copy">
<text class="report-observation-label">本回看见</text>
<text class="report-observation-value">{{reportCard.observation}}</text>
</view>
</view>
<view class="report-observation-card is-family">
<text class="report-observation-index" aria-hidden="true">2</text>
<view class="report-observation-copy">
<text class="report-observation-label">家里可以</text>
<text class="report-observation-value">{{reportCard.familySupport}}</text>
</view>
</view>
<view class="report-observation-card is-today">
<text class="report-observation-index" aria-hidden="true">3</text>
<view class="report-observation-copy">
<text class="report-observation-label">今天试试</text>
<text class="report-observation-value">{{reportCard.todayAction}}</text>
</view>
</view>
</view>
</scroll-view>
<view class="report-actions">
<button
class="report-action report-action-primary"
bindtap="backToChapter"
aria-label="回到{{chapterLabel}}记忆卡"
>回到这一回</button>
<button
class="report-action report-action-secondary"
bindtap="goHome"
aria-label="回到唐侦探封面"
>回到封面</button>
</view>
</view>
</view>
<view wx:else class="report-invalid paper-panel" aria-live="polite">
<view class="report-invalid-seal" aria-hidden="true">桂</view>
<text class="report-invalid-title">这回观察,暂时没有翻开</text>
<text class="report-invalid-copy">{{invalidCardMessage}}</text>
<button
class="report-action report-action-primary report-invalid-action"
bindtap="goHome"
aria-label="回到唐侦探封面"
>回到封面</button>
</view>
</view>
@@ -0,0 +1,28 @@
.report-shell{height:100vh;min-height:0;overflow:hidden}
.report-book{display:grid;width:100%;height:100%;overflow:hidden;grid-template-columns:minmax(210px,2fr) minmax(0,5fr);border:2px solid #9e845e;border-radius:9px}
.report-identity{display:flex;min-height:0;align-items:center;padding:15px 18px;overflow:hidden;color:#f5e5bd;background:#263a3e;border-right:5px solid #9b332a;flex-direction:column}
.report-kicker{align-self:flex-start;color:#dfc486;font-size:17px;font-weight:850}
.report-seal,.report-invalid-seal{display:flex;align-items:center;justify-content:center;color:#8d2d25;background:#efe0b8;border:5px double #ad4d3a;border-radius:50%;font-weight:900}
.report-seal{width:66px;height:66px;flex:none;margin:7px 0 4px;font-size:32px}
.report-title{margin-top:3px;font-size:21px;font-weight:900;line-height:1.2;text-align:center}
.report-person-label{color:#d7bd7d;font-size:14px;font-weight:850}.report-person{margin-left:8px;font-size:18px;font-weight:900}
.report-local-note{display:flex;width:100%;margin-top:auto;padding:6px 8px;color:#eadbb5;background:rgba(19,30,32,.38);border:1px solid rgba(223,196,134,.42);border-radius:6px;flex-direction:column;font-size:14px;font-weight:700;line-height:1.3}
.report-main{position:relative;display:grid;min-height:0;padding:46px 17px 12px;gap:8px;grid-template-rows:minmax(0,1fr) auto}
.report-capsule-safe-space{position:absolute;top:6px;right:8px;width:104px;height:36px;pointer-events:none}
.report-scroll{width:100%;height:100%;min-height:0}
.report-heading{display:block;padding-right:108px;color:#493325;font-size:24px;font-weight:900;line-height:1.22}
.report-disclaimer{display:block;margin-top:6px;padding:6px 9px;color:#644a37;background:#eadfbe;border-left:5px solid #8f3028;font-size:15px;font-weight:750;line-height:1.3}
.report-observation-list{display:grid;gap:6px;margin-top:7px}
.report-observation-card{display:grid;align-items:center;gap:9px;padding:6px 9px;background:rgba(255,250,232,.72);border:1px solid rgba(126,86,50,.32);border-radius:7px;grid-template-columns:34px minmax(0,1fr)}
.report-observation-card.is-family{border-left:5px solid #8c6f42}.report-observation-card.is-today{border-left:5px solid #47705c}
.report-observation-index{padding:5px;color:#fff0ce;background:#8f3028;border-radius:50%;font-size:17px;font-weight:900;text-align:center}
.report-observation-copy{display:grid;min-width:0;gap:2px}
.report-observation-label{color:#8d2f27;font-size:15px;font-weight:900}
.report-observation-value{color:#493325;font-size:19px;font-weight:750;line-height:1.32}
.report-actions{display:grid;gap:9px;grid-template-columns:repeat(2,minmax(0,1fr))}
.report-action{display:flex;min-height:52px;align-items:center;justify-content:center;padding:6px 10px;border:3px solid;border-radius:8px;font-size:19px;font-weight:900;line-height:1.2}
.report-action-primary{color:#fff0cb;background:#963128;border-color:#74231d}.report-action-secondary{color:#473326;background:#ead9b2;border-color:#997b54}
.report-invalid{display:flex;width:min(620px,100%);align-items:center;margin:auto;padding:20px;flex-direction:column}.report-invalid-seal{padding:12px;font-size:28px}.report-invalid-title{font-size:22px;font-weight:900}
@media(max-width:700px),(max-height:420px){
.report-book{grid-template-columns:minmax(180px,2fr) minmax(0,5fr)}.report-identity{padding:7px 10px}.report-kicker{font-size:14px}.report-seal{width:42px;height:42px;margin:2px 0;border-width:3px;font-size:22px}.report-title{font-size:17px}.report-local-note{padding:3px 5px;font-size:12px;line-height:1.15}
.report-main{padding:41px 9px 6px;gap:4px}.report-heading{padding-right:100px;font-size:20px}.report-disclaimer{margin-top:3px;padding:3px 6px;font-size:13px;line-height:1.18}.report-observation-list{gap:3px;margin-top:3px}.report-observation-card{gap:6px;padding:3px 6px;grid-template-columns:28px minmax(0,1fr)}.report-observation-index{font-size:14px}.report-observation-label{font-size:13px}.report-observation-value{font-size:16px;line-height:1.18}.report-actions{gap:5px}.report-action{min-height:48px;padding:4px 6px;font-size:16px}}