chore: 项目环境升级为 JDK25,Spring 4.1,项目重构为多模块
This commit is contained in:
18
web-ui/packages/admin/package.json
Normal file
18
web-ui/packages/admin/package.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@manuagent/admin",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./src/index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@manuagent/common": "0.1.0",
|
||||
"vue": "3.5.41",
|
||||
"vue-router": "^4.6.3",
|
||||
"element-plus": "2.14.5"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "vue-tsc --noEmit -p tsconfig.json"
|
||||
}
|
||||
}
|
||||
9
web-ui/packages/admin/src/api.ts
Normal file
9
web-ui/packages/admin/src/api.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { api, resetCsrf } from '@manuagent/common'
|
||||
|
||||
export function login(username: string, password: string) {
|
||||
resetCsrf()
|
||||
return api('/api/auth/login', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ username, password })
|
||||
})
|
||||
}
|
||||
2
web-ui/packages/admin/src/index.ts
Normal file
2
web-ui/packages/admin/src/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as LoginPage } from './pages/LoginPage.vue'
|
||||
export { login } from './api'
|
||||
46
web-ui/packages/admin/src/pages/LoginPage.vue
Normal file
46
web-ui/packages/admin/src/pages/LoginPage.vue
Normal file
@@ -0,0 +1,46 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { login } from '../api'
|
||||
|
||||
const props = defineProps<{ destination: string }>()
|
||||
const router = useRouter()
|
||||
const username = ref('admin')
|
||||
const password = ref('admin123')
|
||||
const loading = ref(false)
|
||||
const error = ref('')
|
||||
|
||||
async function submit() {
|
||||
if (loading.value) return
|
||||
loading.value = true
|
||||
error.value = ''
|
||||
try {
|
||||
await login(username.value, password.value)
|
||||
await router.replace(props.destination)
|
||||
} catch (reason) {
|
||||
error.value = reason instanceof Error ? reason.message : '登录失败'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="login-page">
|
||||
<form class="login-panel" @submit.prevent="submit">
|
||||
<div class="brand large">智</div>
|
||||
<h1>智造申报 Agent</h1>
|
||||
<el-input v-model="username" autocomplete="username" aria-label="用户名" placeholder="用户名" />
|
||||
<el-input
|
||||
v-model="password"
|
||||
type="password"
|
||||
show-password
|
||||
autocomplete="current-password"
|
||||
aria-label="密码"
|
||||
placeholder="密码"
|
||||
/>
|
||||
<p v-if="error" class="form-error">{{ error }}</p>
|
||||
<el-button native-type="submit" type="primary" :loading="loading" class="full-button">登录</el-button>
|
||||
</form>
|
||||
</main>
|
||||
</template>
|
||||
7
web-ui/packages/admin/tsconfig.json
Normal file
7
web-ui/packages/admin/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"src/**/*.vue"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user