feat: 小程序连接服务器IP + 同步未提交开发

- miniprogram/config.js: BASE_URL 指向 http://192.227.237.8:3001
- 动作标题中文化(nameZh),搜索匹配 name/nameZh/nameEn
- 新增计划/收藏/我的 等页面与组件
- 后端 Docker 化(Dockerfile/.dockerignore)与翻译脚本
- .gitignore 补充 .DS_Store
This commit is contained in:
2026-07-22 14:05:30 +08:00
parent b3b58e66fb
commit 70ff806042
79 changed files with 2397 additions and 146070 deletions

View File

@@ -1,11 +1,10 @@
const app = getApp();
const svc = require('../../services/exercise');
const planSvc = require('../../services/plan');
Page({
data: {
statusBarHeight: 20,
collections: [],
counts: {},
groups: [],
loading: true
},
@@ -14,27 +13,22 @@ Page({
this.load();
},
onShow() {
// 从详情返回(可能收藏/导入变化)时刷新
if (!this.data.loading) this.load();
},
load() {
this.setData({ loading: true });
svc.listCollections().then((list) => {
const collections = list || [];
this.setData({ collections, loading: false });
// 异步获取每个训练组合的动作数量
collections.forEach(c => {
svc.getCollectionExercises(c.slug, { pageSize: 1 }).then((res) => {
const key = 'counts.' + c.slug;
this.setData({ [key]: (res && res.total) || 0 });
}).catch(() => {});
});
planSvc.officialGroups().then((res) => {
this.setData({ groups: (res && res.groups) || [], loading: false });
}).catch(() => {
this.setData({ loading: false });
this.setData({ groups: [], loading: false });
});
},
onOpen(e) {
wx.navigateTo({
url: '/pages/collection-detail/collection-detail?slug=' +
encodeURIComponent(e.currentTarget.dataset.slug)
});
// 计算某计划的跳转地址(供 wxml 使用)
planTarget(slug) {
return '/pages/collection-detail/collection-detail?slug=' + encodeURIComponent(slug);
}
});

View File

@@ -2,6 +2,7 @@
"navigationStyle": "custom",
"usingComponents": {
"navbar": "/components/navbar/index",
"bottom-nav": "/components/bottom-nav/index"
"section-header": "/components/section-header/index",
"plan-card": "/components/plan-card/index"
}
}

View File

@@ -1,31 +1,29 @@
<view class="page">
<navbar title="训练计划" />
<navbar title="官方训练计划" show-back />
<view class="section" style="padding-top: 8rpx;">
<view class="intro">
<view class="intro__eyebrow">PROGRAMS</view>
<view class="intro__title">选你的训练主题</view>
<view class="intro__sub">从推、拉、腿到居家无器械,一键开启</view>
<view class="intro__eyebrow">OFFICIAL PROGRAMS</view>
<view class="intro__title">选你的训练阶段</view>
<view class="intro__sub">从新手入门到高级挑战,分级规划你的每一次进阶</view>
</view>
<view class="list" wx:if="{{collections.length}}">
<view
wx:for="{{collections}}"
wx:key="slug"
class="col-card"
style="background: linear-gradient(135deg, {{item.color}}26, var(--surface)); border-color: {{item.color}}55;"
data-slug="{{item.slug}}"
bindtap="onOpen">
<view class="col-card__emoji" style="background: {{item.color}}22;">{{item.emoji}}</view>
<view class="col-card__main">
<view class="col-card__name">{{item.name}}</view>
<view class="col-card__desc">{{item.description}}</view>
<block wx:if="{{groups.length}}">
<view class="group" wx:for="{{groups}}" wx:for-item="g" wx:key="level">
<section-header eyebrow="LEVEL" title="{{g.label}}" />
<view class="grid">
<view class="grid__item" wx:for="{{g.plans}}" wx:for-item="p" wx:key="slug">
<plan-card
plan="{{p}}"
target="/pages/collection-detail/collection-detail?slug={{p.slug}}" />
</view>
</view>
<view class="col-card__count" style="color: {{item.color}};">{{counts[item.slug] || ''}} 个动作 </view>
</view>
</view>
<view wx:elif="{{!loading}}" class="empty">暂无数据</view>
</block>
<view wx:elif="{{!loading}}" class="empty">暂无官方计划</view>
<view wx:else class="empty">加载中…</view>
</view>
<view style="height: 160rpx;"></view>
<bottom-nav active="plan" />
<view style="height: 60rpx;"></view>
</view>

View File

@@ -4,19 +4,8 @@
.intro__title { font-size: 44rpx; font-weight: 700; margin-top: 12rpx; }
.intro__sub { font-size: 26rpx; color: var(--text-2); margin-top: 12rpx; }
.list { display: flex; flex-direction: column; gap: 20rpx; }
.col-card {
display: flex; align-items: center; gap: 24rpx;
background: var(--surface); border: 1rpx solid var(--line);
border-radius: var(--radius); padding: 28rpx;
}
.col-card__emoji {
width: 96rpx; height: 96rpx; border-radius: 24rpx;
display: flex; align-items: center; justify-content: center;
font-size: 52rpx; flex: 0 0 auto;
}
.col-card__main { flex: 1; min-width: 0; }
.col-card__name { font-size: 34rpx; font-weight: 700; color: var(--text); }
.col-card__desc { font-size: 24rpx; color: var(--text-2); margin-top: 8rpx; line-height: 1.4; }
.col-card__count { font-size: 24rpx; flex: 0 0 auto; }
.group { margin-top: 12rpx; }
.group + .group { margin-top: 36rpx; }
.grid { display: flex; flex-wrap: wrap; gap: 18rpx; }
.grid__item { width: calc((100% - 18rpx) / 2); }
.empty { color: var(--text-3); font-size: 26rpx; text-align: center; padding: 80rpx 0; }