feat: 组织
This commit is contained in:
parent
d9d680c9b7
commit
7e285b2a4d
File diff suppressed because it is too large
Load Diff
|
|
@ -12,12 +12,19 @@
|
||||||
"type-check": "vue-tsc --build --force"
|
"type-check": "vue-tsc --build --force"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"ant-design-vue": "^4.2.3",
|
||||||
|
"axios": "^1.7.2",
|
||||||
|
"js-cookie": "^3.0.5",
|
||||||
|
"lodash-es": "^4.17.21",
|
||||||
"pinia": "^2.1.7",
|
"pinia": "^2.1.7",
|
||||||
|
"ts-md5": "^1.3.1",
|
||||||
"vue": "^3.4.29",
|
"vue": "^3.4.29",
|
||||||
|
"vue-i18n": "^9.13.1",
|
||||||
"vue-router": "^4.3.3"
|
"vue-router": "^4.3.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@tsconfig/node20": "^20.1.4",
|
"@tsconfig/node20": "^20.1.4",
|
||||||
|
"@types/js-cookie": "^3.0.6",
|
||||||
"@types/jsdom": "^21.1.7",
|
"@types/jsdom": "^21.1.7",
|
||||||
"@types/node": "^20.14.5",
|
"@types/node": "^20.14.5",
|
||||||
"@vitejs/plugin-vue": "^5.0.5",
|
"@vitejs/plugin-vue": "^5.0.5",
|
||||||
|
|
@ -25,6 +32,7 @@
|
||||||
"@vue/test-utils": "^2.4.6",
|
"@vue/test-utils": "^2.4.6",
|
||||||
"@vue/tsconfig": "^0.5.1",
|
"@vue/tsconfig": "^0.5.1",
|
||||||
"jsdom": "^24.1.0",
|
"jsdom": "^24.1.0",
|
||||||
|
"less": "^4.2.0",
|
||||||
"npm-run-all2": "^6.2.0",
|
"npm-run-all2": "^6.2.0",
|
||||||
"typescript": "~5.4.0",
|
"typescript": "~5.4.0",
|
||||||
"vite": "^5.3.1",
|
"vite": "^5.3.1",
|
||||||
|
|
|
||||||
80
src/App.vue
80
src/App.vue
|
|
@ -1,85 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { RouterLink, RouterView } from 'vue-router'
|
import home from '@/views/home/home.vue'
|
||||||
import HelloWorld from './components/HelloWorld.vue'
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<header>
|
<!-- <home/> -->
|
||||||
<img alt="Vue logo" class="logo" src="@/assets/logo.svg" width="125" height="125" />
|
<router-view />
|
||||||
|
|
||||||
<div class="wrapper">
|
|
||||||
<HelloWorld msg="You did it!" />
|
|
||||||
|
|
||||||
<nav>
|
|
||||||
<RouterLink to="/">Home</RouterLink>
|
|
||||||
<RouterLink to="/about">About</RouterLink>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<RouterView />
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
header {
|
|
||||||
line-height: 1.5;
|
|
||||||
max-height: 100vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
display: block;
|
|
||||||
margin: 0 auto 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav {
|
|
||||||
width: 100%;
|
|
||||||
font-size: 12px;
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a.router-link-exact-active {
|
|
||||||
color: var(--color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a.router-link-exact-active:hover {
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 0 1rem;
|
|
||||||
border-left: 1px solid var(--color-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
nav a:first-of-type {
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
place-items: center;
|
|
||||||
padding-right: calc(var(--section-gap) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.logo {
|
|
||||||
margin: 0 2rem 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
header .wrapper {
|
|
||||||
display: flex;
|
|
||||||
place-items: flex-start;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
nav {
|
|
||||||
text-align: left;
|
|
||||||
margin-left: -1rem;
|
|
||||||
font-size: 1rem;
|
|
||||||
|
|
||||||
padding: 1rem 0;
|
|
||||||
margin-top: 1rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
import http from '@/utils/http'
|
||||||
|
import type { AxiosRequestConfig } from 'axios'
|
||||||
|
|
||||||
|
export const getMenuApi = (params:{}) => { return http.get('/api/application/menus', params) }
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
export interface IApplication{
|
||||||
|
id:number
|
||||||
|
code:string
|
||||||
|
serret:string
|
||||||
|
name:string
|
||||||
|
description:string
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
export interface IMenu{
|
||||||
|
id:number
|
||||||
|
appCode:string
|
||||||
|
code:string
|
||||||
|
name:string
|
||||||
|
parentCode:string
|
||||||
|
type:string
|
||||||
|
order:string
|
||||||
|
icon:string
|
||||||
|
path:string
|
||||||
|
childpath:string
|
||||||
|
isShow:string
|
||||||
|
childeren?:IMenu[]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
export interface IOrganization {
|
||||||
|
id:number
|
||||||
|
name:string
|
||||||
|
parent_id:number
|
||||||
|
sort:number
|
||||||
|
status:number
|
||||||
|
path:string
|
||||||
|
leaders:string[]
|
||||||
|
children:IOrganization[]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
import type {IMenu} from "@/api/application/menu"
|
||||||
|
|
||||||
|
export interface IRole{
|
||||||
|
id:number
|
||||||
|
code:string
|
||||||
|
name:string
|
||||||
|
created_on:string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IOrgRoleAuthor {
|
||||||
|
id:number
|
||||||
|
org_id:number
|
||||||
|
org_name:string
|
||||||
|
role_id:number
|
||||||
|
role_name:string
|
||||||
|
option:number //选择:0-选择组织,1-选择组织含下级
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IRoleMenu extends IMenu{
|
||||||
|
role_id:number
|
||||||
|
role_name:number
|
||||||
|
role_code:number
|
||||||
|
author:boolean
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
import type { ILoginReq, IUser, IUsers } from './model'
|
||||||
|
import http from '@/utils/http'
|
||||||
|
|
||||||
|
export const loginApi = (params: ILoginReq): RES<any> => http.post('/api/user/login', params)
|
||||||
|
|
||||||
|
export const userApi = (): RES<IUser> => http.get('/api/user/user')
|
||||||
|
|
||||||
|
export const addApi = (params: {}) => http.post('/api/user/add', params)
|
||||||
|
|
||||||
|
export const logoutApi = (params: {}) => http.post('/api/user/logout', params)
|
||||||
|
|
||||||
|
export const searchApi = (params: {}): RES<IUsers> => http.get('/api/user/search', params)
|
||||||
|
|
||||||
|
export const disableApi = (params: {}) => http.post('/api/user/disable', params)
|
||||||
|
|
||||||
|
export const enableApi = (params: {}) => http.post('/api/user/enable', params)
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
import type { IMenu } from "@/api/application/menu";
|
||||||
|
import type { IRole } from "@/api/role/role";
|
||||||
|
import type { IOrganization } from "@/api/organization/organization";
|
||||||
|
|
||||||
|
export interface IUser extends IUserInfo{
|
||||||
|
roles:IRole[];
|
||||||
|
orgs:IOrganization[];
|
||||||
|
menus:IMenu[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IUsers{
|
||||||
|
users:IUser[];
|
||||||
|
page:number;
|
||||||
|
total:number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface IUserInfo{
|
||||||
|
id:number;
|
||||||
|
account:string;
|
||||||
|
name:string;
|
||||||
|
mobile:string;
|
||||||
|
email:string;
|
||||||
|
sex:number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ILoginReq{
|
||||||
|
account:string
|
||||||
|
pwd:string
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 787 KiB |
|
|
@ -1,41 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
defineProps<{
|
|
||||||
msg: string
|
|
||||||
}>()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="greetings">
|
|
||||||
<h1 class="green">{{ msg }}</h1>
|
|
||||||
<h3>
|
|
||||||
You’ve successfully created a project with
|
|
||||||
<a href="https://vitejs.dev/" target="_blank" rel="noopener">Vite</a> +
|
|
||||||
<a href="https://vuejs.org/" target="_blank" rel="noopener">Vue 3</a>. What's next?
|
|
||||||
</h3>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
h1 {
|
|
||||||
font-weight: 500;
|
|
||||||
font-size: 2.6rem;
|
|
||||||
position: relative;
|
|
||||||
top: -10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.greetings h1,
|
|
||||||
.greetings h3 {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.greetings h1,
|
|
||||||
.greetings h3 {
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,88 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import WelcomeItem from './WelcomeItem.vue'
|
|
||||||
import DocumentationIcon from './icons/IconDocumentation.vue'
|
|
||||||
import ToolingIcon from './icons/IconTooling.vue'
|
|
||||||
import EcosystemIcon from './icons/IconEcosystem.vue'
|
|
||||||
import CommunityIcon from './icons/IconCommunity.vue'
|
|
||||||
import SupportIcon from './icons/IconSupport.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<WelcomeItem>
|
|
||||||
<template #icon>
|
|
||||||
<DocumentationIcon />
|
|
||||||
</template>
|
|
||||||
<template #heading>Documentation</template>
|
|
||||||
|
|
||||||
Vue’s
|
|
||||||
<a href="https://vuejs.org/" target="_blank" rel="noopener">official documentation</a>
|
|
||||||
provides you with all information you need to get started.
|
|
||||||
</WelcomeItem>
|
|
||||||
|
|
||||||
<WelcomeItem>
|
|
||||||
<template #icon>
|
|
||||||
<ToolingIcon />
|
|
||||||
</template>
|
|
||||||
<template #heading>Tooling</template>
|
|
||||||
|
|
||||||
This project is served and bundled with
|
|
||||||
<a href="https://vitejs.dev/guide/features.html" target="_blank" rel="noopener">Vite</a>. The
|
|
||||||
recommended IDE setup is
|
|
||||||
<a href="https://code.visualstudio.com/" target="_blank" rel="noopener">VSCode</a> +
|
|
||||||
<a href="https://github.com/johnsoncodehk/volar" target="_blank" rel="noopener">Volar</a>. If
|
|
||||||
you need to test your components and web pages, check out
|
|
||||||
<a href="https://www.cypress.io/" target="_blank" rel="noopener">Cypress</a> and
|
|
||||||
<a href="https://on.cypress.io/component" target="_blank" rel="noopener"
|
|
||||||
>Cypress Component Testing</a
|
|
||||||
>.
|
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
More instructions are available in <code>README.md</code>.
|
|
||||||
</WelcomeItem>
|
|
||||||
|
|
||||||
<WelcomeItem>
|
|
||||||
<template #icon>
|
|
||||||
<EcosystemIcon />
|
|
||||||
</template>
|
|
||||||
<template #heading>Ecosystem</template>
|
|
||||||
|
|
||||||
Get official tools and libraries for your project:
|
|
||||||
<a href="https://pinia.vuejs.org/" target="_blank" rel="noopener">Pinia</a>,
|
|
||||||
<a href="https://router.vuejs.org/" target="_blank" rel="noopener">Vue Router</a>,
|
|
||||||
<a href="https://test-utils.vuejs.org/" target="_blank" rel="noopener">Vue Test Utils</a>, and
|
|
||||||
<a href="https://github.com/vuejs/devtools" target="_blank" rel="noopener">Vue Dev Tools</a>. If
|
|
||||||
you need more resources, we suggest paying
|
|
||||||
<a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">Awesome Vue</a>
|
|
||||||
a visit.
|
|
||||||
</WelcomeItem>
|
|
||||||
|
|
||||||
<WelcomeItem>
|
|
||||||
<template #icon>
|
|
||||||
<CommunityIcon />
|
|
||||||
</template>
|
|
||||||
<template #heading>Community</template>
|
|
||||||
|
|
||||||
Got stuck? Ask your question on
|
|
||||||
<a href="https://chat.vuejs.org" target="_blank" rel="noopener">Vue Land</a>, our official
|
|
||||||
Discord server, or
|
|
||||||
<a href="https://stackoverflow.com/questions/tagged/vue.js" target="_blank" rel="noopener"
|
|
||||||
>StackOverflow</a
|
|
||||||
>. You should also subscribe to
|
|
||||||
<a href="https://news.vuejs.org" target="_blank" rel="noopener">our mailing list</a> and follow
|
|
||||||
the official
|
|
||||||
<a href="https://twitter.com/vuejs" target="_blank" rel="noopener">@vuejs</a>
|
|
||||||
twitter account for latest news in the Vue world.
|
|
||||||
</WelcomeItem>
|
|
||||||
|
|
||||||
<WelcomeItem>
|
|
||||||
<template #icon>
|
|
||||||
<SupportIcon />
|
|
||||||
</template>
|
|
||||||
<template #heading>Support Vue</template>
|
|
||||||
|
|
||||||
As an independent project, Vue relies on community backing for its sustainability. You can help
|
|
||||||
us by
|
|
||||||
<a href="https://vuejs.org/sponsor/" target="_blank" rel="noopener">becoming a sponsor</a>.
|
|
||||||
</WelcomeItem>
|
|
||||||
</template>
|
|
||||||
|
|
@ -1,87 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="item">
|
|
||||||
<i>
|
|
||||||
<slot name="icon"></slot>
|
|
||||||
</i>
|
|
||||||
<div class="details">
|
|
||||||
<h3>
|
|
||||||
<slot name="heading"></slot>
|
|
||||||
</h3>
|
|
||||||
<slot></slot>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.item {
|
|
||||||
margin-top: 2rem;
|
|
||||||
display: flex;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.details {
|
|
||||||
flex: 1;
|
|
||||||
margin-left: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
display: flex;
|
|
||||||
place-items: center;
|
|
||||||
place-content: center;
|
|
||||||
width: 32px;
|
|
||||||
height: 32px;
|
|
||||||
|
|
||||||
color: var(--color-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-size: 1.2rem;
|
|
||||||
font-weight: 500;
|
|
||||||
margin-bottom: 0.4rem;
|
|
||||||
color: var(--color-heading);
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.item {
|
|
||||||
margin-top: 0;
|
|
||||||
padding: 0.4rem 0 1rem calc(var(--section-gap) / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
i {
|
|
||||||
top: calc(50% - 25px);
|
|
||||||
left: -26px;
|
|
||||||
position: absolute;
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
background: var(--color-background);
|
|
||||||
border-radius: 8px;
|
|
||||||
width: 50px;
|
|
||||||
height: 50px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:before {
|
|
||||||
content: ' ';
|
|
||||||
border-left: 1px solid var(--color-border);
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
bottom: calc(50% + 25px);
|
|
||||||
height: calc(50% - 25px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:after {
|
|
||||||
content: ' ';
|
|
||||||
border-left: 1px solid var(--color-border);
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: calc(50% + 25px);
|
|
||||||
height: calc(50% - 25px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:first-of-type:before {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.item:last-of-type:after {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
export const baseUrl = import.meta.env.MODE === 'development' ? '/api' : '/api/v1'
|
||||||
|
|
||||||
|
export const imageUrl = import.meta.env.MODE === 'development' ? '/img_url' : ''
|
||||||
|
|
||||||
|
export const app_code:string = 'user-busniss-center'
|
||||||
13
src/main.ts
13
src/main.ts
|
|
@ -1,14 +1,19 @@
|
||||||
import './assets/main.css'
|
// import './assets/main.css'
|
||||||
|
import { setupStore } from './stores/store'
|
||||||
|
import Antd from "ant-design-vue"
|
||||||
import { createApp } from 'vue'
|
import { createApp } from 'vue'
|
||||||
import { createPinia } from 'pinia'
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import router from './router'
|
import router from './router/router'
|
||||||
|
import {setupRouter} from './router/router'
|
||||||
|
|
||||||
const app = createApp(App)
|
const app = createApp(App)
|
||||||
|
|
||||||
app.use(createPinia())
|
app.use(createPinia())
|
||||||
app.use(router)
|
app.use(router)
|
||||||
|
app.use(Antd)
|
||||||
|
setupStore(app)
|
||||||
|
setupRouter(app)
|
||||||
|
await router.isReady()
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
import { getToken } from "@/utils/auth";
|
||||||
|
import type { Route } from "ant-design-vue/es/breadcrumb/Breadcrumb";
|
||||||
|
import type { Router } from "vue-router";
|
||||||
|
import {user} from '@/api/user/api'
|
||||||
|
import type {IUser} from '@/api/user/model'
|
||||||
|
import type { IMenu } from "@/api/application/menu";
|
||||||
|
import {useUserStore} from "@/stores/modules/user"
|
||||||
|
|
||||||
|
const whiteList = ["/login"]
|
||||||
|
|
||||||
|
export function createRouterGuard(router:Router){
|
||||||
|
router.beforeEach(async (to,from,next) =>{
|
||||||
|
if (getToken()){
|
||||||
|
// 获取菜单,构建router和menu
|
||||||
|
const userInfo = await user({})
|
||||||
|
if (userInfo){
|
||||||
|
//
|
||||||
|
const userStore = useUserStore()
|
||||||
|
if (userInfo.data.menus){
|
||||||
|
// 构建菜单
|
||||||
|
// 构建路由
|
||||||
|
userStore.menus = userInfo.data.menus
|
||||||
|
createRouter(router,userInfo.data.menus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 没有token跳转到登陆
|
||||||
|
if (whiteList.indexOf(to.path) !== -1){
|
||||||
|
next()
|
||||||
|
}else{
|
||||||
|
// todo 调用登出接口,删除store等内容
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function createRouter(router:Router,menus:IMenu[]){
|
||||||
|
// todo 创建路由
|
||||||
|
menus.forEach((menu) =>{
|
||||||
|
router.addRoute()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import { createRouter, createWebHistory } from 'vue-router'
|
|
||||||
import HomeView from '../views/HomeView.vue'
|
|
||||||
|
|
||||||
const router = createRouter({
|
|
||||||
history: createWebHistory(import.meta.env.BASE_URL),
|
|
||||||
routes: [
|
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
name: 'home',
|
|
||||||
component: HomeView
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: '/about',
|
|
||||||
name: 'about',
|
|
||||||
// route level code-splitting
|
|
||||||
// this generates a separate chunk (About.[hash].js) for this route
|
|
||||||
// which is lazy-loaded when the route is visited.
|
|
||||||
component: () => import('../views/AboutView.vue')
|
|
||||||
}
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
export default router
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
import { createRouter, createWebHistory } from 'vue-router'
|
||||||
|
import type { RouteRecordRaw } from "vue-router"
|
||||||
|
import type {App} from "vue"
|
||||||
|
|
||||||
|
const routers: RouteRecordRaw[] = [
|
||||||
|
// {
|
||||||
|
// path: '/',
|
||||||
|
// name: 'home',
|
||||||
|
// component: () => import('../views/home/home.vue')
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
path: '/login',
|
||||||
|
name: 'login',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/login/index.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/user',
|
||||||
|
name: 'user',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/user/user.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/organization',
|
||||||
|
name: 'organization',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/organization/organization.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/role',
|
||||||
|
name: 'role',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/role/role.vue')
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/application',
|
||||||
|
name: 'application',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/application/application.vue'),
|
||||||
|
children:[
|
||||||
|
{
|
||||||
|
path:'menu',
|
||||||
|
name:'menu',
|
||||||
|
component:() => import('../views/application/menu/menu.vue'),
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: '/application',
|
||||||
|
name: 'application',
|
||||||
|
// route level code-splitting
|
||||||
|
// this generates a separate chunk (About.[hash].js) for this route
|
||||||
|
// which is lazy-loaded when the route is visited.
|
||||||
|
component: () => import('../views/application/application.vue')
|
||||||
|
},
|
||||||
|
]
|
||||||
|
|
||||||
|
const router = createRouter({
|
||||||
|
history:createWebHistory('/'),
|
||||||
|
routes:routers,
|
||||||
|
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||||
|
})
|
||||||
|
|
||||||
|
export const setupRouter = (app:App<Element>) => {
|
||||||
|
app.use(router)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default router
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
import { ref, computed } from 'vue'
|
|
||||||
import { defineStore } from 'pinia'
|
|
||||||
|
|
||||||
export const useCounterStore = defineStore('counter', () => {
|
|
||||||
const count = ref(0)
|
|
||||||
const doubleCount = computed(() => count.value * 2)
|
|
||||||
function increment() {
|
|
||||||
count.value++
|
|
||||||
}
|
|
||||||
|
|
||||||
return { count, doubleCount, increment }
|
|
||||||
})
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
|
||||||
|
interface appStore{
|
||||||
|
loading:boolean
|
||||||
|
name:string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useAppStore = defineStore("user",{
|
||||||
|
state: () :appStore =>{
|
||||||
|
return {
|
||||||
|
loading:false,
|
||||||
|
name:"用户中心"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getters:{
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
actions:{
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
import { defineStore } from "pinia";
|
||||||
|
import type { IUser } from "@/api/user/model"
|
||||||
|
import type { ItemType } from 'ant-design-vue';
|
||||||
|
import {ref} from 'vue'
|
||||||
|
|
||||||
|
interface userInfo {
|
||||||
|
id: number
|
||||||
|
account: string
|
||||||
|
name: string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface UserStore {
|
||||||
|
info: userInfo
|
||||||
|
menus:any
|
||||||
|
roles: []
|
||||||
|
orgs: []
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useUserStore = defineStore("user", {
|
||||||
|
state: (): UserStore => {
|
||||||
|
return {
|
||||||
|
info: {
|
||||||
|
id: 0,
|
||||||
|
account: "",
|
||||||
|
name: ""
|
||||||
|
},
|
||||||
|
menus: ref(getMenus()),
|
||||||
|
roles: [],
|
||||||
|
orgs: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
getters: {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const getMenus = ():ItemType[] => {
|
||||||
|
return [
|
||||||
|
// {
|
||||||
|
// key:"/",
|
||||||
|
// label:"首页",
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
key:"/user",
|
||||||
|
label:"用户",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key:"/organization",
|
||||||
|
label:"组织",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key:"/role",
|
||||||
|
label:"角色",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key:"/application",
|
||||||
|
label:"应用",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import type {App} from 'vue'
|
||||||
|
import { createPinia } from 'pinia'
|
||||||
|
|
||||||
|
const store = createPinia()
|
||||||
|
|
||||||
|
export function setupStore(app:App<Element>){
|
||||||
|
app.use(store)
|
||||||
|
}
|
||||||
|
|
||||||
|
export {store}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
interface Response<T = any>{
|
||||||
|
data:T;
|
||||||
|
result:boolean;
|
||||||
|
code:number;
|
||||||
|
msg:string;
|
||||||
|
}
|
||||||
|
|
||||||
|
type RES<T> = Promise<Response<T>>
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
import Cookies from "js-cookie"
|
||||||
|
|
||||||
|
const tokenKey = "token"
|
||||||
|
const userIdKey = "id"
|
||||||
|
const userAccountKey = "account"
|
||||||
|
const pwdKey = "pwd"
|
||||||
|
const setOption = {expires:7}
|
||||||
|
|
||||||
|
export function getToken(){
|
||||||
|
return Cookies.get(tokenKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setToken(token: string) {
|
||||||
|
return Cookies.set(tokenKey, token)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function removeToken() {
|
||||||
|
return Cookies.remove(tokenKey)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getAccount = ():string | undefined => {return Cookies.get(userAccountKey)}
|
||||||
|
export const setAccount = (account:string) => {Cookies.set(userAccountKey,account,setOption)}
|
||||||
|
|
||||||
|
export const getUserId = ():number | undefined => {
|
||||||
|
const id = Cookies.get(userIdKey);
|
||||||
|
if (id){
|
||||||
|
return Number(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setUserId = (id:number) => {Cookies.set(userIdKey,String(id),setOption)}
|
||||||
|
|
||||||
|
export const getPwd = ():string | undefined => {return Cookies.get(pwdKey)}
|
||||||
|
|
||||||
|
export const setPwd = (pwd:string) => {Cookies.set(pwdKey,pwd,setOption)}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
import axios from "axios"
|
||||||
|
import { message as Message } from "ant-design-vue"
|
||||||
|
import { removeToken } from "@/utils/auth"
|
||||||
|
import { useRouter } from "vue-router";
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
const instance = axios.create({
|
||||||
|
baseURL:'/user_center',
|
||||||
|
timeout:5000,
|
||||||
|
})
|
||||||
|
|
||||||
|
instance.interceptors.request.use(
|
||||||
|
(config) => config,
|
||||||
|
(err) => Promise.reject(err)
|
||||||
|
)
|
||||||
|
|
||||||
|
instance.interceptors.response.use(
|
||||||
|
(response) =>{
|
||||||
|
let message = ''
|
||||||
|
const data = response.data as Response<any>;
|
||||||
|
if (!data.result){
|
||||||
|
message = data.msg
|
||||||
|
Message.error(message)
|
||||||
|
}else {
|
||||||
|
if (data.code === 400){
|
||||||
|
message = "400 bad request"
|
||||||
|
Message.error(message)
|
||||||
|
}else if (data.code === 401){
|
||||||
|
// 没有权限则删除token,跳转登陆页面
|
||||||
|
removeToken()
|
||||||
|
router.push("/login")
|
||||||
|
}else if (data.code === 403){
|
||||||
|
message = "权限错误"
|
||||||
|
Message.error(message)
|
||||||
|
}else if (data.code === 500){
|
||||||
|
message = "内部错误"
|
||||||
|
Message.error(message)
|
||||||
|
}else if (data.code === 200){
|
||||||
|
return response.data
|
||||||
|
}else{
|
||||||
|
message = "请求错误,错误码: " + response.data.code
|
||||||
|
Message.error(message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(err) =>{
|
||||||
|
Message.error( "请求失败,错误信息: "+ err.message)
|
||||||
|
Promise.reject(err)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
export default instance;
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="about">
|
|
||||||
<h1>This is an about page</h1>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
@media (min-width: 1024px) {
|
|
||||||
.about {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import TheWelcome from '../components/TheWelcome.vue'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<main>
|
|
||||||
<TheWelcome />
|
|
||||||
</main>
|
|
||||||
</template>
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<h>application</h>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
menu
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
<template>
|
||||||
|
<a-layout class="layout">
|
||||||
|
<a-layout-header>
|
||||||
|
<a-menu
|
||||||
|
v-model:selectedKeys="selectedKeys"
|
||||||
|
theme="dark"
|
||||||
|
mode="horizontal"
|
||||||
|
:style="{ lineHeight: '64px' }"
|
||||||
|
>
|
||||||
|
<a-menu-item key="1">nav 1</a-menu-item>
|
||||||
|
<a-menu-item key="2">nav 2</a-menu-item>
|
||||||
|
<a-menu-item key="3">nav 3</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||||
|
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||||
|
<a-dropdown class="settings">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu @click="onLogout">
|
||||||
|
<a-menu-item key="1">
|
||||||
|
<LoginOutlined />
|
||||||
|
退出
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button>
|
||||||
|
account
|
||||||
|
</a-button>
|
||||||
|
<UserOutlined />
|
||||||
|
</a-dropdown>
|
||||||
|
</a-layout-header>
|
||||||
|
<a-layout-sider v-model:collapsed="collapsed" :trigger="null" collapsible :style="{width:'500px'}">
|
||||||
|
<!-- <div class="logo" /> -->
|
||||||
|
<a-menu v-model:openKeys="state.openKeys" v-model:selectedKeys="state.selectedKeys"
|
||||||
|
style="width: 200px" :mode="state.mode"
|
||||||
|
:items="menus" :theme="state.theme" inlineIndent = 0 @click="onclickMenu"></a-menu>
|
||||||
|
</a-layout-sider>
|
||||||
|
|
||||||
|
<a-layout-content :style="{ margin: '24px 16px', padding: '24px', background: '#fff', height: '100%' }">
|
||||||
|
<router-view />
|
||||||
|
</a-layout-content>
|
||||||
|
|
||||||
|
</a-layout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {ref,reactive} from 'vue';
|
||||||
|
import {UserOutlined,MenuUnfoldOutlined,MenuFoldOutlined,LoginOutlined,} from '@ant-design/icons-vue';
|
||||||
|
import { useUserStore} from '@/stores/modules/user';
|
||||||
|
import type {MenuProps,MenuMode,MenuTheme,ItemType} from 'ant-design-vue'
|
||||||
|
import { useRouter,RouterView} from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const selectedKeys = ref < string[] > (['1']);
|
||||||
|
const collapsed = ref < boolean > (false);
|
||||||
|
const account = ref < string > ('admin');
|
||||||
|
const onclickMenu:MenuProps['onClick'] = e => {
|
||||||
|
router.push(e.key as string)
|
||||||
|
};
|
||||||
|
|
||||||
|
const menus = useUserStore().menus;
|
||||||
|
const state = reactive({
|
||||||
|
mode: 'inline' as MenuMode,
|
||||||
|
theme: 'dark' as MenuTheme,
|
||||||
|
selectedKeys: ['1'],
|
||||||
|
openKeys: ['sub1'],
|
||||||
|
});
|
||||||
|
|
||||||
|
const onLogout = () => {
|
||||||
|
console.log('loginout')
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.header {
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
position:absolute;
|
||||||
|
right:0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
<template>
|
||||||
|
<a-layout>
|
||||||
|
<a-layout-sider v-model:collapsed="collapsed" :trigger="null" collapsible :style="{width:'500px'}">
|
||||||
|
<!-- <div class="logo" /> -->
|
||||||
|
<a-menu v-model:openKeys="state.openKeys" v-model:selectedKeys="state.selectedKeys"
|
||||||
|
style="width: 200px" :mode="state.mode"
|
||||||
|
:items="menus" :theme="state.theme" inlineIndent = 0 @click="onclickMenu"></a-menu>
|
||||||
|
</a-layout-sider>
|
||||||
|
<a-layout>
|
||||||
|
<a-layout-header class="header" style="background: #fff; padding: 0">
|
||||||
|
<menu-unfold-outlined v-if="collapsed" class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||||
|
<menu-fold-outlined v-else class="trigger" @click="() => (collapsed = !collapsed)" />
|
||||||
|
|
||||||
|
<a-dropdown class="settings">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu @click="onLogout">
|
||||||
|
<a-menu-item key="1">
|
||||||
|
<LoginOutlined />
|
||||||
|
退出
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button>
|
||||||
|
account
|
||||||
|
</a-button>
|
||||||
|
<UserOutlined />
|
||||||
|
</a-dropdown>
|
||||||
|
|
||||||
|
</a-layout-header>
|
||||||
|
<a-layout-content :style="{ margin: '24px 16px', padding: '24px', background: '#fff', minHeight: '280px' }">
|
||||||
|
<router-view />
|
||||||
|
</a-layout-content>
|
||||||
|
</a-layout>
|
||||||
|
</a-layout>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import {ref,reactive} from 'vue';
|
||||||
|
import {UserOutlined,MenuUnfoldOutlined,MenuFoldOutlined,LoginOutlined,} from '@ant-design/icons-vue';
|
||||||
|
import { useUserStore} from '@/stores/modules/user';
|
||||||
|
import type {MenuProps,MenuMode,MenuTheme,ItemType} from 'ant-design-vue'
|
||||||
|
import { useRouter,RouterView} from 'vue-router'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const selectedKeys = ref < string[] > (['1']);
|
||||||
|
const collapsed = ref < boolean > (false);
|
||||||
|
const account = ref < string > ('admin');
|
||||||
|
const onclickMenu:MenuProps['onClick'] = e => {
|
||||||
|
router.push(e.key as string)
|
||||||
|
};
|
||||||
|
|
||||||
|
const menus = useUserStore().menus;
|
||||||
|
const state = reactive({
|
||||||
|
mode: 'inline' as MenuMode,
|
||||||
|
theme: 'dark' as MenuTheme,
|
||||||
|
selectedKeys: ['1'],
|
||||||
|
openKeys: ['sub1'],
|
||||||
|
});
|
||||||
|
|
||||||
|
const onLogout = () => {
|
||||||
|
console.log('loginout')
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.header {
|
||||||
|
position:relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.settings {
|
||||||
|
position:absolute;
|
||||||
|
right:0;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<template>
|
||||||
|
<div class="login">
|
||||||
|
<login />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import login from './login.vue'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
.login {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background-size: cover;
|
||||||
|
box-sizing: border-box;
|
||||||
|
justify-content: flex-end;
|
||||||
|
background-image: url('../../assets/images/login-bg.jpg');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
<template>
|
||||||
|
<div class="mr-25 bg-white p-6 w-100">
|
||||||
|
<h3 class="text-xl text-center mb-5 font-bold">登录</h3>
|
||||||
|
<a-form
|
||||||
|
:model="formState"
|
||||||
|
name="custom-validation"
|
||||||
|
ref="formRef"
|
||||||
|
:label-col="{ span: 0 }"
|
||||||
|
:wrapper-col="{ span: 24}"
|
||||||
|
:rules="rules"
|
||||||
|
@finish="onFinish"
|
||||||
|
@finishFailed="onFinishFailed"
|
||||||
|
>
|
||||||
|
<a-form-item name="account">
|
||||||
|
<a-input size="large" v-model:value="formState.account" placeholder="请输入账号" />
|
||||||
|
<template #prefix>
|
||||||
|
<UserOutlined style="color: rgba(0, 0, 0, 0.25)" />
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item name="password">
|
||||||
|
<a-input-password size="large" v-model:value="formState.password" placeholder="请输入密码" />
|
||||||
|
<template #prefix>
|
||||||
|
<LockOutlined style="color: rgba(0, 0, 0, 0.25)" />
|
||||||
|
</template>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item name="remember" :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
<a-checkbox v-model:checked="formState.remember">记住我?</a-checkbox>
|
||||||
|
</a-form-item>
|
||||||
|
|
||||||
|
<a-form-item :wrapper-col="{ offset: 8, span: 16 }">
|
||||||
|
<a-button class="mt-5" type="primary" html-type="submit" size="large"
|
||||||
|
style="width: 100%">登录</a-button>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { reactive,unref } from 'vue';
|
||||||
|
import { loginApi } from '@/api/user/api';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
|
import { getAccount,getPwd,getToken, setAccount, setPwd } from '@/utils/auth'
|
||||||
|
import {Md5} from 'ts-md5'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
|
||||||
|
interface FormState {
|
||||||
|
account: string|undefined;
|
||||||
|
password: string|undefined;
|
||||||
|
remember: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const formState = reactive<FormState>({
|
||||||
|
account: getAccount(),
|
||||||
|
password: getPwd(),
|
||||||
|
remember: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
const rules = {
|
||||||
|
userName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入用户账号',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
password: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入密码',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
const params = {account:values.account,pwd:Md5.hashStr(values.password)}
|
||||||
|
rememberDeal(values)
|
||||||
|
|
||||||
|
loginApi(params).then((res)=>{
|
||||||
|
if (res.code == 200){
|
||||||
|
router.push('/')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
console.log('Login Success:', values);
|
||||||
|
};
|
||||||
|
|
||||||
|
const onFinishFailed = (errorInfo: any) => {
|
||||||
|
console.log('Login Failed:', errorInfo);
|
||||||
|
};
|
||||||
|
|
||||||
|
const rememberDeal = (value:FormState) =>{
|
||||||
|
if (value.remember){
|
||||||
|
setAccount(value.account as string)
|
||||||
|
setPwd(value.password as string)
|
||||||
|
}else{
|
||||||
|
setAccount('')
|
||||||
|
setPwd('')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<h>organization</h>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<h>role</h>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<template>
|
||||||
|
<h>user</h>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
</script>
|
||||||
|
|
@ -10,5 +10,8 @@
|
||||||
{
|
{
|
||||||
"path": "./tsconfig.vitest.json"
|
"path": "./tsconfig.vitest.json"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"compilerOptions": {
|
||||||
|
"types":["vite/client"],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,19 @@ export default defineConfig({
|
||||||
alias: {
|
alias: {
|
||||||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
server: {
|
||||||
|
host:'0.0.0.0',
|
||||||
|
port:9090,
|
||||||
|
/** 端口被占用时,是否直接退出 */
|
||||||
|
strictPort: false,
|
||||||
|
proxy: {
|
||||||
|
// 带选项写法:http://localhost:5173/api/bar -> http://jsonplaceholder.typicode.com/bar
|
||||||
|
'/user_center': {
|
||||||
|
target: 'http://172.31.98.18:9100',
|
||||||
|
changeOrigin: true,
|
||||||
|
rewrite: (path) => path.replace(/^\/user_center/, ''),
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue