合并代码

This commit is contained in:
szz
2025-08-08 09:41:19 +08:00
parent 18aac345f1
commit d57a9dec8f
7 changed files with 147 additions and 15 deletions

View File

@@ -1,3 +1,3 @@
# 开发环境配置 # 开发环境配置
VITE_API_BASE_URL=/api VITE_API_BASE_URL=/api
VITE_UPLOAD_BASE_URL=http://localhost:3000/api/upload VITE_UPLOAD_BASE_URL=http://localhost:3001/api/upload

View File

@@ -1,3 +1,5 @@
# 生产环境配置 # 生产环境配置
VITE_API_BASE_URL=https://www.zrbjr.com/api # VITE_API_BASE_URL=https://www.zrbjr.com/api
VITE_UPLOAD_BASE_URL=https://www.zrbjr.com/api/upload # VITE_UPLOAD_BASE_URL=https://www.zrbjr.com/api/upload
VITE_API_BASE_URL=http://114.55.111.44:3001/api
VITE_UPLOAD_BASE_URL=http://114.55.111.44:3001/api/upload

View File

@@ -53,6 +53,14 @@ const routes = [
title: '个人中心' title: '个人中心'
} }
}, },
{
path: '/loading',
name: 'Loading',
component: () => import('@/views/Loading.vue'),
meta: {
title: '维护中'
}
},
{ {
path: '/mypoints-history', path: '/mypoints-history',
name: 'MyPointsHistory', name: 'MyPointsHistory',
@@ -235,6 +243,12 @@ const router = createRouter({
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
NProgress.start() NProgress.start()
// 系统维护模式:所有页面都跳转到维护页面
// if (to.name !== 'Loading') {
// next({ name: 'Loading' })
// return
// }
const userStore = useUserStore() const userStore = useUserStore()
// 设置页面标题 // 设置页面标题

106
src/views/Loading.vue Normal file
View File

@@ -0,0 +1,106 @@
<template>
<div class="maintenance-container">
<div class="maintenance-content">
<img
src="/public/imgs/loading.png"
alt="加载中"
class="maintenance-spinner"
>
<h1 class="maintenance-title">服务器维护中</h1>
<p class="maintenance-message">
我们正在对系统进行升级维护以提供更好的服务体验<br>
请稍后再访问感谢您的理解与支持
</p>
<div class="maintenance-progress">
<div class="progress-bar"></div>
</div>
</div>
</div>
</template>
<style scoped>
.maintenance-container {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #333;
padding: 20px;
text-align: center;
}
.maintenance-content {
max-width: 500px;
padding: 40px;
background: rgba(255, 255, 255, 0.9);
border-radius: 16px;
box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
backdrop-filter: blur(8px);
animation: fadeIn 0.6s ease-out;
}
.maintenance-spinner {
width: 80px;
height: 80px;
margin-bottom: 20px;
animation: spin 2s linear infinite;
}
.maintenance-title {
font-size: 28px;
font-weight: 600;
margin-bottom: 15px;
color: #2c3e50;
}
.maintenance-message {
font-size: 16px;
line-height: 1.6;
margin-bottom: 25px;
color: #7f8c8d;
}
.maintenance-progress {
height: 6px;
background: #ecf0f1;
border-radius: 3px;
overflow: hidden;
margin-top: 30px;
}
.progress-bar {
height: 100%;
width: 60%;
background: linear-gradient(90deg, #3498db, #9b59b6);
animation: progressAnimation 2s ease-in-out infinite;
border-radius: 3px;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
@keyframes progressAnimation {
0% { width: 20%; }
50% { width: 80%; }
100% { width: 20%; }
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
@media (max-width: 600px) {
.maintenance-content {
padding: 30px 20px;
}
.maintenance-title {
font-size: 24px;
}
}
</style>

View File

@@ -519,7 +519,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$router.push('/profile') this.$router.push('/myprofile')
}).catch(() => {}) }).catch(() => {})
} else { } else {
this.$message.error(errorMessage) this.$message.error(errorMessage)

View File

@@ -205,7 +205,7 @@
</el-image> </el-image>
</div> </div>
<!-- 确认收款操作按钮 --> <!-- 确认收款操作按钮 -->
<div v-if="transfer.status === 'confirmed' && transfer.to_user_id === userStore.user.id" class="transfer-actions"> <div v-if="transfer.status === 'pending' && transfer.to_user_id === userStore.user.id" class="transfer-actions">
<el-button <el-button
type="success" type="success"
size="small" size="small"
@@ -215,12 +215,12 @@
确认收款 确认收款
</el-button> </el-button>
<el-button <el-button
type="warning" type="danger"
size="small" size="small"
@click="confirmNotReceived(transfer.id)" @click="confirmNotReceived(transfer.id)"
:loading="confirmLoading" :loading="confirmLoading"
> >
未收到 拒绝收
</el-button> </el-button>
</div> </div>
</div> </div>
@@ -342,12 +342,20 @@ watch(statusFilter, () => {
// 方法 // 方法
const loadPendingTransfers = async () => { const loadPendingTransfers = async () => {
try { try {
const response = await api.get('/transfers/pending') const response = await api.get('/transfers/pending', {
params: {
user_id: userStore.user.id
}
})
if (response.data.success) { if (response.data.success) {
pendingTransfers.value = response.data.data // 过滤出需要当前用户确认的转账记录
pendingTransfers.value = response.data.data.filter(
transfer => transfer.to_user_id === userStore.user.id && transfer.status === 'pending'
)
} }
} catch (error) { } catch (error) {
console.error('加载待确认转账失败:', error) console.error('加载待确认转账失败:', error)
ElMessage.error('加载待确认转账失败')
} }
} }
@@ -703,7 +711,6 @@ const confirmReturn = async () => {
/** /**
* 显示转账凭证并确认收款 * 显示转账凭证并确认收款
* @param {number} transferId - 转账ID
*/ */
const confirmReceived = async (transferId) => { const confirmReceived = async (transferId) => {
try { try {
@@ -717,8 +724,11 @@ const confirmReceived = async (transferId) => {
// 设置当前转账信息并显示凭证对话框 // 设置当前转账信息并显示凭证对话框
currentTransfer.value = transfer currentTransfer.value = transfer
showVoucherDialog.value = true showVoucherDialog.value = true
// 直接调用确认收款方法
await doConfirmReceived()
} catch (error) { } catch (error) {
console.error('显示转账凭证失败:', error) console.error('确认收款失败:', error)
ElMessage.error('操作失败') ElMessage.error('操作失败')
} }
} }
@@ -739,13 +749,13 @@ const doConfirmReceived = async () => {
) )
confirmLoading.value = true confirmLoading.value = true
const response = await transferAPI.confirmReceived(currentTransfer.value.id) const response = await api.post(`/transfers/confirm-received/${currentTransfer.value.id}`)
if (response.data.success) { if (response.data.success) {
ElMessage.success(response.data.message) ElMessage.success(response.data.message)
showVoucherDialog.value = false showVoucherDialog.value = false
loadTransferHistory() loadTransferHistory()
loadAccountInfo() loadPendingTransfers() // 重新加载待确认转账
} }
} catch (error) { } catch (error) {
if (error !== 'cancel') { if (error !== 'cancel') {

View File

@@ -14,11 +14,11 @@ export default defineConfig({
port: 5173, port: 5173,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://114.55.111.44:3000', target: 'http://127.0.0.1:3001',
changeOrigin: true changeOrigin: true
}, },
'/uploads': { '/uploads': {
target: 'http://114.55.111.44:3000', target: 'http://127.0.0.1:3001',
changeOrigin: true changeOrigin: true
} }
} }