feat: init fitness-coach (backend + miniprogram)

- backend: NestJS service with exercise/plan data
- miniprogram: WeChat mini program client
- exclude node_modules, dist, runtime data-store, local env
This commit is contained in:
2026-07-22 00:35:40 +08:00
commit b3b58e66fb
103 changed files with 154759 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
const app = getApp();
const svc = require('../../services/exercise');
Page({
data: {
statusBarHeight: 20,
collections: [],
counts: {},
loading: true
},
onLoad() {
this.setData({ statusBarHeight: app.globalData.statusBarHeight || 20 });
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(() => {});
});
}).catch(() => {
this.setData({ loading: false });
});
},
onOpen(e) {
wx.navigateTo({
url: '/pages/collection-detail/collection-detail?slug=' +
encodeURIComponent(e.currentTarget.dataset.slug)
});
}
});