You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.4 KiB
52 lines
1.4 KiB
import { clearLoginInfo } from "@/utils";
|
|
|
|
export default {
|
|
data() {
|
|
return {};
|
|
/* eslint-enable */
|
|
},
|
|
created() {},
|
|
activated() {},
|
|
methods: {
|
|
// 退出
|
|
logoutHandle() {
|
|
this.$confirm(
|
|
this.$t("prompt.info", { handle: this.$t("logout") }),
|
|
this.$t("prompt.title"),
|
|
{
|
|
confirmButtonText: this.$t("confirm"),
|
|
cancelButtonText: this.$t("cancel"),
|
|
type: "warning",
|
|
}
|
|
)
|
|
.then(() => {
|
|
//关闭所有标签页
|
|
// tabs, 关闭全部
|
|
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(
|
|
(item) => item.name === "home"
|
|
);
|
|
|
|
this.$http
|
|
.post("/auth/login/logout")
|
|
.then(({ data: res }) => {
|
|
if (res.code !== 0) {
|
|
//别处登陆时 退出不提示 直接跳登陆页即可
|
|
if (res.code !== 10007) {
|
|
this.$message.error(res.msg);
|
|
}
|
|
}
|
|
|
|
clearLoginInfo();
|
|
this.$router.push({ name: "login" });
|
|
// if (localStorage.getItem('userType') === 'work') {
|
|
// this.$router.push({ name: 'loginWork' })
|
|
// } else {
|
|
// this.$router.push({ name: 'login' })
|
|
// }
|
|
})
|
|
.catch(() => {});
|
|
})
|
|
.catch(() => {});
|
|
},
|
|
},
|
|
};
|
|
|