跨域手动配置

This commit is contained in:
Amadeus 2024-05-05 22:39:49 +08:00
parent 259a72fbc5
commit 8e31cc3696
4 changed files with 5 additions and 1 deletions

View File

@ -4,5 +4,6 @@
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$/my-project-frontend" /> <content url="file://$MODULE_DIR$/my-project-frontend" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="index" level="application" />
</component> </component>
</module> </module>

View File

@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<link rel="icon" href="/favicon.ico"> <link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/element-plus/dist/index.css" />
<title>Vite App</title> <title>Vite App</title>
<style> <style>
body { body {

View File

@ -5,6 +5,8 @@ import App from './App.vue'
import router from "@/router"; import router from "@/router";
import axios from "axios"; import axios from "axios";
import 'element-plus/theme-chalk/dark/css-vars.css'
axios.defaults.baseURL = 'http://localhost:8080' axios.defaults.baseURL = 'http://localhost:8080'
const app = createApp(App) const app = createApp(App)

View File

@ -66,7 +66,7 @@ function login(username , password , remember , success , failure = defaultFailu
}, { }, {
'Content-Type': 'application/x-www-form-urlencoded' 'Content-Type': 'application/x-www-form-urlencoded'
},(data)=> { },(data)=> {
storeAccessToken(remember, data.token , data.expire) storeAccessToken(data.token , remember , data.expire)
ElMessage.success(`登录成功,欢迎 ${data.username} 来到我们的系统`) ElMessage.success(`登录成功,欢迎 ${data.username} 来到我们的系统`)
success(data) success(data)