pull/3/head
xiaozhiyong 2 years ago
parent b202072939
commit c501324ce0
  1. 2
      src/layout/components/Navbar.vue
  2. 4
      src/store/modules/user.js
  3. 2
      src/utils/request.js

@ -25,6 +25,7 @@
</template> </template>
<script> <script>
import store from "@/store";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import Breadcrumb from "@/components/Breadcrumb"; import Breadcrumb from "@/components/Breadcrumb";
import Hamburger from "@/components/Hamburger"; import Hamburger from "@/components/Hamburger";
@ -47,6 +48,7 @@ export default {
serve.loginOut().then((res) => { serve.loginOut().then((res) => {
if (res.code === 20000) { if (res.code === 20000) {
localStorage.removeItem("customerToken"); localStorage.removeItem("customerToken");
store.dispatch("user/remove");
this.$router.push("/login"); this.$router.push("/login");
} }
}); });

@ -30,6 +30,10 @@ const actions = {
commit("SET_NAME", data.name); commit("SET_NAME", data.name);
commit("SET_COMPANYTYPE", data); commit("SET_COMPANYTYPE", data);
}, },
remove({ commit }, data) {
commit("SET_AUTH", null);
commit("SET_COMPANYTYPE", "");
},
}; };
export default { export default {

@ -1,6 +1,7 @@
import Vue from "vue"; import Vue from "vue";
import axios from "axios"; import axios from "axios";
import utils from "@/utils/encode"; import utils from "@/utils/encode";
import store from "@/store";
//加密白名单 //加密白名单
const encryptWhite = []; const encryptWhite = [];
const env = process.env.VUE_APP_ENV; const env = process.env.VUE_APP_ENV;
@ -64,6 +65,7 @@ service.interceptors.response.use(
if (res.code === 42011) { if (res.code === 42011) {
Vue.prototype.$message.error(res.msg || "您的登录已失效,请重新登录"); Vue.prototype.$message.error(res.msg || "您的登录已失效,请重新登录");
localStorage.removeItem("removeItem"); localStorage.removeItem("removeItem");
store.dispatch("user/remove");
setTimeout(() => { setTimeout(() => {
window.location.reload(); window.location.reload();
}, 1000); }, 1000);

Loading…
Cancel
Save