更新小程序配置,重构页面结构,删除不再使用的地址管理和章节页面,优化项目结构以提升可维护性;调整全局样式,增强组件的可复用性和一致性。

This commit is contained in:
乘风
2026-02-03 11:35:38 +08:00
parent d74410cfb5
commit a7d781a25b
79 changed files with 10610 additions and 3518 deletions

View File

@@ -1,69 +1,17 @@
const app = getApp()
const mp = require('miniprogram-render')
const getBaseConfig = require('../base.js')
const config = require('../../config')
Page({
data: {
statusBarHeight: 44,
navBarHeight: 88,
totalSections: 62,
purchasedCount: 0,
hasFullBook: false,
featuredSections: [
{ id: '1.1', title: '荷包:电动车出租的被动收入模式', tag: '免费', tagClass: 'tag-free', part: '真实的人' },
{ id: '3.1', title: '3000万流水如何跑出来', tag: '热门', tagClass: 'tag-pink', part: '真实的行业' },
{ id: '8.1', title: '流量杠杆:抖音、Soul、飞书', tag: '推荐', tagClass: 'tag-purple', part: '真实的赚钱' }
],
latestSection: { id: '9.14', title: '大健康私域一个月150万的70后', part: '真实的赚钱' },
partsList: [
{ id: 'part-1', number: '01', title: '真实的人', subtitle: '人性观察与社交逻辑' },
{ id: 'part-2', number: '02', title: '真实的行业', subtitle: '社会运作的底层规则' },
{ id: 'part-3', number: '03', title: '真实的错误', subtitle: '错过机会比失败更贵' },
{ id: 'part-4', number: '04', title: '真实的赚钱', subtitle: '所有行业的杠杆结构' },
{ id: 'part-5', number: '05', title: '真实的未来', subtitle: '人与系统的关系' }
]
},
function init(window, document) {require('../../common/index.js')(window, document)}
onLoad(options) {
this.setNavBarHeight()
if (options && options.ref) app.handleReferralCode({ query: options })
this.loadBookData()
this.updateUserStatus()
},
const baseConfig = getBaseConfig(mp, config, init)
setNavBarHeight() {
const statusBarHeight = app.globalData.statusBarHeight || 44
const navBarHeight = app.globalData.navBarHeight || (statusBarHeight + 44)
this.setData({ statusBarHeight, navBarHeight })
},
onShow() {
if (typeof this.getTabBar === 'function' && this.getTabBar()) this.getTabBar().setData({ selected: 0 })
this.setNavBarHeight()
this.updateUserStatus()
},
loadBookData() {
app.request('/api/book/all-chapters').then((res) => {
if (res && res.data) this.setData({ totalSections: res.totalSections || 62 })
}).catch(() => {})
},
updateUserStatus() {
const { hasFullBook, purchasedSections } = app.globalData
const total = this.data.totalSections || 62
const count = hasFullBook ? total : (purchasedSections?.length || 0)
this.setData({ hasFullBook, purchasedCount: count })
},
goToChapters() { wx.switchTab({ url: '/pages/chapters/chapters' }) },
goToSearch() { wx.navigateTo({ url: '/pages/search/search' }) },
goToRead(e) {
const id = e.currentTarget.dataset.id
wx.navigateTo({ url: '/pages/read/read?id=' + (id || '') })
},
onPullDownRefresh() {
this.loadBookData()
this.updateUserStatus()
wx.stopPullDownRefresh()
}
Component({
...baseConfig.base,
methods: {
...baseConfig.methods,
},
})

View File

@@ -1,5 +1,7 @@
{
"usingComponents": {},
"navigationStyle": "custom",
"enablePullDownRefresh": true
}
"navigationBarTitleText": "Soul创业实验",
"enablePullDownRefresh": false,
"usingComponents": {
"element": "miniprogram-element"
}
}

View File

@@ -1,88 +1 @@
<view class="page">
<view class="nav-placeholder" style="height: {{navBarHeight || (statusBarHeight + 44)}}px;"></view>
<view class="header safe-header-right">
<view class="header-content">
<view class="logo-section">
<view class="logo-icon"><text class="logo-text">S</text></view>
<view class="logo-info">
<view class="logo-title"><text class="text-white">Soul</text><text class="brand-color">创业实验</text></view>
<text class="logo-subtitle">来自派对房的真实故事</text>
</view>
</view>
<view class="chapter-badge">{{totalSections}}章</view>
</view>
<view class="search-bar" bindtap="goToSearch">
<text class="search-icon">🔍</text>
<text class="search-placeholder">搜索章节...</text>
</view>
</view>
<view class="main-content">
<view class="banner-card" bindtap="goToRead" data-id="{{latestSection.id}}">
<view class="banner-glow"></view>
<text class="banner-tag">最新更新</text>
<view class="banner-title">{{latestSection.title}}</view>
<view class="banner-part">{{latestSection.part}}</view>
<view class="banner-action"><text class="banner-action-text">开始阅读</text> →</view>
</view>
<view class="progress-card card">
<view class="progress-header">
<text class="progress-title">我的阅读</text>
<text class="progress-count">{{purchasedCount}}/{{totalSections}}章</text>
</view>
<view class="progress-bar-bg">
<view class="progress-bar-fill" style="width: {{totalSections ? (purchasedCount / totalSections * 100) : 0}}%;"></view>
</view>
<view class="progress-stats">
<view class="stat-item"><text class="stat-value brand-color">{{purchasedCount}}</text><text class="stat-label">已读</text></view>
<view class="stat-item"><text class="stat-value">{{totalSections - purchasedCount}}</text><text class="stat-label">待读</text></view>
<view class="stat-item"><text class="stat-value">5</text><text class="stat-label">篇章</text></view>
<view class="stat-item"><text class="stat-value">{{totalSections}}</text><text class="stat-label">章节</text></view>
</view>
</view>
<view class="section">
<view class="section-header">
<text class="section-title">精选推荐</text>
<view class="section-more" bindtap="goToChapters"><text class="more-text">查看全部</text> →</view>
</view>
<view class="featured-list">
<view class="featured-item" wx:for="{{featuredSections}}" wx:key="id" bindtap="goToRead" data-id="{{item.id}}">
<view class="featured-content">
<view class="featured-meta">
<text class="featured-id brand-color">{{item.id}}</text>
<text class="tag {{item.tagClass}}">{{item.tag}}</text>
</view>
<text class="featured-title">{{item.title}}</text>
<text class="featured-part">{{item.part}}</text>
</view>
<text class="featured-arrow">→</text>
</view>
</view>
</view>
<view class="section">
<text class="section-title">内容概览</text>
<view class="parts-list">
<view class="part-item" wx:for="{{partsList}}" wx:key="id" bindtap="goToChapters">
<view class="part-icon"><text class="part-number">{{item.number}}</text></view>
<view class="part-info">
<text class="part-title">{{item.title}}</text>
<text class="part-subtitle">{{item.subtitle}}</text>
</view>
<text class="part-arrow">→</text>
</view>
</view>
</view>
<view class="preface-card" bindtap="goToRead" data-id="preface">
<view class="preface-content">
<text class="preface-title">序言</text>
<text class="preface-desc">为什么我每天早上6点在Soul开播?</text>
</view>
<view class="tag tag-free">免费</view>
</view>
</view>
<view class="bottom-space"></view>
</view>
<page-meta root-font-size="{{rootFontSize}}" page-style="{{pageStyle}}"></page-meta><element wx:if="{{pageId}}" class="{{bodyClass}}" style="{{bodyStyle}}" data-private-node-id="e-body" data-private-page-id="{{pageId}}" ></element>

View File

@@ -1,65 +0,0 @@
.page { min-height: 100vh; background: #000; padding-bottom: 200rpx; }
.nav-placeholder { width: 100%; }
.header { padding: 0 32rpx 32rpx; }
.header-content { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32rpx; padding-top: 24rpx; }
.logo-section { display: flex; align-items: center; gap: 16rpx; }
.logo-icon { width: 80rpx; height: 80rpx; border-radius: 20rpx; background: linear-gradient(135deg, #00CED1 0%, #20B2AA 100%); display: flex; align-items: center; justify-content: center; box-shadow: 0 8rpx 24rpx rgba(0,206,209,0.3); }
.logo-text { color: #fff; font-size: 36rpx; font-weight: 700; }
.logo-info { display: flex; flex-direction: column; }
.logo-title { font-size: 36rpx; font-weight: 700; }
.text-white { color: #fff; }
.brand-color { color: #00CED1; }
.logo-subtitle { font-size: 22rpx; color: rgba(255,255,255,0.4); margin-top: 4rpx; }
.chapter-badge { font-size: 22rpx; color: #00CED1; background: rgba(0,206,209,0.1); padding: 8rpx 16rpx; border-radius: 32rpx; }
.search-bar { display: flex; align-items: center; gap: 24rpx; padding: 24rpx 32rpx; background: #1c1c1e; border-radius: 24rpx; border: 2rpx solid rgba(255,255,255,0.05); }
.search-icon { font-size: 32rpx; opacity: 0.6; }
.search-placeholder { font-size: 28rpx; color: rgba(255,255,255,0.4); }
.main-content { padding: 0 32rpx; box-sizing: border-box; }
.banner-card { position: relative; padding: 40rpx; border-radius: 32rpx; overflow: hidden; background: linear-gradient(135deg, #0d3331 0%, #1a1a2e 50%, #16213e 100%); margin-bottom: 24rpx; }
.banner-glow { position: absolute; top: 0; right: 0; width: 256rpx; height: 256rpx; background: #00CED1; border-radius: 50%; filter: blur(120rpx); opacity: 0.2; }
.banner-tag { display: inline-block; padding: 8rpx 16rpx; background: #00CED1; color: #000; font-size: 22rpx; font-weight: 500; border-radius: 8rpx; margin-bottom: 24rpx; }
.banner-title { font-size: 36rpx; font-weight: 700; color: #fff; margin-bottom: 16rpx; padding-right: 64rpx; }
.banner-part { font-size: 28rpx; color: rgba(255,255,255,0.6); margin-bottom: 24rpx; }
.banner-action { display: flex; align-items: center; gap: 8rpx; }
.banner-action-text { font-size: 28rpx; color: #00CED1; font-weight: 500; }
.card { background: #1c1c1e; border-radius: 32rpx; padding: 32rpx; border: 2rpx solid rgba(255,255,255,0.05); margin-bottom: 24rpx; }
.progress-card { margin-bottom: 24rpx; }
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24rpx; }
.progress-title { font-size: 28rpx; color: #fff; font-weight: 500; }
.progress-count { font-size: 22rpx; color: rgba(255,255,255,0.4); }
.progress-bar-bg { width: 100%; height: 16rpx; background: #2c2c2e; border-radius: 8rpx; overflow: hidden; margin-bottom: 24rpx; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #00CED1 0%, #20B2AA 100%); border-radius: 8rpx; }
.progress-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24rpx; }
.stat-item { text-align: center; }
.stat-value { font-size: 36rpx; font-weight: 700; color: #fff; display: block; }
.stat-label { font-size: 22rpx; color: rgba(255,255,255,0.4); }
.section { margin-bottom: 24rpx; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24rpx; }
.section-title { font-size: 32rpx; font-weight: 600; color: #fff; }
.section-more { display: flex; align-items: center; gap: 8rpx; }
.more-text { font-size: 24rpx; color: #00CED1; }
.featured-list { display: flex; flex-direction: column; gap: 24rpx; }
.featured-item { display: flex; align-items: flex-start; justify-content: space-between; padding: 32rpx; background: #1c1c1e; border-radius: 24rpx; border: 2rpx solid rgba(255,255,255,0.05); }
.featured-content { flex: 1; }
.featured-meta { display: flex; align-items: center; gap: 16rpx; margin-bottom: 16rpx; }
.featured-id { font-size: 24rpx; font-weight: 500; }
.tag { font-size: 22rpx; padding: 6rpx 16rpx; border-radius: 8rpx; }
.tag-free { background: rgba(0,206,209,0.1); color: #00CED1; }
.tag-pink { background: rgba(233,30,99,0.1); color: #E91E63; }
.tag-purple { background: rgba(123,97,255,0.1); color: #7B61FF; }
.featured-title { font-size: 28rpx; color: #fff; font-weight: 500; display: block; margin-bottom: 8rpx; }
.featured-part { font-size: 22rpx; color: rgba(255,255,255,0.4); }
.featured-arrow { font-size: 32rpx; color: rgba(255,255,255,0.3); }
.parts-list { display: flex; flex-direction: column; gap: 24rpx; }
.part-item { display: flex; align-items: center; gap: 24rpx; padding: 32rpx; background: #1c1c1e; border-radius: 24rpx; border: 2rpx solid rgba(255,255,255,0.05); }
.part-icon { width: 80rpx; height: 80rpx; border-radius: 16rpx; background: linear-gradient(135deg, rgba(0,206,209,0.2) 0%, rgba(32,178,170,0.1) 100%); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.part-number { font-size: 28rpx; font-weight: 700; color: #00CED1; }
.part-info { flex: 1; min-width: 0; }
.part-title { font-size: 28rpx; color: #fff; font-weight: 500; display: block; margin-bottom: 4rpx; }
.part-subtitle { font-size: 22rpx; color: rgba(255,255,255,0.4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-arrow { font-size: 32rpx; color: rgba(255,255,255,0.3); }
.preface-card { display: flex; align-items: center; justify-content: space-between; padding: 32rpx; border-radius: 24rpx; background: linear-gradient(90deg, rgba(0,206,209,0.1) 0%, transparent 100%); border: 2rpx solid rgba(0,206,209,0.2); margin-bottom: 24rpx; }
.preface-content { flex: 1; }
.preface-title { font-size: 28rpx; color: #fff; font-weight: 500; display: block; margin-bottom: 8rpx; }
.preface-desc { font-size: 24rpx; color: rgba(255,255,255,0.6); }
.bottom-space { height: 40rpx; }