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,5 +1,6 @@
const app = getApp();
const svc = require('../../services/exercise');
const planSvc = require('../../services/plan');
Page({
data: {
@@ -7,11 +8,24 @@ Page({
q: '',
results: [],
loading: false,
searched: false
searched: false,
selectMode: false,
planId: '',
navTitle: '搜索'
},
onLoad() {
onLoad(query) {
this.setData({ statusBarHeight: app.globalData.statusBarHeight || 20 });
const selectMode = query.mode === 'select';
const planId = query.planId || '';
this.setData({
selectMode,
planId,
navTitle: selectMode ? '选择动作' : '搜索'
});
if (selectMode) {
wx.setNavigationBarTitle({ title: '选择动作' });
}
},
onInput(e) {
@@ -43,6 +57,14 @@ Page({
},
onExercise(e) {
wx.navigateTo({ url: '/pages/detail/detail?id=' + encodeURIComponent(e.detail.id) });
const id = e.detail.id;
if (this.data.selectMode && this.data.planId) {
planSvc.addExercise(this.data.planId, id).then(() => {
wx.showToast({ title: '已添加', icon: 'success' });
setTimeout(() => wx.navigateBack(), 500);
}).catch(() => {});
return;
}
wx.navigateTo({ url: '/pages/detail/detail?id=' + encodeURIComponent(id) });
}
});

View File

@@ -1,17 +1,18 @@
<view class="page">
<navbar title="搜索" />
<navbar title="{{navTitle}}" show-back="{{selectMode}}" />
<view class="searchbar">
<view class="searchbar__box">
<text class="searchbar__icon">🔍</text>
<input
class="searchbar__input"
placeholder="搜索动作 / 器械 / 部位"
placeholder="{{selectMode ? '选择动作加入计划' : '搜索动作 / 器械 / 部位'}}"
placeholder-class="ph"
value="{{q}}"
confirm-type="search"
bindinput="onInput" />
</view>
</view>
<view wx:if="{{selectMode}}" class="hint">从下方结果中选择动作,加入当前计划</view>
<view class="section" style="padding-top: 8rpx;">
<view class="grid" wx:if="{{results.length}}">

View File

@@ -12,3 +12,4 @@
.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: 120rpx 0; }
.hint { padding: 16rpx 36rpx 0; font-size: 24rpx; color: var(--gold); }