Compare commits

..

3 Commits

Author SHA1 Message Date
ChoChoX
e1e45cee1a feat: 更新项目代码 2026-06-15 21:05:05 +08:00
Kyaru
cbbade3b9c Merge branch 'main' of https://chochox.asia/ChoChoX/backmanagerweb 2026-06-15 20:53:55 +08:00
Kyaru
b067ea3723 首页和第一页的部分完成,css部分待完善 2026-06-15 20:49:34 +08:00
25 changed files with 3065 additions and 2699 deletions

48
.gitignore vendored
View File

@@ -1,24 +1,24 @@
# Logs # Logs
logs logs
*.log *.log
npm-debug.log* npm-debug.log*
yarn-debug.log* yarn-debug.log*
yarn-error.log* yarn-error.log*
pnpm-debug.log* pnpm-debug.log*
lerna-debug.log* lerna-debug.log*
node_modules node_modules
dist dist
dist-ssr dist-ssr
*.local *.local
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*
!.vscode/extensions.json !.vscode/extensions.json
.idea .idea
.DS_Store .DS_Store
*.suo *.suo
*.ntvs* *.ntvs*
*.njsproj *.njsproj
*.sln *.sln
*.sw? *.sw?

View File

@@ -1,3 +1,3 @@
{ {
"recommendations": ["Vue.volar"] "recommendations": ["Vue.volar"]
} }

View File

@@ -1,5 +1,5 @@
# Vue 3 + Vite # Vue 3 + Vite
This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more. This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support). Learn more about IDE Support for Vue in the [Vue Docs Scaling up Guide](https://vuejs.org/guide/scaling-up/tooling.html#ide-support).

View File

@@ -1,13 +1,13 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link href="/favicon.svg" rel="icon" type="image/svg+xml" /> <link href="/favicon.svg" rel="icon" type="image/svg+xml" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" /> <meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>backmanagerweb</title> <title>backmanagerweb</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
<script src="/src/main.js" type="module"></script> <script src="/src/main.js" type="module"></script>
</body> </body>
</html> </html>

2578
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
{ {
"name": "backmanagerweb", "name": "backmanagerweb",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "^2.3.2", "@element-plus/icons-vue": "^2.3.2",
"axios": "^1.17.0", "element-china-area-data": "^6.1.0",
"element-plus": "^2.14.1", "element-plus": "^2.14.1",
"pinia": "^3.0.4", "pinia": "^3.0.4",
"vue": "^3.5.34", "vue": "^3.5.34",
"vue-router": "4" "vue-router": "4"
}, },
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^6.0.6", "@vitejs/plugin-vue": "^6.0.6",
"vite": "^8.0.12" "vite": "^8.0.12"
} }
} }

View File

@@ -1,24 +1,24 @@
<svg xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg">
<symbol id="bluesky-icon" viewBox="0 0 16 17"> <symbol id="bluesky-icon" viewBox="0 0 16 17">
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g> <g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs> <defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
</symbol> </symbol>
<symbol id="discord-icon" viewBox="0 0 20 19"> <symbol id="discord-icon" viewBox="0 0 20 19">
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/> <path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
</symbol> </symbol>
<symbol id="documentation-icon" viewBox="0 0 21 20"> <symbol id="documentation-icon" viewBox="0 0 21 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/> <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/> <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/> <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
</symbol> </symbol>
<symbol id="github-icon" viewBox="0 0 19 19"> <symbol id="github-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/> <path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
</symbol> </symbol>
<symbol id="social-icon" viewBox="0 0 20 20"> <symbol id="social-icon" viewBox="0 0 20 20">
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/> <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/> <path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
</symbol> </symbol>
<symbol id="x-icon" viewBox="0 0 19 19"> <symbol id="x-icon" viewBox="0 0 19 19">
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/> <path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
</symbol> </symbol>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
public/mixue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

View File

@@ -1,3 +1,3 @@
<template> <template>
<router-view /> <router-view />
</template> </template>

View File

