|
|
|
@ -40,7 +40,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
fetchCaptcha() {
|
|
|
|
|
fetch('http://localhost:8081/captchaImage')
|
|
|
|
|
fetch('http://localhost:8080/captchaImage')
|
|
|
|
|
.then(response => response.json()) // 将响应解析为 JSON
|
|
|
|
|
.then(data => {
|
|
|
|
|
if (data.code === 200) {
|
|
|
|
@ -57,7 +57,7 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
async login() {
|
|
|
|
|
try {
|
|
|
|
|
const response = await axios.post('http://localhost:8081/login', {
|
|
|
|
|
const response = await axios.post('http://localhost:8080/login', {
|
|
|
|
|
username: this.username,
|
|
|
|
|
password: this.password,
|
|
|
|
|
code: this.code,// 将验证码传递给后端
|
|
|
|
@ -74,7 +74,7 @@ export default {
|
|
|
|
|
|
|
|
|
|
if (response.data.code === 200) {
|
|
|
|
|
console.log('登录成功', response.data);
|
|
|
|
|
window.location.href = 'http://localhost:8080'; // 登录成功后跳转
|
|
|
|
|
window.location.href = 'http://localhost:8081'; // 登录成功后跳转
|
|
|
|
|
} else {
|
|
|
|
|
console.error('登录失败', response.data.msg);
|
|
|
|
|
this.refreshCaptcha(); // 登录失败时刷新验证码
|
|
|
|
|