安装callback优化

This commit is contained in:
hdm 2022-07-27 17:17:22 +08:00
parent e225974b9e
commit a15ae16215
2 changed files with 31 additions and 16 deletions

View File

@ -422,6 +422,22 @@ fieldset.layui-field-title {
llqCharts.resize(); llqCharts.resize();
}; };
//页面停留时长统计
let stopTime;
window.onpageshow = ()=>{
stopTime = new Date().getTime();
}
window.onpagehide = ()=>{
stopTime = new Date().getTime() - stopTime;
let record = localStorage.getItem('data');
console.log(record);
let data = record && JSON.parse(record) || [];
localStorage.setItem('data',JSON.stringify([...data,{user:new Date().getTime(),path:window.location.href,stopTime}]));
}
</script> </script>
{/block} {/block}
<!-- /脚本 --> <!-- /脚本 -->

View File

@ -145,6 +145,18 @@
form = layui.form, form = layui.form,
element = layui.element; element = layui.element;
var n = 0; var n = 0;
function install_ajax(){
$.ajax({
url:"https://www.gougucms.com/index.php?s=home/get_module/install_ajax",
dataType:'jsonp',
data:{'name':'勾股CMS'},
jsonp:'callback',
success:function(result) {
console.log(result);
},
timeout:3000
});
}
//监听提交 //监听提交
form.on('submit(install)', function (data) { form.on('submit(install)', function (data) {
$('#progress').css('display', 'block'); $('#progress').css('display', 'block');
@ -163,10 +175,7 @@
data: data.field, data: data.field,
beforeSend: function () { beforeSend: function () {
// 禁用按钮防止重复提交 // 禁用按钮防止重复提交
$("#install").attr({ $("#install").attr({disabled: "disabled"}).html('创建中...');
disabled: "disabled"
});
$('#install').html('创建中...');
}, },
success: function (res) { success: function (res) {
if (res.code == 1) { if (res.code == 1) {
@ -188,21 +197,11 @@
} }
}, 500) }, 500)
} }
install_ajax();
} }
}, },
complete: function () { complete: function () {
$.ajax({ $("#install").removeAttr("disabled").html('提交');
url:"https://www.gougucms.com/index.php?s=home/login/install_ajax",
dataType:'jsonp',
data:{'name':'勾股CMS'},
jsonp:'callback',
success:function(result) {
console.log(result);
},
timeout:3000
});
$("#install").removeAttr("disabled");
$('#install').html('提交');
} }
}) })
return false; return false;