Browse Source

TODO vue arry problem

ethan 6 years ago
parent
commit
a2ce22bfe1
1 changed files with 8 additions and 28 deletions
  1. 8 28
      src/views/room/gameHistory/index.vue

+ 8 - 28
src/views/room/gameHistory/index.vue

@@ -18,7 +18,7 @@
18 18
       </div>
19 19
       <el-table :data="list" v-loading.body="listLoading" element-loading-text="Loading" border fit highlight-current-row>
20 20
         <el-table-column :label="data.thirdLayer.name" align="center">
21
-          <el-table-column sortable="true"  :default-sort = "{prop: 'createdAt', order: 'descending'}" label="時間" align="center">
21
+          <el-table-column label="時間" align="center">
22 22
             <template slot-scope="scope" prop="createdAt">
23 23
               <span>{{moment(scope.row.createdAt)}}</span>
24 24
             </template>
@@ -163,32 +163,23 @@ export default {
163 163
     ]),
164 164
     getList() {
165 165
       this.listLoading = true
166
-      this.list = []
166
+      //this.list = []
167 167
       fetchGameHistory(this.data.thirdLayer, this.listQuery).then(response => {
168 168
         this.chipLogList = response.data
169 169
         console.log('wallet', this.chipLogList,this.data.thirdLayer)
170 170
         this.tempCurrentChips = []
171 171
         this.chipLogList.map((item) => {
172 172
           fetchCurrentChips(item['GambleGame-Bucket'], this.data.thirdLayer).then(response => {
173
-            this.$set(this.list,this.list.length,{
173
+            this.list.unshift({
174 174
               id: item.game,
175 175
               createdAt: item['GambleGame-Bucket'].createdAt,
176 176
               type: '遊戲',
177 177
               amount: item.earned,
178 178
               wallet: response.data.currentChips
179 179
             })
180
-            /**
181
-            this.list.push({
182
-              id: item.game,
183
-              createdAt: item['GambleGame-Bucket'].createdAt,
184
-              type: '遊戲',
185
-              amount: item.earned,
186
-              wallet: response.data.currentChips
187
-            })
188
-             */
180
+             
189 181
           })
190 182
         })
191
-        this.listLoading = false
192 183
       })
193 184
       fetchChipsHistory(this.data.thirdLayer, this.listQuery).then(response => {
194 185
         this.gameRecordList = response.data
@@ -196,34 +187,23 @@ export default {
196 187
           if(item.type === config.const.GambleMemberChipsLog.type.deposit) item.type =  '上 / 下 分';
197 188
           if(item.type === config.const.GambleMemberChipsLog.type.reward) item.type =  '獎勵 / 懲罰';
198 189
           if(item.type === config.const.GambleMemberChipsLog.type.reset) item.type =  '歸零';
199
-          this.$set(this.list,this.list.length, {
190
+          this.list.unshift({
200 191
             id: item.id,
201 192
             createdAt: item.createdAt,
202 193
             type: item.type,
203 194
             amount: item.chips,
204 195
             wallet: item.totalChips
205 196
           })
206
-          /*
207
-          this.list.push({
208
-            id: item.id,
209
-            createdAt: item.createdAt,
210
-            type: item.type,
211
-            amount: item.chips,
212
-            wallet: item.totalChips
213
-          })
214
-          */
215 197
         })
216
-
217 198
       })
218
-            console.log('this.' ,this.list.__ob__)
199
+      console.log('wwwwwwww', this.list)
219 200
       this.list.sort(function compare(a, b) {
220 201
         const dateA = new Date(a.createdAt);
221 202
         const dateB = new Date(b.createdAt);
222 203
         return  dateB - dateA;
223 204
       });
224
-            console.log('that.',this.list)
225
-        this.total = this.list.length
226
-        this.listLoading = false
205
+      this.total = this.list.length
206
+      this.listLoading = false
227 207
     },
228 208
     handlePersonDetail(row) {
229 209
       this.listLoading = true