diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index ea54572..1962987 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -16,7 +16,7 @@ ruoyi: # 开发环境配置 server: # 服务器的HTTP端口,默认为8081 - port: 8081 + port: 8080 servlet: # 应用的访问路径 context-path: / diff --git a/vue2/vue/src/components/Login.vue b/vue2/vue/src/components/Login.vue index 68e9eb9..322a7c2 100644 --- a/vue2/vue/src/components/Login.vue +++ b/vue2/vue/src/components/Login.vue @@ -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) { @@ -56,35 +56,35 @@ export default { }); }, async login() { - try { - const response = await axios.post('http://localhost:8081/login', { - username: this.username, - password: this.password, - code: this.code,// 将验证码传递给后端 - uuid: this.uuid - }, { - headers: { - 'Content-Type': 'application/json' // 指定内容类型为 JSON - } - }); - console.log('用户名',this.username); - console.log('密码',this.password); - console.log('验证码',this.code); - console.log('uuid',this.uuid); - - if (response.data.code === 200) { - console.log('登录成功', response.data); - window.location.href = 'http://localhost:8080'; // 登录成功后跳转 - } else { - console.error('登录失败', response.data.msg); - this.refreshCaptcha(); // 登录失败时刷新验证码 + try { + const response = await axios.post('http://localhost:8080/login', { + username: this.username, + password: this.password, + code: this.code,// 将验证码传递给后端 + uuid: this.uuid + }, { + headers: { + 'Content-Type': 'application/json' // 指定内容类型为 JSON } - } catch (error) { - console.error('登录失败', error); - // 登录失败时可以选择刷新验证码 - this.refreshCaptcha(); + }); + console.log('用户名',this.username); + console.log('密码',this.password); + console.log('验证码',this.code); + console.log('uuid',this.uuid); + + if (response.data.code === 200) { + console.log('登录成功', response.data); + window.location.href = 'http://localhost:8081'; // 登录成功后跳转 + } else { + console.error('登录失败', response.data.msg); + this.refreshCaptcha(); // 登录失败时刷新验证码 } - }, + } catch (error) { + console.error('登录失败', error); + // 登录失败时可以选择刷新验证码 + this.refreshCaptcha(); + } + }, // 刷新验证码 refreshCaptcha() { this.fetchCaptcha(); diff --git a/vue2/vue/src/components/Register.vue b/vue2/vue/src/components/Register.vue index 502a987..dc978cd 100644 --- a/vue2/vue/src/components/Register.vue +++ b/vue2/vue/src/components/Register.vue @@ -39,7 +39,7 @@ export default { return; } try { - const response = await axios.post('http://localhost:8081/register', { + const response = await axios.post('http://localhost:8080/register', { username: this.username, password: this.password }); diff --git a/vue2/vue/vue.config.js b/vue2/vue/vue.config.js index 910e297..60ce045 100644 --- a/vue2/vue/vue.config.js +++ b/vue2/vue/vue.config.js @@ -2,3 +2,8 @@ const { defineConfig } = require('@vue/cli-service') module.exports = defineConfig({ transpileDependencies: true }) +module.exports = { + devServer: { + port: 8081, // 修改这里的数值即可更改端口 + }, +}; \ No newline at end of file