fix(my-plans): 修复计划列表页因 plan-card 漏声明 fc-icon 导致编译失败进不去
- 根因:c4639d0 给 plan-card 换上 <fc-icon> 但 plan-card.json 的 usingComponents 留空, 微信要求组件自行声明所引用的自定义组件,导致任何使用 plan-card 的页面编译报错、无法进入。 - 修复:plan-card/index.json 补上 fc-icon 声明(与 exercise-card/avatar/bottom-nav 一致)。 - 整体优化 my-plans: * 新增 status 四态(loading/list/empty/error),请求失败显示具体错误 + 『重新加载』按钮,杜绝静默进不去 * 加载态用 refresh-cw 旋转图标替代纯文字 * 遗留金色主按钮(新建计划/空态按钮/官方计划链接)统一到 Kinetic Dark 的 Volt 绿强调色,去除旧主题不一致
This commit is contained in:
@@ -6,7 +6,8 @@ Page({
|
||||
data: {
|
||||
statusBarHeight: 20,
|
||||
plans: [],
|
||||
loading: true
|
||||
status: 'loading', // 'loading' | 'list' | 'empty' | 'error'
|
||||
errorMsg: ''
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
@@ -22,11 +23,19 @@ Page({
|
||||
},
|
||||
|
||||
load() {
|
||||
this.setData({ loading: true });
|
||||
this.setData({ status: 'loading', errorMsg: '' });
|
||||
planSvc.listMine().then((plans) => {
|
||||
this.setData({ plans: plans || [], loading: false });
|
||||
}).catch(() => {
|
||||
this.setData({ plans: [], loading: false });
|
||||
const list = plans || [];
|
||||
this.setData({
|
||||
plans: list,
|
||||
status: list.length ? 'list' : 'empty'
|
||||
});
|
||||
}).catch((err) => {
|
||||
this.setData({
|
||||
plans: [],
|
||||
status: 'error',
|
||||
errorMsg: (err && err.message) ? err.message : '加载失败,请稍后重试'
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user