前端跳转
This commit is contained in:
@@ -32,6 +32,7 @@ public class CorsFilter implements Filter {
|
|||||||
response.setHeader("Access-Control-Max-Age", "3600");
|
response.setHeader("Access-Control-Max-Age", "3600");
|
||||||
// 允许的header参数
|
// 允许的header参数
|
||||||
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,satoken");
|
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,satoken");
|
||||||
|
response.setHeader("Access-Control-Allow-Credentials", "true");
|
||||||
|
|
||||||
// 如果是预检请求,直接返回
|
// 如果是预检请求,直接返回
|
||||||
if (OPTIONS.equals(request.getMethod())) {
|
if (OPTIONS.equals(request.getMethod())) {
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ public class AuthorizationController {
|
|||||||
put("token", "Bearer " + StpUtil.getTokenValue());
|
put("token", "Bearer " + StpUtil.getTokenValue());
|
||||||
put("user", user);
|
put("user", user);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
// 保存在线信息
|
// 保存在线信息
|
||||||
// onlineUserService.save(userDto, StpUtil.getTokenValue(), request);
|
// onlineUserService.save(userDto, StpUtil.getTokenValue(), request);
|
||||||
return ResponseEntity.ok(authInfo);
|
return ResponseEntity.ok(authInfo);
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ const baseURLStr = window.g.prod.VUE_APP_BASE_API
|
|||||||
// 创建axios实例
|
// 创建axios实例
|
||||||
const service = axios.create({
|
const service = axios.create({
|
||||||
baseURL: process.env.NODE_ENV === 'production' ? baseURLStr : '/', // api 的 base_url
|
baseURL: process.env.NODE_ENV === 'production' ? baseURLStr : '/', // api 的 base_url
|
||||||
timeout: Config.timeout // 请求超时时间
|
timeout: Config.timeout, // 请求超时时间
|
||||||
|
withCredentials: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// request拦截器
|
// request拦截器
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="login" :style="'background-image:url('+ Background +');'">
|
<div class="login" :style="'background-image:url('+ Background +');'">
|
||||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
|
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" label-position="left" label-width="0px" class="login-form">
|
||||||
<h3 class="title">
|
<h3 class="title">
|
||||||
{{title}}</h3>
|
{{ title }}</h3>
|
||||||
<el-form-item prop="username">
|
<el-form-item prop="username">
|
||||||
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
<el-input v-model="loginForm.username" type="text" auto-complete="off" placeholder="账号">
|
||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
||||||
@@ -133,8 +133,13 @@ export default {
|
|||||||
Cookies.remove('rememberMe')
|
Cookies.remove('rememberMe')
|
||||||
}
|
}
|
||||||
this.$store.dispatch('Login', user).then(() => {
|
this.$store.dispatch('Login', user).then(() => {
|
||||||
|
debugger
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
window.location.href = this.redirect
|
||||||
|
// if (this.redirect === 'http://localhost:8013/dashboard'){
|
||||||
|
// window.location.href = this.redirect
|
||||||
|
// }
|
||||||
|
// this.$router.push({ path: this.redirect || '/' })
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
this.getCode()
|
this.getCode()
|
||||||
|
|||||||
Reference in New Issue
Block a user