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:
44
miniprogram/pages/my-plans/my-plans.js
Normal file
44
miniprogram/pages/my-plans/my-plans.js
Normal file
@@ -0,0 +1,44 @@
|
||||
const app = getApp();
|
||||
const planSvc = require('../../services/plan');
|
||||
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 });
|
||||
planSvc.listMine().then((plans) => {
|
||||
this.setData({ plans: plans || [], loading: false });
|
||||
}).catch(() => {
|
||||
this.setData({ plans: [], loading: false });
|
||||
});
|
||||
},
|
||||
|
||||
onNew() {
|
||||
wx.navigateTo({ url: '/pages/plan-edit/plan-edit?mode=new' });
|
||||
},
|
||||
|
||||
onOpen(e) {
|
||||
wx.navigateTo({ url: '/pages/plan-detail/plan-detail?id=' + encodeURIComponent(e.currentTarget.dataset.id) });
|
||||
},
|
||||
|
||||
goOfficial() {
|
||||
wx.navigateTo({ url: '/pages/collection/collection' });
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user