@@ -1,46 +1,46 @@
import axios from 'axios' import axios from 'axios'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import {useUserStore} from '@/stores/user' import {useUserStore} from '@/stores/user'
import router from '@/router' import router from '@/router'
const request = axios.create({ const request = axios.create({
baseURL: '/api', baseURL: '/api',
timeout: 10000, timeout: 10000,
}) })
// 请求拦截:自动带 token // 请求拦截:自动带 token
request.interceptors.request.use( request.interceptors.request.use(
(config) => { (config) => {
const userStore = useUserStore() const userStore = useUserStore()
if (userStore.token){ if (userStore.token){
config.headers.Authorization = `Bearer ${userStore.token}` config.headers.Authorization = `Bearer ${userStore.token}`
} }
return config return config
}, },
(err) => Promise.reject(err) (err) => Promise.reject(err)
) )
// 响应拦截:统一处理 { code, data, message } + 401 跳登录 // 响应拦截:统一处理 { code, data, message } + 401 跳登录
request.interceptors.response.use( request.interceptors.response.use(
(res) => { (res) => {
const body = res.data const body = res.data
if (typeof body?.code === 'undefined') return res.data if (typeof body?.code === 'undefined') return res.data
if (body.code === 0) return body.data if (body.code === 0) return body.data
ElMessage.error(body.message || '请求失败') ElMessage.error(body.message || '请求失败')
return Promise.reject(new Error(body.message || '请求失败')) return Promise.reject(new Error(body.message || '请求失败'))
}, },
(err) => { (err) => {
const status = err.response?.status const status = err.response?.status
if (status === 401) { if (status === 401) {
const userStore = useUserStore() const userStore = useUserStore()
userStore.logout() userStore.logout()
ElMessage.error('登录已过期,请重新登录') ElMessage.error('登录已过期,请重新登录')
router.push('/login') router.push('/login')
}else { }else {
ElMessage.error(err.response?.data?.message || err.message || '网络异常') ElMessage.error(err.response?.data?.message || err.message || '网络异常')
} }
return Promise.reject(err) return Promise.reject(err)
} }
) )
export default request export default request

View File

@@ -1,5 +1,5 @@
import request from './request' import request from './request'
export const login = (data) => request.post('/user/login', data) export const login = (data) => request.post('/user/login', data)
export const getUserInfo = () => request.get('/user/info') export const getUserInfo = () => request.get('/user/info')
export const logout = () => request.post('/user/logout') export const logout = () => request.post('/user/logout')

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,2 +1,2 @@
<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07"
height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg> height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>

Before

Width:  |  Height:  |  Size: 458 B

After

Width:  |  Height:  |  Size: 459 B

View File

