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