diff --git a/common/src/main/resources/static/laydate/5.0/theme/default/laydate.css b/common/src/main/resources/static/laydate/5.0/theme/default/laydate.css deleted file mode 100644 index 30417d03..00000000 --- a/common/src/main/resources/static/laydate/5.0/theme/default/laydate.css +++ /dev/null @@ -1,174 +0,0 @@ -/** 图标字体 **/ -@font-face {font-family:'laydate-icon'; - src:url('./font/iconfont.eot'); - src:url('./font/iconfont.eot#iefix') format('embedded-opentype'), - url('./font/iconfont.svg#iconfont') format('svg'), - url('./font/iconfont.woff') format('woff'), - url('./font/iconfont.ttf') format('truetype'); -} - -.laydate-icon{ - font-family:"laydate-icon"!important; - font-size:16px; - font-style:normal; - -webkit-font-smoothing:antialiased; - -moz-osx-font-smoothing:grayscale; -} - -/** - - @Name:laydata - @Author:贤心 - - **/ - -html #layuicss-laydate{display:none;position:absolute;width:1989px;} - -/* 初始化 */ -.layui-laydate *{margin:0;padding:0;} - -/* 主体结构 */ -.layui-laydate, .layui-laydate *{box-sizing:border-box;} -.layui-laydate{position:absolute;z-index:66666666;margin:5px 0;border-radius:2px;font-size:14px;-webkit-animation-duration:0.3s;animation-duration:0.3s;-webkit-animation-fill-mode:both;animation-fill-mode:both;} -.layui-laydate-main{width:260px;} -.layui-laydate-header *, -.layui-laydate-content td, -.layui-laydate-list li{transition-duration:.3s;-webkit-transition-duration:.3s;} - -@-webkit-keyframes laydate-upbit{ /* 微微往上滑入 */ - from {-webkit-transform:translate3d(0, 20px, 0);opacity:0.3;} - to {-webkit-transform:translate3d(0, 0, 0); opacity:1;} -} -@keyframes laydate-upbit{ - from {transform:translate3d(0, 20px, 0); opacity:0.3;} - to {transform:translate3d(0, 0, 0); opacity:1;} -} -.layui-laydate{-webkit-animation-name:laydate-upbit;animation-name:laydate-upbit;} -.layui-laydate-static{ position:relative;z-index:0;display:inline-block;margin:0;-webkit-animation:none;animation:none;} - -/* 展开年月列表时 */ -.laydate-ym-show .laydate-prev-m, -.laydate-ym-show .laydate-next-m{display:none!important;} -.laydate-ym-show .laydate-prev-y, -.laydate-ym-show .laydate-next-y{display:inline-block!important;} -.laydate-ym-show .laydate-set-ym span[lay-type="month"]{display:none!important;} - -/* 展开时间列表时 */ -.laydate-time-show .layui-laydate-header .layui-icon, -.laydate-time-show .laydate-set-ym span[lay-type="year"], -.laydate-time-show .laydate-set-ym span[lay-type="month"]{display:none!important;} - -/* 头部结构 */ -.layui-laydate-header{position:relative;line-height:22px;padding:6px 50px 5px;} -.layui-laydate-header *{display:inline-block;vertical-align:bottom;} -.layui-laydate-header i{position:absolute;top:6px;padding:0 2px;color:#999;font-size:14px;cursor:pointer;} -.layui-laydate-header i.laydate-prev-y{left:15px;} -.layui-laydate-header i.laydate-prev-m{left:45px;} -.layui-laydate-header i.laydate-next-y{right:15px;} -.layui-laydate-header i.laydate-next-m{right:45px;} -.laydate-set-ym{width:100%;text-align:center;box-sizing:border-box;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;} -.laydate-set-ym span{padding:0 5px;cursor:pointer;} -.laydate-time-text{cursor:default!important;} - -/* 主体结构 */ -.layui-laydate-content{position:relative;padding:5px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;} -.layui-laydate-content table{border-collapse:collapse;border-spacing:0;} -.layui-laydate-content th, -.layui-laydate-content td{width:36px;height:30px;padding:0px;text-align:center;} -.layui-laydate-content th{font-weight:400;} -.layui-laydate-content td{position:relative;cursor:pointer;} -.laydate-day-mark{position:absolute;left:0;top:0;width:100%;height:100%;line-height:30px;font-size:12px;overflow:hidden;} -.laydate-day-mark::after{position:absolute;content:'';right:2px;top:2px;width:5px;height:5px;border-radius:50%;} - -/* 底部结构 */ -.layui-laydate-footer{position:relative;height:36px;line-height:22px;padding:6px 15px;} -.layui-laydate-footer span{margin-right:15px;display:inline-block;cursor:pointer;font-size:12px;} -.layui-laydate-footer span:hover{color:#08c;} -.laydate-footer-btns{position:absolute;right:5px;top:5px;} -.laydate-footer-btns span{margin:0 0 0 3px;padding:0 8px;border:1px solid #C9C9C9;background-color:#fff; white-space:nowrap;vertical-align:top;border-radius:4px;} - -/* 年月列表 */ -.layui-laydate-list{position:absolute;left:0;top:0;width:100%;height:100%;padding:10px;box-sizing:border-box;background-color:#fff;} -.layui-laydate-list>li{position:relative;display:inline-block;width:33.3%;height:36px;line-height:36px;margin:3px 0;vertical-align:middle;text-align:center;cursor:pointer;} -.laydate-month-list>li{width:25%;margin:17px 0;} -.laydate-time-list{} -.laydate-time-list>li{height:100%;margin:0;line-height:normal;cursor:default;} -.laydate-time-list p{position:relative;top:-4px;line-height:29px;} -.laydate-time-list ol{height:181px;overflow:hidden;} -.laydate-time-list>li:hover ol{overflow-y:auto;} -.laydate-time-list ol li{width:130%;padding-left:27px;line-height:30px;text-align:left;cursor:pointer;} - -/* 提示 */ -.layui-laydate-hint{position:absolute;top:115px;left:50%;width:250px;margin-left:-125px;line-height:20px;padding:15px;text-align:center;font-size:12px;color:#FF5722;} - - -/* 双日历 */ -.layui-laydate-range{width:523px;} -.layui-laydate-range .layui-laydate-main{display:inline-block;vertical-align:middle;} -.layui-laydate-range .laydate-main-list-0 .laydate-next-m, -.layui-laydate-range .laydate-main-list-0 .laydate-next-y, -.layui-laydate-range .laydate-main-list-1 .laydate-prev-y, -.layui-laydate-range .laydate-main-list-1 .laydate-prev-m{display:none;} -.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left:1px solid #e2e2e2;} - - -/* 默认简约主题 */ -.layui-laydate, .layui-laydate-hint{border:1px solid #d2d2d2;box-shadow:0 2px 4px rgba(0,0,0,.12);border-radius:5px;background-color:#fff;color:#666;} -.layui-laydate-header{border-bottom:1px solid #e2e2e2;} -.layui-laydate-header i:hover, -.layui-laydate-header span:hover{color:#08c;} -.layui-laydate-content{border-top:none 0;border-bottom:none 0;} -.layui-laydate-content th{color:#333;} -.layui-laydate-content td{color:#666;} -.layui-laydate-content td.laydate-selected{background-color:#c2eaff;} -.laydate-selected:hover{background-color:#c2eaff!important;} -.layui-laydate-content td:hover, -.layui-laydate-list li:hover{background-color:#eaeaea;color:#333;} -.laydate-time-list li ol{margin:0;padding:0;border:1px solid #e2e2e2;border-left-width:0;} -.laydate-time-list li:first-child ol{border-left-width:1px;} -.laydate-time-list>li:hover{background:none;} -.layui-laydate-content .laydate-day-prev, -.layui-laydate-content .laydate-day-next{color:#d2d2d2;} -.laydate-selected.laydate-day-prev, -.laydate-selected.laydate-day-next{background-color:#f8f8f8!important;} -.layui-laydate-footer{border-top:1px solid #e2e2e2;} -.layui-laydate-hint{color:#FF5722;} -.laydate-day-mark::after{background-color:#08c;} -.layui-laydate-content td.layui-this .laydate-day-mark::after{display:none;} -.layui-laydate-footer span[lay-type="date"]{color:#08c;} -.layui-laydate .layui-this{background-color:#08c!important;color:#fff!important;} -.layui-laydate .laydate-btns-confirm{background-color:#139ce0;border:1px solid #139ce0;color:#fff;} -.layui-laydate .laydate-btns-confirm:hover{background-color:#08c;color:#fff;} -.layui-laydate .laydate-disabled, -.layui-laydate .laydate-disabled:hover{background:none!important;color:#d2d2d2!important;border-color:#d2d2d2;cursor:not-allowed!important;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;} - - -/* 墨绿/自定义背景色主题 */ -.laydate-theme-molv{border:none;} -.laydate-theme-molv.layui-laydate-range{width:548px} -.laydate-theme-molv .layui-laydate-main{width:274px;} -.laydate-theme-molv .layui-laydate-header{border:none;background-color:#009688;} -.laydate-theme-molv .layui-laydate-header i, -.laydate-theme-molv .layui-laydate-header span{color:#f6f6f6;} -.laydate-theme-molv .layui-laydate-header i:hover, -.laydate-theme-molv .layui-laydate-header span:hover{color:#fff;} -.laydate-theme-molv .layui-laydate-content{border:1px solid #e2e2e2;border-top:none;border-bottom:none;} -.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left:none;} -.laydate-theme-molv .layui-laydate-footer{border:1px solid #e2e2e2;} - -/* 格子主题 */ -.laydate-theme-grid .layui-laydate-content td, -.laydate-theme-grid .layui-laydate-content thead, -.laydate-theme-grid .laydate-year-list>li, -.laydate-theme-grid .laydate-month-list>li{border:1px solid #e2e2e2;} -.laydate-theme-grid .laydate-selected, -.laydate-theme-grid .laydate-selected:hover{background-color:#f2f2f2!important;color:#009688!important;} -.laydate-theme-grid .laydate-selected.laydate-day-prev, -.laydate-theme-grid .laydate-selected.laydate-day-next{color:#d2d2d2!important;} -.laydate-theme-grid .laydate-year-list, -.laydate-theme-grid .laydate-month-list{margin:1px 0 0 1px;} -.laydate-theme-grid .laydate-year-list>li, -.laydate-theme-grid .laydate-month-list>li{margin:0 -1px -1px 0;} -.laydate-theme-grid .laydate-year-list>li{height:43px;line-height:43px;} -.laydate-theme-grid .laydate-month-list>li{height:71px;line-height:71px;} - diff --git a/common/src/main/resources/static/laydate/5.0/laydate.js b/common/src/main/resources/static/laydate/5.3/laydate.js similarity index 51% rename from common/src/main/resources/static/laydate/5.0/laydate.js rename to common/src/main/resources/static/laydate/5.3/laydate.js index 60a90a20..a84f5a45 100644 --- a/common/src/main/resources/static/laydate/5.0/laydate.js +++ b/common/src/main/resources/static/laydate/5.3/laydate.js @@ -1,118 +1,739 @@ -/** - - @Name : layDate 5.0.9 日期时间控件 - @Author: 贤心 - @Site:http://www.layui.com/laydate/ - @License:MIT - - */ -;!function(){ +/*! + * layDate 5.3.1 日期与时间组件(单独版) + * MIT Licensed + */ + + +/*! + * Layui + * Classic modular Front-End UI library + * MIT Licensed + */ + +;!function(win){ "use strict"; - var isLayui = window.layui && layui.define, ready = { - getPath: function(){ - var jsPath = document.currentScript ? document.currentScript.src : function(){ - var js = document.scripts - ,last = js.length - 1 - ,src; - for(var i = last; i > 0; i--){ - if(js[i].readyState === 'interactive'){ - src = js[i].src; - break; - } - } - return src || js[last].src; - }(); - return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); - }() - - //获取节点的style属性值 - ,getStyle: function(node, name){ - var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); - return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); - } - - //载入CSS配件 - ,link: function(href, fn, cssname){ - - //未设置路径,则不主动加载css - if(!laydate.path) return; - - var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); - if(typeof fn === 'string') cssname = fn; - var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app, timeout = 0; - - link.rel = 'stylesheet'; - link.href = laydate.path + href; - link.id = id; - - if(!document.getElementById(id)){ - head.appendChild(link); - } - - if(typeof fn !== 'function') return; - - //轮询css是否加载完毕 - (function poll() { - if(++timeout > 8 * 1000 / 100){ - return window.console && console.error('laydate.css: Invalid'); - }; - parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); - }()); - } + var doc = win.document, config = { + modules: {} //记录模块物理路径 + ,status: {} //记录模块加载状态 + ,timeout: 10 //符合规范的模块请求最长等待秒数 + ,event: {} //记录模块自定义事件 } - ,laydate = { - v: '5.0.9' - ,config: {} //全局配置项 - ,index: (window.laydate && window.laydate.v) ? 100000 : 0 - ,path: ready.getPath + ,Layui = function(){ + this.v = '2.6.7'; // layui 版本号 + } + + //识别预先可能定义的指定全局对象 + ,GLOBAL = win.LAYUI_GLOBAL || {} + + //获取 layui 所在目录 + ,getPath = function(){ + var jsPath = doc.currentScript ? doc.currentScript.src : function(){ + var js = doc.scripts + ,last = js.length - 1 + ,src; + for(var i = last; i > 0; i--){ + if(js[i].readyState === 'interactive'){ + src = js[i].src; + break; + } + } + return src || js[last].src; + }(); - //设置全局项 - ,set: function(options){ - var that = this; - that.config = lay.extend({}, that.config, options); + return config.dir = GLOBAL.dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + }() + + //异常提示 + ,error = function(msg, type){ + type = type || 'log'; + win.console && console[type] && console[type]('layui error hint: ' + msg); + } + + ,isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]' + + //内置模块 + ,modules = config.builtin = { + lay: 'lay' //基础 DOM 操作 + ,layer: 'layer' //弹层 + ,laydate: 'laydate' //日期 + ,laypage: 'laypage' //分页 + ,laytpl: 'laytpl' //模板引擎 + ,layedit: 'layedit' //富文本编辑器 + ,form: 'form' //表单集 + ,upload: 'upload' //上传 + ,dropdown: 'dropdown' //下拉菜单 + ,transfer: 'transfer' //穿梭框 + ,tree: 'tree' //树结构 + ,table: 'table' //表格 + ,element: 'element' //常用元素操作 + ,rate: 'rate' //评分组件 + ,colorpicker: 'colorpicker' //颜色选择器 + ,slider: 'slider' //滑块 + ,carousel: 'carousel' //轮播 + ,flow: 'flow' //流加载 + ,util: 'util' //工具块 + ,code: 'code' //代码修饰器 + ,jquery: 'jquery' //DOM 库(第三方) + + ,all: 'all' + ,'layui.all': 'layui.all' //聚合标识(功能性的,非真实模块) + }; + + //记录基础数据 + Layui.prototype.cache = config; + + //定义模块 + Layui.prototype.define = function(deps, factory){ + var that = this + ,type = typeof deps === 'function' + ,callback = function(){ + var setApp = function(app, exports){ + layui[app] = exports; + config.status[app] = true; + }; + typeof factory === 'function' && factory(function(app, exports){ + setApp(app, exports); + config.callback[app] = function(){ + factory(setApp); + } + }); + return this; + }; + + type && ( + factory = deps, + deps = [] + ); + + that.use(deps, callback, null, 'define'); + return that; + }; + + //使用特定模块 + Layui.prototype.use = function(apps, callback, exports, from){ + var that = this + ,dir = config.dir = config.dir ? config.dir : getPath + ,head = doc.getElementsByTagName('head')[0]; + + apps = function(){ + if(typeof apps === 'string'){ + return [apps]; + } + //当第一个参数为 function 时,则自动加载所有内置模块,且执行的回调即为该 function 参数; + else if(typeof apps === 'function'){ + callback = apps; + return ['all']; + } + return apps; + }(); + + //如果页面已经存在 jQuery 1.7+ 库且所定义的模块依赖 jQuery,则不加载内部 jquery 模块 + if(win.jQuery && jQuery.fn.on){ + that.each(apps, function(index, item){ + if(item === 'jquery'){ + apps.splice(index, 1); + } + }); + layui.jquery = layui.$ = jQuery; + } + + var item = apps[0] + ,timeout = 0; + exports = exports || []; + + //静态资源host + config.host = config.host || (dir.match(/\/\/([\s\S]+?)\//)||['//'+ location.host +'/'])[0]; + + //加载完毕 + function onScriptLoad(e, url){ + var readyRegExp = navigator.platform === 'PLaySTATION 3' ? /^complete$/ : /^(complete|loaded)$/ + if (e.type === 'load' || (readyRegExp.test((e.currentTarget || e.srcElement).readyState))) { + config.modules[item] = url; + head.removeChild(node); + (function poll() { + if(++timeout > config.timeout * 1000 / 4){ + return error(item + ' is not a valid module', 'error'); + }; + config.status[item] ? onCallback() : setTimeout(poll, 4); + }()); + } + } + + //回调 + function onCallback(){ + exports.push(layui[item]); + apps.length > 1 ? + that.use(apps.slice(1), callback, exports, from) + : ( typeof callback === 'function' && function(){ + //保证文档加载完毕再执行回调 + if(layui.jquery && typeof layui.jquery === 'function' && from !== 'define'){ + return layui.jquery(function(){ + callback.apply(layui, exports); + }); + } + callback.apply(layui, exports); + }() ); + } + + //如果引入了聚合板,内置的模块则不必重复加载 + if( apps.length === 0 || (layui['layui.all'] && modules[item]) ){ + return onCallback(), that; + } + + //获取加载的模块 URL + //如果是内置模块,则按照 dir 参数拼接模块路径 + //如果是扩展模块,则判断模块路径值是否为 {/} 开头, + //如果路径值是 {/} 开头,则模块路径即为后面紧跟的字符。 + //否则,则按照 base 参数拼接模块路径 + + var url = ( modules[item] ? (dir + 'modules/') + : (/^\{\/\}/.test(that.modules[item]) ? '' : (config.base || '')) + ) + (that.modules[item] || item) + '.js'; + url = url.replace(/^\{\/\}/, ''); + + //如果扩展模块(即:非内置模块)对象已经存在,则不必再加载 + if(!config.modules[item] && layui[item]){ + config.modules[item] = url; //并记录起该扩展模块的 url + } + + //首次加载模块 + if(!config.modules[item]){ + var node = doc.createElement('script'); + + node.async = true; + node.charset = 'utf-8'; + node.src = url + function(){ + var version = config.version === true + ? (config.v || (new Date()).getTime()) + : (config.version||''); + return version ? ('?v=' + version) : ''; + }(); + + head.appendChild(node); + + if(node.attachEvent && !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && !isOpera){ + node.attachEvent('onreadystatechange', function(e){ + onScriptLoad(e, url); + }); + } else { + node.addEventListener('load', function(e){ + onScriptLoad(e, url); + }, false); + } + + config.modules[item] = url; + } else { //缓存 + (function poll() { + if(++timeout > config.timeout * 1000 / 4){ + return error(item + ' is not a valid module', 'error'); + }; + (typeof config.modules[item] === 'string' && config.status[item]) + ? onCallback() + : setTimeout(poll, 4); + }()); + } + + return that; + }; + + //获取节点的 style 属性值 + Layui.prototype.getStyle = function(node, name){ + var style = node.currentStyle ? node.currentStyle : win.getComputedStyle(node, null); + return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); + }; + + //css外部加载器 + Layui.prototype.link = function(href, fn, cssname){ + var that = this + ,head = doc.getElementsByTagName('head')[0] + ,link = doc.createElement('link'); + + if(typeof fn === 'string') cssname = fn; + + var app = (cssname || href).replace(/\.|\//g, '') + ,id = link.id = 'layuicss-'+ app + ,STAUTS_NAME = 'creating' + ,timeout = 0; + + link.rel = 'stylesheet'; + link.href = href + (config.debug ? '?v='+new Date().getTime() : ''); + link.media = 'all'; + + if(!doc.getElementById(id)){ + head.appendChild(link); + } + + if(typeof fn !== 'function') return that; + + //轮询 css 是否加载完毕 + (function poll(status) { + var delay = 100 + ,getLinkElem = doc.getElementById(id); //获取动态插入的 link 元素 + + //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 + if(++timeout > config.timeout * 1000 / delay){ + return error(href + ' timeout'); + }; + + //css 加载就绪 + if(parseInt(that.getStyle(getLinkElem, 'width')) === 1989){ + //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 + if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); + //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 + getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); + } else { + getLinkElem.setAttribute('lay-status', STAUTS_NAME); + setTimeout(function(){ + poll(STAUTS_NAME); + }, delay); + } + }()); + + //轮询css是否加载完毕 + /* + (function poll() { + if(++timeout > config.timeout * 1000 / 100){ + return error(href + ' timeout'); + }; + parseInt(that.getStyle(doc.getElementById(id), 'width')) === 1989 ? function(){ + fn(); + }() : setTimeout(poll, 100); + }()); + */ + + return that; + }; + + //css 内部加载器 + Layui.prototype.addcss = function(firename, fn, cssname){ + return layui.link(config.dir + 'css/' + firename, fn, cssname); + }; + + //存储模块的回调 + config.callback = {}; + + //重新执行模块的工厂函数 + Layui.prototype.factory = function(modName){ + if(layui[modName]){ + return typeof config.callback[modName] === 'function' + ? config.callback[modName] + : null; + } + }; + + //图片预加载 + Layui.prototype.img = function(url, callback, error) { + var img = new Image(); + img.src = url; + if(img.complete){ + return callback(img); + } + img.onload = function(){ + img.onload = null; + typeof callback === 'function' && callback(img); + }; + img.onerror = function(e){ + img.onerror = null; + typeof error === 'function' && error(e); + }; + }; + + //全局配置 + Layui.prototype.config = function(options){ + options = options || {}; + for(var key in options){ + config[key] = options[key]; + } + return this; + }; + + //记录全部模块 + Layui.prototype.modules = function(){ + var clone = {}; + for(var o in modules){ + clone[o] = modules[o]; + } + return clone; + }(); + + //拓展模块 + Layui.prototype.extend = function(options){ + var that = this; + + //验证模块是否被占用 + options = options || {}; + for(var o in options){ + if(that[o] || that.modules[o]){ + error(o+ ' Module already exists', 'error'); + } else { + that.modules[o] = options[o]; + } + } + + return that; + }; + + // location.hash 路由解析 + Layui.prototype.router = function(hash){ + var that = this + ,hash = hash || location.hash + ,data = { + path: [] + ,search: {} + ,hash: (hash.match(/[^#](#.*$)/) || [])[1] || '' + }; + + if(!/^#\//.test(hash)) return data; //禁止非路由规范 + hash = hash.replace(/^#\//, ''); + data.href = '/' + hash; + hash = hash.replace(/([^#])(#.*$)/, '$1').split('/') || []; + + //提取 Hash 结构 + that.each(hash, function(index, item){ + /^\w+=/.test(item) ? function(){ + item = item.split('='); + data.search[item[0]] = item[1]; + }() : data.path.push(item); + }); + + return data; + }; + + //URL 解析 + Layui.prototype.url = function(href){ + var that = this + ,data = { + //提取 url 路径 + pathname: function(){ + var pathname = href + ? function(){ + var str = (href.match(/\.[^.]+?\/.+/) || [])[0] || ''; + return str.replace(/^[^\/]+/, '').replace(/\?.+/, ''); + }() + : location.pathname; + return pathname.replace(/^\//, '').split('/'); + }() + + //提取 url 参数 + ,search: function(){ + var obj = {} + ,search = (href + ? function(){ + var str = (href.match(/\?.+/) || [])[0] || ''; + return str.replace(/\#.+/, ''); + }() + : location.search + ).replace(/^\?+/, '').split('&'); //去除 ?,按 & 分割参数 + + //遍历分割后的参数 + that.each(search, function(index, item){ + var _index = item.indexOf('=') + ,key = function(){ //提取 key + if(_index < 0){ + return item.substr(0, item.length); + } else if(_index === 0){ + return false; + } else { + return item.substr(0, _index); + } + }(); + //提取 value + if(key){ + obj[key] = _index > 0 ? item.substr(_index + 1) : null; + } + }); + + return obj; + }() + + //提取 Hash + ,hash: that.router(function(){ + return href + ? ((href.match(/#.+/) || [])[0] || '/') + : location.hash; + }()) + }; + + return data; + }; + + //本地持久性存储 + Layui.prototype.data = function(table, settings, storage){ + table = table || 'layui'; + storage = storage || localStorage; + + if(!win.JSON || !win.JSON.parse) return; + + //如果settings为null,则删除表 + if(settings === null){ + return delete storage[table]; + } + + settings = typeof settings === 'object' + ? settings + : {key: settings}; + + try{ + var data = JSON.parse(storage[table]); + } catch(e){ + var data = {}; + } + + if('value' in settings) data[settings.key] = settings.value; + if(settings.remove) delete data[settings.key]; + storage[table] = JSON.stringify(data); + + return settings.key ? data[settings.key] : data; + }; + + //本地会话性存储 + Layui.prototype.sessionData = function(table, settings){ + return this.data(table, settings, sessionStorage); + } + + //设备信息 + Layui.prototype.device = function(key){ + var agent = navigator.userAgent.toLowerCase() + + //获取版本号 + ,getVersion = function(label){ + var exp = new RegExp(label + '/([^\\s\\_\\-]+)'); + label = (agent.match(exp)||[])[1]; + return label || false; + } + + //返回结果集 + ,result = { + os: function(){ //底层操作系统 + if(/windows/.test(agent)){ + return 'windows'; + } else if(/linux/.test(agent)){ + return 'linux'; + } else if(/iphone|ipod|ipad|ios/.test(agent)){ + return 'ios'; + } else if(/mac/.test(agent)){ + return 'mac'; + } + }() + ,ie: function(){ //ie版本 + return (!!win.ActiveXObject || "ActiveXObject" in win) ? ( + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + ) : false; + }() + ,weixin: getVersion('micromessenger') //是否微信 + }; + + //任意的key + if(key && !result[key]){ + result[key] = getVersion(key); + } + + //移动设备 + result.android = /android/.test(agent); + result.ios = result.os === 'ios'; + result.mobile = (result.android || result.ios) ? true : false; + + return result; + }; + + //提示 + Layui.prototype.hint = function(){ + return { + error: error + }; + }; + + + //typeof 类型细分 -> string/number/boolean/undefined/null、object/array/function/… + Layui.prototype._typeof = function(operand){ + if(operand === null) return String(operand); + + //细分引用类型 + return (typeof operand === 'object' || typeof operand === 'function') ? function(){ + var type = Object.prototype.toString.call(operand).match(/\s(.+)\]$/) || [] //匹配类型字符 + ,classType = 'Function|Array|Date|RegExp|Object|Error|Symbol'; //常见类型字符 + + type = type[1] || 'Object'; + + //除匹配到的类型外,其他对象均返回 object + return new RegExp('\\b('+ classType + ')\\b').test(type) + ? type.toLowerCase() + : 'object'; + }() : typeof operand; + }; + + //对象是否具备数组结构(此处为兼容 jQuery 对象) + Layui.prototype._isArray = function(obj){ + var that = this + ,len + ,type = that._typeof(obj); + + if(!obj || (typeof obj !== 'object') || obj === win) return false; + + len = 'length' in obj && obj.length; //兼容 ie + return type === 'array' || len === 0 || ( + typeof len === 'number' && len > 0 && (len - 1) in obj //兼容 jQuery 对象 + ); + }; + + //遍历 + Layui.prototype.each = function(obj, fn){ + var key + ,that = this + ,callFn = function(key, obj){ //回调 + return fn.call(obj[key], key, obj[key]) + }; + + if(typeof fn !== 'function') return that; + obj = obj || []; + + //优先处理数组结构 + if(that._isArray(obj)){ + for(key = 0; key < obj.length; key++){ + if(callFn(key, obj)) break; + } + } else { + for(key in obj){ + if(callFn(key, obj)) break; + } + } + + return that; + }; + + //将数组中的对象按其某个成员排序 + Layui.prototype.sort = function(obj, key, desc){ + var clone = JSON.parse( + JSON.stringify(obj || []) + ); + + if(!key) return clone; + + //如果是数字,按大小排序;如果是非数字,则按字典序排序 + clone.sort(function(o1, o2){ + var isNum = /^-?\d+$/ + ,v1 = o1[key] + ,v2 = o2[key]; + + if(isNum.test(v1)) v1 = parseFloat(v1); + if(isNum.test(v2)) v2 = parseFloat(v2); + + return v1 - v2; + + /* + if(v1 && !v2){ + return 1; + } else if(!v1 && v2){ + return -1; + } + + if(v1 > v2){ + return 1; + } else if (v1 < v2) { + return -1; + } else { + return 0; + } + */ + + }); + + desc && clone.reverse(); //倒序 + return clone; + }; + + //阻止事件冒泡 + Layui.prototype.stope = function(thisEvent){ + thisEvent = thisEvent || win.event; + try { thisEvent.stopPropagation() } catch(e){ + thisEvent.cancelBubble = true; + } + }; + + //字符常理 + var EV_REMOVE = 'LAYUI-EVENT-REMOVE'; + + //自定义模块事件 + Layui.prototype.onevent = function(modName, events, callback){ + if(typeof modName !== 'string' + || typeof callback !== 'function') return this; + + return Layui.event(modName, events, null, callback); + }; + + //执行自定义模块事件 + Layui.prototype.event = Layui.event = function(modName, events, params, fn){ + var that = this + ,result = null + ,filter = (events || '').match(/\((.*)\)$/)||[] //提取事件过滤器字符结构,如:select(xxx) + ,eventName = (modName + '.'+ events).replace(filter[0], '') //获取事件名称,如:form.select + ,filterName = filter[1] || '' //获取过滤器名称,,如:xxx + ,callback = function(_, item){ + var res = item && item.call(that, params); + res === false && result === null && (result = false); + }; + + //如果参数传入特定字符,则执行移除事件 + if(params === EV_REMOVE){ + delete (that.cache.event[eventName] || {})[filterName]; return that; } - //主体CSS等待事件 - ,ready: function(fn){ - var cssname = 'laydate', ver = '' - ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; - isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); + //添加事件 + if(fn){ + config.event[eventName] = config.event[eventName] || {}; + + //这里不再对重复事件做支持 + //config.event[eventName][filterName] ? config.event[eventName][filterName].push(fn) : + config.event[eventName][filterName] = [fn]; return this; } - } - - //操作当前实例 - ,thisDate = function(){ - var that = this; - return { - //提示框 - hint: function(content){ - that.hint.call(that, content); + + //执行事件回调 + layui.each(config.event[eventName], function(key, item){ + //执行当前模块的全部事件 + if(filterName === '{*}'){ + layui.each(item, callback); + return; } - ,config: that.config - }; - } - - //字符常量 - ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', TIPS_OUT = '开始日期超出了结束日期
建议重新选择', LIMIT_YEAR = [100, 200000] - - ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = '.laydate-btns-time' - - //组件构造器 - ,Class = function(options){ - var that = this; - that.index = ++laydate.index; - that.config = lay.extend({}, that.config, laydate.config, options); - laydate.ready(function(){ - that.init(); + + //执行指定事件 + key === '' && layui.each(item, callback); + (filterName && key === filterName) && layui.each(item, callback); }); + + return result; + }; + + //新增模块事件 + Layui.prototype.on = function(events, modName, callback){ + var that = this; + return that.onevent.call(that, modName, events, callback); } + //移除模块事件 + Layui.prototype.off = function(events, modName){ + var that = this; + return that.event.call(that, modName, events, EV_REMOVE); + }; + + //exports layui + var layui = new Layui(); + + + + +/*! lay 基础 DOM 操作 | MIT Licensed */ + + + "use strict"; + + var MOD_NAME = 'lay' //模块名 + ,document = window.document + //DOM查找 ,lay = function(selector){ return new LAY(selector); @@ -130,9 +751,8 @@ } }; - /* - lay对象操作 + lay 对象操作 */ LAY.prototype = []; @@ -162,39 +782,37 @@ return args[0]; }; + //lay 模块版本 + lay.v = '1.0.7'; + //ie版本 lay.ie = function(){ var agent = navigator.userAgent.toLowerCase(); return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( - (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于 ie11 并没有 msie 的标识 ) : false; }(); - //中止冒泡 - lay.stope = function(e){ - e = e || window.event; - e.stopPropagation - ? e.stopPropagation() - : e.cancelBubble = true; + + + + + + /** + * 获取 layui 常见方法,以便用于组件单独版 + */ + + lay.layui = layui; + lay.getPath = layui.cache.dir; //获取当前 JS 所在目录 + lay.stope = layui.stope; //中止冒泡 + lay.each = function(){ //遍历 + layui.each.apply(layui, arguments); + return this; }; - //对象遍历 - lay.each = function(obj, fn){ - var key - ,that = this; - if(typeof fn !== 'function') return that; - obj = obj || []; - if(obj.constructor === Object){ - for(key in obj){ - if(fn.call(obj[key], key, obj[key])) break; - } - } else { - for(key = 0; key < obj.length; key++){ - if(fn.call(obj[key], key, obj[key])) break; - } - } - return that; - }; + + + //数字前置补零 lay.digit = function(num, length, end){ @@ -215,6 +833,109 @@ }); return elem; }; + + //当前页面是否存在滚动条 + lay.hasScrollbar = function(){ + return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); + }; + + //元素定位 + lay.position = function(elem, elemView, obj){ + if(!elemView) return; + obj = obj || {}; + + //如果绑定的是 document 或 body 元素,则直接获取鼠标坐标 + if(elem === document || elem === lay('body')[0]){ + obj.clickType = 'right'; + } + + //绑定绑定元素的坐标 + var rect = obj.clickType === 'right' ? function(){ + var e = obj.e || window.event || {}; + return { + left: e.clientX + ,top: e.clientY + ,right: e.clientX + ,bottom: e.clientY + } + }() : elem.getBoundingClientRect() + ,elemWidth = elemView.offsetWidth //控件的宽度 + ,elemHeight = elemView.offsetHeight //控件的高度 + + //滚动条高度 + ,scrollArea = function(type){ + type = type ? 'scrollLeft' : 'scrollTop'; + return document.body[type] | document.documentElement[type]; + } + + //窗口宽高 + ,winArea = function(type){ + return document.documentElement[type ? 'clientWidth' : 'clientHeight'] + }, margin = 5, left = rect.left, top = rect.bottom; + + //判断右侧是否超出边界 + if(left + elemWidth + margin > winArea('width')){ + left = winArea('width') - elemWidth - margin; //如果超出右侧,则将面板向右靠齐 + } + + //判断底部和顶部是否超出边界 + if(top + elemHeight + margin > winArea()){ + //优先顶部是否有足够区域显示完全 + if(rect.top > elemHeight + margin){ + top = rect.top - elemHeight - margin*2; //顶部有足够的区域显示 + } else { + //如果面板是鼠标右键弹出,且顶部没有足够区域显示,则将面板向底部靠齐 + if(obj.clickType === 'right'){ + top = winArea() - elemHeight - margin*2; + if(top < 0) top = 0; //不能溢出窗口顶部 + } + } + } + + //定位类型 + var position = obj.position; + if(position) elemView.style.position = position; + + //设置坐标 + elemView.style.left = left + (position === 'fixed' ? 0 : scrollArea(1)) + 'px'; + elemView.style.top = top + (position === 'fixed' ? 0 : scrollArea()) + 'px'; + + //防止页面无滚动条时,又因为弹出面板而出现滚动条导致的坐标计算偏差 + if(!lay.hasScrollbar()){ + var rect1 = elemView.getBoundingClientRect(); + //如果弹出面板的溢出窗口底部,则表示将出现滚动条,此时需要重新计算坐标 + if(!obj.SYSTEM_RELOAD && (rect1.bottom + margin) > winArea()){ + obj.SYSTEM_RELOAD = true; + setTimeout(function(){ + lay.position(elem, elemView, obj); + }, 50); + } + } + }; + + //获取元素上的参数配置上 + lay.options = function(elem, attr){ + var othis = lay(elem) + ,attrName = attr || 'lay-options'; + try { + return new Function('return '+ (othis.attr(attrName) || '{}'))(); + } catch(ev) { + hint.error('parseerror:'+ ev, 'error'); + return {}; + } + }; + + //元素是否属于顶级元素(document 或 body) + lay.isTopElem = function(elem){ + var topElems = [document, lay('body')[0]] + ,matched = false; + lay.each(topElems, function(index, item){ + if(item === elem){ + return matched = true + } + }); + return matched; + }; //追加字符 LAY.addStr = function(str, new_str){ @@ -248,7 +969,7 @@ ,isObject = typeof selector === 'object'; this.each(function(i, item){ - var nativeDOM = isObject ? [selector] : item.querySelectorAll(selector || null); + var nativeDOM = isObject ? item.contains(selector) : item.querySelectorAll(selector || null); for(; index < nativeDOM.length; index++){ arr.push(nativeDOM[index]); } @@ -278,12 +999,12 @@ }); }; - //移除css类 + //移除 css 类 LAY.prototype.removeClass = function(className){ return this.addClass(className, true); }; - //是否包含css类 + //是否包含 css 类 LAY.prototype.hasClass = function(className){ var has = false; this.each(function(index, item){ @@ -294,6 +1015,41 @@ return has; }; + //添加或获取 css style + LAY.prototype.css = function(key, value){ + var that = this + ,parseValue = function(v){ + return isNaN(v) ? v : (v +'px'); + }; + return (typeof key === 'string' && value === undefined) ? function(){ + if(that.length > 0) return that[0].style[key]; + }() : that.each(function(index, item){ + typeof key === 'object' ? lay.each(key, function(thisKey, thisValue){ + item.style[thisKey] = parseValue(thisValue); + }) : item.style[key] = parseValue(value); + }); + }; + + //添加或获取宽度 + LAY.prototype.width = function(value){ + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].offsetWidth; //此处还需做兼容 + }() : that.each(function(index, item){ + that.css('width', value); + }); + }; + + //添加或获取高度 + LAY.prototype.height = function(value){ + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].offsetHeight; //此处还需做兼容 + }() : that.each(function(index, item){ + that.css('height', value); + }); + }; + //添加或获取属性 LAY.prototype.attr = function(key, value){ var that = this; @@ -311,17 +1067,23 @@ }); }; - //设置HTML内容 + //设置或获取 HTML 内容 LAY.prototype.html = function(html){ - return this.each(function(index, item){ + var that = this; + return html === undefined ? function(){ + if(that.length > 0) return that[0].innerHTML; + }() : this.each(function(index, item){ item.innerHTML = html; }); }; - //设置值 + //设置或获取值 LAY.prototype.val = function(value){ - return this.each(function(index, item){ - item.value = value; + var that = this; + return value === undefined ? function(){ + if(that.length > 0) return that[0].value; + }() : this.each(function(index, item){ + item.value = value; }); }; @@ -360,12 +1122,116 @@ }); }; + //暴露 lay 到全局作用域 + window.lay = lay; + + //如果在 layui 体系中 + if(window.layui && layui.define){ + layui.define(function(exports){ //layui 加载 + exports(MOD_NAME, lay); + }); + } + +}(window, window.document); + + +/*! layDate 日期与时间控件 | MIT Licensed */ + +;!function(window, document){ + "use strict"; + + var isLayui = window.layui && layui.define, ready = { + getPath: (window.lay && lay.getPath) ? lay.getPath : '' + + //载入 CSS 依赖 + ,link: function(href, fn, cssname){ + + //未设置路径,则不主动加载 css + if(!laydate.path) return; + + //加载 css + if(window.lay && lay.layui){ + lay.layui.link(laydate.path + href, fn, cssname); + } + } + } + + //识别预先可能定义的指定全局对象 + ,GLOBAL = window.LAYUI_GLOBAL || {} + + //外部调用 + ,laydate = { + v: '5.3.1' //layDate 版本号 + ,config: {} //全局配置项 + ,index: (window.laydate && window.laydate.v) ? 100000 : 0 + ,path: GLOBAL.laydate_dir || ready.getPath + + //设置全局项 + ,set: function(options){ + var that = this; + that.config = lay.extend({}, that.config, options); + return that; + } + + //主体CSS等待事件 + ,ready: function(fn){ + var cssname = 'laydate', ver = '' + ,path = (isLayui ? 'modules/laydate/' : 'theme/') + 'default/laydate.css?v='+ laydate.v + ver; + isLayui ? layui.addcss(path, fn, cssname) : ready.link(path, fn, cssname); + return this; + } + } + + //操作当前实例 + ,thisModule = function(){ + var that = this + ,options = that.config + ,id = options.id; + + thisModule.that[id] = that; //记录当前实例对象 + + return { + //提示框 + hint: function(content){ + that.hint.call(that, content); + } + ,config: that.config + }; + } + + //字符常量 + ,MOD_NAME = 'laydate', ELEM = '.layui-laydate', THIS = 'layui-this', SHOW = 'layui-show', HIDE = 'layui-hide', DISABLED = 'laydate-disabled', LIMIT_YEAR = [100, 200000] + + ,ELEM_STATIC = 'layui-laydate-static', ELEM_LIST = 'layui-laydate-list', ELEM_SELECTED = 'laydate-selected', ELEM_HINT = 'layui-laydate-hint', ELEM_PREV = 'laydate-day-prev', ELEM_NEXT = 'laydate-day-next', ELEM_FOOTER = 'layui-laydate-footer', ELEM_CONFIRM = '.laydate-btns-confirm', ELEM_TIME_TEXT = 'laydate-time-text', ELEM_TIME_BTN = 'laydate-btns-time', ELEM_PREVIEW = 'layui-laydate-preview' + + //组件构造器 + ,Class = function(options){ + var that = this; + that.index = ++laydate.index; + that.config = lay.extend({}, that.config, laydate.config, options); + + //初始化 id 参数 + options = that.config; + options.id = ('id' in options) ? options.id : that.index; + + //初始化 + laydate.ready(function(){ + that.init(); + }); + } + + //日期格式字符 + ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s'; + + //将日期格式字符转换为数组 + thisModule.formatArr = function(format){ + return (format || '').match(new RegExp(dateType + '|.', 'g')) || [] + }; /* 组件操作 */ - //是否闰年 Class.isLeapYear = function(year){ return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0; @@ -377,13 +1243,15 @@ ,range: false //是否开启范围选择,即双控件 ,format: 'yyyy-MM-dd' //默认日期格式 ,value: null //默认日期,支持传入new Date(),或者符合format参数设定的日期格式字符 + ,isInitValue: true //用于控制是否自动向元素填充初始值(需配合 value 参数使用) ,min: '1900-1-1' //有效最小日期,年月日必须用“-”分割,时分秒必须用“:”分割。注意:它并不是遵循 format 设定的格式。 ,max: '2099-12-31' //有效最大日期,同上 ,trigger: 'click' //呼出控件的事件 - ,show: false //是否直接显示,如果设置true,则默认直接显示控件 + ,show: false //是否直接显示,如果设置 true,则默认直接显示控件 ,showBottom: true //是否显示底部栏 + ,isPreview: true //是否显示值预览 ,btns: ['clear', 'now', 'confirm'] //右下角显示的按钮,会按照数组顺序排列 - ,lang: window.lang || 'zh_CN' //语言,只支持cn/en,即中文和英文 + ,lang: 'cn' //语言,只支持cn/en,即中文和英文 ,theme: 'default' //主题 ,position: null //控件定位方式定位, 默认absolute,支持:fixed/absolute/static ,calendar: false //是否开启公历重要节日,仅支持中文版 @@ -398,57 +1266,50 @@ var that = this ,options = that.config ,text = { - zh_CN: { - weeks: ['日', '一', '二', '三', '四', '五', '六'] - ,time: ['时', '分', '秒'] - ,timeTips: '选择时间' - ,startTime: '开始时间' - ,endTime: '结束时间' - ,dateTips: '返回日期' - ,month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'] - ,tools: { - confirm: '确定' - ,clear: '清空' - ,now: '现在' - } + cn: { + weeks: ['日', '一', '二', '三', '四', '五', '六'] + ,time: ['时', '分', '秒'] + ,timeTips: '选择时间' + ,startTime: '开始时间' + ,endTime: '结束时间' + ,dateTips: '返回日期' + ,month: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'] + ,tools: { + confirm: '确定' + ,clear: '清空' + ,now: '现在' + } + ,timeout: '结束时间不能早于开始时间
请重新选择' + ,invalidDate: '不在有效日期或时间范围内' + ,formatError: ['日期格式不合法
必须遵循下述格式:
', '
已为你重置'] + ,preview: '当前选中的结果' } ,en: { - weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] - ,time: ['Hours', 'Minutes', 'Seconds'] - ,timeTips: 'Select Time' - ,startTime: 'Start Time' - ,endTime: 'End Time' - ,dateTips: 'Select Date' - ,month: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - ,tools: { - confirm: 'Confirm' - ,clear: 'Clear' - ,now: 'Now' - } - } - ,ja_JP: { - weeks: ["\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f"] - ,time: ['時', '分', '秒'] - ,timeTips: '選択時間' - ,startTime: '開始時刻' - ,endTime: '終了時刻' - ,dateTips: '選択デート' - ,month: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"] - ,tools: { - confirm: '確認' - ,clear: '明確' - ,now: '今' - } - } + weeks: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] + ,time: ['Hours', 'Minutes', 'Seconds'] + ,timeTips: 'Select Time' + ,startTime: 'Start Time' + ,endTime: 'End Time' + ,dateTips: 'Select Date' + ,month: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] + ,tools: { + confirm: 'Confirm' + ,clear: 'Clear' + ,now: 'Now' + } + ,timeout: 'End time cannot be less than start Time
Please re-select' + ,invalidDate: 'Invalid date' + ,formatError: ['The date format error
Must be followed:
', '
It has been reset'] + ,preview: 'The selected result' + } }; - return text[options.lang] || text['zh_CN']; + return text[options.lang] || text['cn']; }; //初始准备 Class.prototype.init = function(){ var that = this ,options = that.config - ,dateType = 'yyyy|y|MM|M|dd|d|HH|H|mm|m|ss|s' ,isStatic = options.position === 'static' ,format = { year: 'yyyy' @@ -464,15 +1325,29 @@ if(!options.elem[0]) return; //日期范围分隔符 - if(options.range === true) options.range = '-'; + that.rangeStr = options.range ? (typeof options.range === 'string' ? options.range : '-') : ''; - //根据不同type,初始化默认format + //若 range 参数为数组,则表示为开始日期和结束日期的 input 对象 + if(options.range && options.range.constructor === Array){ + that.rangeElem = [ + lay(options.range[0]), + lay(options.range[1]) + ]; + } + + //若 type 设置非法,则初始化为 date 类型 + if(!format[options.type]){ + window.console && console.error && console.error('laydate type error:\''+ options.type + '\' is not supported') + options.type = 'date'; + } + + //根据不同 type,初始化默认 format if(options.format === format.date){ - options.format = format[options.type]; + options.format = format[options.type] || format.date; } //将日期格式转化成数组 - that.format = options.format.match(new RegExp(dateType + '|.', 'g')) || []; + that.format = thisModule.formatArr(options.format); //生成正则表达式 that.EXP_IF = ''; @@ -492,9 +1367,11 @@ that.EXP_IF = that.EXP_IF + EXP; that.EXP_SPLIT = that.EXP_SPLIT + '(' + EXP + ')'; }); + //验证日期格式正则 + that.EXP_IF_ONE = new RegExp('^'+ that.EXP_IF +'$'); //验证单个日期格式 that.EXP_IF = new RegExp('^'+ ( options.range ? - that.EXP_IF + '\\s\\'+ options.range + '\\s' + that.EXP_IF + that.EXP_IF + '\\s\\'+ that.rangeStr + '\\s' + that.EXP_IF : that.EXP_IF ) +'$'); that.EXP_SPLIT = new RegExp('^'+ that.EXP_SPLIT +'$', ''); @@ -513,7 +1390,7 @@ } //记录重要日期 - options.mark = lay.extend({}, (options.calendar && options.lang === 'zh_CN') ? { + options.mark = lay.extend({}, (options.calendar && options.lang === 'cn') ? { '0-1-1': '元旦' ,'0-2-14': '情人' ,'0-3-8': '妇女' @@ -534,10 +1411,10 @@ if(typeof options[item] === 'number'){ //如果为数字 var day = options[item] ,time = new Date().getTime() - ,STAMP = 86400000 //代表一天的时间戳 + ,STAMP = 86400000 //代表一天的毫秒数 ,thisDate = new Date( day ? ( - day < STAMP ? time + day*STAMP : day //如果数字小于一天的时间戳,则数字为天数,否则为时间戳 + day < STAMP ? time + day*STAMP : day //如果数字小于一天的毫秒数,则数字为天数,否则为毫秒数 ) : time ); ymd = [thisDate.getFullYear(), thisDate.getMonth() + 1, thisDate.getDate()]; @@ -562,7 +1439,7 @@ isStatic || that.events(); //默认赋值 - if(options.value){ + if(options.value && options.isInitValue){ if(options.value.constructor === Date){ that.setValue(that.parse(0, that.systemDate(options.value))); } else { @@ -691,12 +1568,16 @@ lay(divFooter).html(function(){ var html = [], btns = []; if(options.type === 'datetime'){ - html.push(''+ lang.timeTips +''); + html.push(''+ lang.timeTips +''); } + if(!(!options.range && options.type === 'datetime')){ + html.push('') + } + lay.each(options.btns, function(i, item){ var title = lang.tools[item] || 'btn'; if(options.range && item === 'now') return; - if(isStatic && item === 'clear') title = options.lang === 'zh_CN' ? '重置' : 'Reset'; + if(isStatic && item === 'clear') title = options.lang === 'cn' ? '重置' : 'Reset'; btns.push(''+ title +''); }); html.push(''); @@ -728,6 +1609,9 @@ elem.appendChild(style); } + //记录当前执行的实例索引 + laydate.thisId = options.id; + //移除上一个控件 that.remove(Class.thisElemDate); @@ -737,7 +1621,7 @@ ,that.position() //定位 ); - that.checkDate().calendar(); //初始校验 + that.checkDate().calendar(null, 0, 'init'); //初始校验 that.changeEvent(); //日期切换 Class.thisElemDate = that.elemID; @@ -745,6 +1629,8 @@ typeof options.ready === 'function' && options.ready(lay.extend({}, options.dateTime, { month: options.dateTime.month + 1 })); + + that.preview(); }; //控件移除 @@ -752,9 +1638,13 @@ var that = this ,options = that.config ,elem = lay('#'+ (prev || that.elemID)); + if(!elem[0]) return that; + if(!elem.hasClass(ELEM_STATIC)){ that.checkDate(function(){ elem.remove(); + //delete options.dateTime; + //delete that.endDate; }); } return that; @@ -763,39 +1653,11 @@ //定位算法 Class.prototype.position = function(){ var that = this - ,options = that.config - ,elem = that.bindElem || options.elem[0] - ,rect = elem.getBoundingClientRect() //绑定元素的坐标 - ,elemWidth = that.elem.offsetWidth //控件的宽度 - ,elemHeight = that.elem.offsetHeight //控件的高度 - - //滚动条高度 - ,scrollArea = function(type){ - type = type ? 'scrollLeft' : 'scrollTop'; - return document.body[type] | document.documentElement[type]; - } - ,winArea = function(type){ - return document.documentElement[type ? 'clientWidth' : 'clientHeight'] - }, margin = 5, left = rect.left, top = rect.bottom; - - //如果右侧超出边界 - if(left + elemWidth + margin > winArea('width')){ - left = winArea('width') - elemWidth - margin; - } - - //如果底部超出边界 - if(top + elemHeight + margin > winArea()){ - top = rect.top > elemHeight //顶部是否有足够区域显示完全 - ? rect.top - elemHeight - : winArea() - elemHeight; - top = top - margin*2; - } - - if(options.position){ - that.elem.style.position = options.position; - } - that.elem.style.left = left + (options.position === 'fixed' ? 0 : scrollArea(1)) + 'px'; - that.elem.style.top = top + (options.position === 'fixed' ? 0 : scrollArea()) + 'px'; + ,options = that.config; + lay.position(that.bindElem || options.elem[0], that.elem, { + position: options.position + }); + return that; }; //提示 @@ -806,11 +1668,11 @@ 'class': ELEM_HINT }); + if(!that.elem) return; + div.innerHTML = content || ''; lay(that.elem).find('.'+ ELEM_HINT).remove(); - if (that.elem){ // ThinkGem 可能会为空 - that.elem.appendChild(div); - } + that.elem.appendChild(div); clearTimeout(that.hinTimer); that.hinTimer = setTimeout(function(){ @@ -832,7 +1694,7 @@ return [Y, M]; }; - //系统消息 + //系统日期 Class.prototype.systemDate = function(newDate){ var thisDate = newDate || new Date(); return { @@ -850,12 +1712,22 @@ var that = this ,thisDate = new Date() ,options = that.config + ,lang = that.lang() ,dateTime = options.dateTime = options.dateTime || that.systemDate() ,thisMaxDate, error ,elem = that.bindElem || options.elem[0] ,valType = that.isInput(elem) ? 'val' : 'html' - ,value = that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : elem.innerHTML) + ,value = function(){ + //如果传入了开始和结束日期的 input 对象,则将其拼接为日期范围字符 + if(that.rangeElem){ + var vals = [that.rangeElem[0].val(), that.rangeElem[1].val()]; + if(vals[0] && vals[1]){ + return vals.join(' ' + that.rangeStr + ' '); + } + } + return that.isInput(elem) ? elem.value : (options.position === 'static' ? '' : lay(elem).attr('lay-date')); + }() //校验日期有效数字 ,checkValid = function(dateTime){ @@ -875,6 +1747,7 @@ var startEnd = ['startTime', 'endTime']; value = (value.match(that.EXP_SPLIT) || []).slice(1); index = index || 0; + if(options.range){ that[startEnd[index]] = that[startEnd[index]] || {}; } @@ -904,7 +1777,7 @@ options.range && (that[startEnd[index]].seconds = thisv); } }); - checkValid(dateTime) + checkValid(dateTime); }; if(fn === 'limit') return checkValid(dateTime), that; @@ -913,51 +1786,106 @@ if(typeof value === 'string'){ value = value.replace(/\s+/g, ' ').replace(/^\s|\s$/g, ''); } - - //如果点击了开始,单未选择结束就关闭,则重新选择开始 - if(that.startState && !that.endState){ - delete that.startState; - that.endState = true; - }; + //如果开启范围,则计算结束日期 + var getEndDate = function(){ + if(options.range){ + that.endDate = that.endDate || lay.extend({}, options.dateTime, function(){ + var obj = {} + ,dateTime = options.dateTime + ,EYM = that.getAsYM(dateTime.year, dateTime.month); + + //初始右侧面板的年月 + if(options.type === 'year'){ + obj.year = dateTime.year + 1; + } else if(options.type !== 'time'){ + obj.year = EYM[0]; + obj.month = EYM[1]; + } + + //初始右侧面板的时间 + if(options.type === 'datetime' || options.type === 'time'){ + obj.hours = 23; + obj.minutes = obj.seconds = 59; + } + + return obj; + }()); + } + }; + getEndDate(); + if(typeof value === 'string' && value){ if(that.EXP_IF.test(value)){ //校验日期格式 if(options.range){ - value = value.split(' '+ options.range +' '); - that.startDate = that.startDate || that.systemDate(); - that.endDate = that.endDate || that.systemDate(); - options.dateTime = lay.extend({}, that.startDate); - lay.each([that.startDate, that.endDate], function(i, item){ + value = value.split(' '+ that.rangeStr +' '); + lay.each([options.dateTime, that.endDate], function(i, item){ initDate(item, value[i], i); }); } else { - initDate(dateTime, value) + initDate(dateTime, value); } } else { - that.hint('日期格式不合法
必须遵循下述格式:
'+ ( - options.range ? (options.format + ' '+ options.range +' ' + options.format) : options.format - ) + '
已为你重置'); + //格式不合法 + that.hint(lang.formatError[0] + ( + options.range ? (options.format + ' '+ that.rangeStr +' ' + options.format) : options.format + ) + lang.formatError[1]); error = true; } } else if(value && value.constructor === Date){ //如果值为日期对象时 options.dateTime = that.systemDate(value); } else { + //重置开始日期 options.dateTime = that.systemDate(); - delete that.startState; - delete that.endState; - delete that.startDate; - delete that.endDate; delete that.startTime; + + //重置结束日期 + delete that.endDate; //删除原有的结束日期 + getEndDate(); //并重新获得新的结束日期 delete that.endTime; } - + + //从日期范围表单中获取初始值 + (function(){ + if(that.rangeElem){ + var vals = [that.rangeElem[0].val(), that.rangeElem[1].val()] + ,arrDate = [options.dateTime, that.endDate]; + lay.each(vals, function(_i, _v){ + if(that.EXP_IF_ONE.test(_v)){ //校验日期格式 + initDate(arrDate[_i], _v, _i); + } + }); + } + })(); + + //校验日期有效数字 checkValid(dateTime); - + if(options.range) checkValid(that.endDate); + + //如果初始值格式错误,则纠正初始值 if(error && value){ that.setValue( options.range ? (that.endDate ? that.parse() : '') : that.parse() ); } + + //如果当前日期不在设定的最大小日期区间,则自动纠正在可选区域 + var getDateTime = function(obj){ + return that.newDate(obj).getTime(); + }; + + //校验主面板是否在可选日期区间 + if(getDateTime(dateTime) > getDateTime(options.max) || getDateTime(dateTime) < getDateTime(options.min)){ + dateTime = options.dateTime = lay.extend({}, options.min); + } + + //校验右侧面板是否在可选日期区间 + if(options.range){ + if(getDateTime(that.endDate) < getDateTime(options.min) || getDateTime(that.endDate) > getDateTime(options.max)){ + that.endDate = lay.extend({}, options.max); + } + } + fn && fn(); return that; }; @@ -985,6 +1913,7 @@ ,options = that.config, timestrap = {} ,dateTime = options[index > 41 ? 'endDate' : 'dateTime'] ,isOut, thisDateTime = lay.extend({}, dateTime, date || {}); + lay.each({ now: thisDateTime ,min: options.min @@ -1008,21 +1937,28 @@ return isOut; }; + //当前日期对象 + Class.prototype.thisDateTime = function(index){ + var that = this + ,options = that.config; + return index ? that.endDate: options.dateTime; + }; + //日历表 - Class.prototype.calendar = function(value){ + Class.prototype.calendar = function(value, index, type){ var that = this ,options = that.config - ,dateTime = value || options.dateTime + ,index = index ? 1 : 0 + ,dateTime = value || that.thisDateTime(index) ,thisDate = new Date(), startWeek, prevMaxDate, thisMaxDate ,lang = that.lang() ,isAlone = options.type !== 'date' && options.type !== 'datetime' - ,index = value ? 1 : 0 ,tds = lay(that.table[index]).find('td') ,elemYM = lay(that.elemHeader[index][2]).find('span'); - if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint('最低只能支持到公元'+ LIMIT_YEAR[0] +'年'); - if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint('最高只能支持到公元'+ LIMIT_YEAR[1] +'年'); + if(dateTime.year < LIMIT_YEAR[0]) dateTime.year = LIMIT_YEAR[0], that.hint(lang.invalidDate); + if(dateTime.year > LIMIT_YEAR[1]) dateTime.year = LIMIT_YEAR[1], that.hint(lang.invalidDate); //记录初始值 if(!that.firstDate){ @@ -1037,21 +1973,19 @@ thisMaxDate = laydate.getEndDate(dateTime.month + 1, dateTime.year); //计算当前月的最后一天 //赋值日 - lay.each(tds, function(index, item){ + lay.each(tds, function(index_, item){ var YMD = [dateTime.year, dateTime.month], st = 0; item = lay(item); item.removeAttr('class'); - if(index < startWeek){ - st = prevMaxDate - startWeek + index; + if(index_ < startWeek){ + st = prevMaxDate - startWeek + index_; item.addClass('laydate-day-prev'); YMD = that.getAsYM(dateTime.year, dateTime.month, 'sub'); - } else if(index >= startWeek && index < thisMaxDate + startWeek){ - st = index - startWeek; - if(!options.range){ - st + 1 === dateTime.date && item.addClass(THIS); - } + } else if(index_ >= startWeek && index_ < thisMaxDate + startWeek){ + st = index_ - startWeek; + st + 1 === dateTime.date && item.addClass(THIS); } else { - st = index - thisMaxDate - startWeek; + st = index_ - thisMaxDate - startWeek; item.addClass('laydate-day-next'); YMD = that.getAsYM(dateTime.year, dateTime.month); } @@ -1062,64 +1996,55 @@ year: YMD[0] ,month: YMD[1] - 1 ,date: YMD[2] - }, index); + }, index_); }); //同步头部年月 lay(elemYM[0]).attr('lay-ym', dateTime.year + '-' + (dateTime.month + 1)); lay(elemYM[1]).attr('lay-ym', dateTime.year + '-' + (dateTime.month + 1)); - if(options.lang === 'zh_CN'){ - lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + '年') - lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + '月'); + if(options.lang === 'cn'){ + lay(elemYM[0]).attr('lay-type', 'year').html(dateTime.year + ' 年') + lay(elemYM[1]).attr('lay-type', 'month').html((dateTime.month + 1) + ' 月'); } else { lay(elemYM[0]).attr('lay-type', 'month').html(lang.month[dateTime.month]); lay(elemYM[1]).attr('lay-type', 'year').html(dateTime.year); } //初始默认选择器 - if(isAlone){ + if(isAlone){ //年、月等独立选择器 if(options.range){ - value ? that.endDate = (that.endDate || { - year: dateTime.year + (options.type === 'year' ? 1 : 0) - ,month: dateTime.month + (options.type === 'month' ? 0 : -1) - }) : (that.startDate = that.startDate || { - year: dateTime.year - ,month: dateTime.month - }); if(value){ that.listYM = [ - [that.startDate.year, that.startDate.month + 1] + [options.dateTime.year, options.dateTime.month + 1] ,[that.endDate.year, that.endDate.month + 1] ]; that.list(options.type, 0).list(options.type, 1); + //同步按钮可点状态 options.type === 'time' ? that.setBtnStatus('时间' ,lay.extend({}, that.systemDate(), that.startTime) ,lay.extend({}, that.systemDate(), that.endTime) ) : that.setBtnStatus(true); } - } - if(!options.range){ + } else { that.listYM = [[dateTime.year, dateTime.month + 1]]; that.list(options.type, 0); } } - //赋值双日历 - if(options.range && !value){ - var EYM = that.getAsYM(dateTime.year, dateTime.month) - that.calendar(lay.extend({}, dateTime, { - year: EYM[0] - ,month: EYM[1] - })); + //初始赋值双日历 + if(options.range && type === 'init' && !value){ + //执行渲染第二个日历 + that.calendar(that.endDate, 1); } //通过检测当前有效日期,来设定确定按钮是否可点 if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0, ['hours', 'minutes', 'seconds']); - //标记选择范围 - if(options.range && value && !isAlone) that.stampRange(); + //同步按钮可点状态 + that.setBtnStatus(); + return that; }; @@ -1142,7 +2067,7 @@ ,elemYM = lay(elemHeader[2]).find('span') ,elemCont = that.elemCont[index || 0] ,haveList = lay(elemCont).find('.'+ ELEM_LIST)[0] - ,isCN = options.lang === 'zh_CN' + ,isCN = options.lang === 'cn' ,text = isCN ? '年' : '' ,listYM = that.listYM[index] || {} @@ -1151,7 +2076,8 @@ if(listYM[0] < 1) listYM[0] = 1; - if(type === 'year'){ //年列表 + //生成年列表 + if(type === 'year'){ var yearNum, startY = yearNum = listYM[0] - 7; if(startY < 1) startY = yearNum = 1; lay.each(new Array(15), function(i){ @@ -1173,7 +2099,10 @@ }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', (yearNum - 8) + '-' + listYM[1]) .html((startY + text) + ' - ' + (yearNum - 1 + text)); - } else if(type === 'month'){ //月列表 + } + + //生成月列表 + else if(type === 'month'){ lay.each(new Array(12), function(i){ var li = lay.elem('li', { 'lay-ym': i @@ -1190,7 +2119,10 @@ }); lay(elemYM[isCN ? 0 : 1]).attr('lay-ym', listYM[0] + '-' + listYM[1]) .html(listYM[0] + text); - } else if(type === 'time'){ //时间列表 + } + + //生成时间列表 + else if(type === 'time'){ //检测时分秒状态是否在有效日期时间范围内 var setTimeStatus = function(){ lay(ul).find('ol').each(function(i, ol){ @@ -1209,15 +2141,17 @@ }); if(!options.range) that.limit(lay(that.footer).find(ELEM_CONFIRM), that[startEnd], 0, ['hours', 'minutes', 'seconds']); }; + + //初始化时间对象 if(options.range){ - if(!that[startEnd]) that[startEnd] = { - hours: 0 - ,minutes: 0 - ,seconds: 0 - }; + if(!that[startEnd]){ + that[startEnd] = startEnd === 'startTime' ? dateTime : that.endDate; + } } else { that[startEnd] = dateTime; } + + //生成时分秒 lay.each([24, 60, 60], function(i, item){ var li = lay.elem('li'), childUL = ['

'+ lang.time[i] +'

    ']; lay.each(new Array(item), function(ii){ @@ -1233,7 +2167,7 @@ if(haveList) elemCont.removeChild(haveList); elemCont.appendChild(ul); - //年月 + //年月面板 - 选择事件 if(type === 'year' || type === 'month'){ //显示切换箭头 lay(that.elemMain[index]).addClass('laydate-ym-show'); @@ -1245,45 +2179,49 @@ if(index === 0){ dateTime[type] = ym; - if(isAlone) that.startDate[type] = ym; that.limit(lay(that.footer).find(ELEM_CONFIRM), null, 0); } else { //范围选择 - if(isAlone){ //非date/datetime类型 - that.endDate[type] = ym; - } else { //date/datetime类型 - var YM = type === 'year' - ? that.getAsYM(ym, listYM[1] - 1, 'sub') - : that.getAsYM(listYM[0], ym, 'sub'); - lay.extend(dateTime, { - year: YM[0] - ,month: YM[1] - }); - } + that.endDate[type] = ym; } - if(options.type === 'year' || options.type === 'month'){ + //当为年选择器或者年月选择器 + var isYearOrMonth = options.type === 'year' || options.type === 'month'; + if(isYearOrMonth){ lay(ul).find('.'+ THIS).removeClass(THIS); lay(this).addClass(THIS); //如果为年月选择器,点击了年列表,则切换到月选择器 if(options.type === 'month' && type === 'year'){ that.listYM[index][0] = ym; - isAlone && (that[['startDate', 'endDate'][index]].year = ym); + isAlone && ((index ? that.endDate : dateTime).year = ym); that.list('month', index); } } else { - that.checkDate('limit').calendar(); + that.checkDate('limit').calendar(null, index); that.closeList(); } that.setBtnStatus(); //同步按钮可点状态 - options.range || that.done(null, 'change'); - lay(that.footer).find(ELEM_TIME_BTN).removeClass(DISABLED); + + //若为月选择器,只有当选择月份时才自动关闭; + //若为年选择器,选择年份即自动关闭 + //且在范围未开启时 + if(!options.range){ + if((options.type === 'month' && type === 'month') || (options.type === 'year' && type === 'year')){ + that.setValue(that.parse()).remove().done(); + } + } + + that.done(null, 'change'); + lay(that.footer).find('.'+ ELEM_TIME_BTN).removeClass(DISABLED); }); - } else { + } else { //时间选择面板 - 选择事件 var span = lay.elem('span', { 'class': ELEM_TIME_TEXT - }), scroll = function(){ //滚动条定位 + }) + + //滚动条定位 + ,scroll = function(){ lay(ul).find('ol').each(function(i){ var ol = this ,li = lay(ol).find('li') @@ -1297,10 +2235,13 @@ }); } }); - }, haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT); - scroll() - span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips + } + ,haveSpan = lay(elemHeader[2]).find('.'+ ELEM_TIME_TEXT); + + scroll(); + span.innerHTML = options.range ? [lang.startTime,lang.endTime][index] : lang.timeTips; lay(that.elemMain[index]).addClass('laydate-time-show'); + if(haveSpan[0]) haveSpan.remove(); elemHeader[2].appendChild(span); @@ -1310,6 +2251,7 @@ lay(ol).find('li').on('click', function(){ var value = this.innerHTML | 0; if(lay(this).hasClass(DISABLED)) return; + if(options.range){ that[startEnd][hms[i]] = value; } else { @@ -1350,10 +2292,10 @@ Class.prototype.setBtnStatus = function(tips, start, end){ var that = this ,options = that.config - ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM) - ,isAlone = options.range && options.type !== 'date' && options.type !== 'time'; - if(isAlone){ - start = start || that.startDate; + ,lang = that.lang() + ,isOut, elemBtn = lay(that.footer).find(ELEM_CONFIRM); + if(options.range && options.type !== 'time'){ + start = start || options.dateTime; end = end || that.endDate; isOut = that.newDate(start).getTime() > that.newDate(end).getTime(); @@ -1364,7 +2306,7 @@ //是否异常提示 if(tips && isOut) that.hint( - typeof tips === 'string' ? TIPS_OUT.replace(/日期/g, tips) : TIPS_OUT + typeof tips === 'string' ? lang.timeout.replace(/日期/g, tips) : lang.timeout ); } }; @@ -1373,34 +2315,17 @@ Class.prototype.parse = function(state, date){ var that = this ,options = that.config - ,dateTime = date || (state + ,dateTime = date || (state == 'end' ? lay.extend({}, that.endDate, that.endTime) - : (options.range ? lay.extend({}, that.startDate, that.startTime) : options.dateTime)) - ,format = that.format.concat(); - - //转义为规定格式 - lay.each(format, function(i, item){ - if(/yyyy|y/.test(item)){ //年 - format[i] = lay.digit(dateTime.year, item.length); - } else if(/MM|M/.test(item)){ //月 - format[i] = lay.digit(dateTime.month + 1, item.length); - } else if(/dd|d/.test(item)){ //日 - format[i] = lay.digit(dateTime.date, item.length); - } else if(/HH|H/.test(item)){ //时 - format[i] = lay.digit(dateTime.hours, item.length); - } else if(/mm|m/.test(item)){ //分 - format[i] = lay.digit(dateTime.minutes, item.length); - } else if(/ss|s/.test(item)){ //秒 - format[i] = lay.digit(dateTime.seconds, item.length); - } - }); + : (options.range ? lay.extend({}, options.dateTime, that.startTime) : options.dateTime)) + ,format = laydate.parse(dateTime, that.format, 1); //返回日期范围字符 - if(options.range && !state){ - return format.join('') + ' '+ options.range +' ' + that.parse(1); + if(options.range && state === undefined){ + return format + ' '+ that.rangeStr +' ' + that.parse('end'); } - return format.join(''); + return format; }; //创建指定日期时间对象 @@ -1420,63 +2345,60 @@ Class.prototype.setValue = function(value){ var that = this ,options = that.config - ,elem = that.bindElem || options.elem[0] - ,valType = that.isInput(elem) ? 'val' : 'html' + ,elem = that.bindElem || options.elem[0]; - options.position === 'static' || lay(elem)[valType](value || ''); - return this; + //静态展现则不作默认赋值 + if(options.position === 'static') return that; + + value = value || ''; + + //绑定的元素是否为 input + if(that.isInput(elem)){ + lay(elem).val(value); + } else { + //如果 range 传入了开始和结束的 input 对象,则分别对其赋值 + if(that.rangeElem){ + that.rangeElem[0].val(value ? that.parse('start') : ''); + that.rangeElem[1].val(value ? that.parse('end') : ''); + } else { + if(lay(elem).find('*').length === 0){ + lay(elem).html(value); + } + lay(elem).attr('lay-date', value); + } + } + + return that; }; - //标记范围内的日期 - Class.prototype.stampRange = function(){ + //预览 + Class.prototype.preview = function(){ var that = this - ,options = that.config - ,startTime, endTime - ,tds = lay(that.elem).find('td'); + ,options = that.config; - if(options.range && !that.endDate) lay(that.footer).find(ELEM_CONFIRM).addClass(DISABLED); - if(!that.endDate) return; - - startTime = that.newDate({ - year: that.startDate.year - ,month: that.startDate.month - ,date: that.startDate.date - }).getTime(); + if(!options.isPreview) return; - endTime = that.newDate({ - year: that.endDate.year - ,month: that.endDate.month - ,date: that.endDate.date - }).getTime(); + var elemPreview = lay(that.elem).find('.'+ ELEM_PREVIEW) + ,value = options.range ? (that.endDate ? that.parse() : '') : that.parse(); - if(startTime > endTime) return that.hint(TIPS_OUT); - - lay.each(tds, function(i, item){ - var ymd = lay(item).attr('lay-ymd').split('-') - ,thisTime = that.newDate({ - year: ymd[0] - ,month: ymd[1] - 1 - ,date: ymd[2] - }).getTime(); - lay(item).removeClass(ELEM_SELECTED + ' ' + THIS); - if(thisTime === startTime || thisTime === endTime){ - lay(item).addClass( - lay(item).hasClass(ELEM_PREV) || lay(item).hasClass(ELEM_NEXT) - ? ELEM_SELECTED - : THIS - ); - } - if(thisTime > startTime && thisTime < endTime){ - lay(item).addClass(ELEM_SELECTED); - } + //显示预览 + elemPreview.html(value).css({ + 'color': '#08c' + ,'font-size': '14px;' }); + setTimeout(function(){ + elemPreview.css({ + 'color': '#666' + ,'font-size': '12px;' + }); + }, 300); }; - //执行done/change回调 + //执行 done/change 回调 Class.prototype.done = function(param, type){ var that = this ,options = that.config - ,start = lay.extend({}, that.startDate ? lay.extend(that.startDate, that.startTime) : options.dateTime) + ,start = lay.extend({}, lay.extend(options.dateTime, that.startTime)) ,end = lay.extend({}, lay.extend(that.endDate, that.endTime)) lay.each([start, end], function(i, item){ @@ -1486,6 +2408,8 @@ }); }); + that.preview(); + param = param || [that.parse(), start, end]; typeof options[type || 'done'] === 'function' && options[type || 'done'].apply(options, param); @@ -1493,28 +2417,13 @@ }; //选择日期 - Class.prototype.choose = function(td){ + Class.prototype.choose = function(td, index){ var that = this ,options = that.config - ,dateTime = options.dateTime + ,dateTime = that.thisDateTime(index) ,tds = lay(that.elem).find('td') - ,YMD = td.attr('lay-ymd').split('-') - - ,setDateTime = function(one){ - var thisDate = new Date(); - - //同步dateTime - one && lay.extend(dateTime, YMD); - - //记录开始日期 - if(options.range){ - that.startDate ? lay.extend(that.startDate, YMD) : ( - that.startDate = lay.extend({}, YMD, that.startTime) - ); - that.startYMD = YMD; - } - }; + ,YMD = td.attr('lay-ymd').split('-'); YMD = { year: YMD[0] | 0 @@ -1523,10 +2432,12 @@ }; if(td.hasClass(DISABLED)) return; + + lay.extend(dateTime, YMD); //同步 dateTime //范围选择 if(options.range){ - + //补充时分秒 lay.each(['startTime', 'endTime'], function(i, item){ that[item] = that[item] || { hours: 0 @@ -1534,54 +2445,12 @@ ,seconds: 0 }; }); - - if(that.endState){ //重新选择 - setDateTime(); - delete that.endState; - delete that.endDate; - that.startState = true; - tds.removeClass(THIS + ' ' + ELEM_SELECTED); - td.addClass(THIS); - } else if(that.startState){ //选中截止 - td.addClass(THIS); - - that.endDate ? lay.extend(that.endDate, YMD) : ( - that.endDate = lay.extend({}, YMD, that.endTime) - ); - - //判断是否顺时或逆时选择 - if(that.newDate(YMD).getTime() < that.newDate(that.startYMD).getTime()){ - var startDate = lay.extend({}, that.endDate, { - hours: that.startDate.hours - ,minutes: that.startDate.minutes - ,seconds: that.startDate.seconds - }); - lay.extend(that.endDate, that.startDate, { - hours: that.endDate.hours - ,minutes: that.endDate.minutes - ,seconds: that.endDate.seconds - }); - that.startDate = startDate; - } - - options.showBottom || that.done(); - that.stampRange(); //标记范围内的日期 - that.endState = true; - that.done(null, 'change'); - } else { //选中开始 - td.addClass(THIS); - setDateTime(); - that.startState = true; - } - lay(that.footer).find(ELEM_CONFIRM)[that.endDate ? 'removeClass' : 'addClass'](DISABLED); + that.calendar(null, index).done(null, 'change'); } else if(options.position === 'static'){ //直接嵌套的选中 - setDateTime(true); - that.calendar().done().done(null, 'change'); + that.calendar().done().done(null, 'change'); //同时执行 done 和 change 回调 } else if(options.type === 'date'){ - setDateTime(true); that.setValue(that.parse()).remove().done(); } else if(options.type === 'datetime'){ - setDateTime(true); that.calendar().done(null, 'change'); } }; @@ -1590,6 +2459,7 @@ Class.prototype.tool = function(btn, type){ var that = this ,options = that.config + ,lang = that.lang() ,dateTime = options.dateTime ,isStatic = options.position === 'static' ,active = { @@ -1609,18 +2479,17 @@ //清空、重置 ,clear: function(){ - that.setValue('').remove(); isStatic && ( lay.extend(dateTime, that.firstDate) ,that.calendar() ) options.range && ( - delete that.startState - ,delete that.endState + delete options.dateTime ,delete that.endDate ,delete that.startTime ,delete that.endTime ); + that.setValue('').remove(); that.done(['', {}, {}]); } @@ -1640,13 +2509,13 @@ //确定 ,confirm: function(){ if(options.range){ - if(!that.endDate) return that.hint('请先选择日期范围'); if(lay(btn).hasClass(DISABLED)) return that.hint( - options.type === 'time' ? TIPS_OUT.replace(/日期/g, '时间') : TIPS_OUT + options.type === 'time' ? lang.timeout.replace(/日期/g, '时间') : lang.timeout ); } else { - if(lay(btn).hasClass(DISABLED)) return that.hint('不在有效日期或时间范围内'); + if(lay(btn).hasClass(DISABLED)) return that.hint(lang.invalidDate); } + // ThinkGem 当下一个日期弹出前,可能上一个还未设置,导致选择不上的问题(下面2行调换顺序) that.setValue(that.parse()).remove() that.done(); } @@ -1658,14 +2527,13 @@ Class.prototype.change = function(index){ var that = this ,options = that.config - ,dateTime = options.dateTime + ,dateTime = that.thisDateTime(index) ,isAlone = options.range && (options.type === 'year' || options.type === 'month') ,elemCont = that.elemCont[index || 0] ,listYM = that.listYM[index] ,addSubYeay = function(type){ - var startEnd = ['startDate', 'endDate'][index] - ,isYear = lay(elemCont).find('.laydate-year-list')[0] + var isYear = lay(elemCont).find('.laydate-year-list')[0] ,isMonth = lay(elemCont).find('.laydate-month-list')[0]; //切换年列表 @@ -1683,13 +2551,14 @@ lay.extend(dateTime, { year: listYM[0] }); - if(isAlone) that[startEnd].year = listYM[0]; - options.range || that.done(null, 'change'); - that.setBtnStatus(); + if(isAlone) dateTime.year = listYM[0]; + options.range || that.done(null, 'change'); options.range || that.limit(lay(that.footer).find(ELEM_CONFIRM), { year: listYM[0] }); } + + that.setBtnStatus(); return isYear || isMonth; }; @@ -1697,8 +2566,8 @@ prevYear: function(){ if(addSubYeay('sub')) return; dateTime.year--; - that.checkDate('limit').calendar(); - options.range || that.done(null, 'change'); + that.checkDate('limit').calendar(null, index); + that.done(null, 'change'); } ,prevMonth: function(){ var YM = that.getAsYM(dateTime.year, dateTime.month, 'sub'); @@ -1706,8 +2575,8 @@ year: YM[0] ,month: YM[1] }); - that.checkDate('limit').calendar(); - options.range || that.done(null, 'change'); + that.checkDate('limit').calendar(null, index); + that.done(null, 'change'); } ,nextMonth: function(){ var YM = that.getAsYM(dateTime.year, dateTime.month); @@ -1715,14 +2584,14 @@ year: YM[0] ,month: YM[1] }); - that.checkDate('limit').calendar(); - options.range || that.done(null, 'change'); + that.checkDate('limit').calendar(null, index); + that.done(null, 'change'); } ,nextYear: function(){ if(addSubYeay()) return; dateTime.year++ - that.checkDate('limit').calendar(); - options.range || that.done(null, 'change'); + that.checkDate('limit').calendar(null, index); + that.done(null, 'change'); } }; }; @@ -1735,6 +2604,8 @@ //日期选择事件 lay(that.elem).on('click', function(e){ lay.stope(e); + }).on('mousedown', function(e){ + lay.stope(e); }); //年月切换 @@ -1761,7 +2632,7 @@ that.listYM[i] = [layYM[0] | 0, layYM[1] | 0]; that.list(layType, i); - lay(that.footer).find(ELEM_TIME_BTN).addClass(DISABLED); + lay(that.footer).find('.'+ ELEM_TIME_BTN).addClass(DISABLED); }); //下一月 @@ -1779,7 +2650,7 @@ lay.each(that.table, function(i, table){ var tds = lay(table).find('td'); tds.on('click', function(){ - that.choose(lay(this)); + that.choose(lay(this), i); }); }); @@ -1819,17 +2690,44 @@ showEvent(options.elem, 'bind'); showEvent(options.eventElem); + options.elem[0].eventHandler = true; + }; + + //记录所有实例 + thisModule.that = {}; //记录所有实例对象 + + //获取当前实例对象 + thisModule.getThis = function(id){ + var that = thisModule.that[id]; + if(!that) hint.error(id ? (MOD_NAME +' instance with ID \''+ id +'\' not found') : 'ID argument required'); + return that; + }; + + //初始执行 + ready.run = function(lay){ //绑定关闭控件事件 - lay(document).on('click', function(e){ - if(e.target === options.elem[0] - || e.target === options.eventElem[0] - || e.target === lay(options.closeStop)[0]){ - return; - } + lay(document).on('mousedown', function(e){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + + var options = that.config; + + if( + e.target === options.elem[0] || + e.target === options.eventElem[0] || + e.target === lay(options.closeStop)[0] + ) return; + that.remove(); + }).on('keydown', function(e){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + if(e.keyCode === 13){ - if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElem){ + if(lay('#'+ that.elemID)[0] && that.elemID === Class.thisElemDate){ e.preventDefault(); lay(that.footer).find(ELEM_CONFIRM)[0].click(); } @@ -1838,20 +2736,53 @@ //自适应定位 lay(window).on('resize', function(){ + if(!laydate.thisId) return; + var that = thisModule.getThis(laydate.thisId); + if(!that) return; + if(!that.elem || !lay(ELEM)[0]){ return false; } + that.position(); }); - - options.elem[0].eventHandler = true; }; - //核心接口 laydate.render = function(options){ var inst = new Class(options); - return thisDate.call(inst); + return thisModule.call(inst); + }; + + //将指定对象转化为日期值 + laydate.parse = function(dateTime, format, one){ + dateTime = dateTime || {}; + + //如果 format 是字符型,则转换为数组格式 + if(typeof format === 'string'){ + format = thisModule.formatArr(format); + } + + format = (format || []).concat(); + + //转义为规定格式 + lay.each(format, function(i, item){ + if(/yyyy|y/.test(item)){ //年 + format[i] = lay.digit(dateTime.year, item.length); + } else if(/MM|M/.test(item)){ //月 + format[i] = lay.digit(dateTime.month + (one || 0), item.length); + } else if(/dd|d/.test(item)){ //日 + format[i] = lay.digit(dateTime.date, item.length); + } else if(/HH|H/.test(item)){ //时 + format[i] = lay.digit(dateTime.hours, item.length); + } else if(/mm|m/.test(item)){ //分 + format[i] = lay.digit(dateTime.minutes, item.length); + } else if(/ss|s/.test(item)){ //秒 + format[i] = lay.digit(dateTime.seconds, item.length); + } + }); + + return format.join(''); }; //得到某月的最后一天 @@ -1866,23 +2797,24 @@ return new Date(thisDate.getTime() - 1000*60*60*24).getDate(); }; - //暴露lay - window.lay = window.lay || lay; - //加载方式 isLayui ? ( laydate.ready() - ,layui.define(function(exports){ //layui加载 + ,layui.define('lay', function(exports){ //layui 加载 laydate.path = layui.cache.dir; + ready.run(lay); exports(MOD_NAME, laydate); }) ) : ( - (typeof define === 'function' && define.amd) ? define(function(){ //requirejs加载 + (typeof define === 'function' && define.amd) ? define(function(){ //requirejs 加载 + ready.run(lay); return laydate; - }) : function(){ //普通script标签加载 + }) : function(){ //普通 script 标签加载 laydate.ready(); - window.laydate = laydate + ready.run(window.lay); + window.laydate = laydate; }() ); -}(); \ No newline at end of file +}(window, window.document); + diff --git a/common/src/main/resources/static/laydate/5.0/test.html b/common/src/main/resources/static/laydate/5.3/test.html similarity index 100% rename from common/src/main/resources/static/laydate/5.0/test.html rename to common/src/main/resources/static/laydate/5.3/test.html diff --git a/common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.eot b/common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.eot similarity index 100% rename from common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.eot rename to common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.eot diff --git a/common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.svg b/common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.svg similarity index 100% rename from common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.svg rename to common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.svg diff --git a/common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.ttf b/common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.ttf similarity index 100% rename from common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.ttf rename to common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.ttf diff --git a/common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.woff b/common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.woff similarity index 100% rename from common/src/main/resources/static/laydate/5.0/theme/default/font/iconfont.woff rename to common/src/main/resources/static/laydate/5.3/theme/default/font/iconfont.woff diff --git a/common/src/main/resources/static/laydate/5.3/theme/default/laydate.css b/common/src/main/resources/static/laydate/5.3/theme/default/laydate.css new file mode 100644 index 00000000..8fddab20 --- /dev/null +++ b/common/src/main/resources/static/laydate/5.3/theme/default/laydate.css @@ -0,0 +1,171 @@ +/** 图标字体 **/ +@font-face {font-family: 'laydate-icon'; + src: url('./font/iconfont.eot'); + src: url('./font/iconfont.eot#iefix') format('embedded-opentype'), + url('./font/iconfont.svg#iconfont') format('svg'), + url('./font/iconfont.woff') format('woff'), + url('./font/iconfont.ttf') format('truetype'); +} + +.laydate-icon{ + font-family:"laydate-icon" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/** + + @Name: laydata + + **/ + + +html #layuicss-laydate{display: none; position: absolute; width: 1989px;} + +/* 初始化 */ +.layui-laydate *{margin: 0; padding: 0;} + +/* 主体结构 */ +.layui-laydate, .layui-laydate *{box-sizing: border-box;} +.layui-laydate{position: absolute; z-index: 66666666; margin: 5px 0; border-radius: 2px; font-size: 14px; -webkit-animation-duration: 0.2s; animation-duration: 0.2s; -webkit-animation-fill-mode: both; animation-fill-mode: both;} +.layui-laydate-main{width: 260px;} +.layui-laydate-header *, +.layui-laydate-content td, +.layui-laydate-list li{transition-duration: .3s; -webkit-transition-duration: .3s;} + +/* 微微往下滑入 */ +@keyframes laydate-downbit { + 0% {opacity: 0.3; transform: translate3d(0, -5px, 0);} + 100% {opacity: 1; transform: translate3d(0, 0, 0);} +} + +.layui-laydate{animation-name: laydate-downbit;} +.layui-laydate-static{ position: relative; z-index: 0; display: inline-block; margin: 0; -webkit-animation: none; animation: none;} + +/* 展开年月列表时 */ +.laydate-ym-show .laydate-prev-m, +.laydate-ym-show .laydate-next-m{display: none !important;} +.laydate-ym-show .laydate-prev-y, +.laydate-ym-show .laydate-next-y{display: inline-block !important;} +.laydate-ym-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + +/* 展开时间列表时 */ +.laydate-time-show .layui-laydate-header .layui-icon, +.laydate-time-show .laydate-set-ym span[lay-type="year"], +.laydate-time-show .laydate-set-ym span[lay-type="month"]{display: none !important;} + +/* 头部结构 */ +.layui-laydate-header{position: relative; line-height: 22px; padding: 6px 50px 5px;} +.layui-laydate-header *{display: inline-block; vertical-align: bottom;} +.layui-laydate-header i{position: absolute; top: 6px; padding: 0 2px; color: #999; font-size: 14px; cursor: pointer;} +.layui-laydate-header i.laydate-prev-y{left: 15px;} +.layui-laydate-header i.laydate-prev-m{left: 45px;} +.layui-laydate-header i.laydate-next-y{right: 15px;} +.layui-laydate-header i.laydate-next-m{right: 45px;} +.laydate-set-ym{width: 100%; text-align: center; box-sizing: border-box; text-overflow: ellipsis; overflow: hidden; white-space: nowrap;} +.laydate-set-ym span{padding: 0 5px; cursor: pointer;} +.laydate-time-text{cursor: default !important;} + +/* 主体结构 */ +.layui-laydate-content{position: relative; padding: 5px; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} +.layui-laydate-content table{border-collapse: collapse; border-spacing: 0;} +.layui-laydate-content th, +.layui-laydate-content td{width: 36px; height: 30px; padding: 5px; text-align: center;} +.layui-laydate-content th{font-weight: 400;} +.layui-laydate-content td{position: relative; cursor: pointer;} +.laydate-day-mark{position: absolute; left: 0; top: 0; width: 100%; line-height: 30px; font-size: 12px; overflow: hidden;} +.laydate-day-mark::after{position: absolute; content:''; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%;} + +/* 底部结构 */ +.layui-laydate-footer{position: relative; height: 36px; line-height: 22px; padding: 6px 15px;} +.layui-laydate-footer span{display: inline-block; vertical-align: top; height: 24px; line-height: 22px; padding: 0 10px; border: 1px solid #C9C9C9; border-radius: 2px; background-color: #fff; font-size: 12px; cursor: pointer; white-space: nowrap; transition: all .3s;} +.layui-laydate-footer span:hover{color: #08c;} +.layui-laydate-footer span.layui-laydate-preview{cursor: default; border-color: transparent !important;} +.layui-laydate-footer span.layui-laydate-preview:hover{color: #666;} +.layui-laydate-footer span:first-child.layui-laydate-preview{padding-left: 0;} +.laydate-footer-btns{position: absolute; right: 5px; top: 5px;} +.laydate-footer-btns span{margin:0 0 0 3px;padding:0 8px;border:1px solid #C9C9C9;background-color:#fff; white-space:nowrap;vertical-align:top;border-radius:4px;} + +/* 年月列表 */ +.layui-laydate-list{position: absolute; left: 0; top: 0; width: 100%; height: 100%; padding: 10px; box-sizing: border-box; background-color: #fff;} +.layui-laydate-list>li{position: relative; display: inline-block; width: 33.3%; height: 36px; line-height: 36px; margin: 3px 0; vertical-align: middle; text-align: center; cursor: pointer;} +.laydate-month-list>li{width: 25%; margin: 17px 0;} +.laydate-time-list{} +.laydate-time-list>li{height: 100%; margin: 0; line-height: normal; cursor: default;} +.laydate-time-list p{position: relative; top: -4px; line-height: 29px;} +.laydate-time-list ol{height: 181px; overflow: hidden;} +.laydate-time-list>li:hover ol{overflow-y: auto;} +.laydate-time-list ol li{width: 130%; padding-left: 27px; height: 30px; line-height: 30px; text-align: left; cursor: pointer;} + +/* 提示 */ +.layui-laydate-hint{position: absolute; top: 115px; left: 50%; width: 250px; margin-left: -125px; line-height: 20px; padding: 15px; text-align: center; font-size: 12px; color: #FF5722;} + + +/* 双日历 */ +.layui-laydate-range{width: 546px;} +.layui-laydate-range .layui-laydate-main{display: inline-block; vertical-align: middle;} +.layui-laydate-range .laydate-main-list-1 .layui-laydate-header, +.layui-laydate-range .laydate-main-list-1 .layui-laydate-content{border-left: 1px solid #e2e2e2;} + + +/* 默认简约主题 */ +.layui-laydate, .layui-laydate-hint{border: 1px solid #d2d2d2; box-shadow: 0 2px 4px rgba(0,0,0,.12); background-color: #fff; color: #666;} +.layui-laydate-header{border-bottom: 1px solid #e2e2e2;} +.layui-laydate-header i:hover, +.layui-laydate-header span:hover{color: #08c;} +.layui-laydate-content{border-top: none 0; border-bottom: none 0;} +.layui-laydate-content th{color: #333;} +.layui-laydate-content td{color: #666;} +.layui-laydate-content td.laydate-selected{background-color: #c2eaff;} +.laydate-selected:hover{background-color: #c2eaff !important;} +.layui-laydate-content td:hover, +.layui-laydate-list li:hover{background-color: #eaeaea; color: #333;} +.laydate-time-list li ol{margin: 0; padding: 0; border: 1px solid #e2e2e2; border-left-width: 0;} +.laydate-time-list li:first-child ol{border-left-width: 1px;} +.laydate-time-list>li:hover{background: none;} +.layui-laydate-content .laydate-day-prev, +.layui-laydate-content .laydate-day-next{color: #d2d2d2;} +.laydate-selected.laydate-day-prev, +.laydate-selected.laydate-day-next{background-color: #f8f8f8 !important;} +.layui-laydate-footer{border-top: 1px solid #e2e2e2;} +.layui-laydate-hint{color: #FF5722;} +.laydate-day-mark::after{background-color: #08c;} +.layui-laydate-content td.layui-this .laydate-day-mark::after{display: none;} +.layui-laydate-footer span[lay-type="date"]{color: #08c;} +.layui-laydate .layui-this{background-color: #08c !important; color: #fff !important;} +.layui-laydate .laydate-btns-confirm{background-color:#139ce0;border:1px solid #139ce0;color:#fff;} +.layui-laydate .laydate-btns-confirm:hover{background-color:#08c;color:#fff;} +.layui-laydate .laydate-disabled, +.layui-laydate .laydate-disabled:hover{background:none !important; color: #d2d2d2 !important; cursor: not-allowed !important; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;} + +/* 墨绿/自定义背景色主题 */ +.laydate-theme-molv{border: none;} +.laydate-theme-molv.layui-laydate-range{width: 548px} +.laydate-theme-molv .layui-laydate-main{width: 274px;} +.laydate-theme-molv .layui-laydate-header{border: none; background-color: #009688;} +.laydate-theme-molv .layui-laydate-header i, +.laydate-theme-molv .layui-laydate-header span{color: #f6f6f6;} +.laydate-theme-molv .layui-laydate-header i:hover, +.laydate-theme-molv .layui-laydate-header span:hover{color: #fff;} +.laydate-theme-molv .layui-laydate-content{border: 1px solid #e2e2e2; border-top: none; border-bottom: none;} +.laydate-theme-molv .laydate-main-list-1 .layui-laydate-content{border-left: none;} +.laydate-theme-molv .layui-laydate-footer{border: 1px solid #e2e2e2;} + +/* 格子主题 */ +.laydate-theme-grid .layui-laydate-content td, +.laydate-theme-grid .layui-laydate-content thead, +.laydate-theme-grid .laydate-year-list>li, +.laydate-theme-grid .laydate-month-list>li{border: 1px solid #e2e2e2;} +.laydate-theme-grid .laydate-selected, +.laydate-theme-grid .laydate-selected:hover{background-color: #f2f2f2 !important; color: #009688 !important;} +.laydate-theme-grid .laydate-selected.laydate-day-prev, +.laydate-theme-grid .laydate-selected.laydate-day-next{color: #d2d2d2 !important;} +.laydate-theme-grid .laydate-year-list, +.laydate-theme-grid .laydate-month-list{margin: 1px 0 0 1px;} +.laydate-theme-grid .laydate-year-list>li, +.laydate-theme-grid .laydate-month-list>li{margin: 0 -1px -1px 0;} +.laydate-theme-grid .laydate-year-list>li{height: 43px; line-height: 43px;} +.laydate-theme-grid .laydate-month-list>li{height: 71px; line-height: 71px;} + diff --git a/common/src/main/resources/static/layer/3.1/demo.html b/common/src/main/resources/static/layer/3.5/demo.html similarity index 100% rename from common/src/main/resources/static/layer/3.1/demo.html rename to common/src/main/resources/static/layer/3.5/demo.html diff --git a/common/src/main/resources/static/layer/3.1/layer.js b/common/src/main/resources/static/layer/3.5/layer.js similarity index 79% rename from common/src/main/resources/static/layer/3.1/layer.js rename to common/src/main/resources/static/layer/3.5/layer.js index beac9ef4..262e8986 100644 --- a/common/src/main/resources/static/layer/3.1/layer.js +++ b/common/src/main/resources/static/layer/3.5/layer.js @@ -1,1379 +1,1459 @@ -/** - @Name:layer v3.1.1 Web弹层组件 - @Author:贤心 - @Site:http://layer.layui.com - @License:MIT - - */ - -;!function(window, undefined){ -"use strict"; - -var isLayui = window.layui && layui.define, $, win, ready = { - getPath: function(){ - var jsPath = document.currentScript ? document.currentScript.src : function(){ - var js = document.scripts - ,last = js.length - 1 - ,src; - for(var i = last; i > 0; i--){ - if(js[i].readyState === 'interactive'){ - src = js[i].src; - break; - } - } - return src || js[last].src; - }(); - return jsPath.substring(0, jsPath.lastIndexOf('/') + 1); - }(), - - config: {}, end: {}, minIndex: 0, minLeft: [], - //btn: [layer.i18n.btnOk, layer.i18n.btnCancel], // ThinkGem - - //五种原始层模式 - type: ['dialog', 'page', 'iframe', 'loading', 'tips'], - - //获取节点的style属性值 - getStyle: function(node, name){ - var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); - return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); - }, - - //载入CSS配件 - link: function(href, fn, cssname){ - - //未设置路径,则不主动加载css - if(!layer.path) return; - - var head = document.getElementsByTagName("head")[0], link = document.createElement('link'); - if(typeof fn === 'string') cssname = fn; - var app = (cssname || href).replace(/\.|\//g, ''); - var id = 'layuicss-'+ app, timeout = 0; - - link.rel = 'stylesheet'; - link.href = layer.path + href; - link.id = id; - - if(!document.getElementById(id)){ - head.appendChild(link); - } - - if(typeof fn !== 'function') return; - - //轮询css是否加载完毕 - (function poll() { - if(++timeout > 8 * 1000 / 100){ - return window.console && console.error('layer.css: Invalid'); - }; - parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100); - }()); - } -}; - -//默认内置方法。 -var layer = { - v: '3.1.1', - i18n: { // ThinkGem 国际化支持 - btnOk: '确定', - btnCancel: '取消', - title: '信息', - promptTipA: '最多输入', - promptTipB: '个字符', - noPicture: '没有图片', - photoError: '当前图片地址异常
    是否继续查看下一张?', - photoNextPage: '下一张', - photoClose: '不看了' - }, - ie: function(){ //ie版本 - var agent = navigator.userAgent.toLowerCase(); - return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( - (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 - ) : false; - }(), - index: (window.layer && window.layer.v) ? 100000 : 0, - path: ready.getPath, - config: function(options, fn){ - options = options || {}; - layer.cache = ready.config = $.extend({}, ready.config, options); - layer.path = ready.config.path || layer.path; - typeof options.extend === 'string' && (options.extend = [options.extend]); - - if(ready.config.path) layer.ready(); - - if(!options.extend) return this; - - isLayui - ? layui.addcss('modules/layer/' + options.extend) - : ready.link('skin/' + options.extend); - - return this; - }, - - //主体CSS等待事件 - ready: function(callback){ - var cssname = 'layer', ver = '' - ,path = (isLayui ? 'modules/layer/' : 'skin/') + 'default/layer.css?v='+ layer.v + ver; - isLayui ? layui.addcss(path, callback, cssname) : ready.link(path, callback, cssname); - return this; - }, - - //各种快捷引用 - alert: function(content, options, yes){ - var type = typeof options === 'function'; - if(type) yes = options; - return layer.open($.extend({ - content: content, - yes: yes - }, type ? {} : options)); - }, - - confirm: function(content, options, yes, cancel){ - var type = typeof options === 'function'; - if(type){ - cancel = yes; - yes = options; - } - return layer.open($.extend({ - content: content, - //btn: ready.btn, - btn: [layer.i18n.btnOk, layer.i18n.btnCancel], - yes: yes, - btn2: cancel - }, type ? {} : options)); - }, - - //最常用提示层 - msg: function(content, options, end){ - var type = typeof options === 'function', rskin = ready.config.skin; - var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg'; - options = options || {}; - skin = skin + ' ' + (options.positionClass || ''); - var anim = doms.anim.length - 1; - if(type) end = options; - return layer.open($.extend({ - content: content, - time: 3000, - shade: false, - skin: skin, - title: false, - closeBtn: options.time && options.time >= 5000 || false, - btn: false, - resize: false, - end: end - }, (type && !ready.config.skin) ? { - skin: skin + ' layui-layer-hui', - anim: anim - } : function(){ - options = options || {}; - if(options.icon === -1 || options.icon === undefined && !ready.config.skin){ - options.skin = skin + ' ' + (options.skin||'layui-layer-hui'); - } - return options; - }())); - }, - - load: function(icon, options){ - return layer.open($.extend({ - type: 3, - icon: icon || 0, - resize: false, - shade: 0.01 - }, options)); - }, - - tips: function(content, follow, options){ - return layer.open($.extend({ - type: 4, - content: [content, follow], - closeBtn: false, - time: 3000, - shade: false, - resize: false, - fixed: false, - maxWidth: 210 - }, options)); - } -}; - -var Class = function(setings){ - var that = this; - that.index = ++layer.index; - that.config = $.extend({}, that.config, ready.config, setings); - document.body ? that.creat() : setTimeout(function(){ - that.creat(); - }, 30); -}; - -Class.pt = Class.prototype; - -//缓存常用字符 -var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close']; -doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06']; - -//默认配置 -Class.pt.config = { - type: 0, - shade: 0.3, - fixed: true, - move: doms[1], - title: function(){return layer.i18n.title}, - offset: 'auto', - area: 'auto', - closeBtn: 1, - time: 0, //0表示不自动关闭 - zIndex: 19891014, - maxWidth: 360, - anim: 0, - isOutAnim: true, - icon: -1, - moveType: 1, - resize: true, - scrollbar: true, //是否允许浏览器滚动条 - tips: 2 -}; - -//容器 -Class.pt.vessel = function(conType, callback){ - var that = this, times = that.index, config = that.config; - var zIndex = config.zIndex + times, titype = typeof config.title === 'object'; - var ismax = config.maxmin && (config.type === 1 || config.type === 2); - var titleHTML = (config.title ? '
    ' - + (titype ? config.title[0] : (typeof config.title === 'function' ? config.title() : config.title)) - + '
    ' : ''); - - config.zIndex = zIndex; - callback([ - //遮罩 - config.shade ? ('
    ') : '', - - //主体 - '
    ' - + (conType && config.type != 2 ? '' : titleHTML) - + '
    ' - + (config.type == 0 && config.icon !== -1 ? '' : '') - + (config.type == 1 && conType ? '' : (config.content||'')) - + '
    ' - + ''+ function(){ - var closebtn = ismax && config.title ? '' : ''; // ThinkGem 必须有标题的清空下才能最小化 - closebtn += ismax ? '' : ''; - config.closeBtn && (closebtn += ''); - return closebtn; - }() + '' - + (config.btn ? function(){ - var button = ''; - typeof config.btn === 'string' && (config.btn = [config.btn]); - for(var i = 0, len = config.btn.length; i < len; i++){ - button += ''+ config.btn[i] +'' - } - return '
    '+ button +'
    ' - }() : '') - + (config.resize ? '' : '') - + '
    ' - ], titleHTML, $('
    ')); - return that; -}; - -//创建骨架 -Class.pt.creat = function(){ - var that = this - ,config = that.config - ,times = that.index, nodeIndex - ,content = config.content - ,conType = typeof content === 'object' - ,body = $('body'); - - if(config.id && $('#'+config.id)[0]) return; - - if(typeof config.area === 'string'){ - config.area = config.area === 'auto' ? ['', ''] : [config.area, '']; - } - - //anim兼容旧版shift - if(config.shift){ - config.anim = config.shift; - } - - if(layer.ie == 6){ - config.fixed = false; - } - - switch(config.type){ - case 0: - //config.btn = ('btn' in config) ? config.btn : ready.btn[0]; ThinkGem - config.btn = ('btn' in config) ? config.btn : layer.i18n.btnOk;// ThinkGem - layer.closeAll('dialog'); - break; - case 2: - var content = config.content = conType ? config.content : [config.content, 'auto']; -// config.content = ''; - // 2017-5-13 ThinkGem 支持post方式提交iframe - config.content = '
    '; - break; - case 3: - delete config.title; - delete config.closeBtn; - config.icon === -1 && (config.icon === 0); - layer.closeAll('loading'); - break; - case 4: - conType || (config.content = [config.content, 'body']); - config.follow = config.content[1]; - config.content = config.content[0] + ''; - delete config.title; - config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true]; - config.tipsMore || layer.closeAll('tips'); - break; - } - - //建立容器 - that.vessel(conType, function(html, titleHTML, moveElem){ - body.append(html[0]); - conType ? function(){ - (config.type == 2 || config.type == 4) ? function(){ - $('body').append(html[1]); - }() : function(){ - if(!content.parents('.'+doms[0])[0]){ - content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]); - $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML); - } - }(); - }() : body.append(html[1]); - $('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem); - that.layero = $('#'+ doms[0] + times); - config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times); - }).auto(times); - - //遮罩 - $('#layui-layer-shade'+ that.index).css({ - 'background-color': config.shade[1] || '#000' - ,'opacity': config.shade[0]||config.shade - }); - - //config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]); // ThinkGem 不需要ie6 - - // 2017-5-13 ThinkGem 支持post方式提交iframe - if (config.type == 2){ - if (config.method == 'GET' || config.method == 'get'){ - var iframeSrc = content[0] || '', formData = config.contentFormData; - for(var key in formData || {}){ - iframeSrc += iframeSrc.indexOf('?') == -1 ? '?' : '&'; - iframeSrc += key + '=' + formData[key]; - } - that.layero.find('#' + doms[4] + times).attr('src', iframeSrc); - }else{ - var form = that.layero.find('#' + doms[4] + '-form' + times), formData = config.contentFormData; - for(var key in formData || {}){ - form.append(''); - } - form.submit(); - } - } - //坐标自适应浏览器窗口尺寸 - config.type == 4 ? that.tips() : that.offset(); - if(config.fixed){ - win.on('resize', function(){ - that.offset(); - (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times); - config.type == 4 && that.tips(); - }); - } - - config.time <= 0 || setTimeout(function(){ - layer.close(that.index) - }, config.time); - that.move().callback(); - - //为兼容jQuery3.0的css动画影响元素尺寸计算 - if(doms.anim[config.anim]){ - var animClass = 'layer-anim '+ doms.anim[config.anim]; - that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ - $(this).removeClass(animClass); - }); - }; - - //记录关闭动画 - if(config.isOutAnim){ - that.layero.data('isOutAnim', true); - } -}; - -//自适应 -Class.pt.auto = function(index){ - var that = this, config = that.config, layero = $('#'+ doms[0] + index); - - if(config.area[0] === '' && config.maxWidth > 0){ - //为了修复IE7下一个让人难以理解的bug - if(layer.ie && layer.ie < 8 && config.btn){ - layero.width(layero.innerWidth()); - } - layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth); - } - - var area = [layero.innerWidth(), layero.innerHeight()] - ,titHeight = layero.find(doms[1]).outerHeight() || 0 - ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 - ,setHeight = function(elem){ - elem = layero.find(elem); - elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0)); - }; - - switch(config.type){ - case 2: - setHeight('iframe'); - break; - default: - if(config.area[1] === ''){ - if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){ - area[1] = config.maxHeight; - setHeight('.'+doms[5]); - } else if(config.fixed && area[1] >= win.height()){ - area[1] = win.height(); - setHeight('.'+doms[5]); - } - } else { - setHeight('.'+doms[5]); - } - break; - }; - - return that; -}; - -//计算坐标 -Class.pt.offset = function(){ - var that = this, config = that.config, layero = that.layero; - var area = [layero.outerWidth(), layero.outerHeight()]; - var type = typeof config.offset === 'object'; - that.offsetTop = (win.height() - area[1])/2; - that.offsetLeft = (win.width() - area[0])/2; - - if(type){ - that.offsetTop = config.offset[0]; - that.offsetLeft = config.offset[1]||that.offsetLeft; - } else if(config.offset !== 'auto'){ - - if(config.offset === 't'){ //上 - that.offsetTop = 0; - } else if(config.offset === 'r'){ //右 - that.offsetLeft = win.width() - area[0]; - } else if(config.offset === 'b'){ //下 - that.offsetTop = win.height() - area[1]; - } else if(config.offset === 'l'){ //左 - that.offsetLeft = 0; - } else if(config.offset === 'lt'){ //左上角 - that.offsetTop = 0; - that.offsetLeft = 0; - } else if(config.offset === 'lb'){ //左下角 - that.offsetTop = win.height() - area[1]; - that.offsetLeft = 0; - } else if(config.offset === 'rt'){ //右上角 - that.offsetTop = 0; - that.offsetLeft = win.width() - area[0]; - } else if(config.offset === 'rb'){ //右下角 - that.offsetTop = win.height() - area[1]; - that.offsetLeft = win.width() - area[0]; - } else { - that.offsetTop = config.offset; - } - - } - - if(!config.fixed){ - that.offsetTop = /%$/.test(that.offsetTop) ? - win.height()*parseFloat(that.offsetTop)/100 - : parseFloat(that.offsetTop); - that.offsetLeft = /%$/.test(that.offsetLeft) ? - win.width()*parseFloat(that.offsetLeft)/100 - : parseFloat(that.offsetLeft); - that.offsetTop += win.scrollTop(); - that.offsetLeft += win.scrollLeft(); - } - - if(layero.attr('minLeft')){ - that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0); - that.offsetLeft = layero.css('left'); - } - - that.offsetTop = that.offsetTop > 0 ? that.offsetTop : 0; // 2017-5-8 ThinkGem Top值不小于0 - - layero.css({top: that.offsetTop, left: that.offsetLeft}); -}; - -//Tips -Class.pt.tips = function(){ - var that = this, config = that.config, layero = that.layero; - var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow); - if(!follow[0]) follow = $('body'); - var goal = { - width: follow.outerWidth(), - height: follow.outerHeight(), - top: follow.offset().top, - left: follow.offset().left - }, tipsG = layero.find('.layui-layer-TipsG'); - - var guide = config.tips[0]; - config.tips[1] || tipsG.remove(); - - goal.autoLeft = function(){ - if(goal.left + layArea[0] - win.width() > 0){ - goal.tipLeft = goal.left + goal.width - layArea[0]; - tipsG.css({right: 12, left: 'auto'}); - } else { - goal.tipLeft = goal.left; - }; - }; - - //辨别tips的方位 - goal.where = [function(){ //上 - goal.autoLeft(); - goal.tipTop = goal.top - layArea[1] - 10; - tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); - }, function(){ //右 - goal.tipLeft = goal.left + goal.width + 10; - goal.tipTop = goal.top; - tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); - }, function(){ //下 - goal.autoLeft(); - goal.tipTop = goal.top + goal.height + 10; - tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]); - }, function(){ //左 - goal.tipLeft = goal.left - layArea[0] - 10; - goal.tipTop = goal.top; - tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); - }]; - goal.where[guide-1](); - - /* 8*2为小三角形占据的空间 */ - if(guide === 1){ - goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2](); - } else if(guide === 2){ - win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]() - } else if(guide === 3){ - (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0](); - } else if(guide === 4){ - layArea[0] + 8*2 - goal.left > 0 && goal.where[1]() - } - - layero.find('.'+doms[5]).css({ - 'background-color': config.tips[1], - 'padding-right': (config.closeBtn ? '30px' : '') - }); - layero.css({ - left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), - top: goal.tipTop - (config.fixed ? win.scrollTop() : 0) - }); -} - -//拖拽层 -Class.pt.move = function(){ - var that = this - ,config = that.config - ,_DOC = $(document) - ,layero = that.layero - ,moveElem = layero.find(config.move) - ,resizeElem = layero.find('.layui-layer-resize') - ,dict = {}; - - if(config.move){ - moveElem.css('cursor', 'move'); - } - - moveElem.on('mousedown', function(e){ - e.preventDefault(); - if(config.move){ - dict.moveStart = true; - dict.offset = [ - e.clientX - parseFloat(layero.css('left')) - ,e.clientY - parseFloat(layero.css('top')) - ]; - ready.moveElem.css('cursor', 'move').show(); - } - }); - - resizeElem.on('mousedown', function(e){ - e.preventDefault(); - dict.resizeStart = true; - dict.offset = [e.clientX, e.clientY]; - dict.area = [ - layero.outerWidth() - ,layero.outerHeight() - ]; - ready.moveElem.css('cursor', 'se-resize').show(); - }); - - _DOC.on('mousemove', function(e){ - - //拖拽移动 - if(dict.moveStart){ - var X = e.clientX - dict.offset[0] - ,Y = e.clientY - dict.offset[1] - ,fixed = layero.css('position') === 'fixed'; - - e.preventDefault(); - - dict.stX = fixed ? 0 : win.scrollLeft(); - dict.stY = fixed ? 0 : win.scrollTop(); - - //控制元素不被拖出窗口外 - if(!config.moveOut){ - var setRig = win.width() - layero.outerWidth() + dict.stX - ,setBot = win.height() - layero.outerHeight() + dict.stY; - X < dict.stX && (X = dict.stX); - X > setRig && (X = setRig); - Y < dict.stY && (Y = dict.stY); - Y > setBot && (Y = setBot); - } - - layero.css({ - left: X - ,top: Y - }); - } - - //Resize - if(config.resize && dict.resizeStart){ - var X = e.clientX - dict.offset[0] - ,Y = e.clientY - dict.offset[1]; - - e.preventDefault(); - - layer.style(that.index, { - width: dict.area[0] + X - ,height: dict.area[1] + Y - }) - dict.isResize = true; - config.resizing && config.resizing(layero); - } - }).on('mouseup', function(e){ - if(dict.moveStart){ - delete dict.moveStart; - ready.moveElem.hide(); - config.moveEnd && config.moveEnd(layero); - } - if(dict.resizeStart){ - delete dict.resizeStart; - ready.moveElem.hide(); - } - }); - - return that; -}; - -Class.pt.callback = function(){ - var that = this, layero = that.layero, config = that.config; - that.openLayer(); - if(config.success){ - if(config.type == 2){ - layero.find('iframe').on('load', function(){ - config.success(layero, that.index); - }); - } else { - config.success(layero, that.index); - } - } - layer.ie == 6 && that.IE6(layero); - - //按钮 - layero.find('.'+ doms[6]).children('a').on('click', function(){ - var index = $(this).index(); - if(index === 0){ - if(config.yes){ - var close = config.yes(that.index, layero); - close === false || layer.close(that.index); // 2017-3-31 ThinkGem 添加返回值如果是false则关闭窗口 - } else if(config['btn1']){ - var close = config['btn1'](that.index, layero); - close === false || layer.close(that.index); // 2017-3-31 ThinkGem 添加返回值如果是false则关闭窗口 - } else { - layer.close(that.index); - } - } else { - var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero); - close === false || layer.close(that.index); - } - }); - - //取消 - function cancel(){ - var close = config.cancel && config.cancel(that.index, layero); - close === false || layer.close(that.index); - } - - //右上角关闭回调 - layero.find('.'+ doms[7]).on('click', cancel); - - //点遮罩关闭 - if(config.shadeClose || config.shadeClose == undefined){ - $('#layui-layer-shade'+ that.index).on('click', function(){ - layer.close(that.index); - }); - } - - //最小化 - layero.find('.layui-layer-min').on('click', function(){ - var min = config.min && config.min(layero); - min === false || layer.min(that.index, config); - }); - - //全屏/还原 - layero.find('.layui-layer-max').on('click', function(){ - if($(this).hasClass('layui-layer-maxmin')){ - layer.restore(that.index); - config.restore && config.restore(layero); - } else { - layer.full(that.index, config); - setTimeout(function(){ - config.full && config.full(layero); - }, 100); - } - }); - - config.end && (ready.end[that.index] = config.end); -}; - -//for ie6 恢复select -ready.reselect = function(){ - $.each($('select'), function(index , value){ - var sthis = $(this); - if(!sthis.parents('.'+doms[0])[0]){ - (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); - } - sthis = null; - }); -}; - -Class.pt.IE6 = function(layero){ - //隐藏select - $('select').each(function(index , value){ - var sthis = $(this); - if(!sthis.parents('.'+doms[0])[0]){ - sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide(); - } - sthis = null; - }); -}; - -//需依赖原型的对外方法 -Class.pt.openLayer = function(){ - var that = this; - - //置顶当前窗口 - layer.zIndex = that.config.zIndex; - layer.setTop = function(layero){ - var setZindex = function(){ - layer.zIndex++; - layero.css('z-index', layer.zIndex + 1); - }; - layer.zIndex = parseInt(layero[0].style.zIndex); - layero.on('mousedown', setZindex); - return layer.zIndex; - }; -}; - -ready.record = function(layero){ - var area = [ - layero.width(), - layero.height(), - layero.position().top, - layero.position().left + parseFloat(layero.css('margin-left')) - ]; - layero.find('.layui-layer-max').addClass('layui-layer-maxmin'); - layero.attr({area: area}); -}; - -ready.rescollbar = function(index){ - if(doms.html.attr('layer-full') == index){ - if(doms.html[0].style.removeProperty){ - doms.html[0].style.removeProperty('overflow'); - } else { - doms.html[0].style.removeAttribute('overflow'); - } - doms.html.removeAttr('layer-full'); - } -}; - -/** 内置成员 */ - -window.layer = layer; - -//获取当前对话框所在窗口的jQuery对象和Window对象 ThinkGem -layer.$ = layer.jQuery = jQuery; -layer.window = window; - -//获取子iframe的DOM -layer.getChildFrame = function(selector, index){ - index = index || $('.'+doms[4]).attr('times'); - return $('#'+ doms[0] + index).find('iframe').contents().find(selector); -}; - -//得到当前iframe层的索引,子iframe时使用 -layer.getFrameIndex = function(name){ - return $('#'+ name).parents('.'+doms[4]).attr('times'); -}; - -//iframe层自适应宽高(diffVal差值范围内,进行自适应高度) -layer.iframeAuto = function(index, diffVal, $this){ - if(!index){ - return; - } - var iframe = document.getElementById(doms[4] + index); - if (iframe) { - var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; - if (iframeWin.document.body) { - var layero = $('#'+ doms[0] + index); - var titHeight = layero.find(doms[1]).outerHeight() || 0; - var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; -// var heg = layer.getChildFrame('html', index).outerHeight(); - var heg = iframeWin.document.body.scrollHeight; - var layerHeight = heg + titHeight + btnHeight; - var layerTop = ($(window).height() - layerHeight) / 2; - if (layerTop > 0){ - var $iframe = layero.find('iframe'); - if (Math.abs($iframe.height() - heg) < (diffVal || 9000)){ - layero.animate({height: layerHeight, top: layerTop}, 20); - $iframe.animate({height: heg}, 20); - } - } - } - } -}; - -//重置iframe url -layer.iframeSrc = function(index, url){ - $('#'+ doms[0] + index).find('iframe').attr('src', url); -}; - -//返回当前layer的iframe对象的window对象 ThinkGem -layer.iframeWindow = function(index){ - var ifr = $('#'+ doms[0] + index).find('iframe'); - if (ifr.length > 0){ - return ifr[0].contentWindow; - } - // 取不到iframe返回null - return null; -}; - -//设定层的样式 -layer.style = function(index, options, limit){ - var layero = $('#'+ doms[0] + index) - ,contElem = layero.find('.layui-layer-content') - ,type = layero.attr('type') - ,titHeight = layero.find(doms[1]).outerHeight() || 0 - ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 - ,minLeft = layero.attr('minLeft'); - - if(type === ready.type[3] || type === ready.type[4]){ - return; - } - - if(!limit){ - if(parseFloat(options.width) <= 260){ - options.width = 260; - }; - - if(parseFloat(options.height) - titHeight - btnHeight <= 64){ - options.height = 64 + titHeight + btnHeight; - }; - } - - layero.css(options); -// btnHeight = layero.find('.'+doms[6]).outerHeight(); - btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; // ThinkGem 兼容 jQuery 3.5 - - if(type === ready.type[2]){ - layero.find('iframe').css({ - height: parseFloat(options.height) - titHeight - btnHeight - }); - } else { - contElem.css({ - height: parseFloat(options.height) - titHeight - btnHeight - - parseFloat(contElem.css('padding-top')) - - parseFloat(contElem.css('padding-bottom')) - }) - } -}; - -//最小化 -layer.min = function(index, options){ - var layero = $('#'+ doms[0] + index) - ,titHeight = layero.find(doms[1]).outerHeight() || 0 - ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' - ,position = layero.css('position'); - - ready.record(layero); - - if(ready.minLeft[0]){ - left = ready.minLeft[0]; - ready.minLeft.shift(); - } - - layero.attr('position', position); - - layer.style(index, { - width: 180 - ,height: titHeight - ,left: left - ,top: win.height() - titHeight - ,position: 'fixed' - ,overflow: 'hidden' - }, true); - - layero.find('.layui-layer-min').hide(); - layero.attr('type') === 'page' && layero.find(doms[4]).hide(); - ready.rescollbar(index); - - if(!layero.attr('minLeft')){ - ready.minIndex++; - } - layero.attr('minLeft', left); -}; - -//还原 -layer.restore = function(index){ - var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(','); - var type = layero.attr('type'); - layer.style(index, { - width: parseFloat(area[0]), - height: parseFloat(area[1]), - top: parseFloat(area[2]), - left: parseFloat(area[3]), - position: layero.attr('position'), - overflow: 'visible' - }, true); - layero.find('.layui-layer-max').removeClass('layui-layer-maxmin'); - layero.find('.layui-layer-min').show(); - layero.attr('type') === 'page' && layero.find(doms[4]).show(); - ready.rescollbar(index); -}; - -//全屏 -layer.full = function(index){ - var layero = $('#'+ doms[0] + index), timer; - ready.record(layero); - if(!doms.html.attr('layer-full')){ - doms.html.css('overflow','hidden').attr('layer-full', index); - } - clearTimeout(timer); - timer = setTimeout(function(){ - var isfix = layero.css('position') === 'fixed'; - layer.style(index, { - top: isfix ? 0 : win.scrollTop(), - left: isfix ? 0 : win.scrollLeft(), - width: win.width(), - height: win.height() - }, true); - layero.find('.layui-layer-min').hide(); - }, 100); -}; - -//改变title -layer.title = function(name, index){ - var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]); - title.html(name); -}; - -//关闭layer总方法 -layer.close = function(index){ - var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close'; - if(!layero[0]) return; - var WRAP = 'layui-layer-wrap', remove = function(){ - if(type === ready.type[1] && layero.attr('conType') === 'object'){ - layero.children(':not(.'+ doms[5] +')').remove(); - var wrap = layero.find('.'+WRAP); - for(var i = 0; i < 2; i++){ - wrap.unwrap(); - } - wrap.css('display', wrap.data('display')).removeClass(WRAP); - } else { - //低版本IE 回收 iframe - if(type === ready.type[2]){ - try { - var iframe = $('#'+doms[4]+index)[0]; - iframe.contentWindow.document.write(''); - iframe.contentWindow.close(); - layero.find('.'+doms[5])[0].removeChild(iframe); - } catch(e){} - } - layero[0].innerHTML = ''; - layero.remove(); - } - typeof ready.end[index] === 'function' && ready.end[index](); - delete ready.end[index]; - }; - - if(layero.data('isOutAnim')){ - layero.addClass('layer-anim '+ closeAnim); - } - - $('#layui-layer-moves, #layui-layer-shade' + index).remove(); - layer.ie == 6 && ready.reselect(); - ready.rescollbar(index); - if(layero.attr('minLeft')){ - ready.minIndex--; - ready.minLeft.push(layero.attr('minLeft')); - } - - if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){ - remove() - } else { - setTimeout(function(){ - remove(); - }, 200); - } -}; - -//关闭所有层 -layer.closeAll = function(type){ - $.each($('.'+doms[0]), function(){ - var othis = $(this); - var is = type ? (othis.attr('type') === type) : 1; - is && layer.close(othis.attr('times')); - is = null; - }); -}; - -/** - 拓展模块,layui开始合并在一起 - */ - -var cache = layer.cache||{}, skin = function(type){ - return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : ''); -}; - -//仿系统prompt -layer.prompt = function(options, yes){ - var style = ''; - options = options || {}; - - if(typeof options === 'function') yes = options; - - if(options.area){ - var area = options.area; - style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; - delete options.area; - } - var prompt, content = options.formType == 2 ? '' : function(){ - return ''; - }(); - - var success = options.success; - delete options.success; - - return layer.open($.extend({ - type: 1 - ,btn: [layer.i18n.btnOk,layer.i18n.btnCancel] - ,content: content - ,skin: 'layui-layer-prompt' + skin('prompt') - ,maxWidth: win.width() - ,success: function(layero){ - prompt = layero.find('.layui-layer-input'); - prompt.focus(); - typeof success === 'function' && success(layero); - } - ,resize: false - ,yes: function(index){ - var value = prompt.val(); - if(value === ''){ - prompt.focus(); - } else if(value.length > (options.maxlength||500)) { - layer.tips(layer.i18n.promptTipA + (options.maxlength || 500) + layer.i18n.promptTipB, prompt, {tips: 1}); - } else { - yes && yes(value, index, prompt); - } - } - }, options)); -}; - -//tab层 -layer.tab = function(options){ - options = options || {}; - - var tab = options.tab || {} - ,THIS = 'layui-this' - ,success = options.success; - - delete options.success; - - return layer.open($.extend({ - type: 1, - skin: 'layui-layer-tab' + skin('tab'), - resize: false, - title: function(){ - var len = tab.length, ii = 1, str = ''; - if(len > 0){ - str = ''+ tab[0].title +''; - for(; ii < len; ii++){ - str += ''+ tab[ii].title +''; - } - } - return str; - }(), - content: '', - success: function(layero){ - var btn = layero.find('.layui-layer-title').children(); - var main = layero.find('.layui-layer-tabmain').children(); - btn.on('mousedown', function(e){ - e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; - var othis = $(this), index = othis.index(); - othis.addClass(THIS).siblings().removeClass(THIS); - main.eq(index).show().siblings().hide(); - typeof options.change === 'function' && options.change(index); - }); - typeof success === 'function' && success(layero); - } - }, options)); -}; - -//相册层 -layer.photos = function(options, loop, key){ - var dict = {}; - options = options || {}; - if(!options.photos) return; - var type = options.photos.constructor === Object; - var photos = type ? options.photos : {}, data = photos.data || []; - var start = photos.start || 0; - dict.imgIndex = (start|0) + 1; - - options.img = options.img || 'img'; - - var success = options.success; - delete options.success; - - if(!type){ //页面直接获取 - var parent = $(options.photos), pushData = function(){ - data = []; - parent.find(options.img).each(function(index){ - var othis = $(this); - othis.attr('layer-index', index); - data.push({ - alt: othis.attr('alt'), - pid: othis.attr('layer-pid'), - src: othis.attr('layer-src') || othis.attr('src'), - thumb: othis.attr('src') - }); - }) - }; - - pushData(); - - if (data.length === 0) return; - - loop || parent.on('click', options.img, function(){ - var othis = $(this), index = othis.attr('layer-index'); - layer.photos($.extend(options, { - photos: { - start: index, - data: data, - tab: options.tab - }, - full: options.full - }), true); - pushData(); - }) - - //不直接弹出 - if(!loop) return; - - } else if (data.length === 0){ - return layer.msg(layer.i18n.noPicture); - } - - //上一张 - dict.imgprev = function(key){ - dict.imgIndex--; - if(dict.imgIndex < 1){ - dict.imgIndex = data.length; - } - dict.tabimg(key); - }; - - //下一张 - dict.imgnext = function(key,errorMsg){ - dict.imgIndex++; - if(dict.imgIndex > data.length){ - dict.imgIndex = 1; - if (errorMsg) {return}; - } - dict.tabimg(key) - }; - - //方向键 - dict.keyup = function(event){ - if(!dict.end){ - var code = event.keyCode; - event.preventDefault(); - if(code === 37){ - dict.imgprev(true); - } else if(code === 39) { - dict.imgnext(true); - } else if(code === 27) { - layer.close(dict.index); - } - } - } - - //切换 - dict.tabimg = function(key){ - if(data.length <= 1) return; - photos.start = dict.imgIndex - 1; - layer.close(dict.index); - return layer.photos(options, true, key); - setTimeout(function(){ - layer.photos(options, true, key); - }, 200); - } - - //一些动作 - dict.event = function(){ - dict.bigimg.hover(function(){ - dict.imgsee.show(); - }, function(){ - dict.imgsee.hide(); - }); - - dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ - event.preventDefault(); - dict.imgprev(); - }); - - dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ - event.preventDefault(); - dict.imgnext(); - }); - - $(document).on('keyup', dict.keyup); - }; - - //图片预加载 - function loadImage(url, callback, error) { - var img = new Image(); - img.src = url; - if(img.complete){ - return callback(img); - } - img.onload = function(){ - img.onload = null; - callback(img); - }; - img.onerror = function(e){ - img.onerror = null; - error(e); - }; - }; - - dict.loadi = layer.load(1, { - shade: 'shade' in options ? false : 0.9, - scrollbar: false - }); - - loadImage(data[start].src, function(img){ - layer.close(dict.loadi); - dict.index = layer.open($.extend({ - type: 1, - id: 'layui-layer-photos', - area: function(){ - var imgarea = [img.width, img.height]; - var winarea = [$(window).width() - 100, $(window).height() - 100]; - - //如果 实际图片的宽或者高比 屏幕大(那么进行缩放) - if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){ - var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例 - if(wh[0] > wh[1]){//取缩放比例最大的进行缩放 - imgarea[0] = imgarea[0]/wh[0]; - imgarea[1] = imgarea[1]/wh[0]; - } else if(wh[0] < wh[1]){ - imgarea[0] = imgarea[0]/wh[1]; - imgarea[1] = imgarea[1]/wh[1]; - } - } - - return [imgarea[0]+'px', imgarea[1]+'px']; - }(), - title: false, - shade: 0.9, - shadeClose: true, - closeBtn: false, - move: '.layui-layer-phimg img', - moveType: 1, - scrollbar: false, - moveOut: true, - //anim: Math.random()*5|0, - isOutAnim: false, - skin: 'layui-layer-photos' + skin('photos'), - content: '
    ' - +''+ (data[start].alt||'') +'' - +'
    ' - +(data.length > 1 ? '' : '') - +'
    '+ (data[start].alt||'') +''+ dict.imgIndex +'/'+ data.length +'
    ' - +'
    ' - +'
    ', - success: function(layero, index){ - dict.bigimg = layero.find('.layui-layer-phimg'); - dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar'); - dict.event(layero); - options.tab && options.tab(data[start], layero); - typeof success === 'function' && success(layero); - }, end: function(){ - dict.end = true; - $(document).off('keyup', dict.keyup); - } - }, options)); - }, function(){ - layer.close(dict.loadi); - layer.msg(layer.i18n.photoError, { - time: 30000, - btn: [layer.i18n.photoNextPage, layer.i18n.photoClose], - yes: function(){ - data.length > 1 && dict.imgnext(true,true); - } - }); - }); -}; - -//主入口 -ready.run = function(_$){ - $ = _$; - win = $(window); - doms.html = $('html'); - layer.open = function(deliver){ - var o = new Class(deliver); - return o.index; - }; -}; - -//加载方式 -window.layui && layui.define ? ( - layer.ready() - ,layui.define('jquery', function(exports){ //layui加载 - layer.path = layui.cache.dir; - ready.run(layui.$); - - //暴露模块 - window.layer = layer; - exports('layer', layer); - }) -) : ( - (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载 - ready.run(window.jQuery); - return layer; - }) : function(){ //普通script标签加载 - ready.run(window.jQuery); - layer.ready(); - }() -); - -}(window); \ No newline at end of file + +/*! + * layer 3.5.1 通用 Web 弹出层组件 + * MIT Licensed + */ + +;!function(window, undefined){ +"use strict"; + +var isLayui = window.layui && layui.define, $, win, ready = { + getPath: function(){ + var jsPath = document.currentScript ? document.currentScript.src : function(){ + var js = document.scripts + ,last = js.length - 1 + ,src; + for(var i = last; i > 0; i--){ + if(js[i].readyState === 'interactive'){ + src = js[i].src; + break; + } + } + return src || js[last].src; + }() + ,GLOBAL = window.LAYUI_GLOBAL || {}; + return GLOBAL.layer_dir || jsPath.substring(0, jsPath.lastIndexOf('/') + 1); + }(), + + config: {}, end: {}, minIndex: 0, minLeft: [], + //btn: [layer.i18n.btnOk, layer.i18n.btnCancel], // ThinkGem + + //五种原始层模式 + type: ['dialog', 'page', 'iframe', 'loading', 'tips'], + + //获取节点的style属性值 + getStyle: function(node, name){ + var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null); + return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name); + }, + + //载入 CSS 依赖 + link: function(href, fn, cssname){ + //未设置路径,则不主动加载css + if(!layer.path) return; + + var head = document.getElementsByTagName("head")[0] + ,link = document.createElement('link'); + + if(typeof fn === 'string') cssname = fn; + + var app = (cssname || href).replace(/\.|\//g, ''); + var id = 'layuicss-'+ app + ,STAUTS_NAME = 'creating' + ,timeout = 0; + + link.rel = 'stylesheet'; + link.href = layer.path + href; + link.id = id; + + if(!document.getElementById(id)){ + head.appendChild(link); + } + + if(typeof fn !== 'function') return; + + //轮询 css 是否加载完毕 + (function poll(status) { + var delay = 100 + ,getLinkElem = document.getElementById(id); //获取动态插入的 link 元素 + + //如果轮询超过指定秒数,则视为请求文件失败或 css 文件不符合规范 + if(++timeout > 10 * 1000 / delay){ + return window.console && console.error(app +'.css: Invalid'); + }; + + //css 加载就绪 + if(parseInt(ready.getStyle(getLinkElem, 'width')) === 1989){ + //如果参数来自于初始轮询(即未加载就绪时的),则移除 link 标签状态 + if(status === STAUTS_NAME) getLinkElem.removeAttribute('lay-status'); + //如果 link 标签的状态仍为「创建中」,则继续进入轮询,直到状态改变,则执行回调 + getLinkElem.getAttribute('lay-status') === STAUTS_NAME ? setTimeout(poll, delay) : fn(); + } else { + getLinkElem.setAttribute('lay-status', STAUTS_NAME); + setTimeout(function(){ + poll(STAUTS_NAME); + }, delay); + } + + //parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 1000); + }()); + + } +}; + +//默认内置方法。 +var layer = { + v: '3.5.1', + i18n: { // ThinkGem 国际化支持 + btnOk: '确定', + btnCancel: '取消', + title: '信息', + promptTipA: '最多输入', + promptTipB: '个字符', + noPicture: '没有图片', + photoError: '当前图片地址异常
    是否继续查看下一张?', + photoNextPage: '下一张', + photoClose: '不看了' + }, + ie: function(){ //ie版本 + var agent = navigator.userAgent.toLowerCase(); + return (!!window.ActiveXObject || "ActiveXObject" in window) ? ( + (agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识 + ) : false; + }(), + index: (window.layer && window.layer.v) ? 100000 : 0, + path: ready.getPath, + config: function(options, fn){ + options = options || {}; + layer.cache = ready.config = $.extend({}, ready.config, options); + layer.path = ready.config.path || layer.path; + typeof options.extend === 'string' && (options.extend = [options.extend]); + + //如果设置了路径,则加载样式 + if(ready.config.path) layer.ready(); + + if(!options.extend) return this; + + isLayui + ? layui.addcss('modules/layer/' + options.extend) + : ready.link('theme/' + options.extend); + + return this; + }, + + //主体CSS等待事件 + ready: function(callback){ + var cssname = 'layer', ver = '' + ,path = (isLayui ? 'modules/layer/' : 'theme/') + 'default/layer.css?v='+ layer.v + ver; + isLayui ? layui.addcss(path, callback, cssname) : ready.link(path, callback, cssname); + return this; + }, + + //各种快捷引用 + alert: function(content, options, yes){ + var type = typeof options === 'function'; + if(type) yes = options; + return layer.open($.extend({ + content: content, + yes: yes + }, type ? {} : options)); + }, + + confirm: function(content, options, yes, cancel){ + var type = typeof options === 'function'; + if(type){ + cancel = yes; + yes = options; + } + return layer.open($.extend({ + content: content, + //btn: ready.btn, + btn: [layer.i18n.btnOk, layer.i18n.btnCancel], + yes: yes, + btn2: cancel + }, type ? {} : options)); + }, + + msg: function(content, options, end){ //最常用提示层 + var type = typeof options === 'function', rskin = ready.config.skin; + var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg'; + var anim = doms.anim.length - 1; + if(type) end = options; + return layer.open($.extend({ + content: content, + time: 3000, + shade: false, + skin: skin, + title: false, + closeBtn: options.time && options.time >= 5000 || false, + btn: false, + resize: false, + end: end + }, (type && !ready.config.skin) ? { + skin: skin + ' layui-layer-hui', + anim: anim + } : function(){ + options = options || {}; + if(options.icon === -1 || options.icon === undefined && !ready.config.skin){ + options.skin = skin + ' ' + (options.skin||'layui-layer-hui'); + } + return options; + }())); + }, + + load: function(icon, options){ + return layer.open($.extend({ + type: 3, + icon: icon || 0, + resize: false, + shade: 0.01 + }, options)); + }, + + tips: function(content, follow, options){ + return layer.open($.extend({ + type: 4, + content: [content, follow], + closeBtn: false, + time: 3000, + shade: false, + resize: false, + fixed: false, + maxWidth: 260 + }, options)); + } +}; + +var Class = function(setings){ + var that = this, creat = function(){ + that.creat(); + }; + that.index = ++layer.index; + that.config.maxWidth = $(win).width() - 15*2; //初始最大宽度:当前屏幕宽,左右留 15px 边距 + that.config = $.extend({}, that.config, ready.config, setings); + document.body ? creat() : setTimeout(function(){ + creat(); + }, 30); +}; + +Class.pt = Class.prototype; + +//缓存常用字符 +var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close']; +doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06']; + +doms.SHADE = 'layui-layer-shade'; +doms.MOVE = 'layui-layer-move'; + +//默认配置 +Class.pt.config = { + type: 0, + shade: 0.3, + fixed: true, + move: doms[1], + title: function(){return layer.i18n.title}, + offset: 'auto', + area: 'auto', + closeBtn: 1, + time: 0, //0表示不自动关闭 + zIndex: 19891014, + maxWidth: 360, + anim: 0, + isOutAnim: true, //退出动画 + minStack: true, //最小化堆叠 + icon: -1, + moveType: 1, + resize: true, + scrollbar: true, //是否允许浏览器滚动条 + tips: 2 +}; + +//容器 +Class.pt.vessel = function(conType, callback){ + var that = this, times = that.index, config = that.config; + var zIndex = config.zIndex + times, titype = typeof config.title === 'object'; + var ismax = config.maxmin && (config.type === 1 || config.type === 2); + var titleHTML = (config.title ? '
    ' + + (titype ? config.title[0] : (typeof config.title === 'function' ? config.title() : config.title)) + + '
    ' : ''); + + config.zIndex = zIndex; + callback([ + //遮罩 + config.shade ? ('
    ') : '', + + //主体 + '
    ' + + (conType && config.type != 2 ? '' : titleHTML) + + '
    ' + + (config.type == 0 && config.icon !== -1 ? '' : '') + + (config.type == 1 && conType ? '' : (config.content||'')) + + '
    ' + + ''+ function(){ + var closebtn = ismax && config.title ? '' : ''; // ThinkGem 必须有标题的清空下才能最小化 + config.closeBtn && (closebtn += ''); + return closebtn; + }() + '' + + (config.btn ? function(){ + var button = ''; + typeof config.btn === 'string' && (config.btn = [config.btn]); + for(var i = 0, len = config.btn.length; i < len; i++){ + button += ''+ config.btn[i] +'' + } + return '
    '+ button +'
    ' + }() : '') + + (config.resize ? '' : '') + + '
    ' + ], titleHTML, $('
    ')); + return that; +}; + +//创建骨架 +Class.pt.creat = function(){ + var that = this + ,config = that.config + ,times = that.index, nodeIndex + ,content = config.content + ,conType = typeof content === 'object' + ,body = $('body'); + + if(config.id && $('#'+config.id)[0]) return; + + if(typeof config.area === 'string'){ + config.area = config.area === 'auto' ? ['', ''] : [config.area, '']; + } + + //anim兼容旧版shift + if(config.shift){ + config.anim = config.shift; + } + + if(layer.ie == 6){ + config.fixed = false; + } + + switch(config.type){ + case 0: + //config.btn = ('btn' in config) ? config.btn : ready.btn[0]; + config.btn = ('btn' in config) ? config.btn : layer.i18n.btnOk;// ThinkGem + layer.closeAll('dialog'); + break; + case 2: + var content = config.content = conType ? config.content : [config.content||'', 'auto']; + //config.content = ''; + // 2017-5-13 ThinkGem 支持post方式提交iframe + config.content = '
    '; + break; + case 3: + delete config.title; + delete config.closeBtn; + config.icon === -1 && (config.icon === 0); + layer.closeAll('loading'); + break; + case 4: + conType || (config.content = [config.content, 'body']); + config.follow = config.content[1]; + config.content = config.content[0] + ''; + delete config.title; + config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true]; + config.tipsMore || layer.closeAll('tips'); + break; + } + + //建立容器 + that.vessel(conType, function(html, titleHTML, moveElem){ + body.append(html[0]); + conType ? function(){ + (config.type == 2 || config.type == 4) ? function(){ + $('body').append(html[1]); + }() : function(){ + if(!content.parents('.'+doms[0])[0]){ + content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]); + $('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML); + } + }(); + }() : body.append(html[1]); + $('#'+ doms.MOVE)[0] || body.append(ready.moveElem = moveElem); + + that.layero = $('#'+ doms[0] + times); + that.shadeo = $('#'+ doms.SHADE + times); + + config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times); + }).auto(times); + + //遮罩 + that.shadeo.css({ + 'background-color': config.shade[1] || '#000' + ,'opacity': config.shade[0] || config.shade + }); + + //config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]); // ThinkGem 不需要ie6 + + // 2017-5-13 ThinkGem 支持post方式提交iframe + if (config.type == 2){ + if (config.method == 'GET' || config.method == 'get'){ + var iframeSrc = content[0] || '', formData = config.contentFormData; + for(var key in formData || {}){ + iframeSrc += iframeSrc.indexOf('?') == -1 ? '?' : '&'; + iframeSrc += key + '=' + formData[key]; + } + that.layero.find('#' + doms[4] + times).attr('src', iframeSrc); + }else{ + var form = that.layero.find('#' + doms[4] + '-form' + times), formData = config.contentFormData; + for(var key in formData || {}){ + form.append(''); + } + form.submit(); + } + } + //坐标自适应浏览器窗口尺寸 + config.type == 4 ? that.tips() : function(){ + that.offset() + //首次弹出时,若 css 尚未加载,则等待 css 加载完毕后,重新设定尺寸 + parseInt(ready.getStyle(document.getElementById(doms.MOVE), 'z-index')) || function(){ + that.layero.css('visibility', 'hidden'); + layer.ready(function(){ + that.offset(); + that.layero.css('visibility', 'visible'); + }); + }(); + }(); + + //如果是固定定位 + if(config.fixed){ + win.on('resize', function(){ + that.offset(); + (/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times); + config.type == 4 && that.tips(); + }); + } + + config.time <= 0 || setTimeout(function(){ + layer.close(that.index); + }, config.time); + that.move().callback(); + + //为兼容jQuery3.0的css动画影响元素尺寸计算 + if(doms.anim[config.anim]){ + var animClass = 'layer-anim '+ doms.anim[config.anim]; + that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ + $(this).removeClass(animClass); + }); + }; + + //记录关闭动画 + if(config.isOutAnim){ + that.layero.data('isOutAnim', true); + } +}; + +//自适应 +Class.pt.auto = function(index){ + var that = this, config = that.config, layero = $('#'+ doms[0] + index); + + if(config.area[0] === '' && config.maxWidth > 0){ + //为了修复IE7下一个让人难以理解的bug + if(layer.ie && layer.ie < 8 && config.btn){ + layero.width(layero.innerWidth()); + } + layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth); + } + + var area = [layero.innerWidth(), layero.innerHeight()] + ,titHeight = layero.find(doms[1]).outerHeight() || 0 + ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 + ,setHeight = function(elem){ + elem = layero.find(elem); + elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0)); + }; + + switch(config.type){ + case 2: + setHeight('iframe'); + break; + default: + if(config.area[1] === ''){ + if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){ + area[1] = config.maxHeight; + setHeight('.'+doms[5]); + } else if(config.fixed && area[1] >= win.height()){ + area[1] = win.height(); + setHeight('.'+doms[5]); + } + } else { + setHeight('.'+doms[5]); + } + break; + }; + + return that; +}; + +//计算坐标 +Class.pt.offset = function(){ + var that = this, config = that.config, layero = that.layero; + var area = [layero.outerWidth(), layero.outerHeight()]; + var type = typeof config.offset === 'object'; + that.offsetTop = (win.height() - area[1])/2; + that.offsetLeft = (win.width() - area[0])/2; + + if(type){ + that.offsetTop = config.offset[0]; + that.offsetLeft = config.offset[1]||that.offsetLeft; + } else if(config.offset !== 'auto'){ + + if(config.offset === 't'){ //上 + that.offsetTop = 0; + } else if(config.offset === 'r'){ //右 + that.offsetLeft = win.width() - area[0]; + } else if(config.offset === 'b'){ //下 + that.offsetTop = win.height() - area[1]; + } else if(config.offset === 'l'){ //左 + that.offsetLeft = 0; + } else if(config.offset === 'lt'){ //左上角 + that.offsetTop = 0; + that.offsetLeft = 0; + } else if(config.offset === 'lb'){ //左下角 + that.offsetTop = win.height() - area[1]; + that.offsetLeft = 0; + } else if(config.offset === 'rt'){ //右上角 + that.offsetTop = 0; + that.offsetLeft = win.width() - area[0]; + } else if(config.offset === 'rb'){ //右下角 + that.offsetTop = win.height() - area[1]; + that.offsetLeft = win.width() - area[0]; + } else { + that.offsetTop = config.offset; + } + + } + + if(!config.fixed){ + that.offsetTop = /%$/.test(that.offsetTop) ? + win.height()*parseFloat(that.offsetTop)/100 + : parseFloat(that.offsetTop); + that.offsetLeft = /%$/.test(that.offsetLeft) ? + win.width()*parseFloat(that.offsetLeft)/100 + : parseFloat(that.offsetLeft); + that.offsetTop += win.scrollTop(); + that.offsetLeft += win.scrollLeft(); + } + + if(layero.attr('minLeft')){ + that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0); + that.offsetLeft = layero.css('left'); + } + + that.offsetTop = that.offsetTop > 0 ? that.offsetTop : 0; // 2017-5-8 ThinkGem Top值不小于0 + + layero.css({top: that.offsetTop, left: that.offsetLeft}); +}; + +//Tips +Class.pt.tips = function(){ + var that = this, config = that.config, layero = that.layero; + var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow); + if(!follow[0]) follow = $('body'); + var goal = { + width: follow.outerWidth(), + height: follow.outerHeight(), + top: follow.offset().top, + left: follow.offset().left + }, tipsG = layero.find('.layui-layer-TipsG'); + + var guide = config.tips[0]; + config.tips[1] || tipsG.remove(); + + goal.autoLeft = function(){ + if(goal.left + layArea[0] - win.width() > 0){ + goal.tipLeft = goal.left + goal.width - layArea[0]; + tipsG.css({right: 12, left: 'auto'}); + } else { + goal.tipLeft = goal.left; + }; + }; + + //辨别tips的方位 + goal.where = [function(){ //上 + goal.autoLeft(); + goal.tipTop = goal.top - layArea[1] - 10; + tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]); + }, function(){ //右 + goal.tipLeft = goal.left + goal.width + 10; + goal.tipTop = goal.top; + tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]); + }, function(){ //下 + goal.autoLeft(); + goal.tipTop = goal.top + goal.height + 10; + tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]); + }, function(){ //左 + goal.tipLeft = goal.left - layArea[0] - 10; + goal.tipTop = goal.top; + tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]); + }]; + goal.where[guide-1](); + + /* 8*2为小三角形占据的空间 */ + if(guide === 1){ + goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2](); + } else if(guide === 2){ + win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]() + } else if(guide === 3){ + (goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0](); + } else if(guide === 4){ + layArea[0] + 8*2 - goal.left > 0 && goal.where[1]() + } + + layero.find('.'+doms[5]).css({ + 'background-color': config.tips[1], + 'padding-right': (config.closeBtn ? '30px' : '') + }); + layero.css({ + left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0), + top: goal.tipTop - (config.fixed ? win.scrollTop() : 0) + }); +} + +//拖拽层 +Class.pt.move = function(){ + var that = this + ,config = that.config + ,_DOC = $(document) + ,layero = that.layero + ,moveElem = layero.find(config.move) + ,resizeElem = layero.find('.layui-layer-resize') + ,dict = {}; + + if(config.move){ + moveElem.css('cursor', 'move'); + } + + moveElem.on('mousedown', function(e){ + e.preventDefault(); + if(config.move){ + dict.moveStart = true; + dict.offset = [ + e.clientX - parseFloat(layero.css('left')) + ,e.clientY - parseFloat(layero.css('top')) + ]; + ready.moveElem.css('cursor', 'move').show(); + } + }); + + resizeElem.on('mousedown', function(e){ + e.preventDefault(); + dict.resizeStart = true; + dict.offset = [e.clientX, e.clientY]; + dict.area = [ + layero.outerWidth() + ,layero.outerHeight() + ]; + ready.moveElem.css('cursor', 'se-resize').show(); + }); + + _DOC.on('mousemove', function(e){ + + //拖拽移动 + if(dict.moveStart){ + var X = e.clientX - dict.offset[0] + ,Y = e.clientY - dict.offset[1] + ,fixed = layero.css('position') === 'fixed'; + + e.preventDefault(); + + dict.stX = fixed ? 0 : win.scrollLeft(); + dict.stY = fixed ? 0 : win.scrollTop(); + + //控制元素不被拖出窗口外 + if(!config.moveOut){ + var setRig = win.width() - layero.outerWidth() + dict.stX + ,setBot = win.height() - layero.outerHeight() + dict.stY; + X < dict.stX && (X = dict.stX); + X > setRig && (X = setRig); + Y < dict.stY && (Y = dict.stY); + Y > setBot && (Y = setBot); + } + + layero.css({ + left: X + ,top: Y + }); + } + + //Resize + if(config.resize && dict.resizeStart){ + var X = e.clientX - dict.offset[0] + ,Y = e.clientY - dict.offset[1]; + + e.preventDefault(); + + layer.style(that.index, { + width: dict.area[0] + X + ,height: dict.area[1] + Y + }) + dict.isResize = true; + config.resizing && config.resizing(layero); + } + }).on('mouseup', function(e){ + if(dict.moveStart){ + delete dict.moveStart; + ready.moveElem.hide(); + config.moveEnd && config.moveEnd(layero); + } + if(dict.resizeStart){ + delete dict.resizeStart; + ready.moveElem.hide(); + } + }); + + return that; +}; + +Class.pt.callback = function(){ + var that = this, layero = that.layero, config = that.config; + that.openLayer(); + if(config.success){ + if(config.type == 2){ + layero.find('iframe').on('load', function(){ + config.success(layero, that.index); + }); + } else { + config.success(layero, that.index); + } + } + layer.ie == 6 && that.IE6(layero); + + //按钮 + layero.find('.'+ doms[6]).children('a').on('click', function(){ + var index = $(this).index(); + if(index === 0){ + if(config.yes){ + var close = config.yes(that.index, layero); + close === false || layer.close(that.index); // 2017-3-31 ThinkGem 添加返回值如果是false则关闭窗口 + } else if(config['btn1']){ + var close = config['btn1'](that.index, layero); + close === false || layer.close(that.index); // 2017-3-31 ThinkGem 添加返回值如果是false则关闭窗口 + } else { + layer.close(that.index); + } + } else { + var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero); + close === false || layer.close(that.index); + } + }); + + //取消 + function cancel(){ + var close = config.cancel && config.cancel(that.index, layero); + close === false || layer.close(that.index); + } + + //右上角关闭回调 + layero.find('.'+ doms[7]).on('click', cancel); + + //点遮罩关闭 + if(config.shadeClose || config.shadeClose == undefined){ + that.shadeo.on('click', function(){ + layer.close(that.index); + }); + } + + //最小化 + layero.find('.layui-layer-min').on('click', function(){ + var min = config.min && config.min(layero, that.index); + min === false || layer.min(that.index, config); + }); + + //全屏/还原 + layero.find('.layui-layer-max').on('click', function(){ + if($(this).hasClass('layui-layer-maxmin')){ + layer.restore(that.index); + config.restore && config.restore(layero, that.index); + } else { + layer.full(that.index, config); + setTimeout(function(){ + config.full && config.full(layero, that.index); + }, 100); + } + }); + + config.end && (ready.end[that.index] = config.end); +}; + +//for ie6 恢复select +ready.reselect = function(){ + $.each($('select'), function(index , value){ + var sthis = $(this); + if(!sthis.parents('.'+doms[0])[0]){ + (sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show(); + } + sthis = null; + }); +}; + +Class.pt.IE6 = function(layero){ + //隐藏select + $('select').each(function(index , value){ + var sthis = $(this); + if(!sthis.parents('.'+doms[0])[0]){ + sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide(); + } + sthis = null; + }); +}; + +//需依赖原型的对外方法 +Class.pt.openLayer = function(){ + var that = this; + + //置顶当前窗口 + layer.zIndex = that.config.zIndex; + layer.setTop = function(layero){ + var setZindex = function(){ + layer.zIndex++; + layero.css('z-index', layer.zIndex + 1); + }; + layer.zIndex = parseInt(layero[0].style.zIndex); + layero.on('mousedown', setZindex); + return layer.zIndex; + }; +}; + +//记录宽高坐标,用于还原 +ready.record = function(layero){ + var area = [ + layero.width(), + layero.height(), + layero.position().top, + layero.position().left + parseFloat(layero.css('margin-left')) + ]; + layero.find('.layui-layer-max').addClass('layui-layer-maxmin'); + layero.attr({area: area}); +}; + +ready.rescollbar = function(index){ + if(doms.html.attr('layer-full') == index){ + if(doms.html[0].style.removeProperty){ + doms.html[0].style.removeProperty('overflow'); + } else { + doms.html[0].style.removeAttribute('overflow'); + } + doms.html.removeAttr('layer-full'); + } +}; + +/** 内置成员 */ + +window.layer = layer; + +//获取当前对话框所在窗口的jQuery对象和Window对象 ThinkGem +layer.$ = layer.jQuery = jQuery; +layer.window = window; + +//获取子iframe的DOM +layer.getChildFrame = function(selector, index){ + index = index || $('.'+doms[4]).attr('times'); + return $('#'+ doms[0] + index).find('iframe').contents().find(selector); +}; + +//得到当前iframe层的索引,子iframe时使用 +layer.getFrameIndex = function(name){ + return $('#'+ name).parents('.'+doms[4]).attr('times'); +}; + +//iframe层自适应宽高(diffVal差值范围内,进行自适应高度) +layer.iframeAuto = function(index, diffVal, $this){ + if(!index) return; + var iframe = document.getElementById(doms[4] + index); + if (iframe) { + var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow; + if (iframeWin.document.body) { + var layero = $('#'+ doms[0] + index); + var titHeight = layero.find(doms[1]).outerHeight() || 0; + var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; + // var heg = layer.getChildFrame('html', index).outerHeight(); + var heg = iframeWin.document.body.scrollHeight; + var layerHeight = heg + titHeight + btnHeight; + var layerTop = ($(window).height() - layerHeight) / 2; + if (layerTop > 0){ + var $iframe = layero.find('iframe'); + if (Math.abs($iframe.height() - heg) < (diffVal || 9000)){ + layero.animate({height: layerHeight, top: layerTop}, 20); + $iframe.animate({height: heg}, 20); + } + } + } + } +}; + +//重置iframe url +layer.iframeSrc = function(index, url){ + $('#'+ doms[0] + index).find('iframe').attr('src', url); +}; + +//返回当前layer的iframe对象的window对象 ThinkGem +layer.iframeWindow = function(index){ + var ifr = $('#'+ doms[0] + index).find('iframe'); + if (ifr.length > 0){ + return ifr[0].contentWindow; + } + // 取不到iframe返回null + return null; +}; + +//设定层的样式 +layer.style = function(index, options, limit){ + var layero = $('#'+ doms[0] + index) + ,contElem = layero.find('.layui-layer-content') + ,type = layero.attr('type') + ,titHeight = layero.find(doms[1]).outerHeight() || 0 + ,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0 + ,minLeft = layero.attr('minLeft'); + + if(type === ready.type[3] || type === ready.type[4]){ + return; + } + + if(!limit){ + if(parseFloat(options.width) <= 260){ + options.width = 260; + }; + + if(parseFloat(options.height) - titHeight - btnHeight <= 64){ + options.height = 64 + titHeight + btnHeight; + }; + } + + layero.css(options); + //btnHeight = layero.find('.'+doms[6]).outerHeight(); + btnHeight = layero.find('.'+doms[6]).outerHeight() || 0; // ThinkGem 兼容 jQuery 3.5 + + if(type === ready.type[2]){ + layero.find('iframe').css({ + height: parseFloat(options.height) - titHeight - btnHeight + }); + } else { + contElem.css({ + height: parseFloat(options.height) - titHeight - btnHeight + - parseFloat(contElem.css('padding-top')) + - parseFloat(contElem.css('padding-bottom')) + }) + } +}; + +//最小化 +layer.min = function(index, options){ + options = options || {}; + var layero = $('#'+ doms[0] + index) + ,shadeo = $('#'+ doms.SHADE + index) + ,titHeight = layero.find(doms[1]).outerHeight() || 0 + ,left = layero.attr('minLeft') || (181*ready.minIndex)+'px' + ,position = layero.css('position') + ,settings = { + width: 180 + ,height: titHeight + ,position: 'fixed' + ,overflow: 'hidden' + }; + + //记录宽高坐标,用于还原 + ready.record(layero); + + if(ready.minLeft[0]){ + left = ready.minLeft[0]; + ready.minLeft.shift(); + } + + //是否堆叠在左下角 + if(options.minStack){ + settings.left = left; + settings.top = win.height() - titHeight; + layero.attr('minLeft') || ready.minIndex++; //初次执行,最小化操作索引自增 + layero.attr('minLeft', left); + } + + layero.attr('position', position); + layer.style(index, settings, true); + + layero.find('.layui-layer-min').hide(); + layero.attr('type') === 'page' && layero.find(doms[4]).hide(); + ready.rescollbar(index); + + //隐藏遮罩 + shadeo.hide(); +}; + +//还原 +layer.restore = function(index){ + var layero = $('#'+ doms[0] + index) + ,shadeo = $('#'+ doms.SHADE + index) + ,area = layero.attr('area').split(',') + ,type = layero.attr('type'); + + //恢复原来尺寸 + layer.style(index, { + width: parseFloat(area[0]), + height: parseFloat(area[1]), + top: parseFloat(area[2]), + left: parseFloat(area[3]), + position: layero.attr('position'), + overflow: 'visible' + }, true); + + layero.find('.layui-layer-max').removeClass('layui-layer-maxmin'); + layero.find('.layui-layer-min').show(); + layero.attr('type') === 'page' && layero.find(doms[4]).show(); + ready.rescollbar(index); + + //恢复遮罩 + shadeo.show(); +}; + +//全屏 +layer.full = function(index){ + var layero = $('#'+ doms[0] + index), timer; + ready.record(layero); + if(!doms.html.attr('layer-full')){ + doms.html.css('overflow','hidden').attr('layer-full', index); + } + clearTimeout(timer); + timer = setTimeout(function(){ + var isfix = layero.css('position') === 'fixed'; + layer.style(index, { + top: isfix ? 0 : win.scrollTop(), + left: isfix ? 0 : win.scrollLeft(), + width: win.width(), + height: win.height() + }, true); + layero.find('.layui-layer-min').hide(); + }, 100); +}; + +//改变title +layer.title = function(name, index){ + var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]); + title.html(name); +}; + +//关闭layer总方法 +layer.close = function(index, callback){ + var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close'; + if(!layero[0]) return; + var WRAP = 'layui-layer-wrap', remove = function(){ + if(type === ready.type[1] && layero.attr('conType') === 'object'){ + layero.children(':not(.'+ doms[5] +')').remove(); + var wrap = layero.find('.'+WRAP); + for(var i = 0; i < 2; i++){ + wrap.unwrap(); + } + wrap.css('display', wrap.data('display')).removeClass(WRAP); + } else { + //低版本IE 回收 iframe + if(type === ready.type[2]){ + try { + var iframe = $('#'+doms[4]+index)[0]; + iframe.contentWindow.document.write(''); + iframe.contentWindow.close(); + layero.find('.'+doms[5])[0].removeChild(iframe); + } catch(e){} + } + layero[0].innerHTML = ''; + layero.remove(); + } + typeof ready.end[index] === 'function' && ready.end[index](); + delete ready.end[index]; + typeof callback === 'function' && callback(); + }; + + if(layero.data('isOutAnim')){ + layero.addClass('layer-anim '+ closeAnim); + } + + $('#layui-layer-moves, #'+ doms.SHADE + index).remove(); + layer.ie == 6 && ready.reselect(); + ready.rescollbar(index); + if(layero.attr('minLeft')){ + ready.minIndex--; + ready.minLeft.push(layero.attr('minLeft')); + } + + if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){ + remove() + } else { + setTimeout(function(){ + remove(); + }, 200); + } +}; + +//关闭所有层 +layer.closeAll = function(type, callback){ + if(typeof type === 'function'){ + callback = type; + type = null; + }; + var domsElem = $('.'+doms[0]); + $.each(domsElem, function(_index){ + var othis = $(this); + var is = type ? (othis.attr('type') === type) : 1; + is && layer.close(othis.attr('times'), _index === domsElem.length - 1 ? callback : null); + is = null; + }); + if(domsElem.length === 0) typeof callback === 'function' && callback(); +}; + +/** + + 拓展模块,layui 开始合并在一起 + + */ + +var cache = layer.cache||{}, skin = function(type){ + return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : ''); +}; + +//仿系统prompt +layer.prompt = function(options, yes){ + var style = ''; + options = options || {}; + + if(typeof options === 'function') yes = options; + + if(options.area){ + var area = options.area; + style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"'; + delete options.area; + } + var prompt, content = options.formType == 2 ? '' : function(){ + return ''; + }(); + + var success = options.success; + delete options.success; + + return layer.open($.extend({ + type: 1 + ,btn: [layer.i18n.btnOk,layer.i18n.btnCancel] + ,content: content + ,skin: 'layui-layer-prompt' + skin('prompt') + ,maxWidth: win.width() + ,success: function(layero){ + prompt = layero.find('.layui-layer-input'); + prompt.val(options.value || '').focus(); + typeof success === 'function' && success(layero); + } + ,resize: false + ,yes: function(index){ + var value = prompt.val(); + if(value === ''){ + prompt.focus(); + } else if(value.length > (options.maxlength||500)) { + layer.tips(layer.i18n.promptTipA + (options.maxlength || 500) + layer.i18n.promptTipB, prompt, {tips: 1}); + } else { + yes && yes(value, index, prompt); + } + } + }, options)); +}; + +//tab层 +layer.tab = function(options){ + options = options || {}; + + var tab = options.tab || {} + ,THIS = 'layui-this' + ,success = options.success; + + delete options.success; + + return layer.open($.extend({ + type: 1, + skin: 'layui-layer-tab' + skin('tab'), + resize: false, + title: function(){ + var len = tab.length, ii = 1, str = ''; + if(len > 0){ + str = ''+ tab[0].title +''; + for(; ii < len; ii++){ + str += ''+ tab[ii].title +''; + } + } + return str; + }(), + content: '', + success: function(layero){ + var btn = layero.find('.layui-layer-title').children(); + var main = layero.find('.layui-layer-tabmain').children(); + btn.on('mousedown', function(e){ + e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true; + var othis = $(this), index = othis.index(); + othis.addClass(THIS).siblings().removeClass(THIS); + main.eq(index).show().siblings().hide(); + typeof options.change === 'function' && options.change(index); + }); + typeof success === 'function' && success(layero); + } + }, options)); +}; + +//相册层 +layer.photos = function(options, loop, key){ + var dict = {}; + options = options || {}; + if(!options.photos) return; + + //若 photos 并非选择器或 jQuery 对象,则为普通 object + var isObject = !(typeof options.photos === 'string' || options.photos instanceof $) + ,photos = isObject ? options.photos : {} + ,data = photos.data || [] + ,start = photos.start || 0; + + dict.imgIndex = (start|0) + 1; + options.img = options.img || 'img'; + + var success = options.success; + delete options.success; + + //如果 options.photos 不是一个对象 + if(!isObject){ //页面直接获取 + var parent = $(options.photos), pushData = function(){ + data = []; + parent.find(options.img).each(function(index){ + var othis = $(this); + othis.attr('layer-index', index); + data.push({ + alt: othis.attr('alt'), + pid: othis.attr('layer-pid'), + src: othis.attr('layer-src') || othis.attr('src'), + thumb: othis.attr('src') + }); + }); + }; + + pushData(); + + if (data.length === 0) return; + + loop || parent.on('click', options.img, function(){ + pushData(); + var othis = $(this), index = othis.attr('layer-index'); + layer.photos($.extend(options, { + photos: { + start: index, + data: data, + tab: options.tab + }, + full: options.full + }), true); + }); + + //不直接弹出 + if(!loop) return; + + } else if (data.length === 0){ + return layer.msg(layer.i18n.noPicture); + } + + //上一张 + dict.imgprev = function(key){ + dict.imgIndex--; + if(dict.imgIndex < 1){ + dict.imgIndex = data.length; + } + dict.tabimg(key); + }; + + //下一张 + dict.imgnext = function(key,errorMsg){ + dict.imgIndex++; + if(dict.imgIndex > data.length){ + dict.imgIndex = 1; + if (errorMsg) {return}; + } + dict.tabimg(key) + }; + + //方向键 + dict.keyup = function(event){ + if(!dict.end){ + var code = event.keyCode; + event.preventDefault(); + if(code === 37){ + dict.imgprev(true); + } else if(code === 39) { + dict.imgnext(true); + } else if(code === 27) { + layer.close(dict.index); + } + } + } + + //切换 + dict.tabimg = function(key){ + if(data.length <= 1) return; + photos.start = dict.imgIndex - 1; + layer.close(dict.index); + return layer.photos(options, true, key); + setTimeout(function(){ + layer.photos(options, true, key); + }, 200); + } + + //一些动作 + dict.event = function(){ + /* + dict.bigimg.hover(function(){ + dict.imgsee.show(); + }, function(){ + dict.imgsee.hide(); + }); + */ + + dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){ + event.preventDefault(); + dict.imgprev(true); + }); + + dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){ + event.preventDefault(); + dict.imgnext(true); + }); + + $(document).on('keyup', dict.keyup); + }; + + //图片预加载 + function loadImage(url, callback, error) { + var img = new Image(); + img.src = url; + if(img.complete){ + return callback(img); + } + img.onload = function(){ + img.onload = null; + callback(img); + }; + img.onerror = function(e){ + img.onerror = null; + error(e); + }; + }; + + dict.loadi = layer.load(1, { + shade: 'shade' in options ? false : 0.9, + scrollbar: false + }); + + loadImage(data[start].src, function(img){ + layer.close(dict.loadi); + + //切换图片时不出现动画 + if(key) options.anim = -1; + + //弹出图片层 + dict.index = layer.open($.extend({ + type: 1, + id: 'layui-layer-photos', + area: function(){ + var imgarea = [img.width, img.height]; + var winarea = [$(window).width() - 100, $(window).height() - 100]; + + //如果 实际图片的宽或者高比 屏幕大(那么进行缩放) + if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){ + var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例 + if(wh[0] > wh[1]){//取缩放比例最大的进行缩放 + imgarea[0] = imgarea[0]/wh[0]; + imgarea[1] = imgarea[1]/wh[0]; + } else if(wh[0] < wh[1]){ + imgarea[0] = imgarea[0]/wh[1]; + imgarea[1] = imgarea[1]/wh[1]; + } + } + + return [imgarea[0]+'px', imgarea[1]+'px']; + }(), + title: false, + shade: 0.9, + shadeClose: true, + closeBtn: false, + move: '.layui-layer-phimg img', + moveType: 1, + scrollbar: false, + moveOut: true, + anim: 5, + isOutAnim: false, + skin: 'layui-layer-photos' + skin('photos'), + content: '
    ' + +''+ (data[start].alt||'') +'' + +function(){ + if(data.length > 1){ + return '
    ' + +'' + +'
    '+ (data[start].alt || '') +''+ dict.imgIndex +' / '+ data.length +'
    ' + +'
    ' + } + return ''; + }() + +'
    ', + success: function(layero, index){ + dict.bigimg = layero.find('.layui-layer-phimg'); + dict.imgsee = layero.find('.layui-layer-imgbar'); + dict.event(layero); + options.tab && options.tab(data[start], layero); + typeof success === 'function' && success(layero); + }, end: function(){ + dict.end = true; + $(document).off('keyup', dict.keyup); + } + }, options)); + }, function(){ + layer.close(dict.loadi); + layer.msg(layer.i18n.photoError, { + time: 30000, + btn: [layer.i18n.photoNextPage, layer.i18n.photoClose], + yes: function(){ + data.length > 1 && dict.imgnext(true,true); + } + }); + }); +}; + +//主入口 +ready.run = function(_$){ + $ = _$; + win = $(window); + doms.html = $('html'); + layer.open = function(deliver){ + var o = new Class(deliver); + return o.index; + }; +}; + +//加载方式 +window.layui && layui.define ? ( + layer.ready() + ,layui.define('jquery', function(exports){ //layui 加载 + layer.path = layui.cache.dir; + ready.run(layui.$); + + //暴露模块 + window.layer = layer; + exports('layer', layer); + }) +) : ( + (typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs 加载 + ready.run(window.jQuery); + return layer; + }) : function(){ //普通 script 标签加载 + layer.ready(); + ready.run(window.jQuery); + }() +); + +}(window); diff --git a/common/src/main/resources/static/layer/3.1/mobile/README.md b/common/src/main/resources/static/layer/3.5/mobile/README.md similarity index 97% rename from common/src/main/resources/static/layer/3.1/mobile/README.md rename to common/src/main/resources/static/layer/3.5/mobile/README.md index 1baea780..1e217a7e 100644 --- a/common/src/main/resources/static/layer/3.1/mobile/README.md +++ b/common/src/main/resources/static/layer/3.5/mobile/README.md @@ -1,14 +1,14 @@ - -## layer mobile -layer mobile是为移动设备(手机、平板等webkit内核浏览器/webview)量身定做的弹层支撑,采用Native JavaScript编写,完全独立于PC版的layer,您需要按照场景选择使用。 - -[文档与演示](http://sentsin.com/layui/layer/) - -1. 无需依赖任何库,只加载layer.m.js即可 -2. 小巧玲珑,性能卓越、柔情似水… -3. 具备无以伦比的自适应功能 -4. 灵活的皮肤自定义支撑,充分确保弹层风格多样化 -5. 丰富、科学的接口,让弹弹弹层无所不能 - -## 备注 -[官网](http://sentsin.com/layui/layer/)、[有问必答](http://say.sentsin.com/home-48.html) + +## layer mobile +layer mobile是为移动设备(手机、平板等webkit内核浏览器/webview)量身定做的弹层支撑,采用Native JavaScript编写,完全独立于PC版的layer,您需要按照场景选择使用。 + +[文档与演示](http://sentsin.com/layui/layer/) + +1. 无需依赖任何库,只加载layer.m.js即可 +2. 小巧玲珑,性能卓越、柔情似水… +3. 具备无以伦比的自适应功能 +4. 灵活的皮肤自定义支撑,充分确保弹层风格多样化 +5. 丰富、科学的接口,让弹弹弹层无所不能 + +## 备注 +[官网](http://sentsin.com/layui/layer/)、[有问必答](http://say.sentsin.com/home-48.html) diff --git a/common/src/main/resources/static/layer/3.1/mobile/layer.js b/common/src/main/resources/static/layer/3.5/mobile/layer.js similarity index 95% rename from common/src/main/resources/static/layer/3.1/mobile/layer.js rename to common/src/main/resources/static/layer/3.5/mobile/layer.js index 8d973b47..23116171 100644 --- a/common/src/main/resources/static/layer/3.1/mobile/layer.js +++ b/common/src/main/resources/static/layer/3.5/mobile/layer.js @@ -1,208 +1,207 @@ -/*! - - @Name:layer mobile v2.0 弹层组件移动版 - @Author:贤心 - @Site:http://layer.layui.com/mobie/ - @License:LGPL - - */ - -;!function(win){ - -"use strict"; - -var doc = document, query = 'querySelectorAll', claname = 'getElementsByClassName', S = function(s){ - return doc[query](s); -}; - -//默认配置 -var config = { - type: 0 - ,shade: true - ,shadeClose: true - ,fixed: true - ,anim: 'scale' //默认动画类型 -}; - -var ready = { - extend: function(obj){ - var newobj = JSON.parse(JSON.stringify(config)); - for(var i in obj){ - newobj[i] = obj[i]; - } - return newobj; - }, - timer: {}, end: {} -}; - -//点触事件 -ready.touch = function(elem, fn){ - elem.addEventListener('click', function(e){ - fn.call(this, e); - }, false); -}; - -var index = 0, classs = ['layui-m-layer'], Layer = function(options){ - var that = this; - that.config = ready.extend(options); - that.view(); -}; - -Layer.prototype.view = function(){ - var that = this, config = that.config, layerbox = doc.createElement('div'); - - that.id = layerbox.id = classs[0] + index; - layerbox.setAttribute('class', classs[0] + ' ' + classs[0]+(config.type || 0)); - layerbox.setAttribute('index', index); - - //标题区域 - var title = (function(){ - var titype = typeof config.title === 'object'; - return config.title - ? '

    '+ (titype ? config.title[0] : config.title) +'

    ' - : ''; - }()); - - //按钮区域 - var button = (function(){ - typeof config.btn === 'string' && (config.btn = [config.btn]); - var btns = (config.btn || []).length, btndom; - if(btns === 0 || !config.btn){ - return ''; - } - btndom = ''+ config.btn[0] +'' - if(btns === 2){ - btndom = ''+ config.btn[1] +'' + btndom; - } - return '
    '+ btndom + '
    '; - }()); - - if(!config.fixed){ - config.top = config.hasOwnProperty('top') ? config.top : 100; - config.style = config.style || ''; - config.style += ' top:'+ ( doc.body.scrollTop + config.top) + 'px'; - } - - if(config.type === 2){ - config.content = '

    '+ (config.content||'') +'

    '; - } - - if(config.skin) config.anim = 'up'; - if(config.skin === 'msg') config.shade = false; - - layerbox.innerHTML = (config.shade ? '
    ' : '') - +'
    ' - +'
    ' - +'
    ' - + title - +'
    '+ config.content +'
    ' - + button - +'
    ' - +'
    ' - +'
    '; - - if(!config.type || config.type === 2){ - var dialogs = doc[claname](classs[0] + config.type), dialen = dialogs.length; - if(dialen >= 1){ - layer.close(dialogs[0].getAttribute('index')) - } - } - - document.body.appendChild(layerbox); - var elem = that.elem = S('#'+that.id)[0]; - config.success && config.success(elem); - - that.index = index++; - that.action(config, elem); -}; - -Layer.prototype.action = function(config, elem){ - var that = this; - - //自动关闭 - if(config.time){ - ready.timer[that.index] = setTimeout(function(){ - layer.close(that.index); - }, config.time*1000); - } - - //确认取消 - var btn = function(){ - var type = this.getAttribute('type'); - if(type == 0){ - config.no && config.no(); - layer.close(that.index); - } else { - config.yes ? config.yes(that.index) : layer.close(that.index); - } - }; - if(config.btn){ - var btns = elem[claname]('layui-m-layerbtn')[0].children, btnlen = btns.length; - for(var ii = 0; ii < btnlen; ii++){ - ready.touch(btns[ii], btn); - } - } - - //点遮罩关闭 - if(config.shade && config.shadeClose){ - var shade = elem[claname]('layui-m-layershade')[0]; - ready.touch(shade, function(){ - layer.close(that.index, config.end); - }); - } - - config.end && (ready.end[that.index] = config.end); -}; - -win.layer = { - v: '2.0', - index: index, - - //核心方法 - open: function(options){ - var o = new Layer(options || {}); - return o.index; - }, - - close: function(index){ - var ibox = S('#'+classs[0]+index)[0]; - if(!ibox) return; - ibox.innerHTML = ''; - doc.body.removeChild(ibox); - clearTimeout(ready.timer[index]); - delete ready.timer[index]; - typeof ready.end[index] === 'function' && ready.end[index](); - delete ready.end[index]; - }, - - //关闭所有layer层 - closeAll: function(){ - var boxs = doc[claname](classs[0]); - for(var i = 0, len = boxs.length; i < len; i++){ - layer.close((boxs[0].getAttribute('index')|0)); - } - } -}; - -'function' == typeof define ? define(function() { - return layer; -}) : function(){ - - var js = document.scripts, script = js[js.length - 1], jsPath = script.src; - var path = jsPath.substring(0, jsPath.lastIndexOf("/") + 1); - - //如果合并方式,则需要单独引入layer.css - if(script.getAttribute('merge')) return; - - document.head.appendChild(function(){ - var link = doc.createElement('link'); - link.href = path + 'need/layer.css?2.0'; - link.type = 'text/css'; - link.rel = 'styleSheet' - link.id = 'layermcss'; - return link; - }()); - -}(); - +/*! + + @Name:layer mobile v2.0 弹层组件移动版 + @Author:贤心 + @License:MIT + + */ + +;!function(win){ + +"use strict"; + +var doc = document, query = 'querySelectorAll', claname = 'getElementsByClassName', S = function(s){ + return doc[query](s); +}; + +//默认配置 +var config = { + type: 0 + ,shade: true + ,shadeClose: true + ,fixed: true + ,anim: 'scale' //默认动画类型 +}; + +var ready = { + extend: function(obj){ + var newobj = JSON.parse(JSON.stringify(config)); + for(var i in obj){ + newobj[i] = obj[i]; + } + return newobj; + }, + timer: {}, end: {} +}; + +//点触事件 +ready.touch = function(elem, fn){ + elem.addEventListener('click', function(e){ + fn.call(this, e); + }, false); +}; + +var index = 0, classs = ['layui-m-layer'], Layer = function(options){ + var that = this; + that.config = ready.extend(options); + that.view(); +}; + +Layer.prototype.view = function(){ + var that = this, config = that.config, layerbox = doc.createElement('div'); + + that.id = layerbox.id = classs[0] + index; + layerbox.setAttribute('class', classs[0] + ' ' + classs[0]+(config.type || 0)); + layerbox.setAttribute('index', index); + + //标题区域 + var title = (function(){ + var titype = typeof config.title === 'object'; + return config.title + ? '

    '+ (titype ? config.title[0] : config.title) +'

    ' + : ''; + }()); + + //按钮区域 + var button = (function(){ + typeof config.btn === 'string' && (config.btn = [config.btn]); + var btns = (config.btn || []).length, btndom; + if(btns === 0 || !config.btn){ + return ''; + } + btndom = ''+ config.btn[0] +'' + if(btns === 2){ + btndom = ''+ config.btn[1] +'' + btndom; + } + return '
    '+ btndom + '
    '; + }()); + + if(!config.fixed){ + config.top = config.hasOwnProperty('top') ? config.top : 100; + config.style = config.style || ''; + config.style += ' top:'+ ( doc.body.scrollTop + config.top) + 'px'; + } + + if(config.type === 2){ + config.content = '

    '+ (config.content||'') +'

    '; + } + + if(config.skin) config.anim = 'up'; + if(config.skin === 'msg') config.shade = false; + + layerbox.innerHTML = (config.shade ? '
    ' : '') + +'
    ' + +'
    ' + +'
    ' + + title + +'
    '+ config.content +'
    ' + + button + +'
    ' + +'
    ' + +'
    '; + + if(!config.type || config.type === 2){ + var dialogs = doc[claname](classs[0] + config.type), dialen = dialogs.length; + if(dialen >= 1){ + layer.close(dialogs[0].getAttribute('index')) + } + } + + document.body.appendChild(layerbox); + var elem = that.elem = S('#'+that.id)[0]; + config.success && config.success(elem); + + that.index = index++; + that.action(config, elem); +}; + +Layer.prototype.action = function(config, elem){ + var that = this; + + //自动关闭 + if(config.time){ + ready.timer[that.index] = setTimeout(function(){ + layer.close(that.index); + }, config.time*1000); + } + + //确认取消 + var btn = function(){ + var type = this.getAttribute('type'); + if(type == 0){ + config.no && config.no(); + layer.close(that.index); + } else { + config.yes ? config.yes(that.index) : layer.close(that.index); + } + }; + if(config.btn){ + var btns = elem[claname]('layui-m-layerbtn')[0].children, btnlen = btns.length; + for(var ii = 0; ii < btnlen; ii++){ + ready.touch(btns[ii], btn); + } + } + + //点遮罩关闭 + if(config.shade && config.shadeClose){ + var shade = elem[claname]('layui-m-layershade')[0]; + ready.touch(shade, function(){ + layer.close(that.index, config.end); + }); + } + + config.end && (ready.end[that.index] = config.end); +}; + +win.layer = { + v: '2.0', + index: index, + + //核心方法 + open: function(options){ + var o = new Layer(options || {}); + return o.index; + }, + + close: function(index){ + var ibox = S('#'+classs[0]+index)[0]; + if(!ibox) return; + ibox.innerHTML = ''; + doc.body.removeChild(ibox); + clearTimeout(ready.timer[index]); + delete ready.timer[index]; + typeof ready.end[index] === 'function' && ready.end[index](); + delete ready.end[index]; + }, + + //关闭所有layer层 + closeAll: function(){ + var boxs = doc[claname](classs[0]); + for(var i = 0, len = boxs.length; i < len; i++){ + layer.close((boxs[0].getAttribute('index')|0)); + } + } +}; + +'function' == typeof define ? define(function() { + return layer; +}) : function(){ + + var js = document.scripts, script = js[js.length - 1], jsPath = script.src; + var path = jsPath.substring(0, jsPath.lastIndexOf("/") + 1); + + //如果合并方式,则需要单独引入layer.css + if(script.getAttribute('merge')) return; + + document.head.appendChild(function(){ + var link = doc.createElement('link'); + link.href = path + 'need/layer.css?2.0'; + link.type = 'text/css'; + link.rel = 'styleSheet' + link.id = 'layermcss'; + return link; + }()); + +}(); + }(window); \ No newline at end of file diff --git a/common/src/main/resources/static/layer/3.1/mobile/need/layer.css b/common/src/main/resources/static/layer/3.5/mobile/need/layer.css similarity index 98% rename from common/src/main/resources/static/layer/3.1/mobile/need/layer.css rename to common/src/main/resources/static/layer/3.5/mobile/need/layer.css index 2f28bdf5..c8b32e07 100644 --- a/common/src/main/resources/static/layer/3.1/mobile/need/layer.css +++ b/common/src/main/resources/static/layer/3.5/mobile/need/layer.css @@ -1,87 +1,87 @@ - -/* - layer mobile -*/ - -.layui-m-layer{position:relative; z-index: 19891014;} -.layui-m-layer *{-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;} -.layui-m-layershade, -.layui-m-layermain{position:fixed; left:0; top:0; width:100%; height:100%;} -.layui-m-layershade{background-color:rgba(0,0,0, .7); pointer-events:auto;} -.layui-m-layermain{display:table; font-family: Helvetica, arial, sans-serif; pointer-events: none;} -.layui-m-layermain .layui-m-layersection{display:table-cell; vertical-align:middle; text-align:center;} -.layui-m-layerchild{position:relative; display:inline-block; text-align:left; background-color:#fff; font-size:14px; border-radius: 5px; box-shadow: 0 0 8px rgba(0, 0, 0, 0.1); pointer-events:auto; -webkit-overflow-scrolling: touch;} -.layui-m-layerchild{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration: .2s; animation-duration: .2s;} - - -/* 弹出动画 */ -@-webkit-keyframes layui-m-anim-scale { /* 默认 */ - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} -} -@keyframes layui-m-anim-scale { /* 默认 */ - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} -} -.layui-m-anim-scale{animation-name: layui-m-anim-scale; -webkit-animation-name: layui-m-anim-scale;} - -@-webkit-keyframes layui-m-anim-up{ - 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} - 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} -} -@keyframes layui-m-anim-up{ - 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} - 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} -} -.layui-m-anim-up{-webkit-animation-name: layui-m-anim-up;animation-name: layui-m-anim-up} - - -.layui-m-layer0 .layui-m-layerchild{width: 90%; max-width: 640px;} -.layui-m-layer1 .layui-m-layerchild{border:none; border-radius:0;} -.layui-m-layer2 .layui-m-layerchild{width:auto; max-width:260px; min-width:40px; border:none; background: none; box-shadow: none; color:#fff;} -.layui-m-layerchild h3{padding: 0 10px; height: 60px; line-height: 60px; font-size:16px; font-weight: 400; border-radius: 5px 5px 0 0; text-align: center;} -.layui-m-layerchild h3, -.layui-m-layerbtn span{ text-overflow:ellipsis; overflow:hidden; white-space:nowrap;} -.layui-m-layercont{padding: 50px 30px; line-height: 22px; text-align:center;} -.layui-m-layer1 .layui-m-layercont{padding:0; text-align:left;} -.layui-m-layer2 .layui-m-layercont{text-align:center; padding: 0; line-height: 0;} -.layui-m-layer2 .layui-m-layercont i{width:25px; height:25px; margin-left:8px; display:inline-block; background-color:#fff; border-radius:100%;} -.layui-m-layer2 .layui-m-layercont p{margin-top: 20px;} - -/* loading */ -@-webkit-keyframes layui-m-anim-loading{ - 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} - 40%{transform:scale(1); -webkit-transform:scale(1)} -} -@keyframes layui-m-anim-loading{ - 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} - 40%{transform:scale(1); -webkit-transform:scale(1)} -} -.layui-m-layer2 .layui-m-layercont i{-webkit-animation: layui-m-anim-loading 1.4s infinite ease-in-out; animation: layui-m-anim-loading 1.4s infinite ease-in-out; -webkit-animation-fill-mode: both; animation-fill-mode: both;} - -.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0; -webkit-animation-delay: -.32s; animation-delay: -.32s;} -.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay: -.16s; animation-delay: -.16s;} -.layui-m-layer2 .layui-m-layercont>div{line-height:22px; padding-top:7px; margin-bottom:20px; font-size: 14px;} -.layui-m-layerbtn{display: box; display: -moz-box; display: -webkit-box; width: 100%; position:relative; height: 50px; line-height: 50px; font-size: 0; text-align:center; border-top:1px solid #D0D0D0; background-color: #F2F2F2; border-radius: 0 0 5px 5px;} -.layui-m-layerbtn span{position:relative; display: block; -moz-box-flex: 1; box-flex: 1; -webkit-box-flex: 1; text-align:center; font-size:14px; border-radius: 0 0 5px 5px; cursor:pointer;} -.layui-m-layerbtn span[yes]{color: #40AFFE;} -.layui-m-layerbtn span[no]{border-right: 1px solid #D0D0D0; border-radius: 0 0 0 5px;} -.layui-m-layerbtn span:active{background-color: #F6F6F6;} -.layui-m-layerend{position:absolute; right:7px; top:10px; width:30px; height:30px; border: 0; font-weight:400; background: transparent; cursor: pointer; -webkit-appearance: none; font-size:30px;} -.layui-m-layerend::before, .layui-m-layerend::after{position:absolute; left:5px; top:15px; content:''; width:18px; height:1px; background-color:#999; transform:rotate(45deg); -webkit-transform:rotate(45deg); border-radius: 3px;} -.layui-m-layerend::after{transform:rotate(-45deg); -webkit-transform:rotate(-45deg);} - -/* 底部对话框风格 */ -body .layui-m-layer .layui-m-layer-footer{position: fixed; width: 95%; max-width: 100%; margin: 0 auto; left:0; right: 0; bottom: 10px; background: none;} -.layui-m-layer-footer .layui-m-layercont{padding: 20px; border-radius: 5px 5px 0 0; background-color: rgba(255,255,255,.8);} -.layui-m-layer-footer .layui-m-layerbtn{display: block; height: auto; background: none; border-top: none;} -.layui-m-layer-footer .layui-m-layerbtn span{background-color: rgba(255,255,255,.8);} -.layui-m-layer-footer .layui-m-layerbtn span[no]{color: #FD482C; border-top: 1px solid #c2c2c2; border-radius: 0 0 5px 5px;} -.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top: 10px; border-radius: 5px;} - -/* 通用提示 */ -body .layui-m-layer .layui-m-layer-msg{width: auto; max-width: 90%; margin: 0 auto; bottom: -150px; background-color: rgba(0,0,0,.7); color: #fff;} -.layui-m-layer-msg .layui-m-layercont{padding: 10px 20px;} - - - + +/* + layer mobile +*/ + +.layui-m-layer{position:relative; z-index: 19891014;} +.layui-m-layer *{-webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box;} +.layui-m-layershade, +.layui-m-layermain{position:fixed; left:0; top:0; width:100%; height:100%;} +.layui-m-layershade{background-color:rgba(0,0,0, .7); pointer-events:auto;} +.layui-m-layermain{display:table; font-family: Helvetica, arial, sans-serif; pointer-events: none;} +.layui-m-layermain .layui-m-layersection{display:table-cell; vertical-align:middle; text-align:center;} +.layui-m-layerchild{position:relative; display:inline-block; text-align:left; background-color:#fff; font-size:14px; border-radius: 5px; box-shadow: 0 0 8px rgba(0, 0, 0, 0.1); pointer-events:auto; -webkit-overflow-scrolling: touch;} +.layui-m-layerchild{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration: .2s; animation-duration: .2s;} + + +/* 弹出动画 */ +@-webkit-keyframes layui-m-anim-scale { /* 默认 */ + 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} + 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} +} +@keyframes layui-m-anim-scale { /* 默认 */ + 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} + 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} +} +.layui-m-anim-scale{animation-name: layui-m-anim-scale; -webkit-animation-name: layui-m-anim-scale;} + +@-webkit-keyframes layui-m-anim-up{ + 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} + 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} +} +@keyframes layui-m-anim-up{ + 0%{opacity: 0; -webkit-transform: translateY(800px); transform: translateY(800px)} + 100%{opacity: 1; -webkit-transform: translateY(0); transform: translateY(0)} +} +.layui-m-anim-up{-webkit-animation-name: layui-m-anim-up;animation-name: layui-m-anim-up} + + +.layui-m-layer0 .layui-m-layerchild{width: 90%; max-width: 640px;} +.layui-m-layer1 .layui-m-layerchild{border:none; border-radius:0;} +.layui-m-layer2 .layui-m-layerchild{width:auto; max-width:260px; min-width:40px; border:none; background: none; box-shadow: none; color:#fff;} +.layui-m-layerchild h3{padding: 0 10px; height: 60px; line-height: 60px; font-size:16px; font-weight: 400; border-radius: 5px 5px 0 0; text-align: center;} +.layui-m-layerchild h3, +.layui-m-layerbtn span{ text-overflow:ellipsis; overflow:hidden; white-space:nowrap;} +.layui-m-layercont{padding: 50px 30px; line-height: 22px; text-align:center;} +.layui-m-layer1 .layui-m-layercont{padding:0; text-align:left;} +.layui-m-layer2 .layui-m-layercont{text-align:center; padding: 0; line-height: 0;} +.layui-m-layer2 .layui-m-layercont i{width:25px; height:25px; margin-left:8px; display:inline-block; background-color:#fff; border-radius:100%;} +.layui-m-layer2 .layui-m-layercont p{margin-top: 20px;} + +/* loading */ +@-webkit-keyframes layui-m-anim-loading{ + 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} + 40%{transform:scale(1); -webkit-transform:scale(1)} +} +@keyframes layui-m-anim-loading{ + 0%,80%,100%{transform:scale(0); -webkit-transform:scale(0)} + 40%{transform:scale(1); -webkit-transform:scale(1)} +} +.layui-m-layer2 .layui-m-layercont i{-webkit-animation: layui-m-anim-loading 1.4s infinite ease-in-out; animation: layui-m-anim-loading 1.4s infinite ease-in-out; -webkit-animation-fill-mode: both; animation-fill-mode: both;} + +.layui-m-layer2 .layui-m-layercont i:first-child{margin-left:0; -webkit-animation-delay: -.32s; animation-delay: -.32s;} +.layui-m-layer2 .layui-m-layercont i.layui-m-layerload{-webkit-animation-delay: -.16s; animation-delay: -.16s;} +.layui-m-layer2 .layui-m-layercont>div{line-height:22px; padding-top:7px; margin-bottom:20px; font-size: 14px;} +.layui-m-layerbtn{display: box; display: -moz-box; display: -webkit-box; width: 100%; position:relative; height: 50px; line-height: 50px; font-size: 0; text-align:center; border-top:1px solid #D0D0D0; background-color: #F2F2F2; border-radius: 0 0 5px 5px;} +.layui-m-layerbtn span{position:relative; display: block; -moz-box-flex: 1; box-flex: 1; -webkit-box-flex: 1; text-align:center; font-size:14px; border-radius: 0 0 5px 5px; cursor:pointer;} +.layui-m-layerbtn span[yes]{color: #40AFFE;} +.layui-m-layerbtn span[no]{border-right: 1px solid #D0D0D0; border-radius: 0 0 0 5px;} +.layui-m-layerbtn span:active{background-color: #F6F6F6;} +.layui-m-layerend{position:absolute; right:7px; top:10px; width:30px; height:30px; border: 0; font-weight:400; background: transparent; cursor: pointer; -webkit-appearance: none; font-size:30px;} +.layui-m-layerend::before, .layui-m-layerend::after{position:absolute; left:5px; top:15px; content:''; width:18px; height:1px; background-color:#999; transform:rotate(45deg); -webkit-transform:rotate(45deg); border-radius: 3px;} +.layui-m-layerend::after{transform:rotate(-45deg); -webkit-transform:rotate(-45deg);} + +/* 底部对话框风格 */ +body .layui-m-layer .layui-m-layer-footer{position: fixed; width: 95%; max-width: 100%; margin: 0 auto; left:0; right: 0; bottom: 10px; background: none;} +.layui-m-layer-footer .layui-m-layercont{padding: 20px; border-radius: 5px 5px 0 0; background-color: rgba(255,255,255,.8);} +.layui-m-layer-footer .layui-m-layerbtn{display: block; height: auto; background: none; border-top: none;} +.layui-m-layer-footer .layui-m-layerbtn span{background-color: rgba(255,255,255,.8);} +.layui-m-layer-footer .layui-m-layerbtn span[no]{color: #FD482C; border-top: 1px solid #c2c2c2; border-radius: 0 0 5px 5px;} +.layui-m-layer-footer .layui-m-layerbtn span[yes]{margin-top: 10px; border-radius: 5px;} + +/* 通用提示 */ +body .layui-m-layer .layui-m-layer-msg{width: auto; max-width: 90%; margin: 0 auto; bottom: -150px; background-color: rgba(0,0,0,.7); color: #fff;} +.layui-m-layer-msg .layui-m-layercont{padding: 10px 20px;} + + + diff --git a/common/src/main/resources/static/layer/3.1/skin/default/icon-ext.png b/common/src/main/resources/static/layer/3.5/theme/default/icon-ext.png similarity index 100% rename from common/src/main/resources/static/layer/3.1/skin/default/icon-ext.png rename to common/src/main/resources/static/layer/3.5/theme/default/icon-ext.png diff --git a/common/src/main/resources/static/layer/3.1/skin/default/icon.png b/common/src/main/resources/static/layer/3.5/theme/default/icon.png similarity index 100% rename from common/src/main/resources/static/layer/3.1/skin/default/icon.png rename to common/src/main/resources/static/layer/3.5/theme/default/icon.png diff --git a/common/src/main/resources/static/layer/3.1/skin/default/layer.css b/common/src/main/resources/static/layer/3.5/theme/default/layer.css similarity index 88% rename from common/src/main/resources/static/layer/3.1/skin/default/layer.css rename to common/src/main/resources/static/layer/3.5/theme/default/layer.css index f33fd019..8bee53f4 100644 --- a/common/src/main/resources/static/layer/3.1/skin/default/layer.css +++ b/common/src/main/resources/static/layer/3.5/theme/default/layer.css @@ -1,190 +1,187 @@ -/** - - @Name: layer - @Author: 贤心 - - **/ - -/* *html{background-image: url(about:blank); background-attachment: fixed;} */ -html #layuicss-layer{display: none; position: absolute; width: 1989px;} - -/* common */ -.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;} -.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");} -.layui-layer{-webkit-overflow-scrolling: touch;} -.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; border-radius: 3px; box-shadow: 1px 1px 50px rgba(0,0,0,.3);} -.layui-layer-close{position:absolute;} -.layui-layer-content{position:relative;} -.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);} -.layui-layer-load{background:url(loading-1.gif) #eee center center no-repeat;} -.layui-layer-ico{ background:url(icon.png) no-repeat;} -.layui-layer-dialog .layui-layer-ico, -.layui-layer-setwin a, -.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;} - -.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;} -.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;} - -/* 动画 */ -.layer-anim{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;} - -@-webkit-keyframes layer-bounceIn { /* 默认 */ - 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} -} -@keyframes layer-bounceIn { - 0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)} - 100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)} -} -.layer-anim-00{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn} - -@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown} - -@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig} - -@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft} - -@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);-ms-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn} - -@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn} - -@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}} - -/* 标题栏 */ -.layui-layer-title{padding:0 80px 0 20px; height:42px; line-height:42px; border-bottom:1px solid #eee; font-size:14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background-color: #F8F8F8; border-radius: 3px 3px 0 0;} -.layui-layer-setwin{position:absolute; right:15px; *right:0; top:15px; font-size:0; line-height: initial;} -.layui-layer-setwin a{position:relative; width: 16px; height:16px; margin-left:10px; font-size:12px; _overflow:hidden;} -.layui-layer-setwin .layui-layer-min cite{position:absolute; width:14px; height:2px; left:0; top:50%; margin-top:-1px; background-color:#2E2D3C; cursor:pointer; _overflow:hidden;} -.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA; } -.layui-layer-setwin .layui-layer-max{background-position:-32px -40px;} -.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px;} -.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px;} -.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px;} -.layui-layer-setwin .layui-layer-close1{background-position: 1px -40px; cursor: pointer;} -.layui-layer-setwin .layui-layer-close1:hover{opacity:0.7;} -.layui-layer-setwin .layui-layer-close2{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-149px -31px; *right:-18px; _display:none;} -.layui-layer-setwin .layui-layer-close2:hover{ background-position:-180px -31px;} - -/* 按钮栏 */ -.layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;} -.layui-layer-btn a{height: 28px; line-height: 28px; margin: 5px 5px 0; padding: 0 15px; border: 1px solid #dedede; background-color:#fff; color: #333; border-radius: 3px; font-weight:400; cursor:pointer; text-decoration: none;} -.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;} -.layui-layer-btn a:active{opacity: 0.8;} -.layui-layer-btn .layui-layer-btn0{border-color: #1E9FFF; background-color: #1E9FFF; color:#fff;} -.layui-layer-btn-l{text-align: left;} -.layui-layer-btn-c{text-align: center;} - -/* 定制化 */ -.layui-layer-dialog{min-width:260px;} -.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;} -.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;} -.layui-layer-ico1{background-position:-30px 0 } -.layui-layer-ico2{background-position:-60px 0;} -.layui-layer-ico3{background-position:-90px 0;} -.layui-layer-ico4{background-position:-120px 0;} -.layui-layer-ico5{background-position:-150px 0;} -.layui-layer-ico6{background-position:-180px 0;} -.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;} -.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;} -.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;} -.layui-layer-hui .layui-layer-content{padding:12px 25px; text-align:center;} -.layui-layer-dialog .layui-layer-padding{padding: 20px 20px 20px 55px; text-align: left;} -.layui-layer-page .layui-layer-content{position:relative; overflow:auto;} -.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;} -.layui-layer-nobg{background:none;} -.layui-layer-iframe iframe{display: block; width: 100%; border-radius: 3px;} -/* .layui-layer-iframe, .layui-layer-iframe iframe {transition:top 0.2s ease-in-out;} 去掉动画IE下效果不好 */ - -.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;} -.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url(loading-0.gif) no-repeat;} -.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url(loading-1.gif) no-repeat;} -.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url(loading-2.gif) no-repeat;} -.layui-layer-tips{background: none; box-shadow:none; border:none;} -.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 8px 15px; font-size: 12px; _float:left; border-radius: 3px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;} -.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;} -.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;} -.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;} -.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;} -.layui-layer-tips i.layui-layer-TipsB{top:-8px;} -.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top: 5px; border-bottom-style:solid; border-bottom-color: #000;} -.layui-layer-tips i.layui-layer-TipsR{left:-8px;} -.layui-layer-tips i.layui-layer-TipsL{right:-8px;} - -/* skin */ -.layui-layer-lan[type="dialog"]{min-width:280px;} -.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;} -.layui-layer-lan .layui-layer-btn{padding: 5px 10px 10px; text-align: right; border-top:1px solid #E9E7E7} -.layui-layer-lan .layui-layer-btn a{background: #fff; border-color: #E9E7E7; color: #333;} -.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;} -.layui-layer-molv .layui-layer-title{background: #009f95; color:#fff; border: none;} -.layui-layer-molv .layui-layer-btn a{background: #009f95; border-color: #009f95;} -.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;} - - -/** - - @Name: layer拓展样式 - - */ - -.layui-layer-iconext{background:url(icon-ext.png) no-repeat;} - -/* prompt模式 */ -.layui-layer-prompt .layui-layer-input{display: block; width: 230px; height: 36px; margin: 0 auto; line-height: 30px; padding-left: 10px; border: 1px solid #e6e6e6; color: #333;} -.layui-layer-prompt textarea.layui-layer-input{width: 300px; height: 100px; line-height: 20px; padding: 6px 10px;} -.layui-layer-prompt .layui-layer-content{padding: 20px;} -.layui-layer-prompt .layui-layer-btn{padding-top: 0;} - -/* tab模式 */ -.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);} -.layui-layer-tab .layui-layer-title{padding-left:0; overflow: visible;} -.layui-layer-tab .layui-layer-title span{position:relative; float:left; min-width:80px; max-width:260px; padding:0 20px; text-align:center; cursor:default; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; cursor: pointer;} -.layui-layer-tab .layui-layer-title span.layui-this{height: 43px; border-left: 1px solid #eee; border-right: 1px solid #eee; background-color: #fff; z-index: 10;} -.layui-layer-tab .layui-layer-title span:first-child{border-left:none;} -.layui-layer-tabmain{line-height:24px; clear:both;} -.layui-layer-tabmain .layui-layer-tabli{display:none;} -.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;} - -/* photo模式 */ -.layui-layer-photos{-webkit-animation-duration: .8s; animation-duration: .8s;} -.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;} -.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;} -.layui-layer-imguide,.layui-layer-imgbar{display:none;} -.layui-layer-imgprev, .layui-layer-imgnext{position:absolute; top:50%; width:27px; _width:44px; height:44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());} -.layui-layer-imgprev{left:10px; background-position:-5px -5px; _background-position:-70px -5px;} -.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;} -.layui-layer-imgnext{right:10px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;} -.layui-layer-imgnext:hover{background-position:-33px -50px; _background-position:-120px -50px;} -.layui-layer-imgbar{position:absolute; left:0; bottom:0; width:100%; height:32px; line-height:32px; background-color:rgba(0,0,0,.8); background-color:#000\9; filter:Alpha(opacity=80); color:#fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;} -.layui-layer-imgtit{/*position:absolute; left:20px;*/} -.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;} -.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;} -.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;} -.layui-layer-imgtit em{padding-left:10px; font-style: normal;} - -/* 关闭动画 */ -@-webkit-keyframes layer-bounceOut { - 100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)} - 30% {-webkit-transform: scale(1.05); transform: scale(1.05)} - 0% {-webkit-transform: scale(1); transform: scale(1);} -} -@keyframes layer-bounceOut { - 100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);} - 30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);} - 0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);} -} -.layer-anim-close{-webkit-animation-name: layer-bounceOut; animation-name: layer-bounceOut; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.2s; animation-duration:.2s;} - -/* @media screen and (max-width: 1100px) { 没有标题的时候,关闭按钮显示不全 */ -/* .layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;} */ -/* } */ - -/* ThinkGem */ -.layui-layer-title {font-weight:bold;font-size:15px;background:#fff;height:45px;line-height:45px;} -.layui-layer-page .layui-layer-content {overflow-x:hidden;} -.layui-layer-page .layui-layer-content .form-file{padding-top:4px;} -.layui-layer-page .layui-layer-btn, .layui-layer-iframe .layui-layer-btn { - padding-top:3px;padding-bottom:10px;} -.layui-layer-btn .layui-layer-btn0{border-color:#367fa9;background-color:#367fa9;} -.layui-layer-btn a {height:auto;padding:0 12px;font-size:13px;background-color:#f4f4f4;} -.layui-layer.toast-top-full-width {min-width: 60%;} +/** + + @Name: layer + + **/ + +/* *html{background-image: url(about:blank); background-attachment: fixed;} */ +html #layuicss-layer{display: none; position: absolute; width: 1989px;} + +/* common */ +.layui-layer-shade, .layui-layer{position:fixed; _position:absolute; pointer-events: auto;} +.layui-layer-shade{top:0; left:0; width:100%; height:100%; _height:expression(document.body.offsetHeight+"px");} +.layui-layer{-webkit-overflow-scrolling: touch;} +.layui-layer{top:150px; left: 0; margin:0; padding:0; background-color:#fff; -webkit-background-clip: content; border-radius: 3px; box-shadow: 1px 1px 50px rgba(0,0,0,.3);} +.layui-layer-close{position:absolute;} +.layui-layer-content{position:relative; overflow: hidden;} +.layui-layer-border{border: 1px solid #B2B2B2; border: 1px solid rgba(0,0,0,.1); box-shadow: 1px 1px 5px rgba(0,0,0,.2);} +.layui-layer-load{background:url(loading-1.gif) #eee center center no-repeat;} +.layui-layer-ico{ background:url(icon.png) no-repeat;} +.layui-layer-dialog .layui-layer-ico, +.layui-layer-setwin a, +.layui-layer-btn a{display:inline-block; *display:inline; *zoom:1; vertical-align:top;} + +.layui-layer-move{display: none; position: fixed; *position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; cursor: move; opacity: 0; filter:alpha(opacity=0); background-color: #fff; z-index: 2147483647;} +.layui-layer-resize{position: absolute; width: 15px; height: 15px; right: 0; bottom: 0; cursor: se-resize;} + +/* 动画 */ +.layer-anim{-webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.3s; animation-duration:.3s;} + +@-webkit-keyframes layer-bounceIn { /* 默认 */ + 0% {opacity: 0; -webkit-transform: scale(.5); transform: scale(.5)} + 100% {opacity: 1; -webkit-transform: scale(1); transform: scale(1)} +} +@keyframes layer-bounceIn { + 0% {opacity: 0; -webkit-transform: scale(.5); -ms-transform: scale(.5); transform: scale(.5)} + 100% {opacity: 1; -webkit-transform: scale(1); -ms-transform: scale(1); transform: scale(1)} +} +.layer-anim-00{-webkit-animation-name: layer-bounceIn;animation-name: layer-bounceIn} + +@-webkit-keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInDown{0%{opacity:0;-webkit-transform:scale(.1) translateY(-2000px);-ms-transform:scale(.1) translateY(-2000px);transform:scale(.1) translateY(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateY(60px);-ms-transform:scale(.475) translateY(60px);transform:scale(.475) translateY(60px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-01{-webkit-animation-name:layer-zoomInDown;animation-name:layer-zoomInDown} + +@-webkit-keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);transform:translateY(0)}}@keyframes layer-fadeInUpBig{0%{opacity:0;-webkit-transform:translateY(2000px);-ms-transform:translateY(2000px);transform:translateY(2000px)}100%{opacity:1;-webkit-transform:translateY(0);-ms-transform:translateY(0);transform:translateY(0)}}.layer-anim-02{-webkit-animation-name:layer-fadeInUpBig;animation-name:layer-fadeInUpBig} + +@-webkit-keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}@keyframes layer-zoomInLeft{0%{opacity:0;-webkit-transform:scale(.1) translateX(-2000px);-ms-transform:scale(.1) translateX(-2000px);transform:scale(.1) translateX(-2000px);-webkit-animation-timing-function:ease-in-out;animation-timing-function:ease-in-out}60%{opacity:1;-webkit-transform:scale(.475) translateX(48px);-ms-transform:scale(.475) translateX(48px);transform:scale(.475) translateX(48px);-webkit-animation-timing-function:ease-out;animation-timing-function:ease-out}}.layer-anim-03{-webkit-animation-name:layer-zoomInLeft;animation-name:layer-zoomInLeft} + +@-webkit-keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}@keyframes layer-rollIn{0%{opacity:0;-webkit-transform:translateX(-100%) rotate(-120deg);-ms-transform:translateX(-100%) rotate(-120deg);transform:translateX(-100%) rotate(-120deg)}100%{opacity:1;-webkit-transform:translateX(0px) rotate(0deg);-ms-transform:translateX(0px) rotate(0deg);transform:translateX(0px) rotate(0deg)}}.layer-anim-04{-webkit-animation-name:layer-rollIn;animation-name:layer-rollIn} + +@keyframes layer-fadeIn{0%{opacity:0}100%{opacity:1}}.layer-anim-05{-webkit-animation-name:layer-fadeIn;animation-name:layer-fadeIn} + +@-webkit-keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);transform:translateX(10px)}}@keyframes layer-shake{0%,100%{-webkit-transform:translateX(0);-ms-transform:translateX(0);transform:translateX(0)}10%,30%,50%,70%,90%{-webkit-transform:translateX(-10px);-ms-transform:translateX(-10px);transform:translateX(-10px)}20%,40%,60%,80%{-webkit-transform:translateX(10px);-ms-transform:translateX(10px);transform:translateX(10px)}}.layer-anim-06{-webkit-animation-name:layer-shake;animation-name:layer-shake}@-webkit-keyframes fadeIn{0%{opacity:0}100%{opacity:1}} + +/* 标题栏 */ +.layui-layer-title{padding:0 80px 0 20px; height: 50px; line-height: 50px; border-bottom:1px solid #F0F0F0; font-size: 14px; color:#333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 2px 2px 0 0;} +.layui-layer-setwin{position:absolute; right: 15px; *right:0; top: 15px; font-size:0; line-height: initial;} +.layui-layer-setwin a{position:relative; width: 16px; height:16px; margin-left:10px; font-size:12px; _overflow:hidden;} +.layui-layer-setwin .layui-layer-min cite{position:absolute; width:14px; height:2px; left:0; top:50%; margin-top:-1px; background-color:#2E2D3C; cursor:pointer; _overflow:hidden;} +.layui-layer-setwin .layui-layer-min:hover cite{background-color:#2D93CA; } +.layui-layer-setwin .layui-layer-max{background-position:-32px -40px;} +.layui-layer-setwin .layui-layer-max:hover{background-position:-16px -40px;} +.layui-layer-setwin .layui-layer-maxmin{background-position:-65px -40px;} +.layui-layer-setwin .layui-layer-maxmin:hover{background-position:-49px -40px;} +.layui-layer-setwin .layui-layer-close1{background-position: 1px -40px; cursor: pointer;} +.layui-layer-setwin .layui-layer-close1:hover{opacity:0.7;} +.layui-layer-setwin .layui-layer-close2{position:absolute; right:-28px; top:-28px; width:30px; height:30px; margin-left:0; background-position:-149px -31px; *right:-18px; _display:none;} +.layui-layer-setwin .layui-layer-close2:hover{ background-position:-180px -31px;} + +/* 按钮栏 */ +.layui-layer-btn{text-align: right; padding: 0 15px 12px; pointer-events: auto; user-select: none; -webkit-user-select: none;} +.layui-layer-btn a{height: 28px; line-height: 28px; margin: 5px 5px 0; padding: 0 15px; border: 1px solid #dedede; background-color:#fff; color: #333; border-radius: 3px; font-weight:400; cursor:pointer; text-decoration: none;} +.layui-layer-btn a:hover{opacity: 0.9; text-decoration: none;} +.layui-layer-btn a:active{opacity: 0.8;} +.layui-layer-btn .layui-layer-btn0{border-color: #1E9FFF; background-color: #1E9FFF; color:#fff;} +.layui-layer-btn-l{text-align: left;} +.layui-layer-btn-c{text-align: center;} + +/* 定制化 */ +.layui-layer-dialog{min-width: 300px;} +.layui-layer-dialog .layui-layer-content{position: relative; padding:20px; line-height:24px; word-break: break-all; overflow:hidden; font-size:14px; overflow-x: hidden; overflow-y:auto;} +.layui-layer-dialog .layui-layer-content .layui-layer-ico{position:absolute; top:16px; left:15px; _left:-40px; width:30px; height:30px;} +.layui-layer-ico1{background-position:-30px 0 } +.layui-layer-ico2{background-position:-60px 0;} +.layui-layer-ico3{background-position:-90px 0;} +.layui-layer-ico4{background-position:-120px 0;} +.layui-layer-ico5{background-position:-150px 0;} +.layui-layer-ico6{background-position:-180px 0;} +.layui-layer-rim{border:6px solid #8D8D8D; border:6px solid rgba(0,0,0,.3); border-radius:5px; box-shadow: none;} +.layui-layer-msg{min-width:180px; border:1px solid #D3D4D3; box-shadow: none;} +.layui-layer-hui{min-width:100px; background-color: #000; filter:alpha(opacity=60); background-color: rgba(0,0,0,0.6); color: #fff; border:none;} +.layui-layer-hui .layui-layer-content{padding:12px 25px; text-align:center;} +.layui-layer-dialog .layui-layer-padding{padding: 20px 20px 20px 55px; text-align: left;} +.layui-layer-page .layui-layer-content{position:relative; overflow:auto;} +.layui-layer-page .layui-layer-btn,.layui-layer-iframe .layui-layer-btn{padding-top:10px;} +.layui-layer-nobg{background:none;} +.layui-layer-iframe iframe{display: block; width: 100%; border-radius: 3px;} + +.layui-layer-loading{border-radius:100%; background:none; box-shadow:none; border:none;} +.layui-layer-loading .layui-layer-content{width:60px; height:24px; background:url(loading-0.gif) no-repeat;} +.layui-layer-loading .layui-layer-loading1{width:37px; height:37px; background:url(loading-1.gif) no-repeat;} +.layui-layer-loading .layui-layer-loading2, .layui-layer-ico16{width:32px; height:32px; background:url(loading-2.gif) no-repeat;} +.layui-layer-tips{background: none; box-shadow:none; border:none;} +.layui-layer-tips .layui-layer-content{position: relative; line-height: 22px; min-width: 12px; padding: 8px 15px; font-size: 12px; _float:left; border-radius: 3px; box-shadow: 1px 1px 3px rgba(0,0,0,.2); background-color: #000; color: #fff;} +.layui-layer-tips .layui-layer-close{right:-2px; top:-1px;} +.layui-layer-tips i.layui-layer-TipsG{ position:absolute; width:0; height:0; border-width:8px; border-color:transparent; border-style:dashed; *overflow:hidden;} +.layui-layer-tips i.layui-layer-TipsT, .layui-layer-tips i.layui-layer-TipsB{left:5px; border-right-style:solid; border-right-color: #000;} +.layui-layer-tips i.layui-layer-TipsT{bottom:-8px;} +.layui-layer-tips i.layui-layer-TipsB{top:-8px;} +.layui-layer-tips i.layui-layer-TipsR, .layui-layer-tips i.layui-layer-TipsL{top: 5px; border-bottom-style:solid; border-bottom-color: #000;} +.layui-layer-tips i.layui-layer-TipsR{left:-8px;} +.layui-layer-tips i.layui-layer-TipsL{right:-8px;} + +/* skin */ +.layui-layer-lan[type="dialog"]{min-width:280px;} +.layui-layer-lan .layui-layer-title{background:#4476A7; color:#fff; border: none;} +.layui-layer-lan .layui-layer-btn{padding: 5px 10px 10px; text-align: right; border-top:1px solid #E9E7E7} +.layui-layer-lan .layui-layer-btn a{background: #fff; border-color: #E9E7E7; color: #333;} +.layui-layer-lan .layui-layer-btn .layui-layer-btn1{background:#C9C5C5;} +.layui-layer-molv .layui-layer-title{background: #009f95; color:#fff; border: none;} +.layui-layer-molv .layui-layer-btn a{background: #009f95; border-color: #009f95;} +.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1;} + + +/** + + @Name: layer拓展样式 + + */ + +.layui-layer-iconext{background:url(icon-ext.png) no-repeat;} + +/* prompt模式 */ +.layui-layer-prompt .layui-layer-input{display: block; width: 260px; height: 36px; margin: 0 auto; line-height: 30px; padding-left: 10px; border: 1px solid #e6e6e6; color: #333;} +.layui-layer-prompt textarea.layui-layer-input{width: 300px; height: 100px; line-height: 20px; padding: 6px 10px;} +.layui-layer-prompt .layui-layer-content{padding: 20px;} +.layui-layer-prompt .layui-layer-btn{padding-top: 0;} + +/* tab模式 */ +.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4);} +.layui-layer-tab .layui-layer-title{padding-left:0; overflow: visible;} +.layui-layer-tab .layui-layer-title span{position:relative; float:left; min-width:80px; max-width: 300px; padding:0 20px; text-align:center; cursor:default; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; cursor: pointer;} +.layui-layer-tab .layui-layer-title span.layui-this{height: 51px; border-left: 1px solid #eee; border-right: 1px solid #eee; background-color: #fff; z-index: 10;} +.layui-layer-tab .layui-layer-title span:first-child{border-left:none;} +.layui-layer-tabmain{line-height:24px; clear:both;} +.layui-layer-tabmain .layui-layer-tabli{display:none;} +.layui-layer-tabmain .layui-layer-tabli.layui-this{display: block;} + +/* photo模式 */ +.layui-layer-photos{background: none; box-shadow: none;} +.layui-layer-photos .layui-layer-content{overflow:hidden; text-align: center;} +.layui-layer-photos .layui-layer-phimg img{position: relative; width:100%; display: inline-block; *display:inline; *zoom:1; vertical-align:top;} +.layui-layer-imgprev, .layui-layer-imgnext{position: fixed; top: 50%; width: 27px; _width: 44px; height: 44px; margin-top:-22px; outline:none;blr:expression(this.onFocus=this.blur());} +.layui-layer-imgprev{left: 30px; background-position:-5px -5px; _background-position:-70px -5px;} +.layui-layer-imgprev:hover{background-position:-33px -5px; _background-position:-120px -5px;} +.layui-layer-imgnext{right: 30px; _right:8px; background-position:-5px -50px; _background-position:-70px -50px;} +.layui-layer-imgnext:hover{background-position: -33px -50px; _background-position: -120px -50px;} +.layui-layer-imgbar{position: fixed; left:0; right: 0; bottom:0; width:100%; height: 40px; line-height: 40px; background-color:#000\9; filter:Alpha(opacity=60); background-color: rgba(2,0,0,.35); color: #fff; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size:0;} +.layui-layer-imgtit{/*position:absolute; left:20px;*/} +.layui-layer-imgtit *{display:inline-block; *display:inline; *zoom:1; vertical-align:top; font-size:12px;} +.layui-layer-imgtit a{max-width:65%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; color:#fff;} +.layui-layer-imgtit a:hover{color:#fff; text-decoration:underline;} +.layui-layer-imgtit em{padding-left:10px; font-style: normal;} + +/* 关闭动画 */ +@-webkit-keyframes layer-bounceOut { + 100% {opacity: 0; -webkit-transform: scale(.7); transform: scale(.7)} + 30% {-webkit-transform: scale(1.05); transform: scale(1.05)} + 0% {-webkit-transform: scale(1); transform: scale(1);} +} +@keyframes layer-bounceOut { + 100% {opacity: 0; -webkit-transform: scale(.7); -ms-transform: scale(.7); transform: scale(.7);} + 30% {-webkit-transform: scale(1.05); -ms-transform: scale(1.05); transform: scale(1.05);} + 0% {-webkit-transform: scale(1); -ms-transform: scale(1);transform: scale(1);} +} +.layer-anim-close{-webkit-animation-name: layer-bounceOut; animation-name: layer-bounceOut; -webkit-animation-fill-mode: both; animation-fill-mode: both; -webkit-animation-duration:.2s; animation-duration:.2s;} + +/* @media screen and (max-width: 1100px) { 没有标题的时候,关闭按钮显示不全 */ +/* .layui-layer-iframe{overflow-y: auto; -webkit-overflow-scrolling: touch;} */ +/* } */ + +/* ThinkGem */ +.layui-layer-title {font-weight:bold;font-size:15px;background:#fff;height:45px;line-height:45px;} +.layui-layer-page .layui-layer-content {overflow-x:hidden;} +.layui-layer-page .layui-layer-content .form-file{padding-top:4px;} +.layui-layer-page .layui-layer-btn, .layui-layer-iframe .layui-layer-btn { + padding-top:3px;padding-bottom:10px;} +.layui-layer-btn .layui-layer-btn0{border-color:#367fa9;background-color:#367fa9;} +.layui-layer-btn a {height:auto;padding:0 12px;font-size:13px;background-color:#f4f4f4;} +.layui-layer.toast-top-full-width {min-width: 60%;} diff --git a/common/src/main/resources/static/layer/3.1/skin/default/loading-0.gif b/common/src/main/resources/static/layer/3.5/theme/default/loading-0.gif similarity index 100% rename from common/src/main/resources/static/layer/3.1/skin/default/loading-0.gif rename to common/src/main/resources/static/layer/3.5/theme/default/loading-0.gif diff --git a/common/src/main/resources/static/layer/3.1/skin/default/loading-1.gif b/common/src/main/resources/static/layer/3.5/theme/default/loading-1.gif similarity index 100% rename from common/src/main/resources/static/layer/3.1/skin/default/loading-1.gif rename to common/src/main/resources/static/layer/3.5/theme/default/loading-1.gif diff --git a/common/src/main/resources/static/layer/3.1/skin/default/loading-2.gif b/common/src/main/resources/static/layer/3.5/theme/default/loading-2.gif similarity index 100% rename from common/src/main/resources/static/layer/3.1/skin/default/loading-2.gif rename to common/src/main/resources/static/layer/3.5/theme/default/loading-2.gif diff --git a/common/src/main/resources/static/layer/3.5/theme/moon/default.png b/common/src/main/resources/static/layer/3.5/theme/moon/default.png new file mode 100644 index 00000000..77dfaf30 Binary files /dev/null and b/common/src/main/resources/static/layer/3.5/theme/moon/default.png differ diff --git a/common/src/main/resources/static/layer/3.5/theme/moon/style.css b/common/src/main/resources/static/layer/3.5/theme/moon/style.css new file mode 100644 index 00000000..e8264cec --- /dev/null +++ b/common/src/main/resources/static/layer/3.5/theme/moon/style.css @@ -0,0 +1,140 @@ +/* + * layer皮肤 + * + */ + +html #layui_layer_skinmoonstylecss { + display: none; + position: absolute; + width: 1989px; +} + +body .layer-ext-moon[type="dialog"] { + min-width: 320px; +} +body .layer-ext-moon-msg[type="dialog"]{min-width:200px;} +body .layer-ext-moon .layui-layer-title { + background: #f6f6f6; + color: #212a31; + font-size: 16px; + font-weight: bold; + height: 46px; + line-height: 46px; + border-bottom: 1px solid #D5D5D5; +} + + + +body .layer-ext-moon .layui-layer-content .layui-layer-ico { + height: 32px; + width: 32px; + top:18.5px; +} +body .layer-ext-moon .layui-layer-ico0 { + background: url(default.png) no-repeat -96px 0; + ; +} +body .layer-ext-moon .layui-layer-ico1 { + background: url(default.png) no-repeat -224px 0; + ; +} +body .layer-ext-moon .layui-layer-ico2 { + background: url(default.png) no-repeat -192px 0; +} +body .layer-ext-moon .layui-layer-ico3 { + background: url(default.png) no-repeat -160px 0; +} +body .layer-ext-moon .layui-layer-ico4 { + background: url(default.png) no-repeat -320px 0; +} +body .layer-ext-moon .layui-layer-ico5 { + background: url(default.png) no-repeat -288px 0; +} +body .layer-ext-moon .layui-layer-ico6 { + background: url(default.png) -256px 0; +} +body .layer-ext-moon .layui-layer-ico7 { + background: url(default.png) no-repeat -128px 0; +} +body .layer-ext-moon .layui-layer-setwin { + top: 15px; + right: 15px; +} +body .layer-ext-moon .layui-layer-setwin a { + width: 16px; + height: 16px; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-min cite:hover { + background-color: #56abe4; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-max { + background: url(default.png) no-repeat -80px 0; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-max:hover { + background: url(default.png) no-repeat -64px 0; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-maxmin { + background: url(default.png) no-repeat -32px 0; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-maxmin:hover { + background: url(default.png) no-repeat -16px 0; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-close1,body .layer-ext-moon .layui-layer-setwin .layui-layer-close2 { + background: url(default.png) 0 0; +} +body .layer-ext-moon .layui-layer-setwin .layui-layer-close1:hover,body .layer-ext-moon .layui-layer-setwin .layui-layer-close2:hover { + background: url(default.png) -48px 0; +} +body .layer-ext-moon .layui-layer-padding{padding-top: 24px;} +body .layer-ext-moon .layui-layer-btn { + text-align: center; + padding-top: 15px; + padding-bottom:15px; + background: #f0f4f7; + border-top: 1px #c7c7c7 solid; +} +body .layer-ext-moon .layui-layer-btn a { + font-size: 12px; + font-weight: normal; + margin: 0 3px; + margin-right: 7px; + margin-left: 7px; + padding: 6px 20px; + color: #fff; + border: 1px solid #0064b6; + background: #0071ce; + border-radius: 3px; + display: inline-block; + height: 20px; + line-height: 20px; + text-align: center; + vertical-align: middle; + background-repeat: no-repeat; + text-decoration: none; + outline: none; +} +body .layer-ext-moon .layui-layer-btn .layui-layer-btn0 { + background: #0071ce; +} +body .layer-ext-moon .layui-layer-btn .layui-layer-btn1 { + background: #fff; + color: #404a58; + border: 1px solid #c0c4cd; + border-radius: 3px; +} +body .layer-ext-moon .layui-layer-btn .layui-layer-btn2 { + background: #f60; + color: #fff; + border: 1px solid #f60; + border-radius: 3px; +} +body .layer-ext-moon .layui-layer-btn .layui-layer-btn3 { + background: #f00; + color: #fff; + border: 1px solid #f00; + border-radius: 3px; +} + +body .layer-ext-moon .layui-layer-title span.layui-layer-tabnow{ + height:47px; +} diff --git a/modules/cms/src/main/resources/views/modules/cmsfront/themes/default/search.html b/modules/cms/src/main/resources/views/modules/cmsfront/themes/default/search.html index 03192892..a93a9765 100644 --- a/modules/cms/src/main/resources/views/modules/cmsfront/themes/default/search.html +++ b/modules/cms/src/main/resources/views/modules/cmsfront/themes/default/search.html @@ -1,5 +1,5 @@ <% layout('layouts/default.html', {title: '全站搜索', libs: []}){ %> - +