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:
36
miniprogram/pages/plan-favorites/plan-favorites.js
Normal file
36
miniprogram/pages/plan-favorites/plan-favorites.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const app = getApp();
|
||||
const favSvc = require('../../services/favorite');
|
||||
const auth = require('../../utils/auth');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
statusBarHeight: 20,
|
||||
plans: [],
|
||||
loading: true
|
||||
},
|
||||
|
||||
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.listPlans().then((plans) => {
|
||||
this.setData({ plans: plans || [], loading: false });
|
||||
}).catch(() => {
|
||||
this.setData({ plans: [], loading: false });
|
||||
});
|
||||
},
|
||||
|
||||
goOfficial() {
|
||||
wx.navigateTo({ url: '/pages/collection/collection' });
|
||||
}
|
||||
});
|
||||
7
miniprogram/pages/plan-favorites/plan-favorites.json
Normal file
7
miniprogram/pages/plan-favorites/plan-favorites.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationStyle": "custom",
|
||||
"usingComponents": {
|
||||
"navbar": "/components/navbar/index",
|
||||
"plan-card": "/components/plan-card/index"
|
||||
}
|
||||
}
|
||||
24
miniprogram/pages/plan-favorites/plan-favorites.wxml
Normal file
24
miniprogram/pages/plan-favorites/plan-favorites.wxml
Normal file
@@ -0,0 +1,24 @@
|
||||
<view class="page">
|
||||
<navbar title="收藏的官方计划" show-back />
|
||||
|
||||
<view class="section" style="padding-top: 8rpx;">
|
||||
<block wx:if="{{plans.length}}">
|
||||
<view class="grid">
|
||||
<view class="grid__item" wx:for="{{plans}}" wx:key="slug">
|
||||
<plan-card
|
||||
plan="{{item}}"
|
||||
target="/pages/collection-detail/collection-detail?slug={{item.slug}}" />
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
|
||||
<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="goOfficial">浏览官方计划</view>
|
||||
</view>
|
||||
<view wx:else class="empty">加载中…</view>
|
||||
</view>
|
||||
|
||||
<view style="height: 80rpx;"></view>
|
||||
</view>
|
||||
17
miniprogram/pages/plan-favorites/plan-favorites.wxss
Normal file
17
miniprogram/pages/plan-favorites/plan-favorites.wxss
Normal file
@@ -0,0 +1,17 @@
|
||||
.page { min-height: 100vh; background: var(--bg-grad); }
|
||||
.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; }
|
||||
|
||||
.empty-box { display: flex; flex-direction: column; align-items: center; padding: 120rpx 40rpx; }
|
||||
.empty-box__emoji {
|
||||
width: 150rpx; height: 150rpx; border-radius: 36rpx;
|
||||
background: var(--surface-2); display: flex; align-items: center; justify-content: center;
|
||||
font-size: 80rpx;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
Reference in New Issue
Block a user