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

@@ -0,0 +1,55 @@
const app = getApp();
const favSvc = require('../../services/favorite');
const auth = require('../../utils/auth');
Page({
data: {
statusBarHeight: 20,
list: [],
loading: true,
managing: false
},
onLoad() {
this.setData({ statusBarHeight: app.globalData.statusBarHeight || 20 });
},
onShow() {
if (auth.isLogin()) this.load();
else {
wx.showToast({ title: '请先登录', icon: 'none' });
setTimeout(() => wx.navigateBack(), 600);
}
},
load() {
this.setData({ loading: true });
favSvc.listExercises().then((list) => {
this.setData({ list: list || [], loading: false });
}).catch(() => {
this.setData({ list: [], loading: false });
});
},
onManage() {
this.setData({ managing: !this.data.managing });
},
onRemove(e) {
const id = e.currentTarget.dataset.id;
favSvc.removeExercise(id).then(() => {
const list = this.data.list.filter(i => i.id !== id);
this.setData({ list });
wx.showToast({ title: '已移除', icon: 'none' });
}).catch(() => {});
},
onExercise(e) {
if (this.data.managing) return;
wx.navigateTo({ url: '/pages/detail/detail?id=' + encodeURIComponent(e.detail.id) });
},
goRecommend() {
wx.navigateTo({ url: '/pages/recommend/recommend' });
}
});

View File

@@ -0,0 +1,7 @@
{
"navigationStyle": "custom",
"usingComponents": {
"navbar": "/components/navbar/index",
"exercise-card": "/components/exercise-card/index"
}
}

View File

@@ -0,0 +1,28 @@
<view class="page">
<navbar title="我的收藏" show-back />
<view class="bar">
<view class="bar__count">{{list.length}} 个收藏动作</view>
<view wx:if="{{list.length}}" class="bar__manage" bindtap="onManage">{{managing ? '完成' : '管理'}}</view>
</view>
<view class="section" style="padding-top: 8rpx;">
<view class="grid" wx:if="{{list.length}}">
<view class="grid__item" wx:for="{{list}}" wx:key="id">
<view class="item">
<exercise-card exercise="{{item}}" bind:tap="onExercise" />
<view wx:if="{{managing}}" class="remove" data-id="{{item.id}}" catchtap="onRemove">移除</view>
</view>
</view>
</view>
<view wx:elif="{{!loading}}" class="empty-box">
<view class="empty-box__emoji">🔍</view>
<view class="empty-box__t">还没有收藏,去发现喜欢的动作吧</view>
<view class="empty-box__btn" bindtap="goRecommend">去推荐</view>
</view>
<view wx:else class="empty">加载中…</view>
</view>
<view style="height: 80rpx;"></view>
</view>

View File

@@ -0,0 +1,33 @@
.page { min-height: 100vh; background: var(--bg-grad); }
.bar {
display: flex; align-items: center; justify-content: space-between;
padding: 16rpx 32rpx;
}
.bar__count { font-size: 28rpx; color: var(--text-2); }
.bar__manage {
font-size: 28rpx; color: var(--gold); font-weight: 600;
padding: 8rpx 28rpx; border: 1rpx solid var(--gold-line);
border-radius: 999rpx;
}
.grid { display: flex; flex-wrap: wrap; gap: 18rpx; }
.grid__item { width: calc((100% - 18rpx) / 2); }
.item { position: relative; }
.remove {
position: absolute; right: 12rpx; top: 12rpx; z-index: 5;
background: rgba(229,84,75,0.92); color: #fff;
font-size: 22rpx; padding: 8rpx 18rpx; border-radius: 999rpx;
}
.empty { color: var(--text-3); font-size: 26rpx; text-align: center; padding: 120rpx 0; }
.empty-box { display: flex; flex-direction: column; align-items: center; padding: 120rpx 40rpx; }
.empty-box__emoji {
width: 140rpx; height: 140rpx; border-radius: 999rpx;
background: var(--surface-2); display: flex; align-items: center; justify-content: center;
font-size: 72rpx;
}
.empty-box__t { font-size: 28rpx; color: var(--text-2); margin-top: 32rpx; text-align: center; }
.empty-box__btn {
margin-top: 40rpx; padding: 22rpx 64rpx; border-radius: 999rpx;
background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
color: #0E1110; font-weight: 700; font-size: 30rpx;
}