refactor:重构错误页,优化编辑器,上传新效果图
|
@ -161,7 +161,6 @@ func (c *BaseController) ShowErrorPage(errCode int, errMsg string) {
|
||||||
if errCode >= 200 && errCode <= 510 {
|
if errCode >= 200 && errCode <= 510 {
|
||||||
c.CustomAbort(errCode, buf.String())
|
c.CustomAbort(errCode, buf.String())
|
||||||
}else{
|
}else{
|
||||||
c.CustomAbort(200, buf.String())
|
c.CustomAbort(500, buf.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ func (c *DocumentController) Read() {
|
||||||
doc, err = doc.FromCacheById(docId)
|
doc, err = doc.FromCacheById(docId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
beego.Error("从缓存中读取文档时失败 ->", err)
|
beego.Error("从缓存中读取文档时失败 ->", err)
|
||||||
c.ShowErrorPage(500, "文档不存在或已删除")
|
c.ShowErrorPage(404, "文档不存在或已删除")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
doc, err = doc.FromCacheByIdentify(id, bookResult.BookId)
|
doc, err = doc.FromCacheByIdentify(id, bookResult.BookId)
|
||||||
|
|
|
@ -202,10 +202,8 @@ $(function () {
|
||||||
timeout : 30000,
|
timeout : 30000,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (res) {
|
success: function (res) {
|
||||||
layer.close(index);
|
|
||||||
if (res.errcode === 0) {
|
if (res.errcode === 0) {
|
||||||
resetEditorChanged(false);
|
resetEditorChanged(false);
|
||||||
window.saveing = false;
|
|
||||||
for (var i in window.documentCategory) {
|
for (var i in window.documentCategory) {
|
||||||
var item = window.documentCategory[i];
|
var item = window.documentCategory[i];
|
||||||
|
|
||||||
|
@ -230,8 +228,10 @@ $(function () {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error : function (XMLHttpRequest, textStatus, errorThrown) {
|
error : function (XMLHttpRequest, textStatus, errorThrown) {
|
||||||
layer.close(index);
|
|
||||||
layer.msg("服务器错误:" + errorThrown);
|
layer.msg("服务器错误:" + errorThrown);
|
||||||
|
},
|
||||||
|
complete :function () {
|
||||||
|
layer.close(index);
|
||||||
window.saveing = false;
|
window.saveing = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -138,7 +138,7 @@ $(function () {
|
||||||
|
|
||||||
pushVueLists(res.data.attach);
|
pushVueLists(res.data.attach);
|
||||||
initHighlighting();
|
initHighlighting();
|
||||||
|
setLastSelectNode($node);
|
||||||
}else{
|
}else{
|
||||||
layer.msg("文档加载失败");
|
layer.msg("文档加载失败");
|
||||||
}
|
}
|
||||||
|
@ -182,13 +182,13 @@ $(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
beforeSend : function () {
|
beforeSend : function () {
|
||||||
index = layer.load(1, {shade: [0.1,'#fff'] });
|
index = layer.load(1, {shade: [0.1,'#fff'] });
|
||||||
|
window.saveing = true;
|
||||||
},
|
},
|
||||||
url : window.editURL,
|
url : window.editURL,
|
||||||
data : {"identify" : window.book.identify,"doc_id" : doc_id,"markdown" : content,"html" : html,"cover" : $is_cover ? "yes":"no","version": version},
|
data : {"identify" : window.book.identify,"doc_id" : doc_id,"markdown" : content,"html" : html,"cover" : $is_cover ? "yes":"no","version": version},
|
||||||
type :"post",
|
type :"post",
|
||||||
dataType :"json",
|
dataType :"json",
|
||||||
success : function (res) {
|
success : function (res) {
|
||||||
layer.close(index);
|
|
||||||
if(res.errcode === 0){
|
if(res.errcode === 0){
|
||||||
for(var i in window.documentCategory){
|
for(var i in window.documentCategory){
|
||||||
var item = window.documentCategory[i];
|
var item = window.documentCategory[i];
|
||||||
|
@ -214,6 +214,13 @@ $(function () {
|
||||||
}else{
|
}else{
|
||||||
layer.msg(res.message);
|
layer.msg(res.message);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error : function (XMLHttpRequest, textStatus, errorThrown) {
|
||||||
|
layer.msg("服务器错误:" + errorThrown);
|
||||||
|
},
|
||||||
|
complete :function () {
|
||||||
|
layer.close(index);
|
||||||
|
window.saveing = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -317,17 +324,8 @@ $(function () {
|
||||||
}
|
}
|
||||||
}).on('loaded.jstree', function () {
|
}).on('loaded.jstree', function () {
|
||||||
window.treeCatalog = $(this).jstree();
|
window.treeCatalog = $(this).jstree();
|
||||||
var $select_node_id = window.treeCatalog.get_selected();
|
//如果没有选中节点则选中默认节点
|
||||||
if ($select_node_id) {
|
openLastSelectedNode();
|
||||||
var $select_node = window.treeCatalog.get_node($select_node_id[0])
|
|
||||||
if ($select_node) {
|
|
||||||
$select_node.node = {
|
|
||||||
id: $select_node.id
|
|
||||||
};
|
|
||||||
|
|
||||||
loadDocument($select_node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}).on('select_node.jstree', function (node, selected, event) {
|
}).on('select_node.jstree', function (node, selected, event) {
|
||||||
if(window.menu_save.hasClass('change')) {
|
if(window.menu_save.hasClass('change')) {
|
||||||
|
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 372 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 367 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 282 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 230 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 558 KiB |
|
@ -7,7 +7,7 @@
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||||
<meta name="renderer" content="webkit" />
|
<meta name="renderer" content="webkit" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>服务器异常 - Powered by MinDoc</title>
|
<title> {{if eq 200 .ErrorCode}}友情提示{{else if eq 404 .ErrorCode}}页面不存在{{else}}服务器异0常{{end}} - Powered by MinDoc</title>
|
||||||
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
|
<link href="{{cdncss "/static/fonts/lato-100.css"}}" rel="stylesheet" type="text/css">
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
html, body {
|
html, body {
|
||||||
|
|