懒羊羊
2023-08-30 71e81ed1d12e4d69f53c8ad9e066650ad4186293
提交 | 用户 | 时间
71e81e 1 /** EasyWeb iframe v3.1.8 date:2020-05-04 License By http://easyweb.vip */
2
3 // 用common.js必须加上Feng.addCtx("${ctxPath}");
4 Feng.info = function (info) {
5     top.layer.msg(info, {icon: 6});
6 };
7 Feng.success = function (info) {
8     top.layer.msg(info, {icon: 1});
9 };
10 Feng.error = function (info) {
11     top.layer.msg(info, {icon: 2});
12 };
13 Feng.confirm = function (tip, ensure) {
14     top.layer.confirm(tip, {
15         skin: 'layui-layer-admin'
16     }, function () {
17         ensure();
18     });
19 };
20 Feng.currentDate = function () {
21     // 获取当前日期
22     var date = new Date();
23
24     // 获取当前月份
25     var nowMonth = date.getMonth() + 1;
26
27     // 获取当前是几号
28     var strDate = date.getDate();
29
30     // 添加分隔符“-”
31     var seperator = "-";
32
33     // 对月份进行处理,1-9月在前面添加一个“0”
34     if (nowMonth >= 1 && nowMonth <= 9) {
35         nowMonth = "0" + nowMonth;
36     }
37
38     // 对月份进行处理,1-9号在前面添加一个“0”
39     if (strDate >= 0 && strDate <= 9) {
40         strDate = "0" + strDate;
41     }
42
43     // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
44     return date.getFullYear() + seperator + nowMonth + seperator + strDate;
45 };
46 Feng.getUrlParam = function (name) {
47     var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
48     var r = window.location.search.substr(1).match(reg);
49     if (r != null) {
50         return unescape(r[2]);
51     } else {
52         return null;
53     }
54 };
55 Feng.infoDetail = function (title, info) {
56     var display = "";
57     if (typeof info === "string") {
58         display = info;
59     } else {
60         if (info instanceof Array) {
61             for (var x in info) {
62                 display = display + info[x] + "<br/>";
63             }
64         } else {
65             display = info;
66         }
67     }
68     top.layer.open({
69         title: title,
70         type: 1,
71         skin: 'layui-layer-rim', //加上边框
72         area: ['950px', '600px'], //宽高
73         content: '<div style="padding: 20px;">' + display + '</div>'
74     });
75 };
76 Feng.zTreeCheckedNodes = function (zTreeId) {
77     var zTree = $.fn.zTree.getZTreeObj(zTreeId);
78     var nodes = zTree.getCheckedNodes();
79     var ids = "";
80     for (var i = 0, l = nodes.length; i < l; i++) {
81         ids += "," + nodes[i].id;
82     }
83     return ids.substring(1);
84 };
85 Feng.closeAllLoading = function () {
86     layer.closeAll('loading');
87 };
88 Feng.getClientHeight = function () {
89     var clientHeight = 0;
90     if (document.body.clientHeight && document.documentElement.clientHeight) {
91         clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
92     } else {
93         clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight : document.documentElement.clientHeight;
94     }
95     return clientHeight;
96 };
97 Feng.getClientHeightPx = function () {
98     return Feng.getClientHeight() + 'px';
99 };
100
101 // 以下代码是配置layui扩展模块的目录,每个页面都需要引入
102 layui.config({
103     version: Feng.version,
104     base: Feng.ctxPath + '/assets/common/module/'
105 }).extend({
106     steps: 'steps/steps',
107     notice: 'notice/notice',
108     cascader: 'cascader/cascader',
109     dropdown: 'dropdown/dropdown',
110     fileChoose: 'fileChoose/fileChoose',
111     Split: 'Split/Split',
112     Cropper: 'Cropper/Cropper',
113     tagsInput: 'tagsInput/tagsInput',
114     citypicker: 'city-picker/city-picker',
115     introJs: 'introJs/introJs',
116     zTree: 'zTree/zTree',
117
118     //一下是Guns用的插件
119     formSelects: '../../expand/module/formSelects/formSelects-v4',
120     selectPlus: '../../expand/module/selectPlus/selectPlus',
121     iconPicker: '../../expand/module/iconPicker/iconPicker',
122     ztree: '../../expand/module/ztree/ztree-object',
123     ax: '../../expand/module/ax/ax',
124     func: '../../expand/module/func/func'
125 }).use(['layer', 'admin'], function () {
126     var $ = layui.jquery;
127     var layer = layui.layer;
128     var admin = layui.admin;
129
130     // 移除loading动画
131     setTimeout(function () {
132         admin.removeLoading();
133     }, window === top ? 300 : 0);
134
135     //注册session超时的操作
136     $.ajaxSetup({
137         contentType: "application/x-www-form-urlencoded;charset=utf-8",
138         complete: function (XMLHttpRequest, textStatus) {
139
140             //如果超时就处理 ,指定要跳转的页面
141             if (XMLHttpRequest.getResponseHeader("Guns-Session-Timeout") === "true") {
142                 window.location = Feng.ctxPath + "/global/sessionError";
143             }
144
145         }
146     });
147
148 });