yuanmingze 3 сар өмнө
parent
commit
1fef57745a

+ 1 - 0
src/main.ts

@@ -1,6 +1,7 @@
 import 'normalize.css'
 import 'vant/lib/index.css'
 import 'viewerjs/dist/viewer.css'
+import '@/styles/index.scss'
 
 import { createApp } from 'vue'
 import App from './App.vue'

+ 2 - 1
src/router/index.ts

@@ -13,8 +13,9 @@ const router = createRouter({
 router.beforeEach((to, from, next) => {
   const userStore = useUserStoreWithOut()
   const token = userStore.access_token
+  const pushRecordId = userStore.pushRecordId
 
-  if (to.meta.requiresAuth && !token) {
+  if (to.meta.requiresAuth && !token && !pushRecordId) {
     // 未登录时跳转登录页
     next({
       path: '/login',

+ 24 - 0
src/styles/index.scss

@@ -0,0 +1,24 @@
+/* iOS 安全区变量(兼容老版本 iOS 的 constant 写法) */
+:root {
+  --safe-top: constant(safe-area-inset-top);
+  --safe-top: env(safe-area-inset-top);
+}
+
+/* 修正 Vant NavBar 在 fixed + placeholder 场景下的真实高度与占位高度 */
+.invoice-page {
+  /* 让页面背景延展到安全区背后,避免出现“露底色”的条带 */
+  background: #f5f6f8;
+}
+
+/* ① 导航条本体:加上安全区内边距并增高整体高度 */
+.van-nav-bar.van-nav-bar--fixed {
+  padding-top: var(--safe-top); /* 让标题避开刘海 */
+  height: calc(46px + var(--safe-top)) !important; /* 46px 为 Vant 默认高度 */
+}
+
+/* ② placeholder:高度与导航条保持一致(关键修复点) */
+.van-nav-bar__placeholder {
+  height: calc(46px + var(--safe-top)) !important;
+}
+
+/* ③ 若你在别处又给了全局 safe-area 顶部 padding,可去掉,避免“双倍间距” */

+ 5 - 8
src/views/login/index.vue

@@ -227,16 +227,13 @@ const loginBtn = useDebounceFn(async () => {
       loginMessage.value = res.msg
       loginDialog.value = true
     }
+    toast.close()
   } catch (err: any) {
-    const { code, message } = err || {}
-    if (code && message)
-      showFailToast({
-        message: message,
-        duration: 1500, // 3.5 秒
-        forbidClick: true, // 可选:禁止点击
-      })
-  } finally {
     toast.close()
+    const { code, message } = err || {}
+    if (code && message) {
+      showFailToast(message)
+    }
   }
 }, 800)