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,9 +31,15 @@ export function fetchDealingRecords(data) {
31 31
 }
32 32
 
33 33
 export function fetchDetails(data, query = { round: 1 }) {
34
-  console.log('round', query.round)
35 34
   return request({
36 35
     url: `/gambleGameBuckets/${data.id}/round/${query.round}/detail`,
37 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,7 +33,7 @@
33 33
 <script>
34 34
 
35 35
 import { mapGetters, mapActions } from 'vuex'
36
-import { fetchDetails, fetchMemberRecords, fetchDealingRecords } from '@/api/gambleGameBucket'
36
+import { fetchDetails, fetchRoundCount } from '@/api/gambleGameBucket'
37 37
 import _ from 'lodash'
38 38
 
39 39
 export default {
@@ -52,12 +52,16 @@ export default {
52 52
       func: '',
53 53
       rowIndex: 0,
54 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 58
   props: [ 'bucket' ],
60 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 65
     this.SetListVisble(false)    
62 66
     this.getList()
63 67
   },