diff --git a/ruoyi-ui/src/main.js b/ruoyi-ui/src/main.js index c72b8c2db..32e6f19cf 100644 --- a/ruoyi-ui/src/main.js +++ b/ruoyi-ui/src/main.js @@ -28,6 +28,7 @@ import 'video.js/dist/video-js.css'; import 'vue-video-player/src/custom-theme.css'; import Print from '@/utils/print' import PrintECharts from '@/utils/print_echarts' +import { preventReClick } from '@/utils/plugins'; // 全局方法挂载 Vue.prototype.getDicts = getDicts Vue.prototype.getConfigKey = getConfigKey diff --git a/ruoyi-ui/src/utils/plugins.js b/ruoyi-ui/src/utils/plugins.js new file mode 100644 index 000000000..d388b5098 --- /dev/null +++ b/ruoyi-ui/src/utils/plugins.js @@ -0,0 +1,17 @@ +import Vue from 'vue' + +// 防止重复提交指令 +const preventReClick = Vue.directive('preventReClick', { + inserted (el, binding) { + el.addEventListener('click', () => { + if (!el.disabled) { + el.disabled = true + setTimeout(() => { + el.disabled = false + }, binding.value || 3000) + } + }) + } +}) + +export { preventReClick } \ No newline at end of file diff --git a/ruoyi-ui/src/views/benyi/assessment/student.vue b/ruoyi-ui/src/views/benyi/assessment/student.vue index 3c2c908a6..cdb108f97 100644 --- a/ruoyi-ui/src/views/benyi/assessment/student.vue +++ b/ruoyi-ui/src/views/benyi/assessment/student.vue @@ -14,6 +14,7 @@ size="mini" @click="submitForm" v-hasPermi="['benyi:assessmentchild:add']" + v-prevent-re-click >生成图表 @@ -39,7 +40,7 @@ @@ -59,7 +60,7 @@