Browse Source

use vues fix visble bug

Unknown 7 years ago
parent
commit
25fa2556e5

+ 2 - 1
src/store/getters.js

@@ -3,6 +3,7 @@ const getters = {
3 3
   token: state => state.user.token,
4 4
   avatar: state => state.user.avatar,
5 5
   username: state => state.user.username,
6
-  roles: state => state.user.roles
6
+  roles: state => state.user.roles,
7
+  listVisble: state => state.gambleGameBucket.listVisble
7 8
 }
8 9
 export default getters

+ 3 - 1
src/store/index.js

@@ -2,6 +2,7 @@ import Vue from 'vue'
2 2
 import Vuex from 'vuex'
3 3
 import app from './modules/app'
4 4
 import user from './modules/user'
5
+import gambleGameBucket from './modules/gambleGameBucket'
5 6
 import getters from './getters'
6 7
 
7 8
 Vue.use(Vuex)
@@ -9,7 +10,8 @@ Vue.use(Vuex)
9 10
 const store = new Vuex.Store({
10 11
   modules: {
11 12
     app,
12
-    user
13
+    user,
14
+    gambleGameBucket
13 15
   },
14 16
   getters
15 17
 })

+ 17 - 0
src/store/modules/gambleGameBucket.js

@@ -0,0 +1,17 @@
1
+const gambleGameBucket = {
2
+  state: {
3
+    listVisble: true
4
+  },
5
+  mutations: {
6
+    SET_LISTVISBLE: (state, listVisble) => {
7
+      state.listVisble = listVisble
8
+    }
9
+  },
10
+  actions: {
11
+    SetListVisble({ commit }, listVisble) {
12
+      commit('SET_LISTVISBLE', listVisble)
13
+    }
14
+  }
15
+}
16
+
17
+export default gambleGameBucket

+ 13 - 0
src/views/gambleGameBucket/detail/index.vue

@@ -26,6 +26,8 @@
26 26
 </template>
27 27
 
28 28
 <script>
29
+
30
+import { mapGetters, mapActions } from 'vuex'
29 31
 import { fetchDetails, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
30 32
 import _ from 'lodash'
31 33
 
@@ -52,7 +54,15 @@ export default {
52 54
   created() {
53 55
     this.getList()
54 56
   },
57
+  computed: {
58
+    ...mapGetters([
59
+      'listVisble',
60
+    ])
61
+  },
55 62
   methods: {
63
+    ...mapActions([
64
+      'SetListVisble',
65
+    ]),    
56 66
     getList() {
57 67
       this.listLoading = true
58 68
       let group ,detailTemp
@@ -126,6 +136,9 @@ export default {
126 136
         }
127 137
       }
128 138
     }
139
+  },
140
+  destroyed() {
141
+    this.SetListVisble(true)
129 142
   }
130 143
 }
131 144
 </script>

+ 11 - 2
src/views/gambleGameBucket/index.vue

@@ -38,6 +38,8 @@
38 38
 </template>
39 39
 
40 40
 <script>
41
+
42
+import { mapGetters, mapActions } from 'vuex'
41 43
 import { fetchList, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
42 44
 
43 45
 export default {
@@ -46,7 +48,6 @@ export default {
46 48
       list: null,
47 49
       listLoading: true,
48 50
       total: null,
49
-      listVisble: true,
50 51
       bucket: '',
51 52
       listQuery: {
52 53
         page: 1,
@@ -69,7 +70,15 @@ export default {
69 70
   created() {
70 71
     this.getList()
71 72
   },
73
+  computed: {
74
+    ...mapGetters([
75
+      'listVisble',
76
+    ])
77
+  },
72 78
   methods: {
79
+    ...mapActions([
80
+      'SetListVisble',
81
+    ]),
73 82
     getList() {
74 83
       this.listLoading = true
75 84
       fetchList(this.listQuery).then(response => {
@@ -80,7 +89,7 @@ export default {
80 89
     },
81 90
     handlePage(row) {
82 91
       this.temp = Object.assign({}, row) // copy obj
83
-      this.listVisble = false
92
+      this.SetListVisble(false)
84 93
       this.bucket = row
85 94
       // fetchMemberRecords(row).then(response => {
86 95
       //   console.log(response.data)