zhaomiao před 3 roky
rodič
revize
03fd2d418d

+ 2 - 2
src/App.vue

@@ -11,7 +11,7 @@
     
     <el-container style="height: 100%">
       <el-header style="height: 60px; padding: 0 0px">
-        <headers></headers>
+        <headers v-if="this.login"></headers>
       </el-header>
 
       <el-container class="fot">
@@ -33,7 +33,7 @@ import headers from "@layout/header";
 import mains from "@layout/main";
 export default {
   computed: {
-    ...mapGetters(["asidez", "mainy", "themeName"]),
+    ...mapGetters(["asidez", "mainy", "themeName","login"]),
   },
   components: {
     asiders,

+ 1 - 1
src/api/axios.js

@@ -43,7 +43,7 @@ export function requestData (options) {
     // 创建请求实例
     const XHRReq = axios.create({
       headers,
-      baseURL: process.env.VUE_APP_LOCALTEST_URL || '/api/',
+      baseURL: process.env.VUE_APP_API_URL || '/api/',
       timeout: options.timeout || 3000,
     });
 

+ 1 - 1
src/assets/js/login.js

@@ -30,7 +30,7 @@ export default {
           message: '登陆成功',
           type: 'success'
         });
-        
+         this.$store.commit('changelogin',true);
          this.$router.push('/'); // 跳转到首页
 			} else {
         this.$message.error('登录失败');// ui弹窗提示

+ 2 - 1
src/components/common/menu.vue

@@ -37,6 +37,7 @@ export default {
   methods: {
     //初始化
     getMenu () {
+      console.log(898989)
       this.API.requestData({
         showLoading: true, // 请求是否显示加载中遮罩层,默认 false ,可缺省
         subUrl: "admin/usermenu", // 请求接口地址,必传项
@@ -49,7 +50,7 @@ export default {
 
     // 菜单点击跳转
     menuC (item) {
-      debugger
+      // debugger
       if (item.type === 'changeTheme') {
         this.$store.commit('changeTheme', item.url);
       } else {

+ 1 - 0
src/store/getters.js

@@ -6,5 +6,6 @@ const getters = {
   themeName: state => state.themeName,
   asidez: state => state.z,
   mainy: state => state.y,
+  login: state => state.login,
 }
 export default getters

+ 4 - 0
src/store/index.js

@@ -8,6 +8,7 @@ const state = {
   submitDDTag: false,   //提交 - 防抖动 - 针对快速请求问题的拦截机制
   loading: false,   //全局 - 加载中....
   themeName: "light",
+  login:false,
   z:"width:1%",
   y:"width:99%"
 };
@@ -27,6 +28,9 @@ const mutations = {
   },
   changeY(state, tag){
     state.y = tag;
+  },
+  changelogin(state,tag){
+    state.login = tag;
   }
 };
 var vuexStore = new Vuex.Store({

+ 1 - 0
src/views/headPortrait.vue

@@ -43,6 +43,7 @@ export default {
   methods: {
     ...mapMutations("user", ["REMOVE_TOKEN"]),
     loginout() {
+      this.$store.commit('changelogin',false);
       this.REMOVE_TOKEN();
     },
   },