提交 | 用户 | 时间
|
1ac2bc
|
1 |
layui.use(['layer', 'form', 'admin', 'ax'], function () { |
懒 |
2 |
var $ = layui.jquery; |
|
3 |
var $ax = layui.ax; |
|
4 |
var form = layui.form; |
|
5 |
var admin = layui.admin; |
|
6 |
var layer = layui.layer; |
|
7 |
|
|
8 |
//实例化编辑器 |
|
9 |
var ue = UE.getEditor('container', { |
|
10 |
enableAutoSave: false, |
|
11 |
autoHeightEnabled: true, |
|
12 |
autoFloatEnabled: false, |
|
13 |
scaleEnabled: true, //滚动条 |
|
14 |
initialFrameHeight: 400 //默认的编辑区域高度 |
|
15 |
}); |
|
16 |
|
|
17 |
UE.Editor.prototype._bkGetActionUrl = UE.Editor.prototype.getActionUrl; |
|
18 |
UE.Editor.prototype.getActionUrl = function (action) { |
|
19 |
if (action === 'uploadimage' || action === 'uploadscrawl' || action === 'uploadimage') { |
|
20 |
return Feng.ctxPath + '/ueditor/imgUpdate'; |
|
21 |
} else if (action === 'uploadfile') { |
|
22 |
return Feng.ctxPath + '/ueditor/uploadfile'; |
|
23 |
} else if (action === 'uploadvideo') { |
|
24 |
return Feng.ctxPath + '/ueditor/uploadvideo'; |
|
25 |
} else { |
|
26 |
return this._bkGetActionUrl.call(this, action); |
|
27 |
} |
|
28 |
}; |
|
29 |
|
|
30 |
// 表单提交事件 |
|
31 |
form.on('submit(btnSubmit)', function (data) { |
|
32 |
var ajax = new $ax(Feng.ctxPath + "/notice/add", function (data) { |
|
33 |
Feng.success("添加成功!"); |
|
34 |
window.location.href = Feng.ctxPath + '/notice'; |
|
35 |
}, function (data) { |
|
36 |
Feng.error("添加失败!" + data.responseJSON.message) |
|
37 |
}); |
|
38 |
ajax.set(data.field); |
|
39 |
ajax.start(); |
|
40 |
//添加 return false 可成功跳转页面 |
|
41 |
return false; |
|
42 |
}); |
|
43 |
|
|
44 |
//取消按钮 |
|
45 |
$('#cancel').click(function () { |
|
46 |
window.location.href = Feng.ctxPath + "/notice"; |
|
47 |
}); |
|
48 |
|
|
49 |
}); |