大量的代码格式化
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -14,7 +14,11 @@
|
||||
<!-- 下拉刷新区域 -->
|
||||
<van-pull-refresh v-model="refreshing" @refresh="onRefresh">
|
||||
<!-- 加载提示 -->
|
||||
<van-loading v-if="loading && !(transactionList && transactionList.length)" vertical style="padding: 50px 0">
|
||||
<van-loading
|
||||
v-if="loading && !(transactionList && transactionList.length)"
|
||||
vertical
|
||||
style="padding: 50px 0"
|
||||
>
|
||||
加载中...
|
||||
</van-loading>
|
||||
|
||||
@@ -26,14 +30,16 @@
|
||||
:show-delete="true"
|
||||
@load="onLoad"
|
||||
@click="viewDetail"
|
||||
@delete="(id) => {
|
||||
// 从当前的交易列表中移除该交易
|
||||
transactionList.value = transactionList.value.filter(t => t.id !== id)
|
||||
}"
|
||||
@delete="
|
||||
(id) => {
|
||||
// 从当前的交易列表中移除该交易
|
||||
transactionList.value = transactionList.value.filter((t) => t.id !== id)
|
||||
}
|
||||
"
|
||||
/>
|
||||
|
||||
<!-- 底部安全距离 -->
|
||||
<div style="height: calc(50px + env(safe-area-inset-bottom, 0px))"></div>
|
||||
<div style="height: calc(50px + env(safe-area-inset-bottom, 0px))" />
|
||||
</van-pull-refresh>
|
||||
|
||||
<!-- 详情/编辑弹出层 -->
|
||||
@@ -48,10 +54,7 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { showToast } from 'vant'
|
||||
import {
|
||||
getTransactionList,
|
||||
getTransactionDetail
|
||||
} from '@/api/transactionRecord'
|
||||
import { getTransactionList, getTransactionDetail } from '@/api/transactionRecord'
|
||||
import TransactionList from '@/components/TransactionList.vue'
|
||||
import TransactionDetail from '@/components/TransactionDetail.vue'
|
||||
|
||||
@@ -69,8 +72,6 @@ const currentTransaction = ref(null)
|
||||
const searchKeyword = ref('')
|
||||
let searchTimer = null
|
||||
|
||||
|
||||
|
||||
// 加载数据
|
||||
const loadData = async (isRefresh = false) => {
|
||||
if (isRefresh) {
|
||||
@@ -85,24 +86,24 @@ const loadData = async (isRefresh = false) => {
|
||||
pageIndex: pageIndex.value,
|
||||
pageSize: pageSize
|
||||
}
|
||||
|
||||
|
||||
// 添加搜索关键词
|
||||
if (searchKeyword.value) {
|
||||
params.searchKeyword = searchKeyword.value
|
||||
}
|
||||
|
||||
|
||||
const response = await getTransactionList(params)
|
||||
|
||||
|
||||
if (response.success) {
|
||||
const newList = response.data || []
|
||||
total.value = response.total || 0
|
||||
|
||||
|
||||
if (isRefresh) {
|
||||
transactionList.value = newList
|
||||
} else {
|
||||
transactionList.value = [...(transactionList.value || []), ...newList]
|
||||
}
|
||||
|
||||
|
||||
if (newList.length === 0 || newList.length < pageSize) {
|
||||
finished.value = true
|
||||
} else {
|
||||
@@ -194,10 +195,12 @@ const onGlobalTransactionDeleted = () => {
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
window.addEventListener && window.addEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
||||
window.addEventListener &&
|
||||
window.addEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener && window.removeEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
||||
window.removeEventListener &&
|
||||
window.removeEventListener('transaction-deleted', onGlobalTransactionDeleted)
|
||||
})
|
||||
|
||||
// 外部新增/修改/批量更新时的刷新监听
|
||||
@@ -208,18 +211,16 @@ const onGlobalTransactionsChanged = () => {
|
||||
loadData(true)
|
||||
}
|
||||
|
||||
window.addEventListener && window.addEventListener('transactions-changed', onGlobalTransactionsChanged)
|
||||
window.addEventListener &&
|
||||
window.addEventListener('transactions-changed', onGlobalTransactionsChanged)
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener && window.removeEventListener('transactions-changed', onGlobalTransactionsChanged)
|
||||
window.removeEventListener &&
|
||||
window.removeEventListener('transactions-changed', onGlobalTransactionsChanged)
|
||||
})
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
:deep(.van-pull-refresh) {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
@@ -231,7 +232,6 @@ onBeforeUnmount(() => {
|
||||
padding: 4px 12px;
|
||||
z-index: 100;
|
||||
margin-top: 10px;
|
||||
|
||||
}
|
||||
|
||||
.top-search-bar :deep(.van-search) {
|
||||
@@ -239,10 +239,8 @@ onBeforeUnmount(() => {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 设置页面容器背景色 */
|
||||
:deep(.van-nav-bar) {
|
||||
background: transparent !important;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user