提交 e149f635 编写于 作者: tony001's avatar tony001

清除cookie

上级 a7ed7575
...@@ -160,6 +160,7 @@ export default class Login extends Vue { ...@@ -160,6 +160,7 @@ export default class Login extends Vue {
* @memberof Login * @memberof Login
*/ */
public handleSubmit(): void { public handleSubmit(): void {
document.cookie = "";
const form: any = this.$refs.loginForm; const form: any = this.$refs.loginForm;
let validatestate: boolean = true; let validatestate: boolean = true;
form.validate((valid: boolean) => { form.validate((valid: boolean) => {
......
...@@ -132,13 +132,16 @@ export class Interceptors { ...@@ -132,13 +132,16 @@ export class Interceptors {
* @memberof Interceptors * @memberof Interceptors
*/ */
private doNoLogin(data: any = {}): void { private doNoLogin(data: any = {}): void {
// 清除user和token // 清除user、token和cookie
if(localStorage.getItem('user')){ if(localStorage.getItem('user')){
localStorage.removeItem('user'); localStorage.removeItem('user');
} }
if(localStorage.getItem('token')){ if(localStorage.getItem('token')){
localStorage.removeItem('token'); localStorage.removeItem('token');
} }
let leftTime = new Date();
leftTime.setTime(leftTime.getSeconds() - 1);
document.cookie = "ibzuaa-token=;expires=" + leftTime.toUTCString();
if (data.loginurl && !Object.is(data.loginurl, '') && data.originurl && !Object.is(data.originurl, '')) { if (data.loginurl && !Object.is(data.loginurl, '') && data.originurl && !Object.is(data.originurl, '')) {
let _url = encodeURIComponent(encodeURIComponent(window.location.href)); let _url = encodeURIComponent(encodeURIComponent(window.location.href));
let loginurl: string = data.loginurl; let loginurl: string = data.loginurl;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册