@@ -1,143 +1,143 @@
<template> <template>
<div class="login-container"> <div class="login-container">
<el-card class="login-card" shadow="always"> <el-card class="login-card" shadow="always">
<template #header> <template #header>
<div class="card-header"> <div class="card-header">
<h2>欢迎登录</h2> <h2>欢迎登录</h2>
<p class="subtitle">请输入您的账号信息</p> <p class="subtitle">请输入您的账号信息</p>
</div> </div>
</template> </template>
<el-form <el-form
ref="loginFormRef" ref="loginFormRef"
:model="loginForm" :model="loginForm"
:rules="rules" :rules="rules"
label-position="top" label-position="top"
@keyup.enter="handleLogin" @keyup.enter="handleLogin"
> >
<el-form-item label="用户名" prop="username"> <el-form-item label="用户名" prop="username">
<el-input <el-input
v-model="loginForm.username" v-model="loginForm.username"
:prefix-icon="User" :prefix-icon="User"
clearable clearable
placeholder="请输入用户名" placeholder="请输入用户名"
/> />
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input <el-input
v-model="loginForm.password" v-model="loginForm.password"
:prefix-icon="Lock" :prefix-icon="Lock"
clearable clearable
placeholder="请输入密码" placeholder="请输入密码"
show-password show-password
type="password" type="password"
/> />
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-checkbox v-model="loginForm.remember">记住我</el-checkbox> <el-checkbox v-model="loginForm.remember">记住我</el-checkbox>
</el-form-item> </el-form-item>
<el-form-item class="login-form-button"> <el-form-item class="login-form-button">
<el-button <el-button
:loading="loading" :loading="loading"
class="login-btn" class="login-btn"
type="primary" type="primary"
@click="handleLogin" @click="handleLogin"
> >
</el-button> </el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
</div> </div>
</template> </template>
<script setup> <script setup>
import {reactive, ref} from 'vue' import {reactive, ref} from 'vue'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import {Lock, User} from '@element-plus/icons-vue' import {Lock, User} from '@element-plus/icons-vue'
import {useRouter} from 'vue-router' import {useRouter} from 'vue-router'
import {useUserStore} from "@/stores/user.js"; import {useUserStore} from "@/stores/user.js";
const router = useRouter() const router = useRouter()
const userStore = useUserStore() const userStore = useUserStore()
const loginFormRef = ref(null) const loginFormRef = ref(null)
const loading = ref(false) const loading = ref(false)
const loginForm = reactive({ const loginForm = reactive({
username: '', username: '',
password: '', password: '',
remember: false, remember: false,
}) })
const rules = { const rules = {
username: [ username: [
{ required: true, message: '请输入用户名', trigger: 'blur' }, { required: true, message: '请输入用户名', trigger: 'blur' },
], ],
password: [ password: [
{ required: true, message: '请输入密码', trigger: 'blur' }, { required: true, message: '请输入密码', trigger: 'blur' },
], ],
} }
const handleLogin = async () => { const handleLogin = async () => {
if (!loginFormRef.value) return if (!loginFormRef.value) return
try { try {
await loginFormRef.value.validate() await loginFormRef.value.validate()
loading.value = true loading.value = true
await userStore.login({ await userStore.login({
username: loginForm.username, username: loginForm.username,
password: loginForm.password, password: loginForm.password,
}) })
ElMessage.success('登录成功') ElMessage.success('登录成功')
router.push('/panel') router.push('/panel')
} catch(e) { } catch(e) {
// 校验失败element-plus 会自动显示红色提示 // 校验失败element-plus 会自动显示红色提示
console.warn('login failed',e?.message) console.warn('login failed',e?.message)
} finally { } finally {
loading.value = false loading.value = false
} }
} }
</script> </script>
<style scoped> <style scoped>
.login-container { .login-container {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100vh; min-height: 100vh;
padding: 20px; padding: 20px;
} }
.login-card { .login-card {
width: 420px; width: 420px;
border-radius: 12px; border-radius: 12px;
border: none; border: none;
} }
.card-header { .card-header {
text-align: center; text-align: center;
} }
.card-header h2 { .card-header h2 {
margin: 0 0 8px; margin: 0 0 8px;
color: #303133; color: #303133;
} }
.subtitle { .subtitle {
margin: 0; margin: 0;
font-size: 14px; font-size: 14px;
color: #909399; color: #909399;
} }
.login-btn { .login-btn {
display: block; display: block;
margin: 0 auto; margin: 0 auto;
text-align: center; text-align: center;
width: 75%; width: 75%;
} }
</style> </style>

194
src/components/home.vue Normal file
View File

@@ -0,0 +1,194 @@
<template>
<div class="home-container">
<div class="banner">
<video src="../../public/蜜雪冰城-雪王百科.mp4" autoplay muted loop></video>
</div>
</div>
<div class="home-body">
<div class="first-head">雪王简介</div>
<div class="intro-content">
<div class="pic">
<img src="../../public/mixue.png" alt="雪王">
</div>
<div class="txt">
<div class="second-head">
"我是手拿冰淇凌权杖的雪王"
<br>
"一生只爱冰淇凌与茶"
</div>
<ul class="xuewang-list">
<li v-for="(item, index) in snowKingInfo" :key="index">
<span class="label">{{ item.label }}</span>
<span class="divider"></span>
<span class="value">{{ item.value }}</span>
</li>
</ul>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
const snowKingInfo = ref([
{ label: '生日', value: '11月22日' },
{ label: '性格', value: '正直、友善、热情、进取' },
{ label: '职位', value: '蜜雪冰城首席品控官兼全球品牌代言人' },
{ label: '口头禅', value: '你爱我,我爱你,蜜雪冰城甜蜜蜜' },
{ label: '爱好', value: '唱歌跳舞,研究冰淇淋与茶的新奇吃法' }
])
</script>
<style scoped>
.home-container {
padding: 0;
text-align: center;
}
.banner {
width: 100%;
height: 90vh;
min-height: 500px;
}
.banner video {
width: 100%;
height: 100%;
object-fit: cover;
}
.home-body {
padding: 100px 80px;
background: linear-gradient(180deg, #FEF7F7 0%, rgba(254, 247, 247, 0.00) 64.96%);
}
.first-head {
text-align: center;
font-size: 58px;
font-weight: 700;
color: #2E2F30;
margin-bottom: 68px;
line-height: 1.17;
}
.intro-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1400px;
margin: 0 auto;
}
.pic {
width: 750px;
height: 660px;
border-radius: 30px;
overflow: hidden;
}
.pic img {
width: 100%;
height: 100%;
object-fit: cover;
transition: transform 0.5s;
}
.pic:hover img {
transform: scale(1.05);
}
.txt {
width: 676px;
}
.second-head {
font-size: 46px;
font-weight: 700;
color: #E60012;
line-height: 1.33;
margin-bottom: 67px;
}
.xuewang-list {
list-style: none;
padding: 0;
}
.xuewang-list li {
display: flex;
align-items: center;
margin-bottom: 18px;
color: #666;
font-size: 24px;
font-weight: 400;
line-height: 1.5;
}
.xuewang-list li:last-child {
margin-bottom: 0;
}
.xuewang-list .label {
color: #2E2F30;
font-weight: 700;
min-width: 80px;
}
.xuewang-list .divider {
width: 1px;
height: 18px;
background-color: #999;
margin: 0 15px;
}
.xuewang-list .value {
display: flex;
align-items: center;
}
/* 响应式适配 */
@media (max-width: 1200px) {
.intro-content {
flex-direction: column;
}
.pic {
width: 100%;
height: auto;
aspect-ratio: 750/660;
}
.txt {
width: 100%;
margin-top: 48px;
}
}
@media (max-width: 768px) {
.home-body {
padding: 50px 20px;
}
.first-head {
font-size: 36px;
margin-bottom: 40px;
}
.second-head {
font-size: 28px;
margin-bottom: 40px;
}
.xuewang-list li {
font-size: 18px;
flex-direction: column;
align-items: flex-start;
}
.xuewang-list .divider {
display: none;
}
}
</style>

