开发助手
This commit is contained in:
parent
d7e69e07b8
commit
bfbe7fcd70
@ -16,7 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Transactional
|
||||
public class AuthenticationService {
|
||||
|
||||
@Value("${file.password}")
|
||||
@Value("${login.password}")
|
||||
private String loginPassword;
|
||||
|
||||
public boolean login(String password, HttpServletRequest request) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8080
|
||||
port: 80
|
||||
spring:
|
||||
application:
|
||||
name: dev-assistant-service
|
||||
@ -22,4 +22,6 @@ spring:
|
||||
|
||||
file:
|
||||
upload-dir: ./data/files
|
||||
password: "0105"
|
||||
|
||||
login:
|
||||
password: "0105"
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
<link rel="icon" type="image/svg+xml" href="./logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>开发助手</title>
|
||||
<script type="module" crossorigin src="./assets/index-BWAEkyiu.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-Bn6hwlxB.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-BfmNLccx.css">
|
||||
</head>
|
||||
<body>
|
||||
|
@ -4,6 +4,7 @@ import {useRouter} from "vue-router";
|
||||
import {loginApi} from "~/api/login.js";
|
||||
|
||||
const loginFormRef = ref()
|
||||
const inputRef = ref()
|
||||
const router = useRouter()
|
||||
|
||||
const loginForm = ref({
|
||||
@ -11,7 +12,6 @@ const loginForm = ref({
|
||||
})
|
||||
|
||||
const loging = ref(false)
|
||||
const message = ref('')
|
||||
|
||||
// 表单校验规则
|
||||
const loginFormRules = reactive({
|
||||
@ -23,23 +23,30 @@ const login = async (loginFormRef) => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
loging.value = true
|
||||
loginApi(loginForm.value).then((res) => {
|
||||
let data = res.data
|
||||
loging.value = false
|
||||
if (data.code === 200) {
|
||||
router.push('/')
|
||||
} else {
|
||||
message.value = data.message
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.error(JSON.stringify(err))
|
||||
loging.value = false
|
||||
message.value = '系统错误 请稍后再试'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let timer = null
|
||||
const passwordKeyup = (loginFormRef) => {
|
||||
if (timer) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
timer = setTimeout(() => {
|
||||
login(loginFormRef)
|
||||
}, 300);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
inputRef.value.focus()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -51,15 +58,18 @@ const login = async (loginFormRef) => {
|
||||
</div>
|
||||
<el-form ref="loginFormRef" :model="loginForm" :rules="loginFormRules" class="login-form">
|
||||
<el-form-item prop="password">
|
||||
<el-input v-model="loginForm.password" autocomplete="new-password" clearable type="password" size="large"
|
||||
placeholder="请输入口令" @keyup.enter="login(loginFormRef)"></el-input>
|
||||
<el-input
|
||||
v-model="loginForm.password"
|
||||
autocomplete="new-password"
|
||||
clearable type="password"
|
||||
size="large"
|
||||
placeholder="请输入口令"
|
||||
ref="inputRef"
|
||||
@keyup="passwordKeyup(loginFormRef)"></el-input>
|
||||
</el-form-item>
|
||||
<el-button type="primary" size="large" @click="login(loginFormRef)" style="width: 100%">
|
||||
登录
|
||||
</el-button>
|
||||
<div class="message">
|
||||
<el-text type="danger"> {{ message }}</el-text>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
@ -91,6 +101,7 @@ const login = async (loginFormRef) => {
|
||||
width: 320px;
|
||||
height: 260px;
|
||||
overflow: visible;
|
||||
margin-top: -100px;
|
||||
}
|
||||
|
||||
.title {
|
||||
|
Loading…
x
Reference in New Issue
Block a user