Browse Source

pc页面防止重复提交

feature/yujt_analysis_pc
zhangyuan 5 years ago
parent
commit
3076360f3c
  1. 9
      src/views/modules/activity/group-add-or-update.vue

9
src/views/modules/activity/group-add-or-update.vue

@ -48,7 +48,7 @@
</el-form> </el-form>
<template slot="footer"> <template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button> <el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button> <el-button :disabled="disabled" type="primary" @click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template> </template>
</el-dialog> </el-dialog>
</template> </template>
@ -89,6 +89,7 @@ export default {
categoryOptions: [], categoryOptions: [],
options: [], options: [],
loading: false, loading: false,
disabled:false,
uploadUrl: '' uploadUrl: ''
} }
}, },
@ -238,11 +239,13 @@ export default {
}, },
// //
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
this.disabled = true
this.$refs['dataForm'].validate((valid) => { this.$refs['dataForm'].validate((valid) => {
if (!valid) { if (!valid) {
return false return false
} }
this.$http[!this.dataForm.id ? 'post' : 'put']('/property/group/interest', this.dataForm).then(({ data: res }) => { this.$http[!this.dataForm.id ? 'post' : 'put']('/property/group/interest', this.dataForm).then(({ data: res }) => {
this.disabled = false
if (res.code !== 0) { if (res.code !== 0) {
return this.$message.error(res.msg) return this.$message.error(res.msg)
} }
@ -255,7 +258,9 @@ export default {
this.$emit('refreshDataList') this.$emit('refreshDataList')
} }
}) })
}).catch(() => {}) }).catch(() => {
this.loading = false
})
}) })
}, 1000, { 'leading': true, 'trailing': false }) }, 1000, { 'leading': true, 'trailing': false })
} }

Loading…
Cancel
Save