fix(miniprogram): adapt bx topbar for WeChat capsule safe area
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8505115f05
commit
f0d64379a7
13 files changed
+51
-37
No files matched your search
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="onBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -216,6 +216,9 @@ import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { expenseItemApi } from '@/api/bx'
|
||||
import { statusLabel, adminStatusTagClass } from '@/utils/bxFormat'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { getSafeAreaStyle, getGlobalSafeArea } from '@/utils/safeArea'
|
||||
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
|
||||
const expenseTree = ref([])
|
||||
const loading = ref(false)
|
||||
@@ -258,7 +261,7 @@ const dialogTitle = computed(() => {
|
||||
function measureListHeight() {
|
||||
try {
|
||||
const sys = uni.getSystemInfoSync()
|
||||
const topbar = 44 + (sys.statusBarHeight || 0)
|
||||
const topbar = getGlobalSafeArea().headerHeight
|
||||
listHeight.value = `${Math.max(320, (sys.windowHeight || 600) - topbar)}px`
|
||||
} catch (e) {
|
||||
listHeight.value = '70vh'
|
||||
@@ -417,7 +420,7 @@ function handleDelete(item) {
|
||||
}
|
||||
|
||||
function onBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: PAGE_PATHS.workbench }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: PAGE_PATHS.workbench }) })
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page bx-page--form">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -89,6 +89,8 @@ import { ref, reactive, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { advanceApi, attachmentApi } from '@/api/bx'
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
|
||||
const MAX_ATTACHMENTS = 10
|
||||
const editId = ref('')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page bx-page--form">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -197,6 +197,8 @@ import { onLoad } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { advanceApi, attachmentApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
ticketHeaderStatusToneClass,
|
||||
formatAmount,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
<view class="search-wrap">
|
||||
<view class="search-box">
|
||||
<text class="search-box__icon">⌕</text>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
@@ -132,6 +131,8 @@ import { onShow } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { advanceApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
workflowListStatusTagClass,
|
||||
formatAmount,
|
||||
@@ -240,7 +241,7 @@ function clearKeyword() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: PAGE_PATHS.workbench }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: PAGE_PATHS.workbench }) })
|
||||
}
|
||||
|
||||
function goApply(id) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
<view class="search-wrap">
|
||||
<view class="search-box">
|
||||
<text class="search-box__icon">⌕</text>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
@@ -207,6 +206,8 @@ import { onShow } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { advanceApi, reimburseApi, expenseItemApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
ticketHeaderStatusToneClass,
|
||||
workflowListStatusTagClass,
|
||||
@@ -406,7 +407,7 @@ function clearKeyword() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: PAGE_PATHS.workbench }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: PAGE_PATHS.workbench }) })
|
||||
}
|
||||
|
||||
function goDetail(item) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="onBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -16,7 +16,6 @@
|
||||
<template v-if="!detailUser">
|
||||
<view class="search-wrap">
|
||||
<view class="search-box">
|
||||
<text class="search-box__icon">⌕</text>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
@@ -221,6 +220,8 @@
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { attachmentApi, invoiceApi, invoiceWalletApi } from '@/api/bx'
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
|
||||
const PAGE_SIZE = 5
|
||||
|
||||
@@ -509,7 +510,7 @@ function onBack() {
|
||||
resetWalletList()
|
||||
return
|
||||
}
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: '/pages/index/index' }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/workbench/workbench' }) })
|
||||
}
|
||||
|
||||
function onDelete(inv) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -217,6 +217,8 @@
|
||||
<script setup>
|
||||
import { reactive, ref, onMounted } from 'vue'
|
||||
import { attachmentApi, invoiceApi, invoiceWalletApi } from '@/api/bx'
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
|
||||
const PAGE_SIZE = 5
|
||||
|
||||
@@ -251,7 +253,7 @@ const uploadPaths = ref([])
|
||||
const uploading = ref(false)
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: '/pages/index/index' }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: '/pages/workbench/workbench' }) })
|
||||
}
|
||||
|
||||
function money(v) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -31,7 +31,6 @@
|
||||
|
||||
<view class="search-wrap">
|
||||
<view class="search-box">
|
||||
<text class="search-box__icon">⌕</text>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
@@ -248,6 +247,8 @@ import { onShow } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { advanceApi, reimburseApi, expenseItemApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
workflowListStatusTagClass,
|
||||
formatAmount,
|
||||
@@ -402,7 +403,7 @@ function clearKeyword() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: PAGE_PATHS.workbench }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: PAGE_PATHS.workbench }) })
|
||||
}
|
||||
|
||||
function onFabAdd() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page bx-page--form">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -261,6 +261,8 @@ import {
|
||||
invoiceApi
|
||||
} from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
normalizeExpenseItem,
|
||||
flattenExpenseTree,
|
||||
formatExpenseName
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page bx-page--form">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -220,6 +220,8 @@ import { onLoad } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { reimburseApi, attachmentApi, expenseItemApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
ticketHeaderStatusToneClass,
|
||||
formatAmount,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<view class="bx-page">
|
||||
<view class="topbar">
|
||||
<view class="topbar" :style="safeAreaStyle">
|
||||
<view class="topbar-left">
|
||||
<view class="topbar-back" @click="goBack">
|
||||
<text class="topbar-back-icon">‹</text>
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
<view class="search-wrap">
|
||||
<view class="search-box">
|
||||
<text class="search-box__icon">⌕</text>
|
||||
<input
|
||||
class="search-input"
|
||||
v-model="keyword"
|
||||
@@ -147,6 +146,8 @@ import { onShow } from '@dcloudio/uni-app'
|
||||
import { PAGE_PATHS } from '@/config/api'
|
||||
import { reimburseApi, expenseItemApi } from '@/api/bx'
|
||||
import {
|
||||
import { getSafeAreaStyle } from '@/utils/safeArea'
|
||||
const safeAreaStyle = getSafeAreaStyle()
|
||||
statusLabel,
|
||||
workflowListStatusTagClass,
|
||||
formatAmount,
|
||||
@@ -269,7 +270,7 @@ function clearKeyword() {
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
uni.navigateBack({ fail: () => uni.switchTab({ url: PAGE_PATHS.workbench }) })
|
||||
uni.navigateBack({ fail: () => uni.reLaunch({ url: PAGE_PATHS.workbench }) })
|
||||
}
|
||||
|
||||
function goApply(id) {
|
||||
|
||||
Reference in new issue
Block a user