Browse Source

修改 vuex

wangguoyu 4 năm trước cách đây
mục cha
commit
71ac258c19

+ 7 - 2
components/footer.vue

@@ -39,7 +39,7 @@
              <a>联系客服</a>
            </div>
          </div>
-         <div class="link-box">
+         <div class="link-box" v-if="footerFlag">
            <h4>友情链接</h4>
            <div class="link-a-box">
              <a :href="item.url" v-for="(item,index) in requestData" :key="index">{{item.name}}</a>
@@ -58,7 +58,12 @@
       requestData() {
         return this.getFooterYouQingLianJie;
       },
-      ...mapGetters(['getFooterYouQingLianJie']),
+      footerFlag(){
+
+        console.log( this.getFooterFlag);
+        return this.getFooterFlag;
+      },
+      ...mapGetters(['getFooterYouQingLianJie','getFooterFlag']),
     },
     methods: {
       goToPage(item){

+ 2 - 2
components/header.vue

@@ -79,11 +79,11 @@
             keyPath:  '/news',
             children: [],
           },
-          {
+    /*      {
             content:  '帮助中心',
             keyPath:  '/helpCenter',
             children: [],
-          },
+          },*/
           {
             content:  '关于我们',
             keyPath:  '/introduction',

+ 7 - 0
pages/courseware/index.vue

@@ -10,6 +10,13 @@
   export default {
     name:       'examsystem',
     layout:'templateA',
+    async fetch({  $axios,store, params }) {
+      try {
+        store.commit('footerFlag',false)
+      } catch(e) {
+
+      }
+    },
     components: {
     },
     props:      {

+ 7 - 0
pages/examsystem/index.vue

@@ -96,6 +96,13 @@
   export default {
     name:       'examsystem',
     layout:'templateA',
+    async fetch({  $axios,store, params }) {
+      try {
+        store.commit('footerFlag',false)
+      } catch(e) {
+
+      }
+    },
     components: {
     },
     props:      {

+ 3 - 3
pages/index.vue

@@ -309,7 +309,7 @@
 <script>
 
   export default {
-    name: 'Home',
+    name: 'index',
     layout:'templateA',
     watchQuery: true,
     async fetch({$axios, store, query}) {
@@ -317,7 +317,7 @@
       try {
         const { data } = await $axios.post('/home/links/list');
         store.commit('SetFooterYouQingLianJie', data.data.data);
-        store.commit('Home/increment', 3);
+        store.commit('footerFlag',true)
       } catch(e) {
 
       }
@@ -390,7 +390,7 @@
     },
     methods: {
       checkInfo() {
-        this.$router.push({ name: 'Home' })
+        this.$router.push({ name: 'introduction' })
       },
     },
   }

+ 7 - 0
pages/introduction/index.vue

@@ -112,6 +112,13 @@
   export default {
     name:       'introduction',
     layout:'templateA',
+    async fetch({  $axios,store, params }) {
+      try {
+        store.commit('footerFlag',false)
+      } catch(e) {
+
+      }
+    },
     components: {
     },
     props:      {

+ 7 - 0
pages/news/index.vue

@@ -39,6 +39,13 @@
   export default {
     name:       'news',
     layout:'templateA',
+    async fetch({  $axios,store, params }) {
+      try {
+        store.commit('footerFlag',false)
+      } catch(e) {
+
+      }
+    },
     components: {
     },
     props:      {

+ 8 - 1
store/index.js

@@ -5,12 +5,16 @@
 
 export const state = () => ({
   headerMenu: [],
-  FooterYouQingLianJie: []
+  FooterYouQingLianJie: [],
+  footerFlag: false
 })
 
 export const getters = {
   getFooterYouQingLianJie(state) {
     return state.FooterYouQingLianJie;
+  },
+  getFooterFlag(state) {
+    return state.footerFlag
   }
 }
 
@@ -19,6 +23,9 @@ export const mutations = {
   SetHeadMenu(state, payload) {},
   SetFooterYouQingLianJie(state, payload) {
     state.FooterYouQingLianJie = payload;
+  },
+  footerFlag(state, payload) {
+    state.footerFlag = payload;
   }
 }