/** easyweb iframe v3.1.8 date:2020-05-04 license by http://easyweb.vip */
// 用common.js必须加上feng.addctx("${ctxpath}");
feng.info = function (info) {
top.layer.msg(info, {icon: 6});
};
feng.success = function (info) {
top.layer.msg(info, {icon: 1});
};
feng.error = function (info) {
top.layer.msg(info, {icon: 2});
};
feng.confirm = function (tip, ensure) {
top.layer.confirm(tip, {
skin: 'layui-layer-admin'
}, function () {
ensure();
});
};
feng.currentdate = function () {
// 获取当前日期
var date = new date();
// 获取当前月份
var nowmonth = date.getmonth() + 1;
// 获取当前是几号
var strdate = date.getdate();
// 添加分隔符“-”
var seperator = "-";
// 对月份进行处理,1-9月在前面添加一个“0”
if (nowmonth >= 1 && nowmonth <= 9) {
nowmonth = "0" + nowmonth;
}
// 对月份进行处理,1-9号在前面添加一个“0”
if (strdate >= 0 && strdate <= 9) {
strdate = "0" + strdate;
}
// 最后拼接字符串,得到一个格式为(yyyy-mm-dd)的日期
return date.getfullyear() + seperator + nowmonth + seperator + strdate;
};
feng.geturlparam = function (name) {
var reg = new regexp("(^|&)" + name + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return unescape(r[2]);
} else {
return null;
}
};
feng.infodetail = function (title, info) {
var display = "";
if (typeof info === "string") {
display = info;
} else {
if (info instanceof array) {
for (var x in info) {
display = display + info[x] + "
";
}
} else {
display = info;
}
}
top.layer.open({
title: title,
type: 1,
skin: 'layui-layer-rim', //加上边框
area: ['950px', '600px'], //宽高
content: '
' + display + '
'
});
};
feng.ztreecheckednodes = function (ztreeid) {
var ztree = $.fn.ztree.getztreeobj(ztreeid);
var nodes = ztree.getcheckednodes();
var ids = "";
for (var i = 0, l = nodes.length; i < l; i++) {
ids += "," + nodes[i].id;
}
return ids.substring(1);
};
feng.closeallloading = function () {
layer.closeall('loading');
};
feng.getclientheight = function () {
var clientheight = 0;
if (document.body.clientheight && document.documentelement.clientheight) {
clientheight = (document.body.clientheight < document.documentelement.clientheight) ? document.body.clientheight : document.documentelement.clientheight;
} else {
clientheight = (document.body.clientheight > document.documentelement.clientheight) ? document.body.clientheight : document.documentelement.clientheight;
}
return clientheight;
};
feng.getclientheightpx = function () {
return feng.getclientheight() + 'px';
};
// 以下代码是配置layui扩展模块的目录,每个页面都需要引入
layui.config({
version: feng.version,
base: feng.ctxpath + '/assets/common/module/'
}).extend({
steps: 'steps/steps',
notice: 'notice/notice',
cascader: 'cascader/cascader',
dropdown: 'dropdown/dropdown',
filechoose: 'filechoose/filechoose',
split: 'split/split',
cropper: 'cropper/cropper',
tagsinput: 'tagsinput/tagsinput',
citypicker: 'city-picker/city-picker',
introjs: 'introjs/introjs',
ztree: 'ztree/ztree',
//一下是guns用的插件
formselects: '../../expand/module/formselects/formselects-v4',
selectplus: '../../expand/module/selectplus/selectplus',
iconpicker: '../../expand/module/iconpicker/iconpicker',
ztree: '../../expand/module/ztree/ztree-object',
ax: '../../expand/module/ax/ax',
func: '../../expand/module/func/func'
}).use(['layer', 'admin'], function () {
var $ = layui.jquery;
var layer = layui.layer;
var admin = layui.admin;
// 移除loading动画
settimeout(function () {
admin.removeloading();
}, window === top ? 300 : 0);
//注册session超时的操作
$.ajaxsetup({
contenttype: "application/x-www-form-urlencoded;charset=utf-8",
complete: function (xmlhttprequest, textstatus) {
//如果超时就处理 ,指定要跳转的页面
if (xmlhttprequest.getresponseheader("guns-session-timeout") === "true") {
window.location = feng.ctxpath + "/global/sessionerror";
}
}
});
});