|
@@ -67,6 +67,8 @@ import Screenfull from '@/components/Screenfull'
|
|
|
import SizeSelect from '@/components/SizeSelect'
|
|
|
import LangSelect from '@/components/LangSelect'
|
|
|
import Search from '@/components/HeaderSearch'
|
|
|
+import axios from 'axios';
|
|
|
+
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -92,18 +94,20 @@ export default {
|
|
|
// async logout() {
|
|
|
// await this.$store.dispatch('user/logout')
|
|
|
// this.$router.push(`/login?redirect=${this.$route.fullPath}`)
|
|
|
- // }
|
|
|
+ // },
|
|
|
logout() {
|
|
|
const token = this.getTokenFromCookie(); // 获取 token
|
|
|
- this.$store.commit("user/LOGOUT");
|
|
|
- this.$router.push(`/`);
|
|
|
-
|
|
|
- // 单点登录退出
|
|
|
- this.$store.dispatch('public/logoutapi', { token: token }).then(response => {
|
|
|
+
|
|
|
+ axios.get('http://admindev.bjzxtw.org.cn/auth/logoutapi.php', {params:{token:token} }).then(response => {
|
|
|
console.log(response);
|
|
|
+ this.$store.commit("user/LOGOUT");
|
|
|
+ this.$router.push(`/login`);
|
|
|
}).catch(error => {
|
|
|
console.log(error);
|
|
|
- });
|
|
|
+ this.$store.commit("user/LOGOUT");
|
|
|
+ this.$router.push(`/login`);
|
|
|
+ this.$message.error(response.message);
|
|
|
+ });
|
|
|
},
|
|
|
getTokenFromCookie() {
|
|
|
const name = "Admin-Token=";
|