大修改
This commit is contained in:
1 parent
a1cbc9404a
commit
e81481623c
47 files changed
+1453
-285
No files matched your search
+10
-3
@@ -15,7 +15,7 @@ App({
|
||||
/**
|
||||
* 启动流程:配置再静默登录,最后拉已购课程。
|
||||
*
|
||||
* 每一步失败都不阻断启动:配置缺失时用兜底文案,登录失败时按未登录渲染。
|
||||
* 每一步失败都不阻断启动:配置缺失时页面按空值渲染,登录失败时按未登录渲染。
|
||||
* 旧版本在页面 data 里同步读缓存、而缓存由异步写入,首次安装必然报错,这里不再重蹈。
|
||||
*/
|
||||
bootstrap() {
|
||||
@@ -27,8 +27,15 @@ App({
|
||||
|
||||
api
|
||||
.login()
|
||||
.then(() => api.getEntitlements())
|
||||
.then((list) => store.setEntitlements(list))
|
||||
.then((res) => {
|
||||
// 静默登录只建立身份。用户从没主动登录过、或者已经退出,就不去拉已购课程,
|
||||
// 否则知识页会在「未登录」状态下又冒出课程列表。
|
||||
if (!res || !res.user || res.user.isLogin !== 1) {
|
||||
store.setEntitlements([]);
|
||||
return null;
|
||||
}
|
||||
return api.getEntitlements().then((list) => store.setEntitlements(list));
|
||||
})
|
||||
.catch((err) => console.warn('[app] 登录或权益加载失败', err)),
|
||||
];
|
||||
return Promise.all(tasks);
|
||||
|
||||
Reference in new issue
Block a user