View File

@@ -1,11 +1,148 @@
<script setup> <script setup>
</script> import { Search } from '@element-plus/icons-vue'
import { ref,reactive } from 'vue'
<template> import { regionData } from 'element-china-area-data'
<h1>hello ,im 1</h1> import { ElMessage } from 'element-plus'
</template>
const form = reactive({
<style scoped> name: '', // 姓名,默认为空字符串
phone: '', // 电话,默认为空字符串
region: [], // 地区,默认为空数组(省市区三级代码)
address: '', // 详细地址,默认为空字符串
email: '', // 电子邮箱,默认为空字符串
customer_type: 'Normal' // 客户类型,默认选中"普通客户"
})
const search = ref('')
const select = ref('1')
const searchResults=ref([])
const showSearchResults=ref(false) //是否显示搜索结果
const showAddForm=ref(false) //是否显示新增表单
const isEditMode = ref(false) //是否为编辑模式
const currentCustomerId = ref(null) //当前编辑的客户的ID
// 清空表单
const resetForm = () => {
form.name = ''
form.phone = ''
form.region = []
form.address = ''
form.email = ''
form.customer_type = 'Normal'
isEditMode.value = false
currentCustomerId.value = null
}
// 显示新增表单
const addCustomer = () => {
resetForm()
showAddForm.value = true
showSearchResults.value = false
}
// 清空搜索
const clearSearch = () => {
search.value = ''
showSearchResults.value = false
showAddForm.value = false
}
</script>
<template>
<div class="customer-container">
<!-- 搜索栏区域 -->
<div class="customer-search">
<el-input v-model="search" style="max-width: 600px" placeholder="Please input"
class="customer-search-with-select">
<template #prepend>
<el-select v-model="select" placeholder="Select" style="width: 115px">
<el-option label="姓名" value="1" />
<el-option label="电话" value="2" />
<el-option label="邮箱" value="3" />
</el-select>
</template>
<template #append>
<el-button :icon="Search" />
</template>
</el-input>
<el-button type="primary" @click="addCustomer" style="margin-left: 20px">
新增用户
</el-button>
</div>
<div v-if="showSearchResults" class="customer-table">
<el-table :data="searchResults" border style="width: 100%">
<el-table-column prop="name" label="姓名" width="120" />
<el-table-column prop="phone" label="电话" width="150" />
<el-table-column prop="regionText" label="地区" width="200" />
<el-table-column prop="address" label="详细地址" width="200" />
<el-table-column prop="email" label="电子邮箱" width="200" />
<el-table-column prop="customer_type" label="代理商类型" width="120">
<template #default="{ row }">
<el-tag :type="row.customer_type === 'VIP' ? 'danger' : 'info'">
{{ row.customer_type === 'VIP' ? '地区总代理' : '普通代理' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="150" fixed="right">
<template #default="{ row }">
<el-button link type="primary" @click="editCustomer(row)">编辑</el-button>
<el-button link type="danger" @click="deleteCustomer(row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 10px; color: #909399; font-size: 14px;">
找到 {{ searchResults.length }} 条结果
<el-button link type="primary" @click="clearSearch">清空搜索</el-button>
</div>
</div>
<!-- 新增客户表单 -->
<div v-if="showAddForm" class="customer-info-label">
<el-form :model="form" label-width="auto" style="max-width: 600px" label-position="top">
<el-form-item label="姓名">
<el-input v-model="form.name" placeholder="请输入姓名" />
</el-form-item>
<el-form-item label="电话">
<el-input v-model="form.phone" :controls="false" :min="0" :max="99999999999" :precision="0"
placeholder="请输入11位手机号" style="width: 100%" />
</el-form-item>
<el-form-item label="地区">
<el-cascader v-model="form.region" :options="regionData" :props="{ expandTrigger: 'hover' }"
placeholder="请选择省/市/区" clearable style="width: 100%" />
</el-form-item>
<el-form-item label="详细地址">
<el-input v-model="form.address" placeholder=" 请输入详细地址" />
</el-form-item>
<el-form-item label="电子邮箱">
<el-input v-model="form.email" placeholder=" 请输入邮箱地址" />
</el-form-item>
<el-form-item label="代理商类型">
<el-radio-group v-model="form.customer_type">
<el-radio value="VIP">地区总代理</el-radio>
<el-radio value="Normal">普通代理</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="saveCustomer">保存</el-button>
<el-button type="danger" @click="cancelAdd">取消</el-button>
</el-form-item>
</el-form>
</div>
</div>
</template>
<style scoped>
</style> </style>

View File

@@ -1,11 +1,11 @@
<script setup> <script setup>
</script> </script>
<template> <template>
<h1>hello ,im 2</h1> <h1>hello ,im 2</h1>
</template> </template>
<style scoped> <style scoped>
</style> </style>

View File

@@ -1,11 +1,11 @@
<script setup> <script setup>
</script> </script>
<template> <template>
<h1>hello ,im 3</h1> <h1>hello ,im 3</h1>
</template> </template>
<style scoped> <style scoped>
</style> </style>

View File

@@ -1,116 +1,129 @@
<script setup> <script setup>
import {ref} from 'vue' import {ref} from 'vue'
import {useRoute} from 'vue-router' import {useRoute} from 'vue-router'
import {ArrowLeft, Location, Menu as IconMenu, SwitchButton,} from '@element-plus/icons-vue'
const route = useRoute()
const route = useRoute()
const isCollapse = ref(false)
const isCollapse = ref(false) const switchFold = () => {
const switchFold = () => { isCollapse.value = !isCollapse.value
isCollapse.value = !isCollapse.value }
}
</script>
</script>
<template>
<template> <el-container style="height: 100vh">
<el-container style="height: 100vh"> <el-header style="display: flex; align-items: center;">
<el-header style="display: flex; align-items: center;"> <el-menu
<el-menu :ellipsis="false"
:ellipsis="false" mode="horizontal"
mode="horizontal" router
router style="flex: 1;"
style="flex: 1;" >
> <!-- 左侧 -->
<!-- 左侧 --> <el-menu-item index="">
<el-menu-item index=""> <h1 style="margin: 0;">信息管理系统</h1>
<h1 style="margin: 0;">信息管理系统</h1> </el-menu-item>
</el-menu-item>
<!-- 右侧margin-left: auto 把它推到底部 -->
<!-- 右侧margin-left: auto 把它推到底部 --> <el-menu-item index="/login" style="margin-left: auto">
<el-menu-item index="/login" style="margin-left: auto"> <el-icon><SwitchButton/></el-icon>
<el-icon><SwitchButton/></el-icon> <template #title>LogOut</template>
<template #title>LogOut</template> </el-menu-item>
</el-menu-item> </el-menu>
</el-menu> </el-header>
</el-header>
<el-container>
<el-container> <el-aside style="display: flex; flex-direction: column" width="200px">
<el-aside style="display: flex; flex-direction: column" width="200px"> <el-menu
<el-menu :collapse="isCollapse"
:collapse="isCollapse" :default-active="route.path"
:default-active="route.path" router
router style="flex: 1; display: flex; flex-direction: column"
style="flex: 1; display: flex; flex-direction: column" >
> <!-- <el-sub-menu index="1">
<el-sub-menu index="1"> <template #title>
<template #title> <el-icon><IconMenu/></el-icon>
<el-icon><IconMenu/></el-icon> <span>一号栏</span>
<span>一号栏</span> </template>
</template> </el-sub-menu> -->
<el-menu-item index="/panel/page1">
<el-icon><Location/></el-icon> <el-menu-item index="/panel/home">
<template #title>item one</template> <el-icon><House /></el-icon>
</el-menu-item> <template #title>首页</template>
</el-sub-menu> </el-menu-item>
<el-menu-item index="/panel/page2"> <el-menu-item index="/panel/page1">
<el-icon><Location/></el-icon> <el-icon><Avatar /></el-icon>
<template #title>二号栏</template> <template #title>客户管理</template>
</el-menu-item> </el-menu-item>
<el-menu-item index="/panel/page3">
<el-icon><Location/></el-icon> <el-menu-item index="/panel/page2">
<template #title>三号栏</template> <el-icon><Document /></el-icon>
</el-menu-item> <template #title>合同管理</template>
</el-menu-item>
<!-- 关键margin-top: auto 把它推到最底部 --> <el-menu-item index="/panel/page3">
<el-menu-item style="margin-top: auto" @click="switchFold"> <el-icon><Service /></el-icon>
<el-icon :class="{'rotate-180-animation':!isCollapse,'rotate-180-animation-reverse':isCollapse}" ><ArrowLeft /></el-icon> <template #title>售后管理</template>
<template #title>收缩</template> </el-menu-item>
</el-menu-item> <el-menu-item index="/panel/page3">
</el-menu> <el-icon><IceTea /></el-icon>
</el-aside> <template #title>产品管理</template>
</el-menu-item>
<el-main> <el-menu-item index="/panel/page3">
<!-- 这个 router-view 渲染嵌套的子路由page1/page2/page3 --> <el-icon><User /></el-icon>
<router-view /> <template #title>员工管理</template>
</el-main> </el-menu-item>
</el-container>
</el-container> <!-- 关键margin-top: auto 把它推到最底部 -->
</template> <el-menu-item style="margin-top: auto" @click="switchFold">
<el-icon :class="{'rotate-180-animation':!isCollapse,'rotate-180-animation-reverse':isCollapse}" ><ArrowLeft /></el-icon>
<style scoped> <template #title>收缩</template>
</el-menu-item>
.rotate-180-animation { </el-menu>
/* 修改为你想要的动画旋转180度执行一次持续0.5秒 */ </el-aside>
animation: rotate-180 0.3s ease-in-out;
animation-fill-mode:forwards; <el-main>
} <!-- 这个 router-view 渲染嵌套的子路由page1/page2/page3 -->
<router-view />
.rotate-180-animation-reverse { </el-main>
/* 修改为你想要的动画旋转180度执行一次持续0.5秒 */ </el-container>
animation: rotate-180-reverse 0.3s ease-in-out; </el-container>
animation-fill-mode:forwards; </template>
}
<style scoped>
@keyframes rotate-180 {
from { .rotate-180-animation {
transform: rotate(0deg); /* 修改为你想要的动画旋转180度执行一次持续0.5秒 */
} animation: rotate-180 0.3s ease-in-out;
to { animation-fill-mode:forwards;
transform: rotate(180deg); }
}
} .rotate-180-animation-reverse {
/* 修改为你想要的动画旋转180度执行一次持续0.5秒 */
@keyframes rotate-180-reverse { animation: rotate-180-reverse 0.3s ease-in-out;
from { animation-fill-mode:forwards;
transform: rotate(180deg); }
}
to { @keyframes rotate-180 {
transform: rotate(0deg); from {
} transform: rotate(0deg);
} }
to {
transform: rotate(180deg);
</style> }
}
@keyframes rotate-180-reverse {
from {
transform: rotate(180deg);
}
to {
transform: rotate(0deg);
}
}
</style>

View File

@@ -1,13 +1,18 @@
import { createPinia } from 'pinia' import { createPinia } from 'pinia'
import {createApp} from 'vue' import {createApp} from 'vue'
import './style.css' import './style.css'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import App from './App.vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import router from './router' import App from './App.vue'
import router from './router'
const app = createApp(App)
app.use(createPinia()) const app = createApp(App)
app.use(ElementPlus)
app.use(router) for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
router.isReady().then(() => app.mount('#app')) app.component(key, component)
}
app.use(ElementPlus)
app.use(router)
router.isReady().then(() => app.mount('#app'))

View File

@@ -1,42 +1,43 @@
import {createRouter, createWebHistory} from "vue-router"; import {createRouter, createWebHistory} from "vue-router";
import Login from "./components/Login.vue"; import Login from "./components/Login.vue";
import Panel from "./components/panel.vue"; import Home from "./components/home.vue"
import Page1 from "./components/page1.vue"; import Panel from "./components/panel.vue";
import Page2 from "./components/page2.vue"; import Page1 from "./components/page1.vue";
import Page3 from "./components/page3.vue"; import Page2 from "./components/page2.vue";
import Page3 from "./components/page3.vue";
const routes = [
{ path: "/", redirect: "/login" }, const routes = [
{ path: "/login", component: Login }, { path: "/", redirect: "/login" },
{ { path: "/login", component: Login },
path: "/panel", {
component: Panel, path: "/panel",
redirect: "/panel/page1", component: Panel,
meta: { requiresAuth: true}, redirect: "/panel/home",
children: [ children: [
{ path: "page1", component: Page1 }, { path: "home", component:Home},
{ path: "page2", component: Page2 }, { path: "page1", component: Page1 },
{ path: "page3", component: Page3 }, { path: "page2", component: Page2 },
], { path: "page3", component: Page3 },
}, ],
] },
]
const router = createRouter({
history: createWebHistory(), const router = createRouter({
routes, history: createWebHistory(),
}) routes,
})
router.beforeEach((to, from, next) => {
const token = localStorage.getItem("bm_token"); router.beforeEach((to, from, next) => {
if (to.meta['requiresAuth'] && !token) { const token = localStorage.getItem("bm_token");
return next('/login'); if (to.meta['requiresAuth'] && !token) {
} return next('/login');
if (to.path === "/login" && token) { }
return next('/panel'); if (to.path === "/login" && token) {
} return next('/panel');
next() }
}) next()
})
export default router; export default router;

View File

@@ -1,38 +1,38 @@
import {defineStore} from "pinia"; import {defineStore} from "pinia";
import {ref} from "vue"; import {ref} from "vue";
import {login as loginApi, getUserInfo, logout as logoutApi} from "@/api/user.js"; import {login as loginApi, getUserInfo, logout as logoutApi} from "@/api/user.js";
const TOKEN_KEY = 'bm_token' const TOKEN_KEY = 'bm_token'
export const useUserStore = defineStore('user', () => { export const useUserStore = defineStore('user', () => {
const token = ref(localStorage.getItem(TOKEN_KEY) || '') const token = ref(localStorage.getItem(TOKEN_KEY) || '')
const userInfo = ref({}) const userInfo = ref({})
async function login(form) { async function login(form) {
const data = await loginApi(form) const data = await loginApi(form)
token.value = data.token token.value = data.token
userInfo.value = data.user userInfo.value = data.user
localStorage.setItem(TOKEN_KEY, data.token) localStorage.setItem(TOKEN_KEY, data.token)
return data return data
} }
async function fetchUserInfo() { async function fetchUserInfo() {
const data = await getUserInfo() const data = await getUserInfo()
userInfo.value = data userInfo.value = data
return data return data
} }
async function logout() { async function logout() {
try { try {
await logoutApi() await logoutApi()
} catch (_) { } catch (_) {
} }
token.value = '' token.value = ''
userInfo.value = {} userInfo.value = {}
localStorage.removeItem(TOKEN_KEY) localStorage.removeItem(TOKEN_KEY)
} }
return {token, userInfo, logout, login, fetchUserInfo} return {token, userInfo, logout, login, fetchUserInfo}
}) })

View File

@@ -1,22 +1,22 @@
import {defineConfig} from 'vite' import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url' import { fileURLToPath, URL } from 'node:url'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
resolve: { resolve: {
alias: { alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)), //代码里写 @/api/user 时,自动当成 ./src/api/user 来找文件 '@': fileURLToPath(new URL('./src', import.meta.url)), //代码里写 @/api/user 时,自动当成 ./src/api/user 来找文件
}, },
}, },
server: { server: {
port: 5173, port: 5173,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://localhost:3000', target: 'http://localhost:3000',
changeOrigin: true, changeOrigin: true,
} }
} }
} }
}) })

1740
yarn.lock

File diff suppressed because it is too large Load Diff