feat: implement Redux store with slices for user, order, file, and printer management
- Added Redux store configuration in `src/store/index.ts`. - Created slices for user, order, file, and printer with respective reducers and actions. - Implemented custom hooks `useAppDispatch` and `useAppSelector` for typed Redux usage. - Defined types for file, order, printer, and user in `src/types`. - Added utility functions for formatting prices, file sizes, and dates in `src/utils`. - Created common styles and animations in `src/styles` for consistent UI design. - Integrated API request handling with token management in `src/utils/request.ts`. - Implemented local storage management for user token and info in `src/utils/storage.ts`.
This commit is contained in:
@@ -1,56 +1,405 @@
|
||||
/* ============================================
|
||||
首页样式 - 爱印通
|
||||
============================================ */
|
||||
|
||||
@import '../../styles/variables.css';
|
||||
|
||||
page {
|
||||
background-color: white;
|
||||
padding : 14px;
|
||||
box-sizing : border-box;
|
||||
color : #333;
|
||||
background: linear-gradient(180deg, #e8f0fe 0%, #f0f5ff 30%, #fafbfc 100%);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
display : flex;
|
||||
.index-page {
|
||||
min-height: 100vh;
|
||||
padding-bottom: 140px;
|
||||
}
|
||||
|
||||
/* 头部区域 */
|
||||
.header {
|
||||
background: var(--primary-gradient);
|
||||
padding: 100px 32px 80px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-radius: 0 0 40px 40px;
|
||||
}
|
||||
|
||||
.header::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -30%;
|
||||
right: -15%;
|
||||
width: 350px;
|
||||
height: 350px;
|
||||
background: rgba(255, 255, 255, 0.12);
|
||||
border-radius: 50%;
|
||||
animation: float 6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.header::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -20%;
|
||||
left: -10%;
|
||||
width: 250px;
|
||||
height: 250px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 50%;
|
||||
animation: float 8s ease-in-out infinite reverse;
|
||||
}
|
||||
|
||||
@keyframes float {
|
||||
0%, 100% {
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-20px) scale(1.05);
|
||||
}
|
||||
}
|
||||
|
||||
.logo-area {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.app-title {
|
||||
font-size: 48px;
|
||||
font-weight: 700;
|
||||
color: #fff;
|
||||
letter-spacing: 4px;
|
||||
text-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.app-subtitle {
|
||||
font-size: 24px;
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
margin-top: 8px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
/* 登录按钮区域 */
|
||||
.login-section {
|
||||
padding: 0 32px;
|
||||
margin-top: -30px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
animation: slideUp 0.5s ease forwards;
|
||||
}
|
||||
|
||||
.login-btn {
|
||||
width: 100%;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid rgba(90, 147, 223, 0.2);
|
||||
color: var(--primary-color);
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
padding: 24px 0;
|
||||
border-radius: 50px;
|
||||
box-shadow: var(--shadow-lg);
|
||||
backdrop-filter: blur(10px);
|
||||
transition: all var(--transition-base);
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.login-btn::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.login-btn:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
/* 用户卡片 */
|
||||
.user-section {
|
||||
padding: 0 32px;
|
||||
margin-top: -30px;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
animation: slideUp 0.5s ease forwards;
|
||||
}
|
||||
|
||||
.user-card {
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border-radius: var(--radius-xl);
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
box-shadow: var(--shadow-lg);
|
||||
border: 1px solid rgba(255, 255, 255, 0.8);
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.avatar-wrapper {
|
||||
margin-right: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.avatar-img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
border-radius: 50%;
|
||||
border: 3px solid #fff;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.avatar-placeholder {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
background: var(--primary-gradient);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 3px solid #fff;
|
||||
box-shadow: 0 4px 12px rgba(90, 147, 223, 0.3);
|
||||
}
|
||||
|
||||
.avatar-text {
|
||||
font-size: 36px;
|
||||
color: #fff;
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.user-detail {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.user-name {
|
||||
font-size: var(--font-size-xl);
|
||||
color: var(--text-primary);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
display: block;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.user-balance {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--text-tertiary);
|
||||
}
|
||||
|
||||
.logout-btn-small {
|
||||
background: #f5f5f7;
|
||||
color: var(--text-tertiary);
|
||||
font-size: var(--font-size-xs);
|
||||
padding: 10px 20px;
|
||||
border-radius: 24px;
|
||||
border: none;
|
||||
transition: all var(--transition-base);
|
||||
}
|
||||
|
||||
.logout-btn-small:active {
|
||||
background: #e8e8ea;
|
||||
}
|
||||
|
||||
/* 快捷操作 */
|
||||
.quick-actions {
|
||||
display: flex;
|
||||
padding: 32px 24px 0;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.action-item {
|
||||
flex: 1;
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 28px 12px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
box-shadow: var(--shadow-md);
|
||||
transition: all var(--transition-base);
|
||||
border: 1px solid var(--border-light);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.action-item::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 3px;
|
||||
background: var(--primary-gradient);
|
||||
opacity: 0;
|
||||
transition: opacity var(--transition-base);
|
||||
}
|
||||
|
||||
.action-item:active {
|
||||
transform: scale(0.96);
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.action-item:active::before {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.action-item.primary {
|
||||
background: var(--primary-gradient);
|
||||
box-shadow: 0 8px 24px rgba(90, 147, 223, 0.3);
|
||||
}
|
||||
|
||||
.action-item.primary .action-text {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-item.primary .action-icon {
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.action-icon {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: linear-gradient(135deg, #f0f5ff 0%, #e8eefa 100%);
|
||||
border-radius: var(--radius-md);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 32px;
|
||||
margin-bottom: 12px;
|
||||
transition: all var(--transition-base);
|
||||
}
|
||||
|
||||
.action-text {
|
||||
font-size: var(--font-size-base);
|
||||
color: var(--text-secondary);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
/* 价目表 */
|
||||
.price-section {
|
||||
padding: 28px 24px 0;
|
||||
}
|
||||
|
||||
.price-table {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 24px;
|
||||
box-shadow: var(--shadow-md);
|
||||
border: 1px solid var(--border-light);
|
||||
}
|
||||
|
||||
.price-title {
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
color: var(--text-primary);
|
||||
display: block;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 12px;
|
||||
border-left: 4px solid var(--primary-color);
|
||||
}
|
||||
|
||||
.price-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.logo {
|
||||
.price-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 14px 12px;
|
||||
border-radius: var(--radius-sm);
|
||||
transition: background var(--transition-fast);
|
||||
}
|
||||
|
||||
.price-item:nth-child(odd) {
|
||||
background: #fafbfc;
|
||||
}
|
||||
|
||||
.price-item:nth-child(even) {
|
||||
background: var(--bg-card);
|
||||
}
|
||||
|
||||
.price-name {
|
||||
font-size: var(--font-size-base);
|
||||
color: var(--text-secondary);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: var(--font-size-md);
|
||||
color: var(--error-color);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
}
|
||||
|
||||
/* 使用提示 */
|
||||
.tips-section {
|
||||
padding: 28px 24px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.tips-card {
|
||||
background: linear-gradient(135deg, #fefcf3 0%, #fdf9f0 100%);
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 24px;
|
||||
border: 1px solid #f5e8c7;
|
||||
box-shadow: var(--shadow-sm);
|
||||
}
|
||||
|
||||
.tips-title {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: var(--font-weight-semibold);
|
||||
color: #b08945;
|
||||
display: block;
|
||||
width : 270px;
|
||||
height : 270px;
|
||||
margin : 0 auto;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.title,
|
||||
.desc {
|
||||
text-align: center;
|
||||
font-size : 32px;
|
||||
.tips-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.desc {
|
||||
margin : 20px 0;
|
||||
font-size: 28px;
|
||||
color : rgba(0, 0, 0, .85);
|
||||
.tips-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.list {
|
||||
padding : 24px 0;
|
||||
font-size : 32px;
|
||||
display : flex;
|
||||
align-items : center;
|
||||
border-color: rgba(51, 51, 51, .1);
|
||||
border-style: solid;
|
||||
border-width: 1px 0 1px 0;
|
||||
.tips-number {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
background: linear-gradient(135deg, #d4a853 0%, #c49a47 100%);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 18px;
|
||||
color: #fff;
|
||||
font-weight: var(--font-weight-medium);
|
||||
margin-right: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.list:not(:first-child) {
|
||||
border-top-width: 0;
|
||||
.tips-text {
|
||||
font-size: var(--font-size-sm);
|
||||
color: #8a7340;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.label {
|
||||
flex: 0.4;
|
||||
/* 动画 */
|
||||
@keyframes slideUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(20px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
display : block;
|
||||
width : 100%;
|
||||
background-color: transparent;
|
||||
border-radius : 2px;
|
||||
margin-top : 20px;
|
||||
/* 装饰光晕 */
|
||||
.index-page::before {
|
||||
content: '';
|
||||
position: fixed;
|
||||
top: -100px;
|
||||
right: -100px;
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
background: radial-gradient(circle, rgba(125, 179, 245, 0.1) 0%, transparent 70%);
|
||||
border-radius: 50%;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
}
|
||||
Reference in New Issue
Block a user