- miniprogram/config.js: BASE_URL 指向 http://192.227.237.8:3001 - 动作标题中文化(nameZh),搜索匹配 name/nameZh/nameEn - 新增计划/收藏/我的 等页面与组件 - 后端 Docker 化(Dockerfile/.dockerignore)与翻译脚本 - .gitignore 补充 .DS_Store
37 lines
795 B
JavaScript
37 lines
795 B
JavaScript
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' });
|
|
}
|
|
});
|