调整
This commit is contained in:
@@ -191,8 +191,8 @@ const transactionList = ref([])
|
||||
const loading = ref(false)
|
||||
const refreshing = ref(false)
|
||||
const finished = ref(false)
|
||||
const lastId = ref(null)
|
||||
const lastTime = ref(null)
|
||||
const pageIndex = ref(1)
|
||||
const pageSize = 20
|
||||
const total = ref(0)
|
||||
const detailVisible = ref(false)
|
||||
const currentTransaction = ref(null)
|
||||
@@ -251,18 +251,16 @@ const loadClassifyList = async (type = null) => {
|
||||
// 加载数据
|
||||
const loadData = async (isRefresh = false) => {
|
||||
if (isRefresh) {
|
||||
lastId.value = null
|
||||
lastTime.value = null
|
||||
pageIndex.value = 1
|
||||
transactionList.value = []
|
||||
finished.value = false
|
||||
}
|
||||
|
||||
loading.value = true
|
||||
try {
|
||||
const params = {}
|
||||
if (lastTime.value && lastId.value) {
|
||||
params.lastOccurredAt = lastTime.value
|
||||
params.lastId = lastId.value
|
||||
const params = {
|
||||
pageIndex: pageIndex.value,
|
||||
pageSize: pageSize
|
||||
}
|
||||
|
||||
// 添加搜索关键词
|
||||
@@ -275,8 +273,6 @@ const loadData = async (isRefresh = false) => {
|
||||
if (response.success) {
|
||||
const newList = response.data || []
|
||||
total.value = response.total || 0
|
||||
const newLastId = response.lastId || 0
|
||||
const newLastTime = response.lastTime
|
||||
|
||||
if (isRefresh) {
|
||||
transactionList.value = newList
|
||||
@@ -284,15 +280,11 @@ const loadData = async (isRefresh = false) => {
|
||||
transactionList.value = [...(transactionList.value || []), ...newList]
|
||||
}
|
||||
|
||||
if (newLastId > 0 && newLastTime) {
|
||||
lastId.value = newLastId
|
||||
lastTime.value = newLastTime
|
||||
}
|
||||
|
||||
if (newList.length === 0 || newList.length < 20) {
|
||||
if (newList.length === 0 || newList.length < pageSize) {
|
||||
finished.value = true
|
||||
} else {
|
||||
finished.value = false
|
||||
pageIndex.value++
|
||||
}
|
||||
} else {
|
||||
showToast(response.message || '加载数据失败')
|
||||
|
||||
Reference in New Issue
Block a user