diff --git a/src/router/index.js b/src/router/index.js index 6709463..d60e1d6 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -6,7 +6,13 @@ const router = createRouter({ routes: [ { path: '/', - redirect: '/host-center' // 默认重定向,实际会被路由守卫处理 + redirect: '/loading' // 默认跳转到加载页面 + }, + { + path: '/loading', + name: 'loading', + component: () => import('../views/LoadingView.vue'), + meta: { requiresAuth: false, isPublic: true } }, { path: '/host-center', diff --git a/src/utils/routeGuard.js b/src/utils/routeGuard.js index 246a945..3a1ef51 100644 --- a/src/utils/routeGuard.js +++ b/src/utils/routeGuard.js @@ -390,10 +390,11 @@ class RouteGuard { */ isPublicPage(path) { const publicPages = [ - PAGES.APPLY, // 申请页面 - 重要:申请页面不需要权限检查 - PAGES.NOT_APP, // 错误页面 - APP连接失败时的页面 - '/404', // 404页面 - '/error' // 通用错误页面 + '/loading', // 加载页面 - 不需要任何检查 + PAGES.APPLY, // 申请页面 - 重要:申请页面不需要权限检查 + PAGES.NOT_APP, // 错误页面 - APP连接失败时的页面 + '/404', // 404页面 + '/error' // 通用错误页面 ] return publicPages.includes(path) } diff --git a/src/views/InformationDetailsView.vue b/src/views/InformationDetailsView.vue index 2a9c25a..6db2ad7 100644 --- a/src/views/InformationDetailsView.vue +++ b/src/views/InformationDetailsView.vue @@ -18,8 +18,8 @@
-
@@ -28,7 +28,7 @@

{{ transaction.eventDescribe }}

{{ transaction.createTime }}

-
+
{{ transaction.amount > 0 ? '+' : '' }}{{ Math.abs(transaction.amount) }}
@@ -48,6 +48,7 @@ import { ref, onMounted } from 'vue' import MobileHeader from '../components/MobileHeader.vue' import { getWalletDetails, formatDateTime, formatEventDescribe } from '../api/wallet.js' +import {formatUTCTime} from "@/utils/utcFormat.js"; const transactions = ref([]) const loading = ref(false) @@ -57,20 +58,51 @@ const error = ref(null) const fetchData = async () => { loading.value = true error.value = null - + try { const response = await getWalletDetails() - + // 处理API返回的数据 if (response.body && Array.isArray(response.body)) { - transactions.value = response.body.map(item => ({ - id: item.id, - eventDescribe: formatEventDescribe(item.eventDescribe), - createTime: formatDateTime(item.createTime), - amount: item.type === 0 ? -Math.abs(item.amount) : item.amount, // type=0表示支出,显示为负数 - balance: item.balance, - event: item.event - })) + transactions.value = response.body.map(item => { + // 根据 event 字段判断是加还是减 + let amount = item.amount + let isPositive = false + + // 根据事件类型判断显示 + switch (item.event) { + case 'RECEIVE_TRANSFER': + // 接收转账 - 显示为正数(绿色) + amount = Math.abs(item.amount) + isPositive = true + break + case 'TRANSFER': + // 转账支出 - 显示为负数(红色) + amount = -Math.abs(item.amount) + isPositive = false + break + default: + // 其他情况根据 type 字段处理 + // type: 0 表示收入,1 表示支出 + if (item.type === 0) { + amount = Math.abs(item.amount) + isPositive = true + } else { + amount = -Math.abs(item.amount) + isPositive = false + } + } + + return { + id: item.id, + eventDescribe: formatEventDescribe(item.eventDescribe), + createTime: formatUTCTime(item.createTime), + amount: amount, + balance: item.balance, + event: item.event, + isPositive: isPositive + } + }) } else { transactions.value = [] } diff --git a/src/views/LoadingView.vue b/src/views/LoadingView.vue new file mode 100644 index 0000000..37d278f --- /dev/null +++ b/src/views/LoadingView.vue @@ -0,0 +1,427 @@ + + + + +