Browse Source

erp隐藏头部信息

yangc 7 years ago
parent
commit
0d11e54858
5 changed files with 41 additions and 24 deletions
  1. 6 8
      layouts/default.vue
  2. 11 8
      layouts/main.vue
  3. 6 8
      layouts/shop.vue
  4. 5 0
      store/userType.js
  5. 13 0
      store/userType/type.js

+ 6 - 8
layouts/default.vue

@@ -11,11 +11,6 @@
 
   export default {
     name: 'app',
-    data () {
-      return {
-        isInFrame: false
-      }
-    },
     components: {
       HeaderView: Header,
       FooterView: Footer,
@@ -26,10 +21,13 @@
         title: this.title
       }
     },
-    mounted () {
-      this.isInFrame = self !== top
-    },
     computed: {
+      isInFrame () {
+        if (this.$route.path === '/' || this.$route.path === '') {
+          this.$store.dispatch('userType/setUserType', {type: this.$route.query.type || 'mall'})
+        }
+        return this.$store.state.userType.type.type.data === 'erp'
+      },
       title () {
         let path = this.$route.path
         if (path.startsWith('/help/helpList/')) {

+ 11 - 8
layouts/main.vue

@@ -20,11 +20,11 @@
       MainHeader,
       MainNav
     },
-    data () {
-      return {
-        isInFrame: false
-      }
-    },
+//    data () {
+//      return {
+//        isInFrame: false
+//      }
+//    },
     head () {
       return {
         title: this.title,
@@ -34,10 +34,13 @@
         ]
       }
     },
-    mounted () {
-      this.isInFrame = self !== top
-    },
     computed: {
+      isInFrame () {
+        if (this.$route.path === '/' || this.$route.path === '') {
+          this.$store.dispatch('userType/setUserType', {type: this.$route.query.type || 'mall'})
+        }
+        return this.$store.state.userType.type.type.data === 'erp'
+      },
       title () {
         let path = this.$route.path
         if (path === '/product/kind/home') {

+ 6 - 8
layouts/shop.vue

@@ -17,11 +17,6 @@
   }
   export default {
     name: 'shop',
-    data () {
-      return {
-        isInFrame: false
-      }
-    },
     components: {
       HeaderView: Header,
       FooterView: Footer,
@@ -29,9 +24,6 @@
       StoreHeader,
       StoreTitle
     },
-    mounted () {
-      this.isInFrame = self !== top
-    },
     head () {
       return {
         title: this.title,
@@ -42,6 +34,12 @@
       }
     },
     computed: {
+      isInFrame () {
+        if (this.$route.path === '/' || this.$route.path === '') {
+          this.$store.dispatch('userType/setUserType', {type: this.$route.query.type || 'mall'})
+        }
+        return this.$store.state.userType.type.type.data === 'erp'
+      },
       title () {
         let path = this.$route.path
         if (path.startsWith('/store/') && getCount(path, '/') === 2) {

+ 5 - 0
store/userType.js

@@ -0,0 +1,5 @@
+export const actions = {
+  setUserType ({ commit }, params = {}) {
+    commit('type/GET_TYPE_SUCCESS', params.type)
+  }
+}

+ 13 - 0
store/userType/type.js

@@ -0,0 +1,13 @@
+export const state = () => ({
+  type: {
+    fetching: false,
+    data: 'mall'
+  }
+})
+
+export const mutations = {
+  GET_TYPE_SUCCESS (state, result) {
+    state.type.fetching = false
+    state.type.data = result
+  }
+}