Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
8bf952c8ad | 5 hours ago |
|
1d05a6a2fd | 1 week ago |
@ -1,8 +0,0 @@
|
|||||||
# 默认忽略的文件
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# 基于编辑器的 HTTP 客户端请求
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module type="WEB_MODULE" version="4">
|
|
||||||
<component name="NewModuleRootManager">
|
|
||||||
<content url="file://$MODULE_DIR$">
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
||||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
||||||
</content>
|
|
||||||
<orderEntry type="inheritedJdk" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/Front.iml" filepath="$PROJECT_DIR$/.idea/Front.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,5 +0,0 @@
|
|||||||
import userApi from './user';
|
|
||||||
|
|
||||||
export {
|
|
||||||
userApi
|
|
||||||
};
|
|
@ -1,119 +0,0 @@
|
|||||||
import { get, post, put } from './request';
|
|
||||||
|
|
||||||
// 用户接口类型定义
|
|
||||||
export interface UserInfo {
|
|
||||||
username: string;
|
|
||||||
email: string;
|
|
||||||
avatar?: string;
|
|
||||||
gender?: number;
|
|
||||||
bio?: string;
|
|
||||||
birthday?: string;
|
|
||||||
studentId?: string;
|
|
||||||
department?: string;
|
|
||||||
major?: string;
|
|
||||||
grade?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface LoginParams {
|
|
||||||
email: string;
|
|
||||||
password: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RegisterParams {
|
|
||||||
email: string;
|
|
||||||
password: string;
|
|
||||||
username?: string;
|
|
||||||
nickname?: string;
|
|
||||||
studentId?: string;
|
|
||||||
department?: string;
|
|
||||||
major?: string;
|
|
||||||
grade?: string;
|
|
||||||
code: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface EmailCodeParams {
|
|
||||||
email: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface VerifyCodeParams {
|
|
||||||
email: string;
|
|
||||||
code: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UpdateProfileParams {
|
|
||||||
username?: string;
|
|
||||||
bio?: string;
|
|
||||||
gender?: number;
|
|
||||||
birthday?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface UpdatePasswordParams {
|
|
||||||
code: string;
|
|
||||||
newPassword: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 用户API
|
|
||||||
export default {
|
|
||||||
// 登录
|
|
||||||
login(data: LoginParams) {
|
|
||||||
return post<{code: number; data: {token: string}}>(
|
|
||||||
'/users/login',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 注册
|
|
||||||
register(data: RegisterParams) {
|
|
||||||
return post<{code: number; data: {token: string}}>(
|
|
||||||
'/users/register',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取邮箱验证码
|
|
||||||
getEmailCode(data: EmailCodeParams) {
|
|
||||||
return post<{code: number; message: string}>(
|
|
||||||
'/users/code',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 验证邮箱验证码
|
|
||||||
verifyEmailCode(data: VerifyCodeParams) {
|
|
||||||
return post<{code: number; data: {token: string}}>(
|
|
||||||
'/users/login/code',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
getUserInfo() {
|
|
||||||
return get<{code: number; data: UserInfo}>(
|
|
||||||
'/users/info'
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 更新用户资料
|
|
||||||
updateProfile(data: UpdateProfileParams) {
|
|
||||||
return put<{code: number; message: string}>(
|
|
||||||
'/users/profile',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 更新用户密码
|
|
||||||
updatePassword(data: UpdatePasswordParams) {
|
|
||||||
return put<{code: number; message: string}>(
|
|
||||||
'/users/password',
|
|
||||||
data
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 上传头像
|
|
||||||
uploadAvatar(formData: FormData) {
|
|
||||||
return post<{code: number; data: {avatarUrl: string}}>(
|
|
||||||
'/users/avatar',
|
|
||||||
formData
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 24 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 231 KiB |
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,118 @@
|
|||||||
|
:root {
|
||||||
|
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
font-weight: 400;
|
||||||
|
|
||||||
|
color-scheme: light dark;
|
||||||
|
color: rgba(255, 255, 255, 0.87);
|
||||||
|
background-color: #242424;
|
||||||
|
|
||||||
|
font-synthesis: none;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
place-items: center;
|
||||||
|
min-width: 320px;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 3.2em;
|
||||||
|
line-height: 1.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
border-radius: 8px;
|
||||||
|
border:none;
|
||||||
|
padding: 0.6em 1.2em;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: border-color 0.25s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*除了LogPage以外的按钮尽量使用这里的样式*/
|
||||||
|
.btn {
|
||||||
|
outline:none;
|
||||||
|
padding: 10px 24px;
|
||||||
|
margin:10px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 25px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: #9370DB;
|
||||||
|
color: white;
|
||||||
|
box-shadow: 0 4px 10px rgba(147, 112, 219, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #8a63d2;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary {
|
||||||
|
background-color: #e6e6fa;
|
||||||
|
color: #666;
|
||||||
|
box-shadow: 0 4px 10px rgba(230, 230, 250, 0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-secondary:hover {
|
||||||
|
background-color: #dcdcdc;
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*信息展示在card上*/
|
||||||
|
.card {
|
||||||
|
background-color: #fff;
|
||||||
|
border-radius: 20px;
|
||||||
|
padding: 30px;
|
||||||
|
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
|
||||||
|
transition: transform 0.3s ease, box-shadow 0.3s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card:hover {
|
||||||
|
transform: translateY(-5px);
|
||||||
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
#app {
|
||||||
|
width: 100vw;
|
||||||
|
height: 100vh;
|
||||||
|
min-height: 100vh;
|
||||||
|
min-width: 100vw;
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
justify-content:center;
|
||||||
|
align-items:center;
|
||||||
|
flex-direction: column;
|
||||||
|
box-sizing: border-box;
|
||||||
|
overflow:auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: light) {
|
||||||
|
:root {
|
||||||
|
color: #213547;
|
||||||
|
background-color: #ffffff;
|
||||||
|
}
|
||||||
|
a:hover {
|
||||||
|
color: #747bff;
|
||||||
|
}
|
||||||
|
button {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const images = [
|
||||||
|
new URL('@/assets/logo-carousel/1.jpeg', import.meta.url).href,
|
||||||
|
new URL('@/assets/logo-carousel/2.png', import.meta.url).href,
|
||||||
|
new URL('@/assets/logo-carousel/3.jpg', import.meta.url).href
|
||||||
|
]
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<el-carousel :interval="3000" height="300px" arrow="hover">
|
||||||
|
<el-carousel-item v-for="(img, i) in images" :key="i">
|
||||||
|
<img :src="img" class="carousel-img" />
|
||||||
|
</el-carousel-item>
|
||||||
|
</el-carousel>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.carousel-img {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
object-fit: cover;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
@ -1,76 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useUIStore } from '../stores';
|
|
||||||
|
|
||||||
const uiStore = useUIStore();
|
|
||||||
|
|
||||||
// 计算是否显示加载状态
|
|
||||||
const isVisible = computed(() => uiStore.isLoading);
|
|
||||||
const loadingText = computed(() => uiStore.loadingText);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<transition name="fade">
|
|
||||||
<div v-if="isVisible" class="loading-overlay">
|
|
||||||
<div class="loading-container">
|
|
||||||
<div class="loading-spinner"></div>
|
|
||||||
<div class="loading-text">{{ loadingText }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</transition>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.loading-overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-container {
|
|
||||||
background-color: white;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-spinner {
|
|
||||||
width: 40px;
|
|
||||||
height: 40px;
|
|
||||||
border: 4px solid var(--secondary-color);
|
|
||||||
border-top: 4px solid var(--primary-color);
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-text {
|
|
||||||
color: var(--text-primary);
|
|
||||||
font-size: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes spin {
|
|
||||||
0% { transform: rotate(0deg); }
|
|
||||||
100% { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-active,
|
|
||||||
.fade-leave-active {
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-enter-from,
|
|
||||||
.fade-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -0,0 +1,101 @@
|
|||||||
|
<script setup>
|
||||||
|
import { House, Cloudy, User, Cpu, Message, HomeFilled, MessageBox, Calendar } from '@element-plus/icons-vue'
|
||||||
|
import {useRoute} from 'vue-router'
|
||||||
|
|
||||||
|
const route = useRoute();
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<header class ="header-bar" >
|
||||||
|
<!-- 左侧图标组 -->
|
||||||
|
<div class="left-icons">
|
||||||
|
<router-link to="/unilifeHome" class="icon-btn" title="首页">
|
||||||
|
<el-icon class="icon-btn" :size="24">
|
||||||
|
<HomeFilled />
|
||||||
|
</el-icon>
|
||||||
|
</router-link>
|
||||||
|
<router-link to="/cloud" class="icon-btn" title="资料分享">
|
||||||
|
<el-icon class="icon-btn" :size="24">
|
||||||
|
<MessageBox />
|
||||||
|
</el-icon>
|
||||||
|
</router-link>
|
||||||
|
<router-link to="/self" class="icon-btn" title="日程">
|
||||||
|
<el-icon class = "icon-btn" :size="24">
|
||||||
|
<Calendar />
|
||||||
|
</el-icon>
|
||||||
|
</router-link>
|
||||||
|
<router-link to="/assistant" class="icon-btn" title="AI助手">
|
||||||
|
<el-icon class = "icon-btn" :size="24">
|
||||||
|
<Cpu />
|
||||||
|
</el-icon>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 右侧部分 -->
|
||||||
|
<div class="right-section">
|
||||||
|
<router-link to="/message" class="icon-btn" title="消息">
|
||||||
|
<Message size="24" />
|
||||||
|
</router-link>
|
||||||
|
<router-link to="/personal" class="user-entry" title="个人主页">
|
||||||
|
<span>个人主页</span>
|
||||||
|
</router-link>
|
||||||
|
<router-link to="/log" class="icon-btn" title="登录">
|
||||||
|
<el-icon class = "icon-btn" :size="24">
|
||||||
|
<User />
|
||||||
|
</el-icon>
|
||||||
|
</router-link>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.header-bar {
|
||||||
|
height: 70px;
|
||||||
|
width: 100%;
|
||||||
|
background: #ead1fb;
|
||||||
|
position:absolute;
|
||||||
|
top: 0;
|
||||||
|
left:0;
|
||||||
|
padding:0;
|
||||||
|
margin:0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
||||||
|
|
||||||
|
z-index: 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-bar--personal {
|
||||||
|
background: linear-gradient(to top, #c9e4ff, #fad0c4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.left-icons,
|
||||||
|
.right-section {
|
||||||
|
padding:50px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn {
|
||||||
|
margin: 0 10px;
|
||||||
|
color: #606266;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: transform 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-btn:hover {
|
||||||
|
transform: scale(1.1);
|
||||||
|
color: #409EFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-entry {
|
||||||
|
margin-left: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,26 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{ title: string; link: string }>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<router-link :to="link" class="hot-topic-item">
|
||||||
|
{{ title }}
|
||||||
|
</router-link>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.hot-topic-item {
|
||||||
|
display: block;
|
||||||
|
background-color: #fbefff;
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 10px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
color: #333;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #e4d4ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,41 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
post: {
|
||||||
|
title: string
|
||||||
|
tags: string[]
|
||||||
|
excerpt: string
|
||||||
|
link: string
|
||||||
|
}
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<router-link :to="post.link" class="post-card">
|
||||||
|
<h3>{{ post.title }}</h3>
|
||||||
|
<div class="tags">
|
||||||
|
<el-tag v-for="(tag, i) in post.tags" :key="i" type="info">{{ tag }}</el-tag>
|
||||||
|
</div>
|
||||||
|
<p>{{ post.excerpt }}</p>
|
||||||
|
</router-link>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.post-card {
|
||||||
|
display: block;
|
||||||
|
padding: 16px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||||
|
transition: transform 0.2s;
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
transform: translateY(-2px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tags {
|
||||||
|
margin: 8px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,27 @@
|
|||||||
|
import request from "../../src/utils/request"
|
||||||
|
|
||||||
|
|
||||||
|
export function useEmailCode(){
|
||||||
|
const sendEmailCode = async(email:string) =>
|
||||||
|
{
|
||||||
|
return await request.post('/user/code',
|
||||||
|
{
|
||||||
|
params:{email:email}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const verifyEmailCode = async(email:string,code:string) =>
|
||||||
|
{
|
||||||
|
return await request.post('users/login/code',
|
||||||
|
{
|
||||||
|
params:{email:email,code:code}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return{
|
||||||
|
sendEmailCode,
|
||||||
|
verifyEmailCode
|
||||||
|
}
|
||||||
|
}
|
@ -1,79 +0,0 @@
|
|||||||
import { ref } from 'vue';
|
|
||||||
import { userApi } from '../api';
|
|
||||||
import { ElMessage } from 'element-plus';
|
|
||||||
|
|
||||||
export function useEmailCode() {
|
|
||||||
const isSending = ref(false);
|
|
||||||
const countdown = ref(0);
|
|
||||||
let timer: number | null = null;
|
|
||||||
|
|
||||||
// 发送邮箱验证码
|
|
||||||
const sendEmailCode = async (email: string) => {
|
|
||||||
if (isSending.value) return;
|
|
||||||
|
|
||||||
if (!email) {
|
|
||||||
ElMessage.warning('请输入邮箱地址');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
isSending.value = true;
|
|
||||||
const res = await userApi.getEmailCode({ email });
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
|
||||||
ElMessage.success('验证码已发送,请查收邮件');
|
|
||||||
startCountdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('发送验证码失败:', error);
|
|
||||||
ElMessage.error('发送验证码失败,请稍后重试');
|
|
||||||
} finally {
|
|
||||||
isSending.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 验证邮箱验证码
|
|
||||||
const verifyEmailCode = async (email: string, code: string) => {
|
|
||||||
if (!email || !code) {
|
|
||||||
ElMessage.warning('请输入邮箱和验证码');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const res = await userApi.verifyEmailCode({ email, code });
|
|
||||||
return res;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('验证码验证失败:', error);
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 开始倒计时
|
|
||||||
const startCountdown = () => {
|
|
||||||
countdown.value = 60;
|
|
||||||
|
|
||||||
if (timer) {
|
|
||||||
clearInterval(timer);
|
|
||||||
}
|
|
||||||
|
|
||||||
timer = window.setInterval(() => {
|
|
||||||
if (countdown.value > 0) {
|
|
||||||
countdown.value--;
|
|
||||||
} else {
|
|
||||||
if (timer) {
|
|
||||||
clearInterval(timer);
|
|
||||||
timer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
isSending,
|
|
||||||
countdown,
|
|
||||||
sendEmailCode,
|
|
||||||
verifyEmailCode
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,26 +1,16 @@
|
|||||||
import { createApp } from 'vue';
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia';
|
import '@/assets/style/style.css'
|
||||||
import ElementPlus from 'element-plus';
|
import App from './App.vue'
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue';
|
import ElementPlus from 'element-plus'
|
||||||
import App from './App.vue';
|
import 'element-plus/dist/index.css'
|
||||||
import router from './router';
|
import router from './routers/routers'
|
||||||
|
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// 样式
|
const app = createApp(App)
|
||||||
import 'element-plus/dist/index.css';
|
|
||||||
import './styles/global.css';
|
|
||||||
|
|
||||||
// 创建应用实例
|
app.use(ElementPlus)
|
||||||
const app = createApp(App);
|
app.use(router)
|
||||||
|
for(const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
// 使用插件
|
app.component(key, component)
|
||||||
app.use(createPinia());
|
|
||||||
app.use(ElementPlus);
|
|
||||||
app.use(router);
|
|
||||||
|
|
||||||
// 注册所有Element Plus图标
|
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
||||||
app.component(key, component);
|
|
||||||
}
|
}
|
||||||
|
app.mount('#app')
|
||||||
// 挂载应用
|
|
||||||
app.mount('#app');
|
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
import { createRouter, createWebHistory } from 'vue-router';
|
|
||||||
import type { RouteRecordRaw } from 'vue-router';
|
|
||||||
import { useUserStore } from '../stores';
|
|
||||||
|
|
||||||
// 布局
|
|
||||||
import BaseLayout from '../layouts/BaseLayout.vue';
|
|
||||||
import PersonalLayout from '../layouts/PersonalLayout.vue';
|
|
||||||
|
|
||||||
// 页面
|
|
||||||
import Login from '../views/Login.vue';
|
|
||||||
import Home from '../views/Home.vue';
|
|
||||||
import AccountManager from '../views/AccountManager.vue';
|
|
||||||
import NotFound from '../views/NotFound.vue';
|
|
||||||
|
|
||||||
// 路由配置
|
|
||||||
const routes: Array<RouteRecordRaw> = [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
component: BaseLayout,
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
redirect: '/login'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'login',
|
|
||||||
name: 'Login',
|
|
||||||
component: Login,
|
|
||||||
meta: {
|
|
||||||
title: '登录 - UniLife学生论坛',
|
|
||||||
requiresAuth: false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/personal',
|
|
||||||
component: PersonalLayout,
|
|
||||||
meta: {
|
|
||||||
requiresAuth: true
|
|
||||||
},
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
name: 'Home',
|
|
||||||
component: Home,
|
|
||||||
meta: {
|
|
||||||
title: '个人主页 - UniLife学生论坛',
|
|
||||||
requiresAuth: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'account',
|
|
||||||
name: 'AccountManager',
|
|
||||||
component: AccountManager,
|
|
||||||
meta: {
|
|
||||||
title: '账号管理 - UniLife学生论坛',
|
|
||||||
requiresAuth: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 其他个人中心页面可以在这里添加
|
|
||||||
{
|
|
||||||
path: 'posts',
|
|
||||||
name: 'Posts',
|
|
||||||
component: () => import('../views/NotFound.vue'), // 暂时使用NotFound页面
|
|
||||||
meta: {
|
|
||||||
title: '我的帖子 - UniLife学生论坛',
|
|
||||||
requiresAuth: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'messages',
|
|
||||||
name: 'Messages',
|
|
||||||
component: () => import('../views/NotFound.vue'), // 暂时使用NotFound页面
|
|
||||||
meta: {
|
|
||||||
title: '消息中心 - UniLife学生论坛',
|
|
||||||
requiresAuth: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: 'settings',
|
|
||||||
name: 'Settings',
|
|
||||||
component: () => import('../views/NotFound.vue'), // 暂时使用NotFound页面
|
|
||||||
meta: {
|
|
||||||
title: '设置 - UniLife学生论坛',
|
|
||||||
requiresAuth: true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/:pathMatch(.*)*',
|
|
||||||
name: 'NotFound',
|
|
||||||
component: NotFound,
|
|
||||||
meta: {
|
|
||||||
title: '页面不存在 - UniLife学生论坛'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
|
||||||
routes
|
|
||||||
});
|
|
||||||
|
|
||||||
// 全局前置守卫
|
|
||||||
router.beforeEach((to, from, next) => {
|
|
||||||
// 设置页面标题
|
|
||||||
document.title = to.meta.title as string || 'UniLife学生论坛';
|
|
||||||
|
|
||||||
// 检查是否需要登录权限
|
|
||||||
if (to.matched.some(record => record.meta.requiresAuth)) {
|
|
||||||
const userStore = useUserStore();
|
|
||||||
|
|
||||||
// 如果需要登录但用户未登录,重定向到登录页
|
|
||||||
if (!userStore.isLoggedIn) {
|
|
||||||
next({
|
|
||||||
path: '/login',
|
|
||||||
query: { redirect: to.fullPath }
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
next();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
export default router;
|
|
@ -0,0 +1,57 @@
|
|||||||
|
import type { RouteRecord, RouteRecordRaw } from 'vue-router';
|
||||||
|
import { createWebHashHistory, createRouter,createWebHistory } from 'vue-router';
|
||||||
|
import LogPage from '../views/LogPage.vue';
|
||||||
|
import Personal from '@/components/Personal.vue';
|
||||||
|
import Manager from '@/views/AcountManager.vue';
|
||||||
|
import PersonalHome from '@/views/Home.vue';
|
||||||
|
import ForumHome from '@/views/ForumHome.vue';
|
||||||
|
|
||||||
|
const routes:Array<RouteRecordRaw> = [
|
||||||
|
{
|
||||||
|
path: '/',
|
||||||
|
redirect: '/log',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/:pathMatch(.*)*',
|
||||||
|
name: 'NotFound',
|
||||||
|
component: () => import('@/views/404.vue'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path:'/log',
|
||||||
|
name: 'LogPage',
|
||||||
|
component: LogPage
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path:'/personal',
|
||||||
|
name: 'Personal',
|
||||||
|
component: Personal,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path:'',
|
||||||
|
name:'Home',
|
||||||
|
component:PersonalHome,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path:'manager',
|
||||||
|
name: 'Manager',
|
||||||
|
component:Manager,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path:'ai',
|
||||||
|
redirect: '/personal',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path:'/uniLifeHome',
|
||||||
|
name: 'ForumHome',
|
||||||
|
component: ForumHome,
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history: createWebHistory(import.meta.env.BASE_URL),
|
||||||
|
routes
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
@ -1,7 +0,0 @@
|
|||||||
import { useUserStore } from './user';
|
|
||||||
import { useUIStore } from './ui';
|
|
||||||
|
|
||||||
export {
|
|
||||||
useUserStore,
|
|
||||||
useUIStore
|
|
||||||
};
|
|
@ -1,66 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
export const useUIStore = defineStore('ui', () => {
|
|
||||||
// 状态
|
|
||||||
const isMobileView = ref(false);
|
|
||||||
const isSidebarCollapsed = ref(false);
|
|
||||||
const isDarkMode = ref(false);
|
|
||||||
const isLoading = ref(false);
|
|
||||||
const loadingText = ref('加载中...');
|
|
||||||
|
|
||||||
// 检测是否为移动视图
|
|
||||||
const checkMobileView = () => {
|
|
||||||
isMobileView.value = window.innerWidth < 768;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 切换侧边栏状态
|
|
||||||
const toggleSidebar = () => {
|
|
||||||
isSidebarCollapsed.value = !isSidebarCollapsed.value;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 切换暗黑模式
|
|
||||||
const toggleDarkMode = () => {
|
|
||||||
isDarkMode.value = !isDarkMode.value;
|
|
||||||
|
|
||||||
// 应用暗黑模式到文档
|
|
||||||
if (isDarkMode.value) {
|
|
||||||
document.documentElement.classList.add('dark-mode');
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.remove('dark-mode');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 设置加载状态
|
|
||||||
const setLoading = (loading: boolean, text?: string) => {
|
|
||||||
isLoading.value = loading;
|
|
||||||
if (text) {
|
|
||||||
loadingText.value = text;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 初始化
|
|
||||||
const initialize = () => {
|
|
||||||
// 检测移动视图
|
|
||||||
checkMobileView();
|
|
||||||
window.addEventListener('resize', checkMobileView);
|
|
||||||
|
|
||||||
// 检测系统暗黑模式偏好
|
|
||||||
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
||||||
if (prefersDarkMode) {
|
|
||||||
toggleDarkMode();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
isMobileView,
|
|
||||||
isSidebarCollapsed,
|
|
||||||
isDarkMode,
|
|
||||||
isLoading,
|
|
||||||
loadingText,
|
|
||||||
toggleSidebar,
|
|
||||||
toggleDarkMode,
|
|
||||||
setLoading,
|
|
||||||
initialize
|
|
||||||
};
|
|
||||||
});
|
|
@ -1,187 +0,0 @@
|
|||||||
import { defineStore } from 'pinia';
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import userApi from '../api/user';
|
|
||||||
import type { UserInfo } from '../api/user';
|
|
||||||
import { ElMessage } from 'element-plus';
|
|
||||||
|
|
||||||
export const useUserStore = defineStore('user', () => {
|
|
||||||
// 状态
|
|
||||||
const token = ref<string>(localStorage.getItem('token') || '');
|
|
||||||
const userInfo = ref<UserInfo | null>(null);
|
|
||||||
const isLoggedIn = ref<boolean>(!!token.value);
|
|
||||||
const loading = ref<boolean>(false);
|
|
||||||
|
|
||||||
// 设置token
|
|
||||||
const setToken = (newToken: string) => {
|
|
||||||
token.value = newToken;
|
|
||||||
localStorage.setItem('token', newToken);
|
|
||||||
isLoggedIn.value = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 清除token
|
|
||||||
const clearToken = () => {
|
|
||||||
token.value = '';
|
|
||||||
localStorage.removeItem('token');
|
|
||||||
isLoggedIn.value = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 登录
|
|
||||||
const login = async (email: string, password: string) => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await userApi.login({ email, password });
|
|
||||||
|
|
||||||
if (res.code === 200 && res.data.token) {
|
|
||||||
setToken(res.data.token);
|
|
||||||
ElMessage.success('登录成功');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('登录失败:', error);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 通过验证码登录
|
|
||||||
const loginWithCode = async (email: string, code: string) => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await userApi.verifyEmailCode({ email, code });
|
|
||||||
|
|
||||||
if (res.code === 200 && res.data.token) {
|
|
||||||
setToken(res.data.token);
|
|
||||||
ElMessage.success('登录成功');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('登录失败:', error);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 注册
|
|
||||||
const register = async (email: string, password: string, code: string) => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
|
|
||||||
const res = await userApi.register({ email, password, code });
|
|
||||||
|
|
||||||
if (res.code === 200 && res.data.token) {
|
|
||||||
setToken(res.data.token);
|
|
||||||
ElMessage.success('注册成功');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('注册失败:', error);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 登出
|
|
||||||
const logout = () => {
|
|
||||||
clearToken();
|
|
||||||
userInfo.value = null;
|
|
||||||
ElMessage.success('已退出登录');
|
|
||||||
};
|
|
||||||
|
|
||||||
// 获取用户信息
|
|
||||||
const fetchUserInfo = async () => {
|
|
||||||
if (!token.value) return null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await userApi.getUserInfo();
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
|
||||||
userInfo.value = res.data;
|
|
||||||
return res.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('获取用户信息失败:', error);
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 更新用户资料
|
|
||||||
const updateProfile = async (data: {
|
|
||||||
username?: string;
|
|
||||||
bio?: string;
|
|
||||||
gender?: number;
|
|
||||||
birthday?: string;
|
|
||||||
}) => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await userApi.updateProfile(data);
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
|
||||||
// 更新本地用户信息
|
|
||||||
if (userInfo.value) {
|
|
||||||
userInfo.value = {
|
|
||||||
...userInfo.value,
|
|
||||||
...data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
ElMessage.success('个人资料更新成功');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('更新个人资料失败:', error);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// 更新密码
|
|
||||||
const updatePassword = async (code: string, newPassword: string) => {
|
|
||||||
try {
|
|
||||||
loading.value = true;
|
|
||||||
const res = await userApi.updatePassword({ code, newPassword });
|
|
||||||
|
|
||||||
if (res.code === 200) {
|
|
||||||
ElMessage.success('密码修改成功');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('修改密码失败:', error);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
|
||||||
token,
|
|
||||||
userInfo,
|
|
||||||
isLoggedIn,
|
|
||||||
loading,
|
|
||||||
login,
|
|
||||||
loginWithCode,
|
|
||||||
register,
|
|
||||||
logout,
|
|
||||||
fetchUserInfo,
|
|
||||||
updateProfile,
|
|
||||||
updatePassword
|
|
||||||
};
|
|
||||||
});
|
|
@ -1,151 +0,0 @@
|
|||||||
@import './variables.css';
|
|
||||||
@import './reset.css';
|
|
||||||
|
|
||||||
/* 全局样式 */
|
|
||||||
body {
|
|
||||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-weight: 400;
|
|
||||||
color: var(--text-primary);
|
|
||||||
background-color: var(--bg-primary);
|
|
||||||
min-height: 100vh;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#app {
|
|
||||||
width: 100%;
|
|
||||||
height: 100vh;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 通用容器 */
|
|
||||||
.container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: var(--content-max-width);
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: var(--spacing-lg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 卡片样式 */
|
|
||||||
.card {
|
|
||||||
background-color: var(--bg-primary);
|
|
||||||
border-radius: var(--border-radius-lg);
|
|
||||||
padding: var(--spacing-xl);
|
|
||||||
box-shadow: var(--shadow-md);
|
|
||||||
transition: transform var(--transition-normal), box-shadow var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: var(--shadow-lg);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 按钮样式 */
|
|
||||||
.btn {
|
|
||||||
border: none;
|
|
||||||
border-radius: var(--border-radius-md);
|
|
||||||
padding: var(--spacing-sm) var(--spacing-lg);
|
|
||||||
font-size: var(--font-size-md);
|
|
||||||
font-weight: 500;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: white;
|
|
||||||
box-shadow: 0 4px 10px rgba(147, 112, 219, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background-color: var(--primary-dark);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 6px 12px rgba(147, 112, 219, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
background-color: var(--secondary-color);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
box-shadow: 0 4px 10px rgba(230, 230, 250, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
background-color: #dcdcdc;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 6px 12px rgba(230, 230, 250, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 表单样式 */
|
|
||||||
.form-group {
|
|
||||||
margin-bottom: var(--spacing-md);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-label {
|
|
||||||
width: 100px;
|
|
||||||
font-size: var(--font-size-lg);
|
|
||||||
color: var(--text-secondary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input {
|
|
||||||
flex: 1;
|
|
||||||
padding: var(--spacing-sm) var(--spacing-md);
|
|
||||||
border: 2px solid var(--border-color);
|
|
||||||
border-radius: var(--border-radius-md);
|
|
||||||
outline: none;
|
|
||||||
transition: border-color var(--transition-normal);
|
|
||||||
font-size: var(--font-size-md);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-input:focus {
|
|
||||||
border-color: var(--primary-light);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 响应式设计 */
|
|
||||||
@media (max-width: 1024px) {
|
|
||||||
.container {
|
|
||||||
padding: var(--spacing-md);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.form-group {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-label {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: var(--spacing-xs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 动画 */
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.fade-in {
|
|
||||||
animation: fadeIn var(--transition-normal);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes float {
|
|
||||||
0%, 100% {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
transform: translateY(-10px);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.float {
|
|
||||||
animation: float 5s ease-in-out infinite;
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/* CSS Reset */
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
html, body {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
line-height: 1.5;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
-moz-osx-font-smoothing: grayscale;
|
|
||||||
}
|
|
||||||
|
|
||||||
img, picture, video, canvas, svg {
|
|
||||||
display: block;
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
input, button, textarea, select {
|
|
||||||
font: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, h1, h2, h3, h4, h5, h6 {
|
|
||||||
overflow-wrap: break-word;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul, ol {
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
background: none;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
:root {
|
|
||||||
/* 主题颜色 */
|
|
||||||
--primary-color: #9370DB;
|
|
||||||
--primary-light: #b19cd9;
|
|
||||||
--primary-dark: #8a63d2;
|
|
||||||
--secondary-color: #e6e6fa;
|
|
||||||
|
|
||||||
/* 文本颜色 */
|
|
||||||
--text-primary: #333333;
|
|
||||||
--text-secondary: #666666;
|
|
||||||
--text-light: #999999;
|
|
||||||
|
|
||||||
/* 背景颜色 */
|
|
||||||
--bg-primary: #ffffff;
|
|
||||||
--bg-secondary: #f9f7ff;
|
|
||||||
--bg-gradient: linear-gradient(200deg, #f3e7e9, #e3eeff);
|
|
||||||
|
|
||||||
/* 边框颜色 */
|
|
||||||
--border-color: #e6e6fa;
|
|
||||||
|
|
||||||
/* 阴影 */
|
|
||||||
--shadow-sm: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
||||||
--shadow-md: 0 5px 15px rgba(0, 0, 0, 0.05);
|
|
||||||
--shadow-lg: 0 8px 20px rgba(0, 0, 0, 0.1);
|
|
||||||
|
|
||||||
/* 圆角 */
|
|
||||||
--border-radius-sm: 5px;
|
|
||||||
--border-radius-md: 10px;
|
|
||||||
--border-radius-lg: 20px;
|
|
||||||
--border-radius-full: 50%;
|
|
||||||
|
|
||||||
/* 间距 */
|
|
||||||
--spacing-xs: 5px;
|
|
||||||
--spacing-sm: 10px;
|
|
||||||
--spacing-md: 15px;
|
|
||||||
--spacing-lg: 20px;
|
|
||||||
--spacing-xl: 30px;
|
|
||||||
|
|
||||||
/* 字体大小 */
|
|
||||||
--font-size-xs: 0.75rem;
|
|
||||||
--font-size-sm: 0.875rem;
|
|
||||||
--font-size-md: 1rem;
|
|
||||||
--font-size-lg: 1.25rem;
|
|
||||||
--font-size-xl: 1.5rem;
|
|
||||||
--font-size-xxl: 2rem;
|
|
||||||
|
|
||||||
/* 过渡 */
|
|
||||||
--transition-fast: 0.2s ease;
|
|
||||||
--transition-normal: 0.3s ease;
|
|
||||||
--transition-slow: 0.5s ease;
|
|
||||||
|
|
||||||
/* 布局 */
|
|
||||||
--sidebar-width: 84px;
|
|
||||||
--sidebar-width-expanded: 300px;
|
|
||||||
--header-height: 60px;
|
|
||||||
--content-max-width: 1280px;
|
|
||||||
}
|
|
@ -0,0 +1,37 @@
|
|||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const service = axios.create({
|
||||||
|
baseURL: 'http://localhost:8080',
|
||||||
|
timeout: 5000
|
||||||
|
});
|
||||||
|
|
||||||
|
service.interceptors.request.use(
|
||||||
|
config => {
|
||||||
|
const token = localStorage.getItem('token');
|
||||||
|
if (token) {
|
||||||
|
console.log("前端发送信息");
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ console.log("没有token");
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// 对请求错误做些什么
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
service.interceptors.response.use(
|
||||||
|
response => {
|
||||||
|
console.log("后端返回信息");
|
||||||
|
return response.data;
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// 对响应错误做些什么
|
||||||
|
return Promise.reject(error);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export default service;
|
After Width: | Height: | Size: 5.7 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 5.8 KiB |
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 6.7 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 6.5 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 8.4 KiB |
After Width: | Height: | Size: 16 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 2.5 KiB |