初次提交
This commit is contained in:
243
src/App.vue
Normal file
243
src/App.vue
Normal file
@@ -0,0 +1,243 @@
|
||||
<template>
|
||||
<div id="app" :class="{ 'has-bottom-nav': showBottomNav }">
|
||||
<router-view />
|
||||
<BottomNav v-if="showBottomNav" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import BottomNav from '@/components/BottomNav.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// 定义需要显示底部导航的路由
|
||||
const routesWithBottomNav = [
|
||||
'/',
|
||||
'/transfers',
|
||||
'/matching',
|
||||
'/points-history',
|
||||
'/profile',
|
||||
'/shop',
|
||||
'/orders'
|
||||
]
|
||||
|
||||
// 计算是否显示底部导航
|
||||
const showBottomNav = computed(() => {
|
||||
return routesWithBottomNav.includes(route.path)
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
// 应用启动时检查登录状态
|
||||
userStore.checkAuth()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#app {
|
||||
min-height: 100vh;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
|
||||
/* 全局样式 */
|
||||
.page-container {
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
padding-bottom: 100px; /* 为底部导航栏留出空间 */
|
||||
}
|
||||
|
||||
/* 为有底部导航的页面添加底部间距 */
|
||||
.has-bottom-nav {
|
||||
padding-bottom: 100px !important;
|
||||
}
|
||||
|
||||
.card-container {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mb-20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.mt-20 {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
.full-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 768px) {
|
||||
.page-container {
|
||||
padding: 10px;
|
||||
padding-bottom: 120px; /* 增加底部导航空间 */
|
||||
}
|
||||
|
||||
.card-container {
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
/* Element Plus 组件移动端优化 */
|
||||
.el-dialog {
|
||||
width: 95% !important;
|
||||
margin: 0 auto !important;
|
||||
}
|
||||
|
||||
.el-form-item__label {
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
.el-input__inner,
|
||||
.el-textarea__inner {
|
||||
font-size: 16px !important; /* 防止iOS缩放 */
|
||||
}
|
||||
|
||||
.el-button {
|
||||
min-height: 44px !important; /* 触摸友好 */
|
||||
}
|
||||
|
||||
.el-table {
|
||||
font-size: 14px !important;
|
||||
}
|
||||
|
||||
.el-table th,
|
||||
.el-table td {
|
||||
padding: 8px 4px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.page-container {
|
||||
padding: 8px;
|
||||
padding-bottom: 120px;
|
||||
}
|
||||
|
||||
.card-container {
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.el-form-item__label {
|
||||
font-size: 13px !important;
|
||||
}
|
||||
|
||||
.el-button {
|
||||
font-size: 14px !important;
|
||||
padding: 8px 15px !important;
|
||||
}
|
||||
|
||||
.el-table {
|
||||
font-size: 12px !important;
|
||||
}
|
||||
}
|
||||
|
||||
/* Element Plus 样式覆盖 */
|
||||
.el-header {
|
||||
background-color: #409eff;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.el-main {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.el-footer {
|
||||
background-color: #f8f9fa;
|
||||
color: #6c757d;
|
||||
text-align: center;
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
/* 自定义按钮样式 */
|
||||
.btn-primary {
|
||||
background-color: #409eff;
|
||||
border-color: #409eff;
|
||||
}
|
||||
|
||||
.btn-success {
|
||||
background-color: #67c23a;
|
||||
border-color: #67c23a;
|
||||
}
|
||||
|
||||
.btn-warning {
|
||||
background-color: #e6a23c;
|
||||
border-color: #e6a23c;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: #f56c6c;
|
||||
border-color: #f56c6c;
|
||||
}
|
||||
|
||||
/* 加载动画 */
|
||||
.loading-container {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
/* 空状态样式 */
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
color: #909399;
|
||||
}
|
||||
|
||||
.empty-state .el-icon {
|
||||
font-size: 64px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* 用户头像样式 */
|
||||
.user-avatar {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 50%;
|
||||
background-color: #409eff;
|
||||
color: white;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* 状态标签样式 */
|
||||
.status-tag {
|
||||
font-size: 12px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.status-published {
|
||||
background-color: #f0f9ff;
|
||||
color: #1890ff;
|
||||
border: 1px solid #d1ecf1;
|
||||
}
|
||||
|
||||
.status-draft {
|
||||
background-color: #fff7e6;
|
||||
color: #fa8c16;
|
||||
border: 1px solid #ffd591;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user