From fcf86bc1aa24682ac106a2c809e97022f5c70db1 Mon Sep 17 00:00:00 2001 From: mx1700 Date: Sun, 25 Aug 2019 20:04:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=AC=A2=E8=BF=8E=E9=A1=B5?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 578aaca..7000d2a 100644 --- a/index.js +++ b/index.js @@ -105,10 +105,9 @@ Navigation.events().registerAppLaunchedListener(async () => { Alert.alert("loadIcon err: " + err.toString()); } + var splash; try { - //todo:当服务器不可用时,可能会卡在这里很长时间 - //之前的做法是异步更新数据,在下一次打开 app 时从本地读取 - await Api.syncSplash(); + splash = await Api.syncSplash(); } catch (err) {} @@ -121,9 +120,15 @@ Navigation.events().registerAppLaunchedListener(async () => { const password = await Token.getLoginPassword(); if(password) { loginByPassword(); - } else { - Navigation.setRoot(BottomNav.config()); + if(!splash) { + try { + splash = await Api.getSplashByStore(); + } catch(e) { + console.error(e) + } + } + Navigation.setRoot(BottomNav.config(splash)); } }