You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
110 lines
4.1 KiB
110 lines
4.1 KiB
|
|
KindEditor.ready(function (K) {
|
|
|
|
layui.use(['form', 'layer', 'table', 'laytpl', 'laydate', 'upload'], function () {
|
|
var form = layui.form,
|
|
layer = parent.layer === undefined ? layui.layer : top.layer,
|
|
$ = layui.jquery,
|
|
laytpl = layui.laytpl,
|
|
table = layui.table;
|
|
laydate = layui.laydate,
|
|
upload = layui.upload;
|
|
|
|
var OrgId = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgID;
|
|
var OrgName = JSON.parse(window.sessionStorage.getItem("userInfo")).OrgName;
|
|
var UID = JSON.parse(window.sessionStorage.getItem("userInfo")).UserCode;
|
|
var UName = JSON.parse(window.sessionStorage.getItem("userInfo")).USERS_NAME;
|
|
|
|
|
|
|
|
//指定允许上传的文件类型
|
|
upload.render({
|
|
elem: '#upbtn'
|
|
, url: '../../ashx/CommonHandler.ashx' //改成您自己的上传接口
|
|
//, accept: 'file' //普通文件
|
|
, data: {
|
|
Action: 'UploadFiles',
|
|
fileUrl: 'Upload/OA/Meeting/'
|
|
}
|
|
, done: function (res) {
|
|
layer.msg('上传成功');
|
|
console.log(res);
|
|
$("#limg").val(res.url);
|
|
var arr = res.url.split('/');
|
|
$('#fileshow').html("<a href='../../" + res.url + "' target='_blank' style='color:#fff'>" + arr[arr.length - 1] + "</a>");
|
|
}
|
|
});
|
|
|
|
//绑定类型
|
|
$.ajax({
|
|
type: "post",
|
|
url: "../../ashx/CommonHandler.ashx",
|
|
data: { Action: "getDicList", modtype: "TLIVE_TYPE" },
|
|
dataType: "json",
|
|
success: function (res) {
|
|
if (res.code == 0) {
|
|
var arr = res.data;
|
|
var optionhtml = "";
|
|
arr.forEach(function (item) {
|
|
optionhtml += '<option value="' + item.DIC_TEXT +'">' + item.DIC_TEXT+'</option>';
|
|
});
|
|
$("#llx").html(optionhtml);
|
|
form.render();
|
|
}
|
|
}
|
|
});
|
|
|
|
laydate.render({
|
|
elem: '#lsj'
|
|
,type: 'datetime'
|
|
});
|
|
|
|
var editor = K.create('#lnr', {
|
|
cssPath: '../../js/kindeditor/plugins/code/prettify.css',
|
|
uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
|
|
fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
|
|
allowFileManager: true
|
|
});
|
|
|
|
|
|
form.on("submit(AddEdit)", function (data) {
|
|
var editcon = editor.html();
|
|
var encode = encodeURI(editcon);
|
|
// 对编码的字符串转化base64
|
|
var base64 = btoa(encode);
|
|
//load提交
|
|
var index = layer.msg('数据提交中,请稍候', { icon: 16, time: false, shade: 0.8 });
|
|
$.post("../../ashx/TrainingLiveHandler.ashx", {
|
|
Action: $(".Action").val(),
|
|
id: $(".ID").val(), //ID
|
|
lbt: $("#lbt").val(), //类型
|
|
llx: $("#llx").val(), //标题
|
|
lzy: $("#lzy").val(), // 摘要
|
|
lsj: $("#lsj").val(),//时间
|
|
lfbr: $("#lfbr").val(),//发布人
|
|
lly: $("#lly").val(), //来源
|
|
ltp: $("#limg").val(), //图片
|
|
lnr: base64, //内容
|
|
ORG_ID: OrgId,
|
|
OrgName: OrgName,
|
|
UID: UID,
|
|
UName: UName,
|
|
random: new Date().getTime() //随机参数
|
|
}, function (res) {
|
|
console.log(res);
|
|
layer.close(index);
|
|
res = $.parseJSON(res);
|
|
if (res.code == 1) {
|
|
// parent.layer.msg(res.msg);
|
|
top.layer.msg(res.msg);
|
|
parent.location.reload();
|
|
} else {
|
|
layer.close(index);
|
|
layer.msg(res.msg);
|
|
}
|
|
});
|
|
layer.close(index);
|
|
return false;
|
|
})
|
|
})
|
|
});
|
|
|