Browse Source

Add dynamic select

Unknown 7 years ago
parent
commit
aff56e5123
2 changed files with 14 additions and 4 deletions
  1. 7 1
      src/api/gambleGameBucket.js
  2. 7 3
      src/views/gambleGameBucket/detail/index.vue

+ 7 - 1
src/api/gambleGameBucket.js

31
 }
31
 }
32
 
32
 
33
 export function fetchDetails(data, query = { round: 1 }) {
33
 export function fetchDetails(data, query = { round: 1 }) {
34
-  console.log('round', query.round)
35
   return request({
34
   return request({
36
     url: `/gambleGameBuckets/${data.id}/round/${query.round}/detail`,
35
     url: `/gambleGameBuckets/${data.id}/round/${query.round}/detail`,
37
     method: 'get'
36
     method: 'get'
38
   })
37
   })
39
 }
38
 }
39
+
40
+export function fetchRoundCount(data) {
41
+  return request({
42
+    url: `/gambleGameBuckets/${data.id}/roundCount`,
43
+    method: 'get'
44
+  })
45
+}

+ 7 - 3
src/views/gambleGameBucket/detail/index.vue

33
 <script>
33
 <script>
34
 
34
 
35
 import { mapGetters, mapActions } from 'vuex'
35
 import { mapGetters, mapActions } from 'vuex'
36
-import { fetchDetails, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
36
+import { fetchDetails, fetchRoundCount } from '@/api/gambleGameBucket'
37
 import _ from 'lodash'
37
 import _ from 'lodash'
38
 
38
 
39
 export default {
39
 export default {
52
       func: '',
52
       func: '',
53
       rowIndex: 0,
53
       rowIndex: 0,
54
       colIndex: 0,
54
       colIndex: 0,
55
-      roundOptions: [{ label: '第 1 輪', key: 1 }, { label: '第 2 輪', key: 2 },
56
-                      { label: '第 3 輪', key: 3 }, { label: '第 4 輪', key: 4 }],
55
+      roundOptions: [],
57
     }
56
     }
58
   },
57
   },
59
   props: [ 'bucket' ],
58
   props: [ 'bucket' ],
60
   created() {
59
   created() {
60
+    fetchRoundCount(this.bucket).then((response)=>{
61
+      for(let i = 1 ; i<=response.data; i++){
62
+        this.roundOptions.push({ label: `第 ${i} 輪`, key: i })
63
+      }
64
+    })
61
     this.SetListVisble(false)    
65
     this.SetListVisble(false)    
62
     this.getList()
66
     this.getList()
63
   },
67
   },