add logout
parent
7ac4010910
commit
5614414185
|
@ -57,3 +57,12 @@ export function editPwd (params) {
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取密码状态
|
||||||
|
export function logout () {
|
||||||
|
return request({
|
||||||
|
url: '/buyer/members/logout',
|
||||||
|
method: Method.POST,
|
||||||
|
needToken: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -86,6 +86,7 @@
|
||||||
<script>
|
<script>
|
||||||
import storage from '@/plugins/storage.js';
|
import storage from '@/plugins/storage.js';
|
||||||
import { cartGoodsAll } from '@/api/cart.js';
|
import { cartGoodsAll } from '@/api/cart.js';
|
||||||
|
import { logout } from '@/api/account.js';
|
||||||
export default {
|
export default {
|
||||||
name: 'M-Header',
|
name: 'M-Header',
|
||||||
created () {
|
created () {
|
||||||
|
@ -120,12 +121,14 @@ export default {
|
||||||
window.open(url.href, '_blank');
|
window.open(url.href, '_blank');
|
||||||
},
|
},
|
||||||
signOutFun () { // 退出登录
|
signOutFun () { // 退出登录
|
||||||
storage.removeItem('accessToken');
|
logout().then(res => {
|
||||||
storage.removeItem('refreshToken');
|
storage.removeItem('accessToken');
|
||||||
storage.removeItem('userInfo');
|
storage.removeItem('refreshToken');
|
||||||
storage.removeItem('cartNum');
|
storage.removeItem('userInfo');
|
||||||
this.$store.commit('SET_CARTNUM', 0)
|
storage.removeItem('cartNum');
|
||||||
this.$router.push('/login');
|
this.$store.commit('SET_CARTNUM', 0)
|
||||||
|
this.$router.push('/login');
|
||||||
|
});
|
||||||
},
|
},
|
||||||
goUserCenter (path) {
|
goUserCenter (path) {
|
||||||
// 跳转我的订单,我的足迹、收藏等
|
// 跳转我的订单,我的足迹、收藏等
|
||||||
|
|
|
@ -49,6 +49,12 @@ export const getNoticePage = (params) => {
|
||||||
export const login = (params) => {
|
export const login = (params) => {
|
||||||
return getRequestWithNoToken("/user/login", params);
|
return getRequestWithNoToken("/user/login", params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 登出
|
||||||
|
export const logout = () => {
|
||||||
|
return postRequest("/user/logout");
|
||||||
|
};
|
||||||
|
|
||||||
// 刷新token
|
// 刷新token
|
||||||
export const handleRefreshToken = (token) => {
|
export const handleRefreshToken = (token) => {
|
||||||
return getRequestWithNoToken(`/user/refresh/${token}`);
|
return getRequestWithNoToken(`/user/refresh/${token}`);
|
||||||
|
|
|
@ -60,7 +60,7 @@ import messageTip from "./main-components/message-tip.vue";
|
||||||
import circleLoading from "@/views/my-components/lili/circle-loading.vue";
|
import circleLoading from "@/views/my-components/lili/circle-loading.vue";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import util from "@/libs/util.js";
|
import util from "@/libs/util.js";
|
||||||
import { getNoticePage } from "@/api/index";
|
import { getNoticePage,logout } from "@/api/index";
|
||||||
|
|
||||||
var client;
|
var client;
|
||||||
export default {
|
export default {
|
||||||
|
@ -131,11 +131,13 @@ export default {
|
||||||
}
|
}
|
||||||
// 退出登录
|
// 退出登录
|
||||||
else if (name === "loginOut") {
|
else if (name === "loginOut") {
|
||||||
this.$store.commit("logout", this);
|
logout().then(res => {
|
||||||
this.$store.commit('setAdded', false);
|
this.$store.commit("logout", this);
|
||||||
this.setStore("accessToken", "");
|
this.$store.commit('setAdded', false);
|
||||||
this.setStore("refreshToken", "");
|
this.setStore("accessToken", "");
|
||||||
this.$router.push({ path: "/login" });
|
this.setStore("refreshToken", "");
|
||||||
|
this.$router.push({ path: "/login" });
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
//切换标签
|
//切换标签
|
||||||
|
|
|
@ -109,7 +109,7 @@ export default {
|
||||||
modalType: 0, // 添加或编辑标识
|
modalType: 0, // 添加或编辑标识
|
||||||
modalVisible: false, // 添加或编辑显示
|
modalVisible: false, // 添加或编辑显示
|
||||||
modalTitle: "", // 添加或编辑标题
|
modalTitle: "", // 添加或编辑标题
|
||||||
treeDataDefault:"",
|
treeDataDefault: [],
|
||||||
searchForm: {
|
searchForm: {
|
||||||
// 搜索框初始化对象
|
// 搜索框初始化对象
|
||||||
pageNumber: 1, // 当前页数
|
pageNumber: 1, // 当前页数
|
||||||
|
@ -352,7 +352,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.total = this.data.length;
|
this.total = this.data?.length;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
// 添加文章
|
// 添加文章
|
||||||
|
|
|
@ -31,6 +31,12 @@ export const getSellerHomeData = params => {
|
||||||
export const login = params => {
|
export const login = params => {
|
||||||
return postRequestWithNoToken("/login/userLogin", params);
|
return postRequestWithNoToken("/login/userLogin", params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 登出
|
||||||
|
export const logout = () => {
|
||||||
|
return postRequest("/login/logout");
|
||||||
|
};
|
||||||
|
|
||||||
// 获取用户登录信息
|
// 获取用户登录信息
|
||||||
export const userInfo = params => {
|
export const userInfo = params => {
|
||||||
return getRequest("/user/info", params);
|
return getRequest("/user/info", params);
|
||||||
|
|
|
@ -58,6 +58,7 @@ import tagsPageOpened from "./main-components/tags-page-opened.vue";
|
||||||
import circleLoading from "@/views/my-components/lili/circle-loading.vue";
|
import circleLoading from "@/views/my-components/lili/circle-loading.vue";
|
||||||
import Cookies from "js-cookie";
|
import Cookies from "js-cookie";
|
||||||
import util from "@/libs/util.js";
|
import util from "@/libs/util.js";
|
||||||
|
import { logout } from "@/api/index";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -120,12 +121,14 @@ export default {
|
||||||
name: "change_pass",
|
name: "change_pass",
|
||||||
});
|
});
|
||||||
} else if (name == "loginOut") {
|
} else if (name == "loginOut") {
|
||||||
Cookies.set("accessToken", "");
|
logout().then(res => {
|
||||||
this.$store.commit("logout", this);
|
Cookies.set("accessToken", "");
|
||||||
this.$store.commit("clearOpenedSubmenu");
|
this.$store.commit("logout", this);
|
||||||
this.setStore("accessToken", "");
|
this.$store.commit("clearOpenedSubmenu");
|
||||||
this.setStore("refreshToken", "");
|
this.setStore("accessToken", "");
|
||||||
this.$router.push({ path: "/login" });
|
this.setStore("refreshToken", "");
|
||||||
|
this.$router.push({ path: "/login" });
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// 快捷页签选中状态
|
// 快捷页签选中状态
|
||||||
|
|
Loading…
Reference in New Issue