refresh game switch

This commit is contained in:
yangduo 2024-08-30 16:13:02 +08:00
parent 71a612a2d9
commit 3bfdcd228d
2 changed files with 27 additions and 6 deletions

View File

@ -30,3 +30,10 @@ export function updatGameSwitch(data) {
// data // data
// }) // })
// } // }
export function refreshGameSwitch() {
return request({
url: '/game_switch/refresh',
method: 'get'
})
}

View File

@ -1,10 +1,10 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!--div class="filter-container"> <div class="filter-container">
<el-button class="filter-item" style="margin-left: 10px;" type="primary" @click="handleCreate"> <el-button class="filter-item" style="margin-left: 10px;" type="primary" :disabled="refreshdisable" @click="refreshServer">
新增 立刻刷新游戏开关
</el-button> </el-button>
</div--> </div>
<el-table <el-table
:data="gameSwitchList" :data="gameSwitchList"
border border
@ -123,7 +123,7 @@
<script> <script>
// import Pagination from '@/components/Pagination/index.vue' // import Pagination from '@/components/Pagination/index.vue'
import { addGameSwitch, updatGameSwitch, getGameSwitchList } from '@/api/gameswitch' import { addGameSwitch, updatGameSwitch, getGameSwitchList, refreshGameSwitch } from '@/api/gameswitch'
import { parseTime } from '@/utils' import { parseTime } from '@/utils'
export default { export default {
@ -148,6 +148,7 @@ export default {
totalpage: 0, totalpage: 0,
curpage: 1, curpage: 1,
page_size: 8, page_size: 8,
refreshdisable: false,
rules: { rules: {
switch_name: [{ required: true, message: 'required', trigger: 'blur' }], switch_name: [{ required: true, message: 'required', trigger: 'blur' }],
remark: [{ required: true, message: 'required', trigger: 'blur' }] remark: [{ required: true, message: 'required', trigger: 'blur' }]
@ -199,7 +200,6 @@ export default {
}, },
getList() { getList() {
getGameSwitchList(this.page_size, this.curpage).then(response => { getGameSwitchList(this.page_size, this.curpage).then(response => {
console.log(response)
this.gameSwitchList = response.data this.gameSwitchList = response.data
this.totalpage = response.total_page this.totalpage = response.total_page
this.curpage = response.cur_page this.curpage = response.cur_page
@ -213,6 +213,19 @@ export default {
this.curpage = val this.curpage = val
this.getList() this.getList()
}, },
refreshServer() {
refreshGameSwitch().then(res => {
if (res.code === 0) {
this.refreshdisable = true
this.$notify({
title: 'Success',
message: 'refresh Successfully',
type: 'success',
duration: 2000
})
}
})
},
handleCreate() { handleCreate() {
this.resetTemp() this.resetTemp()
this.dialogStatus = 'create' this.dialogStatus = 'create'
@ -253,6 +266,7 @@ export default {
updatGameSwitch(this.form).then(response => { updatGameSwitch(this.form).then(response => {
if (response.code === 0) { if (response.code === 0) {
this.dialogFormVisible = false this.dialogFormVisible = false
this.refreshdisable = false
this.getList() this.getList()
this.$notify({ this.$notify({
title: 'Success', title: 'Success',