Compare commits

..

No commits in common. "7504b2a9decfa3af735ff03a56a839499414b3f3" and "d6ba24ae331bbd5bf351ebb79e7fdf3fbea5c4b0" have entirely different histories.

5 changed files with 58 additions and 65 deletions

View File

@ -1,5 +1,5 @@
<template>
<div class="app-container">
<div id="app">
<!-- 登录页面不显示布局 -->
<router-view v-if="$route.path === '/login'" />
<!-- 主应用布局 -->
@ -14,13 +14,7 @@ import AppLayout from '@/components/AppLayout.vue'
</script>
<style>
/* 全局样式重置 */
body {
margin: 0;
padding: 0;
}
.app-container {
#app {
font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}
</style>
</style>

View File

@ -64,4 +64,4 @@ api.interceptors.response.use(
}
)
export default api
export default api

View File

@ -51,4 +51,4 @@ export const userApi = {
deleteUsers(ids) {
return api.delete('/sysUser/batch', { data: { ids } })
}
}
}

View File

@ -6,45 +6,50 @@
<p class="login-subtitle">部署管理系统</p>
</div>
<div class="login-form">
<div class="form-item">
<t-input
v-model="formData.account"
placeholder="请输入用户名"
size="large"
>
<template #prefix-icon>
<t-icon name="user" />
</template>
</t-input>
</div>
<div class="form-item">
<t-input
v-model="formData.password"
type="password"
placeholder="请输入密码"
size="large"
@keyup.enter="handleSubmit"
>
<template #prefix-icon>
<t-icon name="lock-on" />
</template>
</t-input>
</div>
<t-form
ref="form"
:data="formData"
:rules="rules"
@submit="handleSubmit"
>
<t-form-item name="username">
<t-input
v-model="formData.username"
placeholder="请输入用户名"
size="large"
>
<template #prefix-icon>
<t-icon name="user" />
</template>
</t-input>
</t-form-item>
<div class="form-item">
<t-form-item name="password">
<t-input
v-model="formData.password"
type="password"
placeholder="请输入密码"
size="large"
@keyup.enter="handleSubmit"
>
<template #prefix-icon>
<t-icon name="lock-on" />
</template>
</t-input>
</t-form-item>
<t-form-item>
<t-button
type="submit"
theme="primary"
size="large"
block
:loading="loading"
@click="handleSubmit"
>
登录
</t-button>
</div>
</div>
</t-form-item>
</t-form>
</div>
</div>
</template>
@ -53,29 +58,30 @@
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router'
import { MessagePlugin } from 'tdesign-vue-next'
import { userApi } from '@/api/user'
import auth from '@/utils/auth'
const router = useRouter()
const form = ref()
const loading = ref(false)
const formData = reactive({
account: '',
password: '',
checked: true
username: '',
password: ''
})
const rules = {
username: [
{ required: true, message: '请输入用户名', type: 'error' }
],
password: [
{ required: true, message: '请输入密码', type: 'error' }
]
}
const handleSubmit = async () => {
//
if (!formData.account.trim()) {
MessagePlugin.error('请输入用户名')
return
}
if (!formData.password.trim()) {
MessagePlugin.error('请输入密码')
return
}
const valid = await form.value.validate()
if (!valid) return
loading.value = true
@ -112,6 +118,7 @@ const handleSubmit = async () => {
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
}
.login-card {
@ -141,18 +148,10 @@ const handleSubmit = async () => {
margin: 0;
}
.login-form {
margin-top: 32px;
}
.form-item {
:deep(.t-form-item) {
margin-bottom: 24px;
}
.form-item:last-child {
margin-bottom: 0;
}
:deep(.t-input) {
border-radius: 8px;
}

View File

@ -17,11 +17,11 @@ export default defineConfig({
'/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path
rewrite: (path) => path.replace(/^\/api/, '')
}
}
},
build: {
outDir: 'dist'
}
})
})