Compare commits
3 Commits
feature/fu
...
e1e45cee1a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1e45cee1a | ||
|
|
cbbade3b9c | ||
| 7b927ff6e9 |
48
.gitignore
vendored
48
.gitignore
vendored
@@ -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?
|
||||||
|
|||||||
6
.vscode/extensions.json
vendored
6
.vscode/extensions.json
vendored
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"recommendations": ["Vue.volar"]
|
"recommendations": ["Vue.volar"]
|
||||||
}
|
}
|
||||||
|
|||||||
10
README.md
10
README.md
@@ -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).
|
||||||
|
|||||||
26
index.html
26
index.html
@@ -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
2578
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
@@ -1,22 +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",
|
||||||
"element-china-area-data": "^6.1.0",
|
"element-china-area-data": "^6.1.0",
|
||||||
"element-plus": "^2.14.1",
|
"element-plus": "^2.14.1",
|
||||||
"vue": "^3.5.34",
|
"pinia": "^3.0.4",
|
||||||
"vue-router": "4"
|
"vue": "^3.5.34",
|
||||||
},
|
"vue-router": "4"
|
||||||
"devDependencies": {
|
},
|
||||||
"@vitejs/plugin-vue": "^6.0.6",
|
"devDependencies": {
|
||||||
"vite": "^8.0.12"
|
"@vitejs/plugin-vue": "^6.0.6",
|
||||||
}
|
"vite": "^8.0.12"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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 |
@@ -1,3 +1,3 @@
|
|||||||
<template>
|
<template>
|
||||||
<router-view />
|
<router-view />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
46
src/api/request.js
Normal file
46
src/api/request.js
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import axios from 'axios'
|
||||||
|
import {ElMessage} from 'element-plus'
|
||||||
|
import {useUserStore} from '@/stores/user'
|
||||||
|
import router from '@/router'
|
||||||
|
|
||||||
|
const request = axios.create({
|
||||||
|
baseURL: '/api',
|
||||||
|
timeout: 10000,
|
||||||
|
})
|
||||||
|
|
||||||
|
// 请求拦截:自动带 token
|
||||||
|
request.interceptors.request.use(
|
||||||
|
(config) => {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
if (userStore.token){
|
||||||
|
config.headers.Authorization = `Bearer ${userStore.token}`
|
||||||
|
}
|
||||||
|
return config
|
||||||
|
},
|
||||||
|
(err) => Promise.reject(err)
|
||||||
|
)
|
||||||
|
|
||||||
|
// 响应拦截:统一处理 { code, data, message } + 401 跳登录
|
||||||
|
request.interceptors.response.use(
|
||||||
|
(res) => {
|
||||||
|
const body = res.data
|
||||||
|
if (typeof body?.code === 'undefined') return res.data
|
||||||
|
if (body.code === 0) return body.data
|
||||||
|
ElMessage.error(body.message || '请求失败')
|
||||||
|
return Promise.reject(new Error(body.message || '请求失败'))
|
||||||
|
},
|
||||||
|
(err) => {
|
||||||
|
const status = err.response?.status
|
||||||
|
if (status === 401) {
|
||||||
|
const userStore = useUserStore()
|
||||||
|
userStore.logout()
|
||||||
|
ElMessage.error('登录已过期,请重新登录')
|
||||||
|
router.push('/login')
|
||||||
|
}else {
|
||||||
|
ElMessage.error(err.response?.data?.message || err.message || '网络异常')
|
||||||
|
}
|
||||||
|
return Promise.reject(err)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default request
|
||||||
5
src/api/user.js
Normal file
5
src/api/user.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import request from './request'
|
||||||
|
|
||||||
|
export const login = (data) => request.post('/user/login', data)
|
||||||
|
export const getUserInfo = () => request.get('/user/info')
|
||||||
|
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 |
@@ -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 |
@@ -1,137 +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";
|
||||||
const router = useRouter()
|
|
||||||
|
const router = useRouter()
|
||||||
const loginFormRef = ref(null)
|
const userStore = useUserStore()
|
||||||
const loading = ref(false)
|
|
||||||
|
const loginFormRef = ref(null)
|
||||||
const loginForm = reactive({
|
const loading = ref(false)
|
||||||
username: '',
|
|
||||||
password: '',
|
const loginForm = reactive({
|
||||||
remember: false,
|
username: '',
|
||||||
})
|
password: '',
|
||||||
|
remember: false,
|
||||||
const rules = {
|
})
|
||||||
username: [
|
|
||||||
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
const rules = {
|
||||||
],
|
username: [
|
||||||
password: [
|
{ required: true, message: '请输入用户名', trigger: 'blur' },
|
||||||
{ required: true, message: '请输入密码', trigger: 'blur' },
|
],
|
||||||
],
|
password: [
|
||||||
}
|
{ required: true, message: '请输入密码', trigger: 'blur' },
|
||||||
|
],
|
||||||
const handleLogin = async () => {
|
}
|
||||||
if (!loginFormRef.value) return
|
|
||||||
try {
|
const handleLogin = async () => {
|
||||||
await loginFormRef.value.validate()
|
if (!loginFormRef.value) return
|
||||||
loading.value = true
|
try {
|
||||||
await new Promise((r) => setTimeout(r, 800))
|
await loginFormRef.value.validate()
|
||||||
ElMessage.success('登录成功(模拟)')
|
loading.value = true
|
||||||
router.push('/panel')
|
await userStore.login({
|
||||||
} catch {
|
username: loginForm.username,
|
||||||
// 校验失败,element-plus 会自动显示红色提示
|
password: loginForm.password,
|
||||||
} finally {
|
})
|
||||||
loading.value = false
|
ElMessage.success('登录成功')
|
||||||
}
|
router.push('/panel')
|
||||||
}
|
} catch(e) {
|
||||||
</script>
|
// 校验失败,element-plus 会自动显示红色提示
|
||||||
|
console.warn('login failed',e?.message)
|
||||||
<style scoped>
|
} finally {
|
||||||
.login-container {
|
loading.value = false
|
||||||
display: flex;
|
}
|
||||||
justify-content: center;
|
}
|
||||||
align-items: center;
|
</script>
|
||||||
min-height: 100vh;
|
|
||||||
padding: 20px;
|
<style scoped>
|
||||||
}
|
.login-container {
|
||||||
|
display: flex;
|
||||||
.login-card {
|
justify-content: center;
|
||||||
width: 420px;
|
align-items: center;
|
||||||
border-radius: 12px;
|
min-height: 100vh;
|
||||||
border: none;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.login-card {
|
||||||
text-align: center;
|
width: 420px;
|
||||||
}
|
border-radius: 12px;
|
||||||
|
border: none;
|
||||||
.card-header h2 {
|
}
|
||||||
margin: 0 0 8px;
|
|
||||||
color: #303133;
|
.card-header {
|
||||||
}
|
text-align: center;
|
||||||
|
}
|
||||||
.subtitle {
|
|
||||||
margin: 0;
|
.card-header h2 {
|
||||||
font-size: 14px;
|
margin: 0 0 8px;
|
||||||
color: #909399;
|
color: #303133;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-btn {
|
.subtitle {
|
||||||
display: block;
|
margin: 0;
|
||||||
margin: 0 auto;
|
font-size: 14px;
|
||||||
text-align: center;
|
color: #909399;
|
||||||
width: 75%;
|
}
|
||||||
}
|
|
||||||
</style>
|
.login-btn {
|
||||||
|
display: block;
|
||||||
|
margin: 0 auto;
|
||||||
|
text-align: center;
|
||||||
|
width: 75%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@@ -1,194 +1,194 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="home-container">
|
<div class="home-container">
|
||||||
<div class="banner">
|
<div class="banner">
|
||||||
<video src="../../public/蜜雪冰城-雪王百科.mp4" autoplay muted loop></video>
|
<video src="../../public/蜜雪冰城-雪王百科.mp4" autoplay muted loop></video>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="home-body">
|
<div class="home-body">
|
||||||
<div class="first-head">雪王简介</div>
|
<div class="first-head">雪王简介</div>
|
||||||
<div class="intro-content">
|
<div class="intro-content">
|
||||||
<div class="pic">
|
<div class="pic">
|
||||||
<img src="../../public/mixue.png" alt="雪王">
|
<img src="../../public/mixue.png" alt="雪王">
|
||||||
</div>
|
</div>
|
||||||
<div class="txt">
|
<div class="txt">
|
||||||
<div class="second-head">
|
<div class="second-head">
|
||||||
"我是手拿冰淇凌权杖的雪王"
|
"我是手拿冰淇凌权杖的雪王"
|
||||||
<br>
|
<br>
|
||||||
"一生只爱冰淇凌与茶"
|
"一生只爱冰淇凌与茶"
|
||||||
</div>
|
</div>
|
||||||
<ul class="xuewang-list">
|
<ul class="xuewang-list">
|
||||||
<li v-for="(item, index) in snowKingInfo" :key="index">
|
<li v-for="(item, index) in snowKingInfo" :key="index">
|
||||||
<span class="label">{{ item.label }}</span>
|
<span class="label">{{ item.label }}</span>
|
||||||
<span class="divider"></span>
|
<span class="divider"></span>
|
||||||
<span class="value">{{ item.value }}</span>
|
<span class="value">{{ item.value }}</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
|
||||||
const snowKingInfo = ref([
|
const snowKingInfo = ref([
|
||||||
{ label: '生日', value: '11月22日' },
|
{ label: '生日', value: '11月22日' },
|
||||||
{ label: '性格', value: '正直、友善、热情、进取' },
|
{ label: '性格', value: '正直、友善、热情、进取' },
|
||||||
{ label: '职位', value: '蜜雪冰城首席品控官兼全球品牌代言人' },
|
{ label: '职位', value: '蜜雪冰城首席品控官兼全球品牌代言人' },
|
||||||
{ label: '口头禅', value: '你爱我,我爱你,蜜雪冰城甜蜜蜜' },
|
{ label: '口头禅', value: '你爱我,我爱你,蜜雪冰城甜蜜蜜' },
|
||||||
{ label: '爱好', value: '唱歌跳舞,研究冰淇淋与茶的新奇吃法' }
|
{ label: '爱好', value: '唱歌跳舞,研究冰淇淋与茶的新奇吃法' }
|
||||||
])
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.home-container {
|
.home-container {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner {
|
.banner {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 90vh;
|
height: 90vh;
|
||||||
min-height: 500px;
|
min-height: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.banner video {
|
.banner video {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
.home-body {
|
.home-body {
|
||||||
padding: 100px 80px;
|
padding: 100px 80px;
|
||||||
background: linear-gradient(180deg, #FEF7F7 0%, rgba(254, 247, 247, 0.00) 64.96%);
|
background: linear-gradient(180deg, #FEF7F7 0%, rgba(254, 247, 247, 0.00) 64.96%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.first-head {
|
.first-head {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 58px;
|
font-size: 58px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #2E2F30;
|
color: #2E2F30;
|
||||||
margin-bottom: 68px;
|
margin-bottom: 68px;
|
||||||
line-height: 1.17;
|
line-height: 1.17;
|
||||||
}
|
}
|
||||||
|
|
||||||
.intro-content {
|
.intro-content {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
max-width: 1400px;
|
max-width: 1400px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pic {
|
.pic {
|
||||||
width: 750px;
|
width: 750px;
|
||||||
height: 660px;
|
height: 660px;
|
||||||
border-radius: 30px;
|
border-radius: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pic img {
|
.pic img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
transition: transform 0.5s;
|
transition: transform 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pic:hover img {
|
.pic:hover img {
|
||||||
transform: scale(1.05);
|
transform: scale(1.05);
|
||||||
}
|
}
|
||||||
|
|
||||||
.txt {
|
.txt {
|
||||||
width: 676px;
|
width: 676px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.second-head {
|
.second-head {
|
||||||
font-size: 46px;
|
font-size: 46px;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
color: #E60012;
|
color: #E60012;
|
||||||
line-height: 1.33;
|
line-height: 1.33;
|
||||||
margin-bottom: 67px;
|
margin-bottom: 67px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list {
|
.xuewang-list {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list li {
|
.xuewang-list li {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 18px;
|
margin-bottom: 18px;
|
||||||
color: #666;
|
color: #666;
|
||||||
font-size: 24px;
|
font-size: 24px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list li:last-child {
|
.xuewang-list li:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list .label {
|
.xuewang-list .label {
|
||||||
color: #2E2F30;
|
color: #2E2F30;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list .divider {
|
.xuewang-list .divider {
|
||||||
width: 1px;
|
width: 1px;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
background-color: #999;
|
background-color: #999;
|
||||||
margin: 0 15px;
|
margin: 0 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list .value {
|
.xuewang-list .value {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 响应式适配 */
|
/* 响应式适配 */
|
||||||
@media (max-width: 1200px) {
|
@media (max-width: 1200px) {
|
||||||
.intro-content {
|
.intro-content {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pic {
|
.pic {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
aspect-ratio: 750/660;
|
aspect-ratio: 750/660;
|
||||||
}
|
}
|
||||||
|
|
||||||
.txt {
|
.txt {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
margin-top: 48px;
|
margin-top: 48px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.home-body {
|
.home-body {
|
||||||
padding: 50px 20px;
|
padding: 50px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.first-head {
|
.first-head {
|
||||||
font-size: 36px;
|
font-size: 36px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.second-head {
|
.second-head {
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list li {
|
.xuewang-list li {
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
.xuewang-list .divider {
|
.xuewang-list .divider {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1,148 +1,148 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
|
|
||||||
import { Search } from '@element-plus/icons-vue'
|
import { Search } from '@element-plus/icons-vue'
|
||||||
import { ref,reactive } from 'vue'
|
import { ref,reactive } from 'vue'
|
||||||
import { regionData } from 'element-china-area-data'
|
import { regionData } from 'element-china-area-data'
|
||||||
import { ElMessage } from 'element-plus'
|
import { ElMessage } from 'element-plus'
|
||||||
|
|
||||||
const form = reactive({
|
const form = reactive({
|
||||||
name: '', // 姓名,默认为空字符串
|
name: '', // 姓名,默认为空字符串
|
||||||
phone: '', // 电话,默认为空字符串
|
phone: '', // 电话,默认为空字符串
|
||||||
region: [], // 地区,默认为空数组(省市区三级代码)
|
region: [], // 地区,默认为空数组(省市区三级代码)
|
||||||
address: '', // 详细地址,默认为空字符串
|
address: '', // 详细地址,默认为空字符串
|
||||||
email: '', // 电子邮箱,默认为空字符串
|
email: '', // 电子邮箱,默认为空字符串
|
||||||
customer_type: 'Normal' // 客户类型,默认选中"普通客户"
|
customer_type: 'Normal' // 客户类型,默认选中"普通客户"
|
||||||
})
|
})
|
||||||
|
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
const select = ref('1')
|
const select = ref('1')
|
||||||
|
|
||||||
const searchResults=ref([])
|
const searchResults=ref([])
|
||||||
|
|
||||||
const showSearchResults=ref(false) //是否显示搜索结果
|
const showSearchResults=ref(false) //是否显示搜索结果
|
||||||
const showAddForm=ref(false) //是否显示新增表单
|
const showAddForm=ref(false) //是否显示新增表单
|
||||||
const isEditMode = ref(false) //是否为编辑模式
|
const isEditMode = ref(false) //是否为编辑模式
|
||||||
const currentCustomerId = ref(null) //当前编辑的客户的ID
|
const currentCustomerId = ref(null) //当前编辑的客户的ID
|
||||||
|
|
||||||
// 清空表单
|
// 清空表单
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
form.name = ''
|
form.name = ''
|
||||||
form.phone = ''
|
form.phone = ''
|
||||||
form.region = []
|
form.region = []
|
||||||
form.address = ''
|
form.address = ''
|
||||||
form.email = ''
|
form.email = ''
|
||||||
form.customer_type = 'Normal'
|
form.customer_type = 'Normal'
|
||||||
isEditMode.value = false
|
isEditMode.value = false
|
||||||
currentCustomerId.value = null
|
currentCustomerId.value = null
|
||||||
}
|
}
|
||||||
|
|
||||||
// 显示新增表单
|
// 显示新增表单
|
||||||
const addCustomer = () => {
|
const addCustomer = () => {
|
||||||
resetForm()
|
resetForm()
|
||||||
showAddForm.value = true
|
showAddForm.value = true
|
||||||
showSearchResults.value = false
|
showSearchResults.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清空搜索
|
// 清空搜索
|
||||||
const clearSearch = () => {
|
const clearSearch = () => {
|
||||||
search.value = ''
|
search.value = ''
|
||||||
showSearchResults.value = false
|
showSearchResults.value = false
|
||||||
showAddForm.value = false
|
showAddForm.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="customer-container">
|
<div class="customer-container">
|
||||||
<!-- 搜索栏区域 -->
|
<!-- 搜索栏区域 -->
|
||||||
<div class="customer-search">
|
<div class="customer-search">
|
||||||
<el-input v-model="search" style="max-width: 600px" placeholder="Please input"
|
<el-input v-model="search" style="max-width: 600px" placeholder="Please input"
|
||||||
class="customer-search-with-select">
|
class="customer-search-with-select">
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<el-select v-model="select" placeholder="Select" style="width: 115px">
|
<el-select v-model="select" placeholder="Select" style="width: 115px">
|
||||||
<el-option label="姓名" value="1" />
|
<el-option label="姓名" value="1" />
|
||||||
<el-option label="电话" value="2" />
|
<el-option label="电话" value="2" />
|
||||||
<el-option label="邮箱" value="3" />
|
<el-option label="邮箱" value="3" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
<template #append>
|
<template #append>
|
||||||
<el-button :icon="Search" />
|
<el-button :icon="Search" />
|
||||||
</template>
|
</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-button type="primary" @click="addCustomer" style="margin-left: 20px">
|
<el-button type="primary" @click="addCustomer" style="margin-left: 20px">
|
||||||
新增用户
|
新增用户
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="showSearchResults" class="customer-table">
|
<div v-if="showSearchResults" class="customer-table">
|
||||||
<el-table :data="searchResults" border style="width: 100%">
|
<el-table :data="searchResults" border style="width: 100%">
|
||||||
<el-table-column prop="name" label="姓名" width="120" />
|
<el-table-column prop="name" label="姓名" width="120" />
|
||||||
<el-table-column prop="phone" label="电话" width="150" />
|
<el-table-column prop="phone" label="电话" width="150" />
|
||||||
<el-table-column prop="regionText" label="地区" width="200" />
|
<el-table-column prop="regionText" label="地区" width="200" />
|
||||||
<el-table-column prop="address" label="详细地址" width="200" />
|
<el-table-column prop="address" label="详细地址" width="200" />
|
||||||
<el-table-column prop="email" label="电子邮箱" width="200" />
|
<el-table-column prop="email" label="电子邮箱" width="200" />
|
||||||
<el-table-column prop="customer_type" label="代理商类型" width="120">
|
<el-table-column prop="customer_type" label="代理商类型" width="120">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-tag :type="row.customer_type === 'VIP' ? 'danger' : 'info'">
|
<el-tag :type="row.customer_type === 'VIP' ? 'danger' : 'info'">
|
||||||
{{ row.customer_type === 'VIP' ? '地区总代理' : '普通代理' }}
|
{{ row.customer_type === 'VIP' ? '地区总代理' : '普通代理' }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="150" fixed="right">
|
<el-table-column label="操作" width="150" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-button link type="primary" @click="editCustomer(row)">编辑</el-button>
|
<el-button link type="primary" @click="editCustomer(row)">编辑</el-button>
|
||||||
<el-button link type="danger" @click="deleteCustomer(row.id)">删除</el-button>
|
<el-button link type="danger" @click="deleteCustomer(row.id)">删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<div style="margin-top: 10px; color: #909399; font-size: 14px;">
|
<div style="margin-top: 10px; color: #909399; font-size: 14px;">
|
||||||
找到 {{ searchResults.length }} 条结果
|
找到 {{ searchResults.length }} 条结果
|
||||||
<el-button link type="primary" @click="clearSearch">清空搜索</el-button>
|
<el-button link type="primary" @click="clearSearch">清空搜索</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 新增客户表单 -->
|
<!-- 新增客户表单 -->
|
||||||
<div v-if="showAddForm" class="customer-info-label">
|
<div v-if="showAddForm" class="customer-info-label">
|
||||||
<el-form :model="form" label-width="auto" style="max-width: 600px" label-position="top">
|
<el-form :model="form" label-width="auto" style="max-width: 600px" label-position="top">
|
||||||
<el-form-item label="姓名">
|
<el-form-item label="姓名">
|
||||||
<el-input v-model="form.name" placeholder="请输入姓名" />
|
<el-input v-model="form.name" placeholder="请输入姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="电话">
|
<el-form-item label="电话">
|
||||||
<el-input v-model="form.phone" :controls="false" :min="0" :max="99999999999" :precision="0"
|
<el-input v-model="form.phone" :controls="false" :min="0" :max="99999999999" :precision="0"
|
||||||
placeholder="请输入11位手机号" style="width: 100%" />
|
placeholder="请输入11位手机号" style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="地区">
|
<el-form-item label="地区">
|
||||||
<el-cascader v-model="form.region" :options="regionData" :props="{ expandTrigger: 'hover' }"
|
<el-cascader v-model="form.region" :options="regionData" :props="{ expandTrigger: 'hover' }"
|
||||||
placeholder="请选择省/市/区" clearable style="width: 100%" />
|
placeholder="请选择省/市/区" clearable style="width: 100%" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="详细地址">
|
<el-form-item label="详细地址">
|
||||||
<el-input v-model="form.address" placeholder=" 请输入详细地址" />
|
<el-input v-model="form.address" placeholder=" 请输入详细地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="电子邮箱">
|
<el-form-item label="电子邮箱">
|
||||||
<el-input v-model="form.email" placeholder=" 请输入邮箱地址" />
|
<el-input v-model="form.email" placeholder=" 请输入邮箱地址" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="代理商类型">
|
<el-form-item label="代理商类型">
|
||||||
<el-radio-group v-model="form.customer_type">
|
<el-radio-group v-model="form.customer_type">
|
||||||
<el-radio value="VIP">地区总代理</el-radio>
|
<el-radio value="VIP">地区总代理</el-radio>
|
||||||
<el-radio value="Normal">普通代理</el-radio>
|
<el-radio value="Normal">普通代理</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" @click="saveCustomer">保存</el-button>
|
<el-button type="primary" @click="saveCustomer">保存</el-button>
|
||||||
<el-button type="danger" @click="cancelAdd">取消</el-button>
|
<el-button type="danger" @click="cancelAdd">取消</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
@@ -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>
|
||||||
@@ -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>
|
||||||
@@ -1,129 +1,129 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import {ref} from 'vue'
|
import {ref} from 'vue'
|
||||||
import {useRoute} from 'vue-router'
|
import {useRoute} from 'vue-router'
|
||||||
|
|
||||||
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-sub-menu> -->
|
||||||
|
|
||||||
<el-menu-item index="/panel/home">
|
<el-menu-item index="/panel/home">
|
||||||
<el-icon><House /></el-icon>
|
<el-icon><House /></el-icon>
|
||||||
<template #title>首页</template>
|
<template #title>首页</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/panel/page1">
|
<el-menu-item index="/panel/page1">
|
||||||
<el-icon><Avatar /></el-icon>
|
<el-icon><Avatar /></el-icon>
|
||||||
<template #title>客户管理</template>
|
<template #title>客户管理</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<el-menu-item index="/panel/page2">
|
<el-menu-item index="/panel/page2">
|
||||||
<el-icon><Document /></el-icon>
|
<el-icon><Document /></el-icon>
|
||||||
<template #title>合同管理</template>
|
<template #title>合同管理</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="/panel/page3">
|
<el-menu-item index="/panel/page3">
|
||||||
<el-icon><Service /></el-icon>
|
<el-icon><Service /></el-icon>
|
||||||
<template #title>售后管理</template>
|
<template #title>售后管理</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="/panel/page3">
|
<el-menu-item index="/panel/page3">
|
||||||
<el-icon><IceTea /></el-icon>
|
<el-icon><IceTea /></el-icon>
|
||||||
<template #title>产品管理</template>
|
<template #title>产品管理</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="/panel/page3">
|
<el-menu-item index="/panel/page3">
|
||||||
<el-icon><User /></el-icon>
|
<el-icon><User /></el-icon>
|
||||||
<template #title>员工管理</template>
|
<template #title>员工管理</template>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
|
|
||||||
<!-- ⭐ 关键:margin-top: auto 把它推到最底部 -->
|
<!-- ⭐ 关键:margin-top: auto 把它推到最底部 -->
|
||||||
<el-menu-item style="margin-top: auto" @click="switchFold">
|
<el-menu-item style="margin-top: auto" @click="switchFold">
|
||||||
<el-icon :class="{'rotate-180-animation':!isCollapse,'rotate-180-animation-reverse':isCollapse}" ><ArrowLeft /></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>
|
</el-menu>
|
||||||
</el-aside>
|
</el-aside>
|
||||||
|
|
||||||
<el-main>
|
<el-main>
|
||||||
<!-- ⭐ 这个 router-view 渲染嵌套的子路由(page1/page2/page3) -->
|
<!-- ⭐ 这个 router-view 渲染嵌套的子路由(page1/page2/page3) -->
|
||||||
<router-view />
|
<router-view />
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.rotate-180-animation {
|
.rotate-180-animation {
|
||||||
/* 修改为你想要的动画:旋转180度,执行一次,持续0.5秒 */
|
/* 修改为你想要的动画:旋转180度,执行一次,持续0.5秒 */
|
||||||
animation: rotate-180 0.3s ease-in-out;
|
animation: rotate-180 0.3s ease-in-out;
|
||||||
animation-fill-mode:forwards;
|
animation-fill-mode:forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rotate-180-animation-reverse {
|
.rotate-180-animation-reverse {
|
||||||
/* 修改为你想要的动画:旋转180度,执行一次,持续0.5秒 */
|
/* 修改为你想要的动画:旋转180度,执行一次,持续0.5秒 */
|
||||||
animation: rotate-180-reverse 0.3s ease-in-out;
|
animation: rotate-180-reverse 0.3s ease-in-out;
|
||||||
animation-fill-mode:forwards;
|
animation-fill-mode:forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotate-180 {
|
@keyframes rotate-180 {
|
||||||
from {
|
from {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes rotate-180-reverse {
|
@keyframes rotate-180-reverse {
|
||||||
from {
|
from {
|
||||||
transform: rotate(180deg);
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
transform: rotate(0deg);
|
transform: rotate(0deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
35
src/main.js
35
src/main.js
@@ -1,17 +1,18 @@
|
|||||||
import {createApp} from 'vue'
|
import { createPinia } from 'pinia'
|
||||||
import './style.css'
|
import {createApp} from 'vue'
|
||||||
import ElementPlus from 'element-plus'
|
import './style.css'
|
||||||
import 'element-plus/dist/index.css'
|
import ElementPlus from 'element-plus'
|
||||||
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
|
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)
|
|
||||||
|
const app = createApp(App)
|
||||||
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
|
||||||
app.component(key, component)
|
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
|
||||||
}
|
app.component(key, component)
|
||||||
|
}
|
||||||
app.use(ElementPlus)
|
|
||||||
app.use(router)
|
app.use(ElementPlus)
|
||||||
app.mount('#app')
|
app.use(router)
|
||||||
|
router.isReady().then(() => app.mount('#app'))
|
||||||
|
|||||||
@@ -1,29 +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 Home from "./components/home.vue"
|
import Home from "./components/home.vue"
|
||||||
import Panel from "./components/panel.vue";
|
import Panel from "./components/panel.vue";
|
||||||
import Page1 from "./components/page1.vue";
|
import Page1 from "./components/page1.vue";
|
||||||
import Page2 from "./components/page2.vue";
|
import Page2 from "./components/page2.vue";
|
||||||
import Page3 from "./components/page3.vue";
|
import Page3 from "./components/page3.vue";
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{ path: "/", redirect: "/login" },
|
{ path: "/", redirect: "/login" },
|
||||||
{ path: "/login", component: Login },
|
{ path: "/login", component: Login },
|
||||||
{
|
{
|
||||||
path: "/panel",
|
path: "/panel",
|
||||||
component: Panel,
|
component: Panel,
|
||||||
redirect: "/panel/home",
|
redirect: "/panel/home",
|
||||||
children: [
|
children: [
|
||||||
{ path: "home", component:Home},
|
{ path: "home", component:Home},
|
||||||
{ path: "page1", component: Page1 },
|
{ path: "page1", component: Page1 },
|
||||||
{ path: "page2", component: Page2 },
|
{ path: "page2", component: Page2 },
|
||||||
{ path: "page3", component: Page3 },
|
{ path: "page3", component: Page3 },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
const router = createRouter({
|
const router = createRouter({
|
||||||
history: createWebHistory(),
|
history: createWebHistory(),
|
||||||
routes,
|
routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
const token = localStorage.getItem("bm_token");
|
||||||
|
if (to.meta['requiresAuth'] && !token) {
|
||||||
|
return next('/login');
|
||||||
|
}
|
||||||
|
if (to.path === "/login" && token) {
|
||||||
|
return next('/panel');
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
38
src/stores/user.js
Normal file
38
src/stores/user.js
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
import {defineStore} from "pinia";
|
||||||
|
import {ref} from "vue";
|
||||||
|
import {login as loginApi, getUserInfo, logout as logoutApi} from "@/api/user.js";
|
||||||
|
|
||||||
|
const TOKEN_KEY = 'bm_token'
|
||||||
|
|
||||||
|
export const useUserStore = defineStore('user', () => {
|
||||||
|
const token = ref(localStorage.getItem(TOKEN_KEY) || '')
|
||||||
|
const userInfo = ref({})
|
||||||
|
|
||||||
|
async function login(form) {
|
||||||
|
const data = await loginApi(form)
|
||||||
|
token.value = data.token
|
||||||
|
userInfo.value = data.user
|
||||||
|
localStorage.setItem(TOKEN_KEY, data.token)
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchUserInfo() {
|
||||||
|
const data = await getUserInfo()
|
||||||
|
userInfo.value = data
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
|
||||||
|
async function logout() {
|
||||||
|
try {
|
||||||
|
await logoutApi()
|
||||||
|
} catch (_) {
|
||||||
|
|
||||||
|
}
|
||||||
|
token.value = ''
|
||||||
|
userInfo.value = {}
|
||||||
|
localStorage.removeItem(TOKEN_KEY)
|
||||||
|
}
|
||||||
|
|
||||||
|
return {token, userInfo, logout, login, fetchUserInfo}
|
||||||
|
|
||||||
|
})
|
||||||
@@ -1,7 +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'
|
||||||
// https://vite.dev/config/
|
|
||||||
export default defineConfig({
|
// https://vite.dev/config/
|
||||||
plugins: [vue()],
|
export default defineConfig({
|
||||||
})
|
plugins: [vue()],
|
||||||
|
resolve: {
|
||||||
|
alias: {
|
||||||
|
'@': fileURLToPath(new URL('./src', import.meta.url)), //代码里写 @/api/user 时,自动当成 ./src/api/user 来找文件
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
port: 5173,
|
||||||
|
proxy: {
|
||||||
|
'/api': {
|
||||||
|
target: 'http://localhost:3000',
|
||||||
|
changeOrigin: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user