diff --git a/pages/index/index.js b/pages/index/index.js index 492f69a..9bbcc1f 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -150,18 +150,10 @@ Page({ const systemInfo = wx.getSystemInfoSync(); const screenHeight = systemInfo.screenHeight * 2; - const safeArea = systemInfo.safeArea; const btnHeight = 90; - let minTop, maxTop; - - if (safeArea && safeArea.top > 20) { - minTop = safeArea.top * 2 + 20; - maxTop = safeArea.bottom * 2 - btnHeight - 20; - } else { - minTop = screenHeight * 0.2; - maxTop = screenHeight * 0.6; - } + const minTop = screenHeight * 0.2; + const maxTop = screenHeight * 0.6; if (newTop < minTop) { newTop = minTop; @@ -206,9 +198,13 @@ Page({ const systemInfo = wx.getSystemInfoSync(); const screenHeight = systemInfo.screenHeight * 2; - let defaultTop = screenHeight / 2; + let defaultTop = screenHeight * 0.5; if (savedBtnTop !== '' && savedBtnTop !== -100) { - defaultTop = savedBtnTop; + const minTop = screenHeight * 0.2; + const maxTop = screenHeight * 0.6; + if (savedBtnTop >= minTop && savedBtnTop <= maxTop) { + defaultTop = savedBtnTop; + } } this.setData({