接入自建后端 + Gitea CI/CD
部署到群晖 / deploy (push) Failing after 6m22s

- 新增 server/:Node + Express + SQLite + node-cron 实现登录、纪念日 CRUD 和定时订阅消息推送
- 新增 .gitea/workflows/deploy.yml:推送即触发群晖 Docker 部署,监听 15002
- utils/api.js:自动按 envVersion 切换本地/线上 BASE_URL
- app.js 与 add-anniversary.js 移除 wx.cloud 调用,改走自建后端
- cloudfunctions/ 暂保留以便回滚
- 一并提交此前未入库的首页 / 设置页 / 日历 / 万年历等改造

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-06-01 15:44:09 +08:00
parent 6747ade9c4
commit 3965e542fc
49 changed files with 5616 additions and 670 deletions
+7 -20
View File
@@ -69,29 +69,16 @@ Page({
success: (res) => {
try {
const data = JSON.parse(res.data)
const success = storage.importData(data)
if (success) {
wx.showToast({
title: '导入成功',
icon: 'success'
})
setTimeout(() => {
wx.reLaunch({
url: '/pages/index/index'
})
}, 1500)
const result = storage.importData(data)
if (result.success) {
wx.showToast({ title: '导入成功', icon: 'success' })
setTimeout(() => wx.reLaunch({ url: '/pages/index/index' }), 1500)
} else {
wx.showToast({
title: '导入失败,请检查数据格式',
icon: 'none'
})
wx.showToast({ title: result.error || '导入失败,请检查数据格式', icon: 'none' })
}
} catch (e) {
wx.showToast({
title: '数据格式错误',
icon: 'none'
})
wx.showToast({ title: '数据格式错误', icon: 'none' })
}
}
})
+106 -33
View File
@@ -1,46 +1,119 @@
<!--settings.wxml-->
<view class="container">
<view class="settings-list">
<!-- 数据备份 -->
<view class="setting-section">
<text class="section-title">数据管理</text>
<view class="setting-item" bindtap="onExportData">
<text class="item-label">📤 导出数据</text>
<text class="item-arrow"></text>
<view class="page">
<!-- Header -->
<view class="header">
<view class="header-top">
<view class="header-left">
<text class="header-title">设置</text>
<text class="header-sub">数据管理与关于</text>
</view>
<view class="setting-item" bindtap="onImportData">
<text class="item-label">📥 导入数据</text>
<text class="item-arrow"></text>
<view class="header-icon">⚙️</view>
</view>
<!-- 数据统计 -->
<view class="stats-row">
<view class="stat-item">
<text class="stat-num">{{dataCount.persons}}</text>
<text class="stat-label">位好友</text>
</view>
<view class="setting-item" bindtap="onClearData">
<text class="item-label danger">🗑️ 清空所有数据</text>
<text class="item-arrow"></text>
<view class="stat-sep"></view>
<view class="stat-item">
<text class="stat-num">{{dataCount.anniversaries}}</text>
<text class="stat-label">个纪念日</text>
</view>
</view>
</view>
<scroll-view class="body" scroll-y>
<!-- 数据管理 -->
<view class="section-label">数据管理</view>
<view class="card-group">
<view class="row" bindtap="onExportData">
<view class="row-icon-wrap" style="background:#fff7ed;">
<text class="row-icon">📤</text>
</view>
<view class="row-body">
<text class="row-title">导出数据</text>
<text class="row-desc">复制 JSON 到剪贴板</text>
</view>
<text class="row-arrow"></text>
</view>
<view class="row-divider"></view>
<view class="row" bindtap="onImportData">
<view class="row-icon-wrap" style="background:#eff6ff;">
<text class="row-icon">📥</text>
</view>
<view class="row-body">
<text class="row-title">导入数据</text>
<text class="row-desc">从剪贴板读取并导入</text>
</view>
<text class="row-arrow"></text>
</view>
<view class="row-divider"></view>
<view class="row" bindtap="onClearData">
<view class="row-icon-wrap" style="background:#fff1f2;">
<text class="row-icon">🗑️</text>
</view>
<view class="row-body">
<text class="row-title danger">清空所有数据</text>
<text class="row-desc danger">此操作不可恢复,请谨慎</text>
</view>
<text class="row-arrow danger"></text>
</view>
</view>
<!-- 关于 -->
<view class="setting-section">
<text class="section-title">关于</text>
<view class="setting-item">
<text class="item-label">版本号</text>
<text class="item-value">v1.0.0</text>
<view class="section-label">关于</view>
<view class="card-group">
<view class="row">
<view class="row-icon-wrap" style="background:#f0fdf4;">
<text class="row-icon">📱</text>
</view>
<view class="row-body">
<text class="row-title">版本号</text>
</view>
<text class="row-value">v1.0.0</text>
</view>
<view class="setting-item">
<text class="item-label">开发作者</text>
<text class="item-value">生日提醒团队</text>
<view class="row-divider"></view>
<view class="row">
<view class="row-icon-wrap" style="background:#faf5ff;">
<text class="row-icon">👨‍💻</text>
</view>
<view class="row-body">
<text class="row-title">开发作者</text>
</view>
<text class="row-value">生日提醒团队</text>
</view>
</view>
<!-- 提示信息 -->
<view class="info-box">
<text class="info-title">💡 温馨提示</text>
<text class="info-text">1. 建议定期导出数据备份\n2. 农历转换目前使用简化算法\n3. 提醒功能需要小程序权限</text>
<!-- 提示 -->
<view class="tips-card">
<view class="tips-title">
<text class="tips-icon">💡</text>
<text class="tips-heading">温馨提示</text>
</view>
<view class="tips-item">
<text class="tips-dot">·</text>
<text class="tips-text">建议定期导出数据备份</text>
</view>
<view class="tips-item">
<text class="tips-dot">·</text>
<text class="tips-text">农历转换使用寿星万年历算法(19002100</text>
</view>
<view class="tips-item">
<text class="tips-dot">·</text>
<text class="tips-text">开启提醒需授权订阅消息</text>
</view>
</view>
</view>
<view class="bottom-pad"></view>
</scroll-view>
</view>
+207 -49
View File
@@ -1,82 +1,240 @@
/**settings.wxss**/
.container {
min-height: 100vh;
background-color: #f5f5f5;
padding-bottom: 120rpx;
/* settings.wxss */
page {
background: #f1f4f9;
}
.settings-list {
padding: 32rpx;
.page {
display: flex;
flex-direction: column;
height: 100vh;
background: #f1f4f9;
}
.setting-section {
background-color: #fff;
border-radius: 16rpx;
/* ───── Header ───── */
.header {
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
padding: 48rpx 36rpx 40rpx;
flex-shrink: 0;
}
.header-top {
display: flex;
align-items: flex-start;
justify-content: space-between;
margin-bottom: 32rpx;
}
.header-left {
display: flex;
flex-direction: column;
}
.header-title {
font-size: 44rpx;
font-weight: 700;
color: #fff;
line-height: 1.2;
letter-spacing: 2rpx;
}
.header-sub {
font-size: 26rpx;
color: rgba(255, 255, 255, 0.7);
margin-top: 8rpx;
}
.header-icon {
font-size: 64rpx;
opacity: 0.9;
}
.stats-row {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.15);
border-radius: 20rpx;
padding: 20rpx 32rpx;
}
.stat-item {
display: flex;
align-items: baseline;
gap: 8rpx;
flex: 1;
justify-content: center;
}
.stat-num {
font-size: 48rpx;
font-weight: 700;
color: #fff;
line-height: 1;
}
.stat-label {
font-size: 24rpx;
color: rgba(255, 255, 255, 0.75);
}
.stat-sep {
width: 2rpx;
height: 48rpx;
background: rgba(255, 255, 255, 0.25);
flex-shrink: 0;
}
/* ───── Body ───── */
.body {
flex: 1;
overflow: hidden;
}
/* ───── Section label ───── */
.section-label {
font-size: 24rpx;
font-weight: 600;
color: #94a3b8;
letter-spacing: 2rpx;
padding: 32rpx 32rpx 12rpx;
text-transform: uppercase;
}
/* ───── Card group ───── */
.card-group {
background: #fff;
border-radius: 20rpx;
margin: 0 24rpx;
overflow: hidden;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
}
.section-title {
padding: 24rpx 32rpx;
background-color: #f9f9f9;
font-size: 26rpx;
color: #999;
font-weight: 500;
border-bottom: 1px solid #f0f0f0;
}
.setting-item {
/* ───── Row ───── */
.row {
display: flex;
align-items: center;
justify-content: space-between;
padding: 32rpx;
border-bottom: 1px solid #f0f0f0;
padding: 28rpx 28rpx;
transition: background 0.15s ease;
}
.setting-item:last-child {
border-bottom: none;
.row:active {
background: #f8fafc;
}
.item-label {
font-size: 28rpx;
color: #333;
.row-icon-wrap {
width: 72rpx;
height: 72rpx;
border-radius: 18rpx;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
margin-right: 24rpx;
}
.item-label.danger {
color: #ff5722;
.row-icon {
font-size: 36rpx;
}
.item-value {
font-size: 26rpx;
color: #999;
.row-body {
flex: 1;
display: flex;
flex-direction: column;
gap: 4rpx;
}
.item-arrow {
.row-title {
font-size: 30rpx;
font-weight: 500;
color: #1e293b;
}
.row-title.danger {
color: #ef4444;
}
.row-desc {
font-size: 24rpx;
color: #94a3b8;
}
.row-desc.danger {
color: #fca5a5;
}
.row-arrow {
font-size: 40rpx;
color: #ccc;
color: #cbd5e1;
margin-left: 12rpx;
}
.info-box {
background-color: #fff;
border-radius: 16rpx;
padding: 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
.row-arrow.danger {
color: #fca5a5;
}
.info-title {
.row-value {
font-size: 28rpx;
color: #64748b;
}
.row-divider {
height: 1rpx;
background: #f1f5f9;
margin-left: 120rpx;
}
/* ───── Tips card ───── */
.tips-card {
background: #fff;
border-radius: 20rpx;
margin: 8rpx 24rpx 0;
padding: 28rpx 28rpx 32rpx;
box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.06);
border-left: 6rpx solid #6366f1;
}
.tips-title {
display: flex;
align-items: center;
gap: 12rpx;
margin-bottom: 20rpx;
}
.tips-icon {
font-size: 32rpx;
}
.tips-heading {
font-size: 28rpx;
color: #333;
font-weight: 600;
display: block;
margin-bottom: 16rpx;
color: #1e293b;
}
.info-text {
.tips-item {
display: flex;
align-items: flex-start;
gap: 12rpx;
margin-bottom: 12rpx;
}
.tips-item:last-child {
margin-bottom: 0;
}
.tips-dot {
font-size: 28rpx;
color: #6366f1;
line-height: 1.8;
flex-shrink: 0;
}
.tips-text {
font-size: 26rpx;
color: #666;
line-height: 2;
white-space: pre-line;
display: block;
color: #475569;
line-height: 1.8;
}
/* ───── Bottom padding ───── */
.bottom-pad {
height: 80rpx;
}