优化文档修改页面请求的异常处理

This commit is contained in:
yangjian 2021-07-20 07:15:49 +08:00
parent df9dd9dd7b
commit e68423c107
2 changed files with 41 additions and 28 deletions

View File

@ -10,7 +10,7 @@
- [修复]文档访问权限可绕过的问题;
- [优化]个人中心我协作的文集页面及功能;
- [优化]后台邮件服务器配置逻辑和页面展示;
- [优化]文档发布的异常判断和处理;
- [优化]文档发布和修改的异常判断和处理;
### v0.6.8 2021-06-27

View File

@ -275,39 +275,52 @@
'open_children':$('input:checkbox[name="open-children"]:checked').val(),
'show_children':$('input:checkbox[name="show-children"]:checked').val(),
}
$.post("{% url 'modify_doc' doc_id=doc.id %}",data,function(r){
layer.closeAll("loading");
if(r.status){
//修改成功
window.localStorage.removeItem('mrdoc_doc_cache') // 清空文档缓存
if(is_save == undefined){
layer.msg('保存成功',{time:1000},function(){
md_changed = false;
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
});
}
else if(status === 1){
layer.msg('发布成功',function(){
md_changed = false;
location.reload()
// window.location.href = "{% url 'doc' pro_id=doc.top_doc doc_id=doc.id %}";
});
$.ajax({
url:"{% url 'modify_doc' doc_id=doc.id %}",
type:'post',
data:data,
success:function(r){
layer.closeAll("loading");
if(r.status){
//修改成功
window.localStorage.removeItem('mrdoc_doc_cache') // 清空文档缓存
if(is_save == undefined){
layer.msg('保存成功',{time:1000},function(){
md_changed = false;
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
});
}
else if(status === 1){
layer.msg('发布成功',function(){
md_changed = false;
location.reload()
// window.location.href = "{% url 'doc' pro_id=doc.top_doc doc_id=doc.id %}";
});
}else{
layer.msg('保存成功',{time:1000},function(){
md_changed = false;
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
location.reload();
});
}
}else{
layer.msg('保存成功',{time:1000},function(){
md_changed = false;
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
location.reload();
});
//修改失败
layer.msg('保存失败');
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
}
}else{
},
error:function(r){
//修改失败
layer.msg('保存失败');
layer.closeAll("loading");
layer.msg('保存异常');
$('button.layui-btn').attr("disabled",false);
$('button.layui-btn').removeClass('layui-btn-disabled');
}
});
})
};
// 保存文档 - 只更新内容,不变更状态