mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2025-12-17 16:35:53 +08:00
add logout
This commit is contained in:
@@ -49,6 +49,12 @@ export const getNoticePage = (params) => {
|
||||
export const login = (params) => {
|
||||
return getRequestWithNoToken("/user/login", params);
|
||||
};
|
||||
|
||||
// 登出
|
||||
export const logout = () => {
|
||||
return postRequest("/user/logout");
|
||||
};
|
||||
|
||||
// 刷新token
|
||||
export const handleRefreshToken = (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 Cookies from "js-cookie";
|
||||
import util from "@/libs/util.js";
|
||||
import { getNoticePage } from "@/api/index";
|
||||
import { getNoticePage,logout } from "@/api/index";
|
||||
|
||||
var client;
|
||||
export default {
|
||||
@@ -131,11 +131,13 @@ export default {
|
||||
}
|
||||
// 退出登录
|
||||
else if (name === "loginOut") {
|
||||
this.$store.commit("logout", this);
|
||||
this.$store.commit('setAdded', false);
|
||||
this.setStore("accessToken", "");
|
||||
this.setStore("refreshToken", "");
|
||||
this.$router.push({ path: "/login" });
|
||||
logout().then(res => {
|
||||
this.$store.commit("logout", this);
|
||||
this.$store.commit('setAdded', false);
|
||||
this.setStore("accessToken", "");
|
||||
this.setStore("refreshToken", "");
|
||||
this.$router.push({ path: "/login" });
|
||||
})
|
||||
}
|
||||
},
|
||||
//切换标签
|
||||
|
||||
@@ -109,7 +109,7 @@ export default {
|
||||
modalType: 0, // 添加或编辑标识
|
||||
modalVisible: false, // 添加或编辑显示
|
||||
modalTitle: "", // 添加或编辑标题
|
||||
treeDataDefault:"",
|
||||
treeDataDefault: [],
|
||||
searchForm: {
|
||||
// 搜索框初始化对象
|
||||
pageNumber: 1, // 当前页数
|
||||
@@ -352,7 +352,7 @@ export default {
|
||||
}
|
||||
}
|
||||
});
|
||||
this.total = this.data.length;
|
||||
this.total = this.data?.length;
|
||||
this.loading = false;
|
||||
},
|
||||
// 添加文章
|
||||
|
||||
Reference in New Issue
Block a user