- miniprogram/config.js: BASE_URL 指向 http://192.227.237.8:3001 - 动作标题中文化(nameZh),搜索匹配 name/nameZh/nameEn - 新增计划/收藏/我的 等页面与组件 - 后端 Docker 化(Dockerfile/.dockerignore)与翻译脚本 - .gitignore 补充 .DS_Store
35 lines
820 B
JavaScript
35 lines
820 B
JavaScript
const app = getApp();
|
|
const planSvc = require('../../services/plan');
|
|
|
|
Page({
|
|
data: {
|
|
statusBarHeight: 20,
|
|
groups: [],
|
|
loading: true
|
|
},
|
|
|
|
onLoad() {
|
|
this.setData({ statusBarHeight: app.globalData.statusBarHeight || 20 });
|
|
this.load();
|
|
},
|
|
|
|
onShow() {
|
|
// 从详情返回(可能收藏/导入变化)时刷新
|
|
if (!this.data.loading) this.load();
|
|
},
|
|
|
|
load() {
|
|
this.setData({ loading: true });
|
|
planSvc.officialGroups().then((res) => {
|
|
this.setData({ groups: (res && res.groups) || [], loading: false });
|
|
}).catch(() => {
|
|
this.setData({ groups: [], loading: false });
|
|
});
|
|
},
|
|
|
|
// 计算某计划的跳转地址(供 wxml 使用)
|
|
planTarget(slug) {
|
|
return '/pages/collection-detail/collection-detail?slug=' + encodeURIComponent(slug);
|
|
}
|
|
});
|