diff --git a/controllers/account.go b/controllers/account.go index ad0f461e..ef1bcda1 100644 --- a/controllers/account.go +++ b/controllers/account.go @@ -78,6 +78,7 @@ func (c *AccountController) Login() { } } +//用户注册. func (c *AccountController) Register() { c.TplName = "account/register.tpl" @@ -329,6 +330,7 @@ func (c *AccountController) Logout(){ c.Redirect(beego.URLFor("AccountController.Login"),302) } +//验证码. func (c *AccountController) Captcha() { c.Prepare() diff --git a/controllers/book.go b/controllers/book.go index 91033fa6..d31771fb 100644 --- a/controllers/book.go +++ b/controllers/book.go @@ -557,7 +557,7 @@ func (c *BookController) SaveSort() { beego.Error(err) c.JsonResult(6003,"数据错误") } - fmt.Printf("%+v",docs) + for _,item := range docs { if doc_id,ok := item["id"].(float64);ok { doc,err := models.NewDocument().Find(int(doc_id)); diff --git a/main.go b/main.go index 8b963fc0..a5899360 100644 --- a/main.go +++ b/main.go @@ -32,10 +32,8 @@ func main() { beego.SetStaticPath("uploads","uploads") - - - beego.ErrorController(&controllers.ErrorController{}) + beego.Run() } diff --git a/static/css/markdown.css b/static/css/markdown.css index 870a94ad..a3a2ab63 100644 --- a/static/css/markdown.css +++ b/static/css/markdown.css @@ -33,9 +33,12 @@ body{ width: 280px; position: fixed; border-top: 1px solid #DDDDDD; - bottom: 0; + bottom: 15px; top: 40px; background-color: #FAFAFA; + left: 0; + right: 0; + overflow-y:auto; } .manual-category .manual-nav { font-size: 14px; diff --git a/static/js/editor.js b/static/js/editor.js index 33ad0721..cf672c46 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -187,7 +187,3 @@ function showSuccess($msg,$id) { $($id).addClass("success-message").removeClass("error-message").text($msg); return true; } - - - - diff --git a/static/js/html-editor.js b/static/js/html-editor.js index 2fe1ab34..939f643f 100644 --- a/static/js/html-editor.js +++ b/static/js/html-editor.js @@ -10,6 +10,24 @@ $(function () { }; wangEditor.config.menus.splice(0,0,"|"); wangEditor.config.menus.splice(0,0,"save"); + wangEditor.config.menus.splice(0,0,"release"); + + //移除地图、背景色 + editor.config.menus = $.map(wangEditor.config.menus, function(item, key) { + if (item === 'bgcolor') { + return null; + } + if (item === 'fullscreen') { + return null; + } + if (item === "undo"){ + return null; + } + if (item === "redo"){ + return null; + } + return item; + }); window.editor.ready(function () { if(window.documentCategory.length > 0){ @@ -251,4 +269,24 @@ $(function () { }).on("move_node.jstree", jstree_save); window.saveDocument = saveDocument; + + window.releaseBook = function () { + if(Object.prototype.toString.call(window.documentCategory) === '[object Array]' && window.documentCategory.length > 0){ + $.ajax({ + url : window.releaseURL, + data :{"identify" : window.book.identify }, + type : "post", + dataType : "json", + success : function (res) { + if(res.errcode === 0){ + layer.msg("发布任务已推送到任务队列,稍后将在后台执行。"); + }else{ + layer.msg(res.message); + } + } + }); + }else{ + layer.msg("没有需要发布的文档") + } + }; }); \ No newline at end of file diff --git a/static/wangEditor/plugins/release-menu.js b/static/wangEditor/plugins/release-menu.js new file mode 100644 index 00000000..4dfec50c --- /dev/null +++ b/static/wangEditor/plugins/release-menu.js @@ -0,0 +1,47 @@ +(function () { + + // 获取 wangEditor 构造函数和 jquery + var E = window.wangEditor; + var $ = window.jQuery; + + // 用 createMenu 方法创建菜单 + E.createMenu(function (check) { + + // 定义菜单id,不要和其他菜单id重复。编辑器自带的所有菜单id,可通过『参数配置-自定义菜单』一节查看 + var menuId = 'release'; + + // check将检查菜单配置(『参数配置-自定义菜单』一节描述)中是否该菜单id,如果没有,则忽略下面的代码。 + if (!check(menuId)) { + return; + } + + // this 指向 editor 对象自身 + var editor = this; + + // 创建 menu 对象 + var menu = new E.Menu({ + editor: editor, // 编辑器对象 + id: menuId, // 菜单id + title: '发布', // 菜单标题 + + // 正常状态和选中状态下的dom对象,样式需要自定义 + $domNormal: $(''), + $domSelected: $('') + }); + + // 菜单正常状态下,点击将触发该事件 + menu.clickEvent = function (e) { + window.releaseBook(); + }; + + // 菜单选中状态下,点击将触发该事件 + menu.clickEventSelected = function (e) { + + }; + + + // 增加到editor对象中 + editor.menus[menuId] = menu; + }); + +})(); \ No newline at end of file diff --git a/views/book/index.tpl b/views/book/index.tpl index 8c28610a..48773686 100644 --- a/views/book/index.tpl +++ b/views/book/index.tpl @@ -58,9 +58,9 @@
diff --git a/views/document/html_edit_template.tpl b/views/document/html_edit_template.tpl index dcdecbf5..865c1050 100644 --- a/views/document/html_edit_template.tpl +++ b/views/document/html_edit_template.tpl @@ -126,6 +126,7 @@ +