登录接口联调完成

This commit is contained in:
2026-08-30 15:24:27 +08:00
parent 68ea2af952
commit 9931de77de
3 changed files with 14 additions and 3 deletions
+4 -1
View File
@@ -50,7 +50,10 @@ export default {
// 登录接口接入后在这里提交账号和密码
// 这里模拟登录成功,直接跳转到聊天页面
if (this.username && this.password) {
login(this.username, this.password)
login({
username: this.username,
password: this.password,
})
.then((response) => {
const token = response.data.token;
this.$store.commit("SET_TOKEN", token);
+1 -1
View File
@@ -15,7 +15,7 @@ request.interceptors.request.use(
// 在请求头中添加token
const token = store.state.token;
if (token) {
config.headers['Authorization'] = `Bearer ${token}`;
config.headers['Authorization'] = `${token}`;
}
return config;
},
+9 -1
View File
@@ -1,4 +1,12 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
transpileDependencies: true,
devServer: {
proxy: {
'/api': {
target: 'http://localhost:3000',
changeOrigin: true
}
}
}
})