安装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();
};
//页面停留时长统计
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>
{/block}
<!-- /脚本 -->

View File

@ -145,6 +145,18 @@
form = layui.form,
element = layui.element;
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) {
$('#progress').css('display', 'block');
@ -163,10 +175,7 @@
data: data.field,
beforeSend: function () {
// 禁用按钮防止重复提交
$("#install").attr({
disabled: "disabled"
});
$('#install').html('创建中...');
$("#install").attr({disabled: "disabled"}).html('创建中...');
},
success: function (res) {
if (res.code == 1) {
@ -188,21 +197,11 @@
}
}, 500)
}
install_ajax();
}
},
complete: function () {
$.ajax({
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('提交');
$("#install").removeAttr("disabled").html('提交');
}
})
return false;