1. 文章编辑加入未保存浏览器缓存
2. 文章编辑标题加入长度检查
This commit is contained in:
@@ -254,7 +254,17 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], f
|
||||
var E = window.wangEditor;
|
||||
var editor = new E('#editor');
|
||||
editor.customConfig.uploadImgServer = '/upload/img';
|
||||
editor.create()
|
||||
|
||||
var cache_key = "content_" + $("input[name='contentId']").val();
|
||||
var html = localStorage.getItem(cache_key);
|
||||
|
||||
editor.customConfig.onblur = function (html) {
|
||||
localStorage.setItem(cache_key, html);
|
||||
};
|
||||
|
||||
editor.create();
|
||||
|
||||
if (html) editor.txt.html(html);//缓存的内容
|
||||
|
||||
return editor;
|
||||
}
|
||||
@@ -319,11 +329,11 @@ layui.define(['layer', 'laytpl', 'form', 'element', 'upload', 'util', 'face'], f
|
||||
return arguments.callee;
|
||||
}
|
||||
|
||||
,userstat: function () {
|
||||
/*,userstat: function () {
|
||||
$.getJSON("/os/user/stat",{},function (data) {
|
||||
$("#user_count").html(data.count);
|
||||
});
|
||||
}
|
||||
}*/
|
||||
|
||||
};
|
||||
|
||||
|
@@ -247,7 +247,9 @@ layui.define(['fly','laypage'], function(exports){
|
||||
bean:JSON.stringify(bean)
|
||||
},function (res) {
|
||||
layer.msg("发布成功",{time:2000},function () {
|
||||
location.href = "/";
|
||||
var cache_key = "content_" + $("input[name='contentId']").val();
|
||||
localStorage.removeItem(cache_key);
|
||||
location.href = "/user";
|
||||
});
|
||||
});
|
||||
return false; //阻止表单跳转。如果需要表单跳转,去掉这段即可。
|
||||
|
@@ -288,7 +288,8 @@ layui.define(['laypage', 'fly', 'element', 'flow'], function(exports){
|
||||
bean:JSON.stringify({username:fdata.username, password:fdata.password})
|
||||
,vercode:fdata.vercode
|
||||
},function (data) {
|
||||
data = JSON.parse(data);
|
||||
console.log(data);
|
||||
//data = JSON.parse(data);
|
||||
if(data.retcode != 0){
|
||||
layer.msg(data.retinfo);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user