Commit e3fa663a by 前端

限制多次点击

1 parent f89d627b
...@@ -724,6 +724,7 @@ ...@@ -724,6 +724,7 @@
//批量创建商户 //批量创建商户
var _uploadMerchantUrl var _uploadMerchantUrl
var isRequestInProgress = false;
$('#batchCreate').on('click', function(e){ $('#batchCreate').on('click', function(e){
e.preventDefault(); // 阻止按钮默认行为 e.preventDefault(); // 阻止按钮默认行为
...@@ -784,6 +785,10 @@ ...@@ -784,6 +785,10 @@
}); });
}, },
yes: function(index, layero){ yes: function(index, layero){
if(isRequestInProgress) {
return;
}
isRequestInProgress = true;
var fileInput = $(layero).find('#fileInput')[0]; var fileInput = $(layero).find('#fileInput')[0];
if(!fileInput.files.length && !_uploadMerchantUrl) { if(!fileInput.files.length && !_uploadMerchantUrl) {
layer.msg('请选择文件'); layer.msg('请选择文件');
...@@ -802,7 +807,8 @@ ...@@ -802,7 +807,8 @@
request( request(
params, params,
function (res) { function (res) {
console.log(res) // 请求完成后,将标志变量设置回 false
isRequestInProgress = false;
// 关闭loading效果 // 关闭loading效果
layer.close(loadingIndex); layer.close(loadingIndex);
if(res.code == 0){ if(res.code == 0){
...@@ -819,6 +825,7 @@ ...@@ -819,6 +825,7 @@
} }
) )
layer.close(loadingIndex); layer.close(loadingIndex);
isRequestInProgress = false;
$(layero).find('#fileInput').on('change', function(){ $(layero).find('#fileInput').on('change', function(){
var originalTemplateUrl = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/批量创建商户导入模版.xlsx'; var originalTemplateUrl = 'https://img01.glsx.com.cn/weapp/resource/saas/scrm/xlsx/批量创建商户导入模版.xlsx';
updateTemplateLink(originalTemplateUrl, '下载模板', false); updateTemplateLink(originalTemplateUrl, '下载模板', false);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!