// PC绔紪杈戝櫒宸ュ叿
var ueditor_toolbars = [[
'fullscreen', 'source', '|', 'undo', 'redo', '|',
'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'selectall', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', '|',
'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
'directionalityltr', 'directionalityrtl', 'indent', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
'simpleupload', 'insertimage', 'emotion', 'insertvideo', 'attachment', 'map', 'insertframe', 'insertcode', '|',
'horizontal', 'spechars', '|',
'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
'preview', 'searchreplace', 'drafts'
]];
// 鎵嬫満绔紪杈戝櫒宸ュ叿 previewmobile
var ueditor_toolbars_ey_m = [[
'fullscreen', 'source', '|', 'removeformat' , 'undo', 'redo', '|',
'fontsize', 'forecolor', 'bold', 'italic', 'underline', '|',
'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
'lineheight', 'simpleupload', 'insertimage', 'link', 'unlink', 'anchor', '|',
'insertvideo'
]];
// 褰撳垎椤典笉瓒充互鏄剧ず闅愯棌div
$(function() {
if (parseInt($('div.dataTables_paginate li').length) > 0) {
$('div.dataTables_paginate').show();
}
});
function showErrorMsg(msg, callback) {
layer.msg(msg, {icon: 5,time: 2000}, function(index) {
if (typeof callback !== 'undefined') callback();
layer.close(index);
});
}
function showErrorAlert(msg, icon, callback) {
if (!icon && icon != 0) {
icon = 5;
}
layer.alert(msg, {icon: icon, title: false, closeBtn: false}, function(index) {
if (typeof callback !== 'undefined') callback();
layer.close(index);
});
}
function showMbErrorMsg(msg) {
layer.open({
content: msg, skin: 'footer'
});
}
function showMbErrorAlert(msg) {
layer.open({
content: ''+ey_foreign_system4+'锛?+msg+'', btn: ey_foreign_system2
});
}
function showSuccessMsg(msg, callback) {
layer.msg(msg, {time: 1500}, function(index) {
if (typeof callback !== 'undefined') callback();
layer.close(index);
});
}
function showSuccessAlert(msg, icon, callback) {
if (!icon && icon != 0) {
icon = 1;
}
layer.alert(msg, {icon: icon, title: false, closeBtn: false}, function(index) {
if (typeof callback !== 'undefined') callback();
layer.close(index);
});
}
/*
* 涓婁紶鍥剧墖 鍚庡彴涓撶敤
* @access public
* @null int 涓€娆′笂浼犲浘鐗囧紶鍥
* @elementid string 涓婁紶鎴愬姛鍚庤繑鍥炶矾寰勬彃鍏ユ寚瀹欼D鍏冪礌鍐
* @path string 鎸囧畾涓婁紶淇濆瓨鏂囦欢澶?榛樿瀛樺湪public/upload/temp/鐩綍
* @callback string 鍥炶皟鍑芥暟(鍗曞紶鍥剧墖杩斿洖淇濆瓨璺緞瀛楃涓诧紝澶氬紶鍒欎负璺緞鏁扮粍 )
*/
var layer_GetUploadify;
// PC绔笂浼犲ご鍍
function GetUploadify(num,elementid,path,callback,url,title,is_mobile)
{
if (layer_GetUploadify){
layer.close(layer_GetUploadify);
}
if (num > 0) {
if (!url) url = GetUploadify_url;
if (!title) {
if (callback.indexOf('head_pic_call_back') > -1) {
title = '涓婁紶澶村儚';
} else {
title = '閫夋嫨涓婁紶';
}
}
if (!is_mobile) is_mobile = 0;
if (url.indexOf('?') > -1) {
url += '&';
} else {
url += '?';
}
var upurl = url+'num='+num+'&input='+elementid+'&path='+path+'&func='+callback;
var area = is_mobile==0?['50%', '60%']:['100%', '100%'];
layer_GetUploadify = layer.open({
type: 2,
title: title,
shadeClose: false,
shade: 0.3,
maxmin: true, //寮€鍚渶澶у寲鏈€灏忓寲鎸夐挳
area: area,
content: upurl
});
} else {
showErrorAlert('鍏佽涓婁紶0寮犲浘鐗?);
return false;
}
}
// 鎵嬫満绔笂浼犲ご鍍
function GetUploadify_mobile(num, url, title)
{
var scriptUrl = '/public/plugins/layer_mobile/layer.js';
// 鏀寔瀛愮洰褰
if (typeof __root_dir__ != "undefined") {
scriptUrl = __root_dir__ + scriptUrl;
}
if (typeof __version__ != "undefined") {
scriptUrl = scriptUrl + '?v=' + __version__;
}
// end
$.getScript(scriptUrl, function(){
if (num > 0) {
if (!url) url = GetUploadify_url;
if (!title) title = '澶村儚';
if (url.indexOf('?') > -1) {
url += '&';
} else {
url += '?';
}
var content = $('#update_mobile_file').html();
content = content.replace(/up_f/g, 'upfile');
content = content.replace(/form1/g,'form2');
if ('缂╃暐鍥? == title) {
content += '';
}else{
content += '';
}
layer_GetUploadify = layer.open({
type:1,
title:title,
anim:'up',
style:'position:fixed; bottom:0; left:0; width: 100%; padding:10px 0; border:none;max-width: 100%;',
content:content,
});
} else {
layer.open({
content: '鍏佽涓婁紶0寮犲浘鐗?,
skin: 'footer',
});
return false;
}
});
}
// 鍔犺浇灞
function layer_loading(msg){
if (!msg || '姝e湪澶勭悊' == msg) {
if (typeof ey_foreign_system8 === 'undefined') {
ey_foreign_system8 = "姝e湪澶勭悊";
}
msg = ey_foreign_system8;
}
if (typeof ey_foreign_system9 === 'undefined') {
ey_foreign_system9 = "璇峰嬁鍒锋柊椤甸潰";
}
var loading = layer.msg(
msg+'... '+ey_foreign_system9,
{
icon: 1,
time: 3600000, //1灏忔椂鍚庡悗鑷姩鍏抽棴
shade: [0.2] //0.1閫忔槑搴︾殑鐧借壊鑳屾櫙
});
//loading灞
var index = layer.load(3, {
shade: [0.1,'#fff'] //0.1閫忔槑搴︾殑鐧借壊鑳屾櫙
});
return loading;
}
// 鍔犺浇灞
function layer_loading_mini(icon){
//loading灞
if (!icon) {
icon = 2;
}
var loading = layer.load(icon, {
shade: [0.2,'#000'] //0.1閫忔槑搴︾殑鐧借壊鑳屾櫙
});
return loading;
}
// 娓叉煋缂栬緫鍣
function showEditor_1597892187(elemtid) {
var content = '';
try{
content = UE.getEditor(elemtid).getContent();
UE.getEditor(elemtid).destroy();
}catch(e){}
// 妫€娴嬫墜鏈虹鐨勬爣璇
var is_mobile = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;
// 鍒ゆ柇鎵嬫満绔苟涓旇烦杞
if (is_mobile) {
ueditor_toolbars = ueditor_toolbars_ey_m;
}
var serverUrl = __root_dir__+'/index.php?m=user&c=Uploadify&a=index&savepath=ueditor&lang='+__lang__;
var options = {
serverUrl : serverUrl,
zIndex: 999,
initialFrameWidth: "100%", //鍒濆寲瀹藉害
initialFrameHeight: 450, //鍒濆寲楂樺害
focus: false, //鍒濆鍖栨椂锛屾槸鍚﹁缂栬緫鍣ㄨ幏寰楃劍鐐箃rue鎴杅alse
maximumWords: 99999,
removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//鍏佽鐨勬渶澶у瓧绗︽暟 'fullscreen',
pasteplain:false, //鏄惁榛樿涓虹函鏂囨湰绮樿创銆俧alse涓轰笉浣跨敤绾枃鏈矘璐达紝true涓轰娇鐢ㄧ函鏂囨湰绮樿创
autoHeightEnabled: false,
toolbars: ueditor_toolbars,
// xss 杩囨护鏄惁寮€鍚?inserthtml绛夋搷浣
xssFilterRules: true,
//input xss杩囨护
inputXssFilter: true,
//output xss杩囨护
outputXssFilter: true
};
eval("ue_"+elemtid+" = UE.getEditor(elemtid, options);ue_"+elemtid+".ready(function() {ue_"+elemtid+".setContent(content);});");
}
/**
* 璁剧疆cookie
* @param {[type]} name [description]
* @param {[type]} value [description]
* @param {[type]} time [description]
*/
function ey_setCookies(name, value, time)
{
var cookieString = name + "=" + escape(value) + ";";
if (time != 0) {
var Times = new Date();
Times.setTime(Times.getTime() + time);
cookieString += "expires="+Times.toGMTString()+";"
}
document.cookie = cookieString+"path=/";
}
// 璇诲彇 cookie
function ey_getCookie(c_name)
{
if (document.cookie.length>0)
{
c_start = document.cookie.indexOf(c_name + "=")
if (c_start!=-1)
{
c_start=c_start + c_name.length+1
c_end=document.cookie.indexOf(";",c_start)
if (c_end==-1) c_end=document.cookie.length
return unescape(document.cookie.substring(c_start,c_end))
}
}
return "";
}
function getQueryString(name) {
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
var r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
}
function unifiedFilter(obj) {
var value = $(obj).val();
if (undefined != value || 'undefined' != value || '' != value) {
var url = $(obj).attr('data-url');
if (url.indexOf('?') > -1) {
url += '&';
} else {
url += '?';
}
url += $(obj).attr('data-field') + '=' + value;
window.location.href = url;
}
}
var layer_shade = [0.7, '#fafafa'];
// 缁熶竴鎻愮ず纭妗
function unifiedConfirmBox(msg, width, height, callback_1, btn, callback_2, callback_cancel) {
if (typeof msg === 'undefined' || !msg) msg = '纭鎵ц姝ゆ搷浣滐紵';
if (typeof btn === 'undefined' || !btn) btn = [ey_foreign_system2, ey_foreign_system3];
if (typeof width === 'undefined' || !width) width = '480px;';
if (typeof height === 'undefined' || !height) height = '200px;';
layer.confirm(msg, {
move: false,
closeBtn: 3,
title: ey_foreign_system4,
btnAlign: 'r',
shade: layer_shade,
btn: btn,
area: [width, height],
success: function () {
$(".layui-layer-content").css('text-align', 'left');
},
cancel: function() {
if (typeof callback_cancel !== 'undefined') callback_cancel();
}
}, function (index) {
// 纭鎿嶄綔
if (typeof callback_1 !== 'undefined') callback_1();
layer.close(index);
}, function (index) {
// 鍙栨秷鎿嶄綔
if (typeof callback_2 !== 'undefined') callback_2();
layer.close(index);
});
}
// 缁熶竴鎻愰啋淇℃伅妗
function unifiedRemindBox(msg, width, height) {
if (typeof msg === 'undefined') msg = '璇疯緭鍏ヤ綘鐨勬彁閱掍俊鎭?..';
if (typeof width === 'undefined') width = '480px;';
if (typeof height === 'undefined') height = '200px;';
layer.confirm(msg, {
move: false,
closeBtn: 3,
title: ey_foreign_system4,
btnAlign: 'r',
shade: layer_shade,
btn: [ey_foreign_system2],
area: [width, height],
success: function () {
$(".layui-layer-content").css('text-align', 'left');
}
});
}
function unifiedShowPayConfirmBox(is_wap, successCallback, failCallback, cancelCallback) {
if (0 === parseInt(is_wap)) {
layer.closeAll();
layer.confirm('璇峰湪鏂版墦寮€鐨勯〉闈㈣繘琛屾敮浠橈紒', {
move: false,
closeBtn: 3,
title: ey_foreign_system4,
btnAlign: 'r',
shade: layer_shade,
area: ['480px;', '200px;'],
btn: ['鏀粯鎴愬姛', '鏀粯澶辫触'],
success: function () {
$(".layui-layer-content").css('text-align', 'left');
},
cancel: function() {
if (typeof cancelCallback !== 'undefined') {
cancelCallback();
} else {
window.location.reload();
}
}
}, function () {
// 纭鎿嶄綔
if (typeof successCallback !== 'undefined') successCallback();
}, function (index) {
// 鍙栨秷鎿嶄綔
if (typeof failCallback !== 'undefined') {
failCallback();
} else {
window.location.reload();
}
layer.close(index);
});
}
}
function windowOpen(url) {
window.open(url);
}
function windowLocation(url) {
window.location.href = url;
}
function singleDelAction(obj, id, msg) {
id = id ? [id] : [];
if (id.length == 0) {
showErrorAlert('璇烽€夋嫨鍒犻櫎鍐呭');
return false;
}
var data = {
_ajax: 1,
del_id: id,
};
ajaxSubmitPost(obj, '', msg, data);
}
function batchDelAction(obj, name, msg) {
var ids = [];
$('input[name^='+name+']').each(function(i, o) {
if ($(o).is(':checked')) ids.push($(o).val());
});
if (ids.length == 0) {
showErrorAlert('璇疯嚦灏戦€夋嫨涓€椤?);
return false;
}
var data = {
_ajax: 1,
del_id: ids,
};
ajaxSubmitPost(obj, '', msg, data);
}
function ajaxSubmitPost(obj, url, msg, data) {
url = $(obj).attr('data-url') ? $(obj).attr('data-url') : url;
unifiedConfirmBox(msg, null, null, function() {
layer_loading('姝e湪澶勭悊');
$.ajax({
url : url,
data: data,
type: "post",
dataType: 'json',
success: function (res) {
layer.closeAll();
if (1 === parseInt(res.code)) {
showSuccessMsg(res.msg, function() {
window.location.reload();
});
} else {
showErrorAlert(res.msg);
}
},
error: function(e) {
layer.closeAll();
showErrorAlert(e.responseText);
}
});
});
}
// 鍙戦€?鐭俊銆侀偖绠?鎻愰啋
function eyUnifiedSendRemind(result) {
if (result) {
$.ajax({
url: result.url,
data: result.data,
type: 'post',
dataType: 'json'
});
}
}