diff --git a/uniapp/common/utils/navbar.js b/uniapp/common/utils/navbar.js index 0db7644..aa52bae 100644 --- a/uniapp/common/utils/navbar.js +++ b/uniapp/common/utils/navbar.js @@ -8,15 +8,23 @@ * @returns {Object} 包含 statusBarHeight, navBarHeight, capsulePadding, capsuleWidth, capsuleHeight, capsuleTop, totalHeight */ export function getNavMetrics() { - let statusBarHeight = 20 + let statusBarHeight = 0 let navBarHeight = 44 let capsulePadding = 0 let capsuleWidth = 0 let capsuleHeight = 32 - let capsuleTop = 24 + let capsuleTop = 6 let capsuleRight = 0 try { + // #ifdef H5 + // 浏览器环境下通常无需模拟系统状态栏,状态栏高度置 0,导航栏高度固定 44px + statusBarHeight = 0 + navBarHeight = 44 + capsulePadding = 0 + // #endif + + // #ifndef H5 const sys = uni.getSystemInfoSync ? uni.getSystemInfoSync() : null if (sys && sys.statusBarHeight) { statusBarHeight = sys.statusBarHeight @@ -44,8 +52,9 @@ export function getNavMetrics() { } } // #endif + // #endif } catch (e) { - capsulePadding = 96 + capsulePadding = 0 } return { diff --git a/uniapp/components/fc-navbar/fc-navbar.vue b/uniapp/components/fc-navbar/fc-navbar.vue index 0062197..4c43921 100644 --- a/uniapp/components/fc-navbar/fc-navbar.vue +++ b/uniapp/components/fc-navbar/fc-navbar.vue @@ -67,11 +67,21 @@ export default { * 点击返回上一页,若无历史页面则返回首页 */ onBack() { - const pages = getCurrentPages() + const pages = getCurrentPages ? getCurrentPages() : [] if (pages && pages.length > 1) { uni.navigateBack() } else { + // #ifdef H5 + uni.redirectTo({ + url: '/pages/index/index', + fail: () => { + uni.reLaunch({ url: '/pages/index/index' }) + }, + }) + // #endif + // #ifndef H5 uni.reLaunch({ url: '/pages/index/index' }) + // #endif } }, }, @@ -106,28 +116,40 @@ export default { .fc-navbar__bar { display: flex; align-items: center; - padding-left: 24rpx; + padding-left: 16rpx; box-sizing: border-box; position: relative; } .fc-navbar__back { - width: 60rpx; - height: 60rpx; + width: 72rpx; + height: 72rpx; display: flex; align-items: center; justify-content: center; flex-shrink: 0; + cursor: pointer; + border-radius: 50%; + transition: background-color 0.2s ease, transform 0.15s ease; + &:active { + transform: scale(0.92); + background-color: rgba(255, 255, 255, 0.18); + } +} +.fc-navbar--white .fc-navbar__back:active { + background-color: rgba(0, 0, 0, 0.06); } .fc-navbar__back-icon { - font-size: 52rpx; + font-size: 54rpx; line-height: 1; font-weight: 300; + margin-top: -4rpx; } .fc-navbar__title { flex: 1; min-width: 0; display: flex; align-items: center; + padding: 0 12rpx; &--center { justify-content: center; text-align: center; @@ -135,7 +157,8 @@ export default { } .fc-navbar__title-text { font-size: $fc-font-xl; - font-weight: 600; + font-weight: 700; + letter-spacing: 0.5rpx; } .fc-navbar__right { position: relative; @@ -143,5 +166,7 @@ export default { display: flex; align-items: center; flex-shrink: 0; + min-width: 72rpx; + justify-content: flex-end; } diff --git a/uniapp/components/fc-post-card/fc-post-card.vue b/uniapp/components/fc-post-card/fc-post-card.vue index d1ddf84..e3bba32 100644 --- a/uniapp/components/fc-post-card/fc-post-card.vue +++ b/uniapp/components/fc-post-card/fc-post-card.vue @@ -1,32 +1,35 @@