├── .settings ├── org.eclipse.wst.jsdt.ui.superType.name ├── org.eclipse.wst.jsdt.ui.superType.container ├── org.eclipse.core.resources.prefs ├── com.genuitec.eclipse.core.prefs ├── org.eclipse.jdt.core.prefs ├── org.eclipse.wst.common.project.facet.core.xml ├── org.eclipse.wst.common.component └── .jsdtscope ├── WebRoot ├── META-INF │ └── MANIFEST.MF ├── images │ ├── down.png │ ├── link.cur │ ├── cutImg │ │ ├── 1.jpg │ │ └── 2.jpg │ ├── default.cur │ └── loading.gif ├── css │ ├── kr-loading.css │ ├── comment.css │ ├── style.css.bak │ └── style.css ├── js │ ├── layer │ │ ├── skin │ │ │ └── default │ │ │ │ ├── icon.png │ │ │ │ ├── icon-ext.png │ │ │ │ ├── loading-0.gif │ │ │ │ ├── loading-1.gif │ │ │ │ ├── loading-2.gif │ │ │ │ └── layer.css │ │ ├── mobile │ │ │ ├── layer.js │ │ │ └── need │ │ │ │ └── layer.css │ │ └── layer.js │ ├── jquery.lazyload.min.js │ ├── krry.js │ ├── jquery.onepage-scroll.js │ └── util │ │ ├── kr_util.js │ │ └── sg.js ├── WEB-INF │ ├── classes │ │ └── com │ │ │ └── krry │ │ │ └── WallPaper.class │ └── web.xml └── index.jsp ├── .gitattributes ├── .classpath ├── .project ├── README.md └── src └── com └── krry └── WallPaper.java /.settings/org.eclipse.wst.jsdt.ui.superType.name: -------------------------------------------------------------------------------- 1 | Window -------------------------------------------------------------------------------- /WebRoot/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Class-Path: 3 | 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.jsdt.ui.superType.container: -------------------------------------------------------------------------------- 1 | org.eclipse.wst.jsdt.launching.baseBrowserLibrary -------------------------------------------------------------------------------- /WebRoot/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/down.png -------------------------------------------------------------------------------- /WebRoot/images/link.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/link.cur -------------------------------------------------------------------------------- /WebRoot/css/kr-loading.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/css/kr-loading.css -------------------------------------------------------------------------------- /WebRoot/images/cutImg/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/cutImg/1.jpg -------------------------------------------------------------------------------- /WebRoot/images/cutImg/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/cutImg/2.jpg -------------------------------------------------------------------------------- /WebRoot/images/default.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/default.cur -------------------------------------------------------------------------------- /WebRoot/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/images/loading.gif -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//WebRoot/index.jsp=UTF-8 3 | -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/js/layer/skin/default/icon.png -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/icon-ext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/js/layer/skin/default/icon-ext.png -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/loading-0.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/js/layer/skin/default/loading-0.gif -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/loading-1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/js/layer/skin/default/loading-1.gif -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/loading-2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/js/layer/skin/default/loading-2.gif -------------------------------------------------------------------------------- /WebRoot/WEB-INF/classes/com/krry/WallPaper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Krryxa/krry_wallpaper/HEAD/WebRoot/WEB-INF/classes/com/krry/WallPaper.class -------------------------------------------------------------------------------- /.settings/com.genuitec.eclipse.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | validator.Checked=WebRoot/js/krry.js,WebRoot/js/layer/mobile/layer.js,WebRoot/js/jquery-1.11.2.min.js 3 | validator.Unchecked= 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 4 | org.eclipse.jdt.core.compiler.compliance=1.6 5 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 6 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 7 | org.eclipse.jdt.core.compiler.source=1.6 8 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.project.facet.core.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.settings/org.eclipse.wst.common.component: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.settings/.jsdtscope: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /WebRoot/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | krry_wallpaper 4 | 5 | This is the description of my J2EE component 6 | This is the display name of my J2EE component 7 | WallPaper 8 | com.krry.WallPaper 9 | 10 | 11 | 12 | 13 | WallPaper 14 | /krry/WallPaper 15 | 16 | 17 | 18 | 19 | index.html 20 | index.htm 21 | index.jsp 22 | default.html 23 | default.htm 24 | default.jsp 25 | 26 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | krry_wallpaper 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.wst.jsdt.core.javascriptValidator 10 | 11 | 12 | 13 | 14 | org.eclipse.jdt.core.javabuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.wst.common.project.facet.core.builder 20 | 21 | 22 | 23 | 24 | org.eclipse.wst.validation.validationbuilder 25 | 26 | 27 | 28 | 29 | com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator 30 | 31 | 32 | 33 | 34 | com.genuitec.eclipse.ast.deploy.core.DeploymentBuilder 35 | 36 | 37 | 38 | 39 | 40 | org.eclipse.jem.workbench.JavaEMFNature 41 | org.eclipse.wst.common.modulecore.ModuleCoreNature 42 | org.eclipse.wst.common.project.facet.core.nature 43 | org.eclipse.jdt.core.javanature 44 | org.eclipse.wst.jsdt.core.jsNature 45 | 46 | 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # krry_wallpaper 2 | # 高清壁纸的api,壁纸下载 3 | 4 | ## 采用瀑布流展示壁纸 5 | ### 可下载 6 | 7 | - 接入是360浏览器图片api,自动更新,种类繁多 8 | - js瀑布流(纯css瀑布流不支持横向排列展示) 9 | - ajax 更新 10 | 11 | ## 项目截图 12 | ![](https://github.com/Krryxa/krry_wallpaper/blob/master/WebRoot/images/cutImg/1.jpg) 13 | ![](https://github.com/Krryxa/krry_wallpaper/blob/master/WebRoot/images/cutImg/2.jpg) 14 | 15 | 16 | ## 接口描述 17 | 18 | - 获取壁纸分类 19 | > http://cdn.apc.360.cn/index.php?c=WallPaper&a=getAllCategoriesV2&from=360chrome 20 |
21 | 这个接口很简单,直接请求上述网址,就可以得到 json 数据。返回的数据中有个 data 数组,其中的“name”就是获取到的壁纸分类名,“id”就是这个分类对应的ID值。 22 |

23 | 24 | 25 | - 根据壁纸分类ID获取分类下壁纸图片 26 | > http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid=${分类ID}&start=${从第几张图开始}&count=${每次加载的数量}&from=360chrome 27 |
28 | 通过这个接口获取到的数据很多,但主要要用到的只有几个。一是 data 数组中的 url 值,就是我们要获取的图片链接。 29 |
30 | 它的格式类似于:http://p15.qhimg.com/bdr/__85/t0151ad4ac41239cb58.jpg 31 |
32 | 我们可以根据它来获取这张图片的指定分辨率以及指定画质的图片,以上图为例,如果我们要获取分辨率为 1024*768 ,画质为 80 (最高为100)的图片,只需将上述链接的 “bdr/__85” 替换为 “bdm/1024_768_80” 即可。替换后的图片链接如下:
33 | > http://p19.qhimg.com/bdm/1024_768_80/t0151ad4ac41239cb58.jpg 34 |
35 | 除了 url 值,data 数组中的 tag 是图片对应的标签,如果需要也可以进行获取。 36 |

37 | 38 | 39 | - 获取最近更新的壁纸 40 | > http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByOrder&order=create_time&start=${从第几张图开始}&count=${每次加载的数量}&from=360chrome 41 |
42 | 这个接口的参数是固定的,并且获取到的数据格式与上面一个接口一样。这里就不再描述了 43 |

44 | 45 | - 用于下载图片的api: 46 | > http://image.baidu.com/search/down?tn=download&word=download&ie=utf8&fr=detail&url= 47 | 48 | 49 | - 项目地址:https://www.ainyi.com/krry_wallpaper 50 | - My blog:https://www.ainyi.com 51 | -------------------------------------------------------------------------------- /WebRoot/index.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 桌面壁纸 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
最新壁纸
24 | 32 |
33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/com/krry/WallPaper.java: -------------------------------------------------------------------------------- 1 | package com.krry; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | import java.net.HttpURLConnection; 8 | import java.net.URL; 9 | import java.net.URLConnection; 10 | 11 | import javax.servlet.ServletException; 12 | import javax.servlet.http.HttpServlet; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | 16 | public class WallPaper extends HttpServlet { 17 | 18 | private static final long serialVersionUID = 1L; 19 | 20 | public void doGet(HttpServletRequest request, HttpServletResponse response) 21 | throws ServletException, IOException { 22 | 23 | String url = request.getParameter("url"); 24 | URL localURL = new URL(url); 25 | URLConnection connection = localURL.openConnection(); 26 | HttpURLConnection httpURLConnection = (HttpURLConnection) connection; 27 | httpURLConnection.setRequestProperty("Accept-Charset", "utf-8"); 28 | httpURLConnection.setRequestProperty("Content-Type","application/text"); 29 | 30 | InputStream inputStream = null; 31 | InputStreamReader inputStreamReader = null; 32 | BufferedReader reader = null; 33 | StringBuffer resultBuffer = new StringBuffer(); 34 | String tempLine = null; 35 | 36 | try { 37 | inputStream = httpURLConnection.getInputStream(); 38 | inputStreamReader = new InputStreamReader(inputStream); 39 | reader = new BufferedReader(inputStreamReader); 40 | 41 | while ((tempLine = reader.readLine()) != null) { 42 | resultBuffer.append(tempLine); 43 | } 44 | 45 | } finally { 46 | if (reader != null) { 47 | reader.close(); 48 | } 49 | if (inputStreamReader != null) { 50 | inputStreamReader.close(); 51 | } 52 | if (inputStream != null) { 53 | inputStream.close(); 54 | } 55 | 56 | } 57 | //响应到ajax 58 | response.getWriter().println(resultBuffer.toString()); 59 | 60 | } 61 | 62 | @Override 63 | protected void doPost(HttpServletRequest req, HttpServletResponse resp) 64 | throws ServletException, IOException { 65 | // TODO Auto-generated method stub 66 | doGet(req, resp); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /WebRoot/css/comment.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8";/**{word-wrap:break-word;;outline:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;} 2 | */ 3 | input,textarea{word-wrap:none;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;} 4 | 5 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td,span{padding:0;margin:0;} 6 | body{cursor:url("../images/default.cur"),default;font:normal 14px/1.5em pbfont,"微软雅黑","冬青黑体简体中文 w3","宋体";overflow:auto;} 7 | fieldset,img,html,body,iframe{border:0;cursor:url("../images/default.cur"),default;} 8 | /** 重置表格元素 **/ 9 | table{border-collapse:collapse;border-spacing:0;} 10 | ol,ul{list-style:none;} 11 | address,caption,cite,code,dfn,em,strong,th,var{font-weight:normal;font-style:normal;} 12 | caption,th{text-align:left;} 13 | em,i,small,caption,th{font-weight:normal;font-style:normal;font-size:100%;} 14 | h1,h2,h3,h4,h5,h6,em{font-weight:normal;} 15 | q:before,q:after{content:'';} 16 | .clearfix{*zoom:1;clear:both;} 17 | .clearfix:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0;} 18 | a{cursor:url("../images/link.cur"),pointer;color:#54504C;text-decoration:none;} 19 | img{border:0;vertical-align:middle;-webkit-user-select:none; 20 | -moz-user-select:none; 21 | -ms-user-select:none; 22 | user-select:none;} 23 | a,button{outline:none;border:0;} 24 | input,select{border:1px solid #ccc;font-family:inherit;} 25 | button::-moz-focus-inner{border:0;padding:0;margin:0;} 26 | textarea,input,button,select{outline:0;font-size:inherit;line-height:inherit;color:inherit;font-family:inherit;} 27 | textarea{overflow:auto;resize:none;font-family:inherit;} 28 | 29 | /* 滚动条优化 */ 30 | ::-webkit-scrollbar{width: 8px; 31 | height: 8px;} 32 | ::-webkit-scrollbar-track{background-color: transparent; 33 | -webkit-border-radius: 2em; 34 | -moz-border-radius: 2em; 35 | border-radius: 2em;} 36 | ::-webkit-scrollbar-track-piece{background:#fff;} 37 | ::-webkit-scrollbar-thumb{background-color: #ff4343; background-image: -webkit-linear-gradient(45deg,rgba(255,255,255,.4) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.4) 75%,transparent 75%,transparent); 38 | -webkit-border-radius: 2em; 39 | -moz-border-radius: 2em;border-radius: 2em;} 40 | ::-webkit-scrollbar-thumb:hover{cursor:url("../images/link.cur"),pointer;background-color: #e67412;} 41 | ::-webkit-scrollbar-corner{background:#535353;} 42 | ::-webkit-scrollbar-resizer{background:#FF0BEE;} 43 | scrollbar{-moz-appearance:none !important;background:rgb(0,255,0) !important;} 44 | scrollbarbutton{-moz-appearance:none !important;background-color:rgb(0,0,255) !important;} 45 | scrollbarbutton:hover{-moz-appearance:none !important;background-color:rgb(255,0,0) !important;} 46 | /* 隐藏上下箭头 */ 47 | scrollbarbutton{display:none !important;} 48 | /* 纵向滚动条宽度 */ 49 | scrollbar[orient="vertical"]{min-width:12px !important;} 50 | ::selection{background:#FF5252;color:#fff;} -------------------------------------------------------------------------------- /WebRoot/js/layer/mobile/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer mobile-v2.0.0 Web弹层组件 MIT License http://layer.layui.com/mobile By 贤心 */ 2 | ;!function(e){"use strict";var t=document,n="querySelectorAll",i="getElementsByClassName",a=function(e){return t[n](e)},s={type:0,shade:!0,shadeClose:!0,fixed:!0,anim:"scale"},l={extend:function(e){var t=JSON.parse(JSON.stringify(s));for(var n in e)t[n]=e[n];return t},timer:{},end:{}};l.touch=function(e,t){e.addEventListener("click",function(e){t.call(this,e)},!1)};var r=0,o=["layui-m-layer"],c=function(e){var t=this;t.config=l.extend(e),t.view()};c.prototype.view=function(){var e=this,n=e.config,s=t.createElement("div");e.id=s.id=o[0]+r,s.setAttribute("class",o[0]+" "+o[0]+(n.type||0)),s.setAttribute("index",r);var l=function(){var e="object"==typeof n.title;return n.title?'

'+(e?n.title[0]:n.title)+"

":""}(),c=function(){"string"==typeof n.btn&&(n.btn=[n.btn]);var e,t=(n.btn||[]).length;return 0!==t&&n.btn?(e=''+n.btn[0]+"",2===t&&(e=''+n.btn[1]+""+e),'
'+e+"
"):""}();if(n.fixed||(n.top=n.hasOwnProperty("top")?n.top:100,n.style=n.style||"",n.style+=" top:"+(t.body.scrollTop+n.top)+"px"),2===n.type&&(n.content='

'+(n.content||"")+"

"),n.skin&&(n.anim="up"),"msg"===n.skin&&(n.shade=!1),s.innerHTML=(n.shade?"
':"")+'
"+l+'
'+n.content+"
"+c+"
",!n.type||2===n.type){var d=t[i](o[0]+n.type),y=d.length;y>=1&&layer.close(d[0].getAttribute("index"))}document.body.appendChild(s);var u=e.elem=a("#"+e.id)[0];n.success&&n.success(u),e.index=r++,e.action(n,u)},c.prototype.action=function(e,t){var n=this;e.time&&(l.timer[n.index]=setTimeout(function(){layer.close(n.index)},1e3*e.time));var a=function(){var t=this.getAttribute("type");0==t?(e.no&&e.no(),layer.close(n.index)):e.yes?e.yes(n.index):layer.close(n.index)};if(e.btn)for(var s=t[i]("layui-m-layerbtn")[0].children,r=s.length,o=0;oj.failure_limit)return!1}else c.trigger("appear"),b=0})}var h,i=this,j={threshold:0,failure_limit:0,event:"scroll",effect:"show",container:b,data_attribute:"original",skip_invisible:!0,appear:null,load:null,placeholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC"};return f&&(d!==f.failurelimit&&(f.failure_limit=f.failurelimit,delete f.failurelimit),d!==f.effectspeed&&(f.effect_speed=f.effectspeed,delete f.effectspeed),a.extend(j,f)),h=j.container===d||j.container===b?e:a(j.container),0===j.event.indexOf("scroll")&&h.bind(j.event,function(){return g()}),this.each(function(){var b=this,c=a(b);b.loaded=!1,(c.attr("src")===d||c.attr("src")===!1)&&c.is("img")&&c.attr("src",j.placeholder),c.one("appear",function(){if(!this.loaded){if(j.appear){var d=i.length;j.appear.call(b,d,j)}a("").bind("load",function(){var d=c.attr("data-"+j.data_attribute);c.hide(),c.is("img")?c.attr("src",d):c.css("background-image","url('"+d+"')"),c[j.effect](j.effect_speed),b.loaded=!0;var e=a.grep(i,function(a){return!a.loaded});if(i=a(e),j.load){var f=i.length;j.load.call(b,f,j)}}).attr("src",c.attr("data-"+j.data_attribute))}}),0!==j.event.indexOf("scroll")&&c.bind(j.event,function(){b.loaded||c.trigger("appear")})}),e.bind("resize",function(){g()}),/(?:iphone|ipod|ipad).*os 5/gi.test(navigator.appVersion)&&e.bind("pageshow",function(b){b.originalEvent&&b.originalEvent.persisted&&i.each(function(){a(this).trigger("appear")})}),a(c).ready(function(){g()}),this},a.belowthefold=function(c,f){var g;return g=f.container===d||f.container===b?(b.innerHeight?b.innerHeight:e.height())+e.scrollTop():a(f.container).offset().top+a(f.container).height(),g<=a(c).offset().top-f.threshold},a.rightoffold=function(c,f){var g;return g=f.container===d||f.container===b?e.width()+e.scrollLeft():a(f.container).offset().left+a(f.container).width(),g<=a(c).offset().left-f.threshold},a.abovethetop=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollTop():a(f.container).offset().top,g>=a(c).offset().top+f.threshold+a(c).height()},a.leftofbegin=function(c,f){var g;return g=f.container===d||f.container===b?e.scrollLeft():a(f.container).offset().left,g>=a(c).offset().left+f.threshold+a(c).width()},a.inviewport=function(b,c){return!(a.rightoffold(b,c)||a.leftofbegin(b,c)||a.belowthefold(b,c)||a.abovethetop(b,c))},a.extend(a.expr[":"],{"below-the-fold":function(b){return a.belowthefold(b,{threshold:0})},"above-the-top":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-screen":function(b){return a.rightoffold(b,{threshold:0})},"left-of-screen":function(b){return!a.rightoffold(b,{threshold:0})},"in-viewport":function(b){return a.inviewport(b,{threshold:0})},"above-the-fold":function(b){return!a.belowthefold(b,{threshold:0})},"right-of-fold":function(b){return a.rightoffold(b,{threshold:0})},"left-of-fold":function(b){return!a.rightoffold(b,{threshold:0})}})}(jQuery,window,document); -------------------------------------------------------------------------------- /WebRoot/css/style.css.bak: -------------------------------------------------------------------------------- 1 | 2 | .header{ 3 | position: fixed; 4 | z-index: 99999; 5 | height: 50px; 6 | top:0; 7 | width: 100%; 8 | line-height: 50px; 9 | font-size: 16px; 10 | background-color: #fff; 11 | opacity: 0.77; 12 | -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=77); 13 | filter: alpha(opacity=77); 14 | transition: all 0.25s ease; 15 | -webkit-transition: all 0.25s ease; 16 | -moz-transition: all 0.25s ease; 17 | -o-transition: all 0.25s ease; 18 | -ms-transition: all 0.25s ease; 19 | } 20 | .header .h_left{ 21 | float: left; 22 | margin-left: 29px; 23 | font-size: 24px; 24 | background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0, #f22), color-stop(0.15, #d42004), color-stop(0.3, #fbcd66), color-stop(0.45, #f3d503), color-stop(0.6, #ff5f22), color-stop(0.85, #ff2), color-stop(1, #f22)); 25 | color: transparent; 26 | -webkit-background-clip: text; 27 | } 28 | .header .h_right{ 29 | float:right; 30 | 31 | } 32 | .header .h_right li,.h_right li a{ 33 | float: left; 34 | width: 100px; 35 | cursor:url("../images/link.cur"),pointer; 36 | text-align: center; 37 | -webkit-transition: all 0.25s ease; 38 | -moz-transition: all 0.25s ease; 39 | -o-transition: all 0.25s ease; 40 | -ms-transition: all 0.25s ease; 41 | } 42 | .header .h_right .h_r_no:hover{ 43 | color:#ef4345; 44 | } 45 | .header .h_right li a:hover{ 46 | color:#ef4345; 47 | } 48 | 49 | .header #tags{ 50 | display:none; 51 | width: 200px; 52 | margin-left: -50px; 53 | background: #fff; 54 | color:#000; 55 | } 56 | .header #tags li{ 57 | height: 38px; 58 | line-height: 38px; 59 | } 60 | .header #tags li:hover{ 61 | color:#ef4345; 62 | } 63 | 64 | 65 | #masonry { 66 | width: 100%; 67 | margin-top: 50px; 68 | position:relative; 69 | } 70 | .item { 71 | 72 | z-index: 10; 73 | transition: 0.25s; 74 | overflow: hidden; 75 | position: absolute; 76 | } 77 | .item img{ 78 | width:100%; 79 | height:100%; 80 | transition: 0.25s; 81 | } 82 | .item:hover img{ 83 | z-index: 100; 84 | transition: 0.25s; 85 | overflow: hidden; 86 | animation: bounceIn 0.25s ease-in 2 alternate; 87 | } 88 | .item:hover .down{ 89 | left:0; 90 | } 91 | 92 | .down{ 93 | box-sizing: border-box; 94 | position: absolute; 95 | top: 0; 96 | height: 100%; 97 | background: rgba(0, 0, 0, .7); 98 | filter: alpha(opacity=70); 99 | font-size: 13px; 100 | padding: 10px; 101 | line-height: 22px; 102 | left:-130px; 103 | transition: all 0.25s ease; 104 | -webkit-transition: all 0.25s ease; 105 | -moz-transition: all 0.25s ease; 106 | -o-transition: all 0.25s ease; 107 | -ms-transition: all 0.25s ease; 108 | overflow-y: auto; 109 | 110 | } 111 | .down li{ 112 | background: url(../images/down.png) no-repeat; 113 | background-position: 0 2px; 114 | padding-left: 23px; 115 | } 116 | .down li a{ 117 | color:#fff; 118 | -webkit-transition: all 0.25s ease; 119 | -moz-transition: all 0.25s ease; 120 | -o-transition: all 0.25s ease; 121 | -ms-transition: all 0.25s ease; 122 | } 123 | .down li a:hover{ 124 | color: #ef4345; 125 | } 126 | 127 | .bigImg{ 128 | 129 | } 130 | 131 | .loadmore{ 132 | height: 60px; 133 | text-align: center; 134 | line-height: 60px; 135 | 136 | } 137 | 138 | @keyframes bounceIn{ 139 | 100% { 140 | transform: scale(1.07); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /WebRoot/css/style.css: -------------------------------------------------------------------------------- 1 | 2 | .header{ 3 | position: fixed; 4 | z-index: 99999; 5 | height: 50px; 6 | top:0; 7 | width: 100%; 8 | line-height: 50px; 9 | font-size: 16px; 10 | background-color: #fff; 11 | opacity: 0.77; 12 | -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=77); 13 | filter: alpha(opacity=77); 14 | transition: all 0.25s ease; 15 | -webkit-transition: all 0.25s ease; 16 | -moz-transition: all 0.25s ease; 17 | -o-transition: all 0.25s ease; 18 | -ms-transition: all 0.25s ease; 19 | } 20 | .header .h_left{ 21 | float: left; 22 | margin-left: 29px; 23 | font-size: 24px; 24 | background-image: -webkit-gradient(linear, left top, right bottom, color-stop(0, #f22), color-stop(0.15, #d42004), color-stop(0.3, #fbcd66), color-stop(0.45, #f3d503), color-stop(0.6, #ff5f22), color-stop(0.85, #ff2), color-stop(1, #f22)); 25 | color: transparent; 26 | -webkit-background-clip: text; 27 | } 28 | .header .h_right{ 29 | float:right; 30 | 31 | } 32 | .header .h_right li,.h_right li a{ 33 | float: left; 34 | width: 100px; 35 | cursor:url("../images/link.cur"),pointer; 36 | text-align: center; 37 | -webkit-transition: all 0.25s ease; 38 | -moz-transition: all 0.25s ease; 39 | -o-transition: all 0.25s ease; 40 | -ms-transition: all 0.25s ease; 41 | } 42 | .header .h_right .h_r_no:hover{ 43 | color:#ef4345; 44 | } 45 | .header .h_right li a:hover{ 46 | color:#ef4345; 47 | } 48 | 49 | .header #tags{ 50 | display:none; 51 | width: 200px; 52 | margin-left: -50px; 53 | background: #fff; 54 | color:#000; 55 | } 56 | .header #tags li{ 57 | height: 38px; 58 | line-height: 38px; 59 | } 60 | .header #tags li:hover{ 61 | color:#ef4345; 62 | } 63 | 64 | 65 | #masonry { 66 | width: 100%; 67 | margin-top: 50px; 68 | position:relative; 69 | } 70 | .item { 71 | 72 | z-index: 10; 73 | transition: 0.25s; 74 | overflow: hidden; 75 | position: absolute; 76 | } 77 | .item img{ 78 | width:100%; 79 | height:100%; 80 | transition: 0.25s; 81 | } 82 | .item:hover img{ 83 | z-index: 100; 84 | transition: 0.25s; 85 | overflow: hidden; 86 | animation: bounceIn 0.25s ease-in 2 alternate; 87 | } 88 | .item:hover .down{ 89 | left:0; 90 | } 91 | 92 | .down{ 93 | box-sizing: border-box; 94 | position: absolute; 95 | top: 0; 96 | height: 100%; 97 | background: rgba(0, 0, 0, .7); 98 | filter: alpha(opacity=70); 99 | font-size: 13px; 100 | padding: 10px; 101 | line-height: 22px; 102 | left:-130px; 103 | transition: all 0.25s ease; 104 | -webkit-transition: all 0.25s ease; 105 | -moz-transition: all 0.25s ease; 106 | -o-transition: all 0.25s ease; 107 | -ms-transition: all 0.25s ease; 108 | overflow-y: auto; 109 | 110 | } 111 | .down li{ 112 | background: url(../images/down.png) no-repeat; 113 | background-position: 0 2px; 114 | padding-left: 23px; 115 | } 116 | .down li a{ 117 | color:#fff; 118 | -webkit-transition: all 0.25s ease; 119 | -moz-transition: all 0.25s ease; 120 | -o-transition: all 0.25s ease; 121 | -ms-transition: all 0.25s ease; 122 | } 123 | .down li a:hover{ 124 | color: #ef4345; 125 | } 126 | 127 | .bigImg{ 128 | width:98%; 129 | height:98%; 130 | } 131 | 132 | .loadmore{ 133 | height: 60px; 134 | text-align: center; 135 | line-height: 60px; 136 | 137 | } 138 | 139 | @keyframes bounceIn{ 140 | 100% { 141 | transform: scale(1.07); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /WebRoot/js/layer/mobile/need/layer.css: -------------------------------------------------------------------------------- 1 | .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-layermain,.layui-m-layershade{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,.1);pointer-events:auto;-webkit-overflow-scrolling:touch;-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:0 0;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-layerbtn span,.layui-m-layerchild h3{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%;-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-layerbtn,.layui-m-layerbtn span{position:relative;text-align:center;border-radius:0 0 5px 5px}.layui-m-layer2 .layui-m-layercont p{margin-top:20px}@-webkit-keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes layui-m-anim-loading{0%,100%,80%{transform:scale(0);-webkit-transform:scale(0)}40%{transform:scale(1);-webkit-transform:scale(1)}}.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%;height:50px;line-height:50px;font-size:0;border-top:1px solid #D0D0D0;background-color:#F2F2F2}.layui-m-layerbtn span{display:block;-moz-box-flex:1;box-flex:1;-webkit-box-flex:1;font-size:14px;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:0 0;cursor:pointer;-webkit-appearance:none;font-size:30px}.layui-m-layerend::after,.layui-m-layerend::before{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:0 0}.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:0 0;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} -------------------------------------------------------------------------------- /WebRoot/js/krry.js: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 加载图片 4 | */ 5 | 6 | 7 | var krryimg = { 8 | start:0, //从第0张图片开始 9 | count:20,//每次加载20张图片 10 | timer:null, //加载的定时器 11 | cid:false, //分类id,默认是false 不分类 12 | //加载图片 13 | pics360:function(start,count,cid){ 14 | //小图片展示的尺寸数据 15 | var pxarr = {"1":"512_384_85","2":"640_400_85","3":"720_450_85","4":"800_450_85"}; 16 | var url = ""; 17 | //如果cid不存在,则加载360最新图片 18 | if(!cid) url = `http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByOrder&order=create_time&start=${start}&count=${count}&from=360chrome`; 19 | //否则加载360分类中的图片 20 | else url = `http://wallpaper.apc.360.cn/index.php?c=WallPaper&a=getAppsByCategory&cid=${cid}&start=${start}&count=${count}&from=360chrome`; 21 | 22 | $.ajax({ 23 | url:"krry/WallPaper", 24 | type:"get", 25 | data:{url:url}, 26 | success:function(data){ 27 | var obj = eval('(' + data + ')'); 28 | var pic = obj.data; 29 | if(pic.length == 0){ 30 | loading("全部加载完了哦~",5); 31 | return; 32 | } 33 | var html = ""; 34 | for(pics of pic){ 35 | //获取标签 36 | var rag = pics["utag"]; 37 | //获取图片地址 38 | var picurl = pics["img_1600_900"]; 39 | //随机数取一半的像素 40 | var ram = Math.floor(Math.random()*4)+1; 41 | var pxwh = pxarr[""+ram+""]; 42 | //替换成小图片展示 43 | var smallpicurl = picurl.replace("1600_900_85",pxwh); 44 | //截取宽度高度字符串 45 | var height = pxwh.substring(4,7); 46 | var width = pxwh.substring(0,3); 47 | //1920x1080 48 | var berpic = picurl.replace("1600_900_85","1920_1080_100"); 49 | //1440x900 50 | var bigpic = picurl.replace("1600_900_85","1440_900_100"); 51 | //1024x768 52 | var midpic = picurl.replace("1600_900_85","1024_768_100"); 53 | //800x600 54 | var smapic = picurl.replace("1600_900_85","800_600_100"); 55 | //原图 56 | var orapic = pics["url_thumb"]; 57 | html += 58 | `
59 | ${rag} 60 | 77 |
`; 78 | } 79 | //如果是下拉滚动条加载,就从后面append, 80 | if(krryimg.start>0) $("#masonry").append(html); 81 | //否则是点击了一个按钮,重新加载 82 | else $("#masonry").html(html); 83 | 84 | $("img.lazy").lazyload({ 85 | effect:'fadeIn', 86 | skip_invisible:false, 87 | threshold: 200 // 提前开始加载 88 | }); 89 | //执行瀑布流 90 | waterFall(); 91 | } 92 | 93 | }); 94 | 95 | } 96 | }; 97 | 98 | 99 | //ajax加载360壁纸分类 100 | function ajax360Tags(){ 101 | var url = "http://cdn.apc.360.cn/index.php?c=WallPaper&a=getAllCategoriesV2&from=360chrome"; 102 | $.ajax({ 103 | type: "get", 104 | url: "krry/WallPaper", 105 | data:{url:url}, 106 | dataType : "json", 107 | success: function(jsonData){ 108 | var newHtml = ''; 109 | for (var i = 0; i < jsonData.data.length; i++){ 110 | newHtml += `
  • ${jsonData.data[i].name}
  • `; 111 | } 112 | newHtml += `
    `; 113 | $("#tags").append(newHtml); 114 | } 115 | }); 116 | return true; 117 | } 118 | 119 | 120 | //鼠标滑到分类标签。展开分类列表 121 | $(".notag").hover(function(){ 122 | $("#tags").stop(true).toggle(300); 123 | }); 124 | 125 | //改变页面顶部的小标题 126 | function changeTitle(title){ 127 | $(".header .h_left").text(title); 128 | } 129 | 130 | //点击加载最新壁纸 131 | $(".new360").click(function(){ 132 | //设置krryimg中的cid 133 | krryimg.cid = false; 134 | //改变标题 135 | changeTitle($(this).text()); 136 | krryimg.start = 0; 137 | $("html,body").animate({scrollTop: 0}, 200);//滚动条置顶 138 | krryimg.pics360(krryimg.start,krryimg.count,krryimg.cid);//加载360分类中的图片 139 | 140 | }); 141 | 142 | 143 | //加载360分类中的图片 144 | function loadTagData(cid){ 145 | //设置krryimg中的cid 146 | krryimg.cid = cid; 147 | krryimg.start = 0; 148 | $("html,body").animate({scrollTop: 0}, 200);//滚动条置顶 149 | krryimg.pics360(krryimg.start,krryimg.count,krryimg.cid);//加载360分类中的图片 150 | 151 | } 152 | 153 | 154 | //点击图片变大 155 | function layerbigImg(obj){ 156 | var url = $(obj).attr("src"); 157 | var index = url.lastIndexOf("/"); 158 | url = url.substring(index,url.length); //截取到一个文件名 159 | url = `http://p18.qhimg.com/bdm/940_600_100${url}`; //拼接上路径,并设置大小为940x600,画质100 160 | //页面层-自定义 161 | layer.open({ 162 | type: 1, 163 | title: false, 164 | closeBtn: 2, 165 | shadeClose: true, 166 | area: ['940px', '600px'], 167 | content: `` 168 | }); 169 | } 170 | 171 | 172 | 173 | //瀑布流效果 174 | //这里有一个坑(已经修复): 175 | //因为是动态加载远程图片,在未加载完全无法获取图片宽高 176 | //未加载完全就无法设定每一个item(包裹图片)的top。 177 | 178 | //item的top值:第一行:top为0 179 | // 其他行:必须算出图片宽度在item宽度的缩小比例,与获取的图片高度相乘,从而获得item的高度 180 | // 就可以设置每张图片在瀑布流中每块item的top值(每一行中最小的item高度,数组查找) 181 | //item的left值:第一行:按照每块item的宽度值*块数, 182 | // 其他行:与自身上面一块的left值相等 183 | 184 | //因为无法获取未加载的图片宽高,所以我的方法是: 185 | //获取的图片高度方法:在加载图片时,我已经设置宽高的数组pxarr,随机数获取不同的尺寸来展示 186 | //这里获取的宽度和高度是小图片展示的宽高, 187 | //然后截取字符串,获得图片宽度和高度,放进item标签的data数据中, 188 | //再在瀑布流的item标签循环中得到这个data数据中的宽高 189 | function waterFall() { 190 | // 1- 确定图片的宽度 - 滚动条宽度 191 | var pageWidth = getClient().width-8; 192 | var columns = 3; //3列 193 | var itemWidth = parseInt(pageWidth/columns); //得到item的宽度 194 | $(".item").width(itemWidth); //设置到item的宽度 195 | 196 | var arr = []; 197 | 198 | $("#masonry .item").each(function(i){ 199 | var height = $(this).data("hei"); 200 | var width = $(this).data("wid"); 201 | var bi = itemWidth/width; //获取缩小的比值 202 | var boxheight = parseInt(height*bi); //图片的高度*比值 = item的高度 203 | 204 | if (i < columns) { 205 | // 2- 确定第一行 206 | $(this).css({ 207 | top:0, 208 | left:(itemWidth) * i 209 | }); 210 | arr.push(boxheight); 211 | 212 | } else { 213 | // 其他行 214 | // 3- 找到数组中最小高度 和 它的索引 215 | var minHeight = arr[0]; 216 | var index = 0; 217 | for (var j = 0; j < arr.length; j++) { 218 | if (minHeight > arr[j]) { 219 | minHeight = arr[j]; 220 | index = j; 221 | } 222 | } 223 | // 4- 设置下一行的第一个盒子位置 224 | // top值就是最小列的高度 225 | $(this).css({ 226 | top:arr[index], 227 | left:$("#masonry .item").eq(index).css("left") 228 | }); 229 | 230 | // 5- 修改最小列的高度 231 | // 最小列的高度 = 当前自己的高度 + 拼接过来的高度 232 | arr[index] = arr[index] + boxheight; 233 | } 234 | }); 235 | //加载动画消失 236 | tzUtil.animates($("#tzloading"),"slideUp"); 237 | } 238 | 239 | 240 | //当滚动条到达距离底部180px时 241 | $(window).scroll(function(){ 242 | //清除定时器 243 | clearTimeout(krryimg.timer); 244 | //可视高度 245 | var cheight = $(window).height(); 246 | // 滚动条高度 247 | var ctop = $(document).scrollTop(); 248 | 249 | //文档的高度,到达底部 250 | if(cheight+ctop+10 > document.body.scrollHeight){ 251 | loading("加载中...",5); 252 | krryimg.timer = setTimeout(function(){ 253 | //每次加载20张,每次加载的起点增加20 254 | krryimg.start += 20; 255 | krryimg.pics360(krryimg.start,krryimg.count,krryimg.cid); 256 | },200); 257 | 258 | } 259 | }); 260 | 261 | 262 | //clientWidth 处理兼容性 263 | function getClient() { 264 | return { 265 | width: window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, 266 | height: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight 267 | } 268 | } 269 | 270 | function debounceWaterFall(fn, delay) { 271 | let timeout = null 272 | return (() => { 273 | if (timeout !== null) { 274 | clearTimeout(timeout) 275 | } 276 | timeout = setTimeout(fn, delay) 277 | })() 278 | } 279 | 280 | 281 | // 页面尺寸改变时实时触发 282 | window.onresize = function() { 283 | //重新定义瀑布流 284 | debounceWaterFall(waterFall, 300) 285 | }; 286 | 287 | 288 | 289 | //初始化 290 | window.onload = function(){ 291 | loading("加载中...",5); 292 | krryimg.pics360(krryimg.start,krryimg.count,false); //加载最新图片,false代表加载最新图片 293 | ajax360Tags();//360图片分类 294 | } 295 | 296 | 297 | //判断非空 298 | function isEmpty(val) { 299 | val = $.trim(val); 300 | if (val == null) 301 | return true; 302 | if (val == undefined || val == 'undefined') 303 | return true; 304 | if (val == "") 305 | return true; 306 | if (val.length == 0) 307 | return true; 308 | if (!/[^(^\s*)|(\s*$)]/.test(val)) 309 | return true; 310 | return false; 311 | } 312 | 313 | -------------------------------------------------------------------------------- /WebRoot/js/jquery.onepage-scroll.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * jquery-onepage-scroll.js v1 3 | * =========================================================== 4 | * Copyright 2013 Pete Rojwongsuriya. 5 | * http://www.thepetedesign.com 6 | * 7 | * Create an Apple-like website that let user scroll 8 | * one page at a time 9 | * 10 | * Credit: Eike Send for the awesome swipe event 11 | * https://github.com/peachananr/onepage-scroll 12 | * 13 | * ========================================================== */ 14 | 15 | !function($){ 16 | 17 | var defaults = { 18 | sectionContainer: "section", 19 | easing: "ease", 20 | animationTime: 1000, 21 | pagination: true, 22 | updateURL: false 23 | }; 24 | 25 | /*------------------------------------------------*/ 26 | /* Credit: Eike Send for the awesome swipe event */ 27 | /*------------------------------------------------*/ 28 | 29 | $.fn.swipeEvents = function() { 30 | return this.each(function() { 31 | 32 | var startX, 33 | startY, 34 | $this = $(this); 35 | 36 | $this.bind('touchstart', touchstart); 37 | 38 | function touchstart(event) { 39 | var touches = event.originalEvent.touches; 40 | if (touches && touches.length) { 41 | startX = touches[0].pageX; 42 | startY = touches[0].pageY; 43 | $this.bind('touchmove', touchmove); 44 | } 45 | event.preventDefault(); 46 | } 47 | 48 | function touchmove(event) { 49 | var touches = event.originalEvent.touches; 50 | if (touches && touches.length) { 51 | var deltaX = startX - touches[0].pageX; 52 | var deltaY = startY - touches[0].pageY; 53 | 54 | if (deltaX >= 50) { 55 | $this.trigger("swipeLeft"); 56 | } 57 | if (deltaX <= -50) { 58 | $this.trigger("swipeRight"); 59 | } 60 | if (deltaY >= 50) { 61 | $this.trigger("swipeUp"); 62 | } 63 | if (deltaY <= -50) { 64 | $this.trigger("swipeDown"); 65 | } 66 | if (Math.abs(deltaX) >= 50 || Math.abs(deltaY) >= 50) { 67 | $this.unbind('touchmove', touchmove); 68 | } 69 | } 70 | event.preventDefault(); 71 | } 72 | 73 | }); 74 | }; 75 | 76 | 77 | $.fn.onepage_scroll = function(options){ 78 | var settings = $.extend({}, defaults, options), 79 | el = $(this), 80 | sections = $(settings.sectionContainer) 81 | total = sections.length, 82 | status = "off", 83 | topPos = 0, 84 | lastAnimation = 0, 85 | quietPeriod = 500, 86 | paginationList = ""; 87 | 88 | $.fn.transformPage = function(settings, pos) { 89 | $(this).css({ 90 | "-webkit-transform": "translate3d(0, " + pos + "%, 0)", 91 | "-webkit-transition": "all " + settings.animationTime + "ms " + settings.easing, 92 | "-moz-transform": "translate3d(0, " + pos + "%, 0)", 93 | "-moz-transition": "all " + settings.animationTime + "ms " + settings.easing, 94 | "-ms-transform": "translate3d(0, " + pos + "%, 0)", 95 | "-ms-transition": "all " + settings.animationTime + "ms " + settings.easing, 96 | "transform": "translate3d(0, " + pos + "%, 0)", 97 | "transition": "all " + settings.animationTime + "ms " + settings.easing 98 | }); 99 | } 100 | 101 | $.fn.moveDown = function() { 102 | var el = $(this) 103 | index = $(settings.sectionContainer +".active").data("index"); 104 | if(index < total) { 105 | current = $(settings.sectionContainer + "[data-index='" + index + "']"); 106 | next = $(settings.sectionContainer + "[data-index='" + (index + 1) + "']"); 107 | if(next) { 108 | current.removeClass("active") 109 | next.addClass("active"); 110 | if(settings.pagination == true) { 111 | $(".onepage-pagination li a" + "[data-index='" + index + "']").removeClass("active"); 112 | $(".onepage-pagination li a" + "[data-index='" + (index + 1) + "']").addClass("active"); 113 | } 114 | $("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, ''); 115 | $("body").addClass("viewing-page-"+next.data("index")) 116 | 117 | if (history.replaceState && settings.updateURL == true) { 118 | var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index + 1); 119 | history.pushState( {}, document.title, href ); 120 | } 121 | } 122 | pos = (index * 100) * -1; 123 | el.transformPage(settings, pos); 124 | } 125 | } 126 | 127 | $.fn.moveUp = function() { 128 | var el = $(this) 129 | index = $(settings.sectionContainer +".active").data("index"); 130 | if(index <= total && index > 1) { 131 | current = $(settings.sectionContainer + "[data-index='" + index + "']"); 132 | next = $(settings.sectionContainer + "[data-index='" + (index - 1) + "']"); 133 | 134 | if(next) { 135 | current.removeClass("active") 136 | next.addClass("active") 137 | if(settings.pagination == true) { 138 | $(".onepage-pagination li a" + "[data-index='" + index + "']").removeClass("active"); 139 | $(".onepage-pagination li a" + "[data-index='" + (index - 1) + "']").addClass("active"); 140 | } 141 | $("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, ''); 142 | $("body").addClass("viewing-page-"+next.data("index")) 143 | 144 | if (history.replaceState && settings.updateURL == true) { 145 | var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (index - 1); 146 | history.pushState( {}, document.title, href ); 147 | } 148 | } 149 | pos = ((next.data("index") - 1) * 100) * -1; 150 | el.transformPage(settings, pos); 151 | } 152 | } 153 | 154 | function init_scroll(event, delta) { 155 | deltaOfInterest = delta; 156 | var timeNow = new Date().getTime(); 157 | // Cancel scroll if currently animating or within quiet period 158 | if(timeNow - lastAnimation < quietPeriod + settings.animationTime) { 159 | event.preventDefault(); 160 | return; 161 | } 162 | 163 | if (deltaOfInterest < 0) { 164 | el.moveDown() 165 | } else { 166 | el.moveUp() 167 | } 168 | lastAnimation = timeNow; 169 | } 170 | 171 | // Prepare everything before binding wheel scroll 172 | 173 | el.addClass("onepage-wrapper").css("position","relative"); 174 | $.each( sections, function(i) { 175 | $(this).css({ 176 | position: "absolute", 177 | top: topPos + "%" 178 | }).addClass("section").attr("data-index", i+1); 179 | topPos = topPos + 100; 180 | if(settings.pagination == true) { 181 | paginationList += "
  • " 182 | } 183 | }); 184 | 185 | el.swipeEvents().bind("swipeDown", function(){ 186 | el.moveUp(); 187 | }).bind("swipeUp", function(){ 188 | el.moveDown(); 189 | }); 190 | 191 | // Create Pagination and Display Them 192 | if(settings.pagination == true) { 193 | $("").prependTo("body"); 194 | posTop = (el.find(".onepage-pagination").height() / 2) * -1; 195 | el.find(".onepage-pagination").css("margin-top", posTop); 196 | } 197 | 198 | if(window.location.hash != "" && window.location.hash != "#1") { 199 | init_index = window.location.hash.replace("#", "") 200 | $(settings.sectionContainer + "[data-index='" + init_index + "']").addClass("active") 201 | $("body").addClass("viewing-page-"+ init_index) 202 | if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='" + init_index + "']").addClass("active"); 203 | 204 | next = $(settings.sectionContainer + "[data-index='" + (init_index) + "']"); 205 | if(next) { 206 | next.addClass("active") 207 | if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='" + (init_index) + "']").addClass("active"); 208 | $("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, ''); 209 | $("body").addClass("viewing-page-"+next.data("index")) 210 | if (history.replaceState && settings.updateURL == true) { 211 | var href = window.location.href.substr(0,window.location.href.indexOf('#')) + "#" + (init_index); 212 | history.pushState( {}, document.title, href ); 213 | } 214 | } 215 | pos = ((init_index - 1) * 100) * -1; 216 | el.transformPage(settings, pos); 217 | 218 | }else{ 219 | $(settings.sectionContainer + "[data-index='1']").addClass("active") 220 | $("body").addClass("viewing-page-1") 221 | if(settings.pagination == true) $(".onepage-pagination li a" + "[data-index='1']").addClass("active"); 222 | } 223 | if(settings.pagination == true) { 224 | $(".onepage-pagination li a").click(function (){ 225 | var page_index = $(this).data("index"); 226 | if (!$(this).hasClass("active")) { 227 | current = $(settings.sectionContainer + ".active") 228 | next = $(settings.sectionContainer + "[data-index='" + (page_index) + "']"); 229 | if(next) { 230 | current.removeClass("active") 231 | next.addClass("active") 232 | $(".onepage-pagination li a" + ".active").removeClass("active"); 233 | $(".onepage-pagination li a" + "[data-index='" + (page_index) + "']").addClass("active"); 234 | $("body")[0].className = $("body")[0].className.replace(/\bviewing-page-\d.*?\b/g, ''); 235 | $("body").addClass("viewing-page-"+next.data("index")) 236 | } 237 | pos = ((page_index - 1) * 100) * -1; 238 | el.transformPage(settings, pos); 239 | } 240 | if (settings.updateURL == false) return false; 241 | }); 242 | } 243 | 244 | 245 | 246 | $(document).bind('mousewheel DOMMouseScroll', function(event) { 247 | event.preventDefault(); 248 | var delta = event.originalEvent.wheelDelta || -event.originalEvent.detail; 249 | init_scroll(event, delta); 250 | }); 251 | return false; 252 | 253 | } 254 | 255 | }(window.jQuery); 256 | 257 | 258 | -------------------------------------------------------------------------------- /WebRoot/js/layer/skin/default/layer.css: -------------------------------------------------------------------------------- 1 | .layui-layer-imgbar,.layui-layer-imgtit a,.layui-layer-tab .layui-layer-title span,.layui-layer-title{text-overflow:ellipsis;white-space:nowrap}*html{background-image:url(about:blank);background-attachment:fixed}html #layuicss-skinlayercss{display:none;position:absolute;width:1989px}.layui-layer,.layui-layer-shade{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;top:150px;left:0;margin:0;padding:0;background-color:rgba(0, 0, 0, 0.75);-webkit-background-clip:content;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) center center no-repeat #eee}.layui-layer-ico{background:url(icon.png) no-repeat}.layui-layer-btn a,.layui-layer-dialog .layui-layer-ico,.layui-layer-setwin a{display:inline-block;*display:inline;*zoom:1;vertical-align:top}.layui-layer-move{display:none;position:fixed;*position:absolute;left:0;top:0;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}.layui-layer{border-radius:2px;-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{-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(0) rotate(0);transform:translateX(0) rotate(0)}}@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(0) rotate(0);-ms-transform:translateX(0) rotate(0);transform:translateX(0) rotate(0)}}.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;background-color:#F8F8F8;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:.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 10px 12px;pointer-events:auto;user-select:none;-webkit-user-select:none}.layui-layer-btn a{height:28px;line-height:28px;margin:6px 6px 0;padding:0 15px;border:1px solid #dedede;background-color:#f1f1f1;color:#333;border-radius:2px;font-weight:400;cursor:pointer;text-decoration:none}.layui-layer-btn a:hover{opacity:.9;text-decoration:none}.layui-layer-btn a:active{opacity:.8}.layui-layer-btn .layui-layer-btn0{border-color:#4898d5;background-color:#2e8ded;color:#fff}.layui-layer-btn-l{text-align:left}.layui-layer-btn-c{text-align:center}.layui-layer-dialog{min-width:210px}.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,.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-iframe .layui-layer-btn,.layui-layer-page .layui-layer-btn{padding-top:10px}.layui-layer-nobg{background:0 0}.layui-layer-iframe iframe{display:block;width:100%}.layui-layer-loading{border-radius:100%;background:0 0;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-ico16,.layui-layer-loading .layui-layer-loading2{width:32px;height:32px;background:url(loading-2.gif) no-repeat}.layui-layer-tips{background:0 0;box-shadow:none;border:none}.layui-layer-tips .layui-layer-content{position:relative;line-height:22px;min-width:12px;padding:5px 10px;font-size:12px;_float:left;border-radius:2px;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-TipsB,.layui-layer-tips i.layui-layer-TipsT{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-TipsL,.layui-layer-tips i.layui-layer-TipsR{top:1px;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}.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:#BBB5B5;border:none}.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}.layui-layer-molv .layui-layer-btn .layui-layer-btn1{background:#92B8B1}.layui-layer-iconext{background:url(icon-ext.png) no-repeat}.layui-layer-prompt .layui-layer-input{display:block;width:220px;height:30px;margin:0 auto;line-height:30px;padding:0 5px;border:1px solid #ccc;box-shadow:1px 1px 5px rgba(0,0,0,.1) inset;color:#333}.layui-layer-prompt textarea.layui-layer-input{width:300px;height:100px;line-height:20px}.layui-layer-prompt .layui-layer-content{padding:20px}.layui-layer-prompt .layui-layer-btn{padding-top:0}.layui-layer-tab{box-shadow:1px 1px 50px rgba(0,0,0,.4)}.layui-layer-tab .layui-layer-title{padding-left:0;border-bottom:1px solid #ccc;background-color:#eee;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;overflow:hidden}.layui-layer-tab .layui-layer-title span.layui-layer-tabnow{height:43px;border-left:1px solid #ccc;border-right:1px solid #ccc;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.xubox_tab_layer{display:block}.xubox_tabclose{position:absolute;right:10px;top:5px;cursor:pointer}.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-imgbar,.layui-layer-imguide{display:none}.layui-layer-imgnext,.layui-layer-imgprev{position:absolute;top:50%;width:27px;_width:44px;height:44px;margin-top:-22px;outline:0;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;overflow:hidden;font-size:0}.layui-layer-imgtit *{display:inline-block;*display:inline;*zoom:1;vertical-align:top;font-size:12px}.layui-layer-imgtit a{max-width:65%;overflow:hidden;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-duration:.2s;animation-duration:.2s}@media screen and (max-width:1100px){.layui-layer-iframe{overflow-y:auto;-webkit-overflow-scrolling:touch}} -------------------------------------------------------------------------------- /WebRoot/js/layer/layer.js: -------------------------------------------------------------------------------- 1 | /*! layer-v3.0.2 Web弹层组件 MIT License http://layer.layui.com/ By 贤心 */ 2 | ;!function(e,t){"use strict";var i,n,a=e.layui&&layui.define,o={getPath:function(){var e=document.scripts,t=e[e.length-1],i=t.src;if(!t.getAttribute("merge"))return i.substring(0,i.lastIndexOf("/")+1)}(),config:{},end:{},minIndex:0,minLeft:[],btn:["确定","取消"],type:["dialog","page","iframe","loading","tips"]},r={v:"3.0.2",ie:function(){var t=navigator.userAgent.toLowerCase();return!!(e.ActiveXObject||"ActiveXObject"in e)&&((t.match(/msie\s(\d+)/)||[])[1]||"11")}(),index:e.layer&&e.layer.v?1e5:0,path:o.getPath,config:function(e,t){return e=e||{},r.cache=o.config=i.extend({},o.config,e),r.path=o.config.path||r.path,"string"==typeof e.extend&&(e.extend=[e.extend]),o.config.path&&r.ready(),e.extend?(a?layui.addcss("modules/layer/"+e.extend):r.link("skin/"+e.extend),this):this},link:function(t,n,a){if(r.path){var o=i("head")[0],s=document.createElement("link");"string"==typeof n&&(a=n);var l=(a||t).replace(/\.|\//g,""),f="layuicss-"+l,c=0;s.rel="stylesheet",s.href=r.path+t,s.id=f,i("#"+f)[0]||o.appendChild(s),"function"==typeof n&&!function u(){return++c>80?e.console&&console.error("layer.css: Invalid"):void(1989===parseInt(i("#"+f).css("width"))?n():setTimeout(u,100))}()}},ready:function(e){var t="skinlayercss",i="302";return a?layui.addcss("modules/layer/default/layer.css?v="+r.v+i,e,t):r.link("skin/default/layer.css?v="+r.v+i,e,t),this},alert:function(e,t,n){var a="function"==typeof t;return a&&(n=t),r.open(i.extend({content:e,yes:n},a?{}:t))},confirm:function(e,t,n,a){var s="function"==typeof t;return s&&(a=n,n=t),r.open(i.extend({content:e,btn:o.btn,yes:n,btn2:a},s?{}:t))},msg:function(e,n,a){var s="function"==typeof n,f=o.config.skin,c=(f?f+" "+f+"-msg":"")||"layui-layer-msg",u=l.anim.length-1;return s&&(a=n),r.open(i.extend({content:e,time:3e3,shade:!1,skin:c,title:!1,closeBtn:!1,btn:!1,resize:!1,end:a},s&&!o.config.skin?{skin:c+" layui-layer-hui",anim:u}:function(){return n=n||{},(n.icon===-1||n.icon===t&&!o.config.skin)&&(n.skin=c+" "+(n.skin||"layui-layer-hui")),n}()))},load:function(e,t){return r.open(i.extend({type:3,icon:e||0,resize:!1,shade:.01},t))},tips:function(e,t,n){return r.open(i.extend({type:4,content:[e,t],closeBtn:!1,time:3e3,shade:!1,resize:!1,fixed:!1,maxWidth:210},n))}},s=function(e){var t=this;t.index=++r.index,t.config=i.extend({},t.config,o.config,e),r.ready(function(){document.body?t.creat():setTimeout(function(){t.creat()},50)})};s.pt=s.prototype;var l=["layui-layer",".layui-layer-title",".layui-layer-main",".layui-layer-dialog","layui-layer-iframe","layui-layer-content","layui-layer-btn","layui-layer-close"];l.anim=["layer-anim","layer-anim-01","layer-anim-02","layer-anim-03","layer-anim-04","layer-anim-05","layer-anim-06"],s.pt.config={type:0,shade:.3,fixed:!0,move:l[1],title:"信息",offset:"auto",area:"auto",closeBtn:1,time:0,zIndex:19891014,maxWidth:360,anim:0,icon:-1,moveType:1,resize:!0,scrollbar:!0,tips:2},s.pt.vessel=function(e,t){var n=this,a=n.index,r=n.config,s=r.zIndex+a,f="object"==typeof r.title,c=r.maxmin&&(1===r.type||2===r.type),u=r.title?'
    '+(f?r.title[0]:r.title)+"
    ":"";return r.zIndex=s,t([r.shade?'
    ':"",'
    '+(e&&2!=r.type?"":u)+'
    '+(0==r.type&&r.icon!==-1?'':"")+(1==r.type&&e?"":r.content||"")+'
    '+function(){var e=c?'':"";return r.closeBtn&&(e+=''),e}()+""+(r.btn?function(){var e="";"string"==typeof r.btn&&(r.btn=[r.btn]);for(var t=0,i=r.btn.length;t'+r.btn[t]+"";return'
    '+e+"
    "}():"")+(r.resize?'':"")+"
    "],u,i('
    ')),n},s.pt.creat=function(){var e=this,t=e.config,a=e.index,s=t.content,f="object"==typeof s,c=i("body");if(!t.id||!i("#"+t.id)[0]){switch("string"==typeof t.area&&(t.area="auto"===t.area?["",""]:[t.area,""]),t.shift&&(t.anim=t.shift),6==r.ie&&(t.fixed=!1),t.type){case 0:t.btn="btn"in t?t.btn:o.btn[0],r.closeAll("dialog");break;case 2:var s=t.content=f?t.content:[t.content||"http://layer.layui.com","auto"];t.content='';break;case 3:delete t.title,delete t.closeBtn,t.icon===-1&&0===t.icon,r.closeAll("loading");break;case 4:f||(t.content=[t.content,"body"]),t.follow=t.content[1],t.content=t.content[0]+'',delete t.title,t.tips="object"==typeof t.tips?t.tips:[t.tips,!0],t.tipsMore||r.closeAll("tips")}e.vessel(f,function(n,r,u){c.append(n[0]),f?function(){2==t.type||4==t.type?function(){i("body").append(n[1])}():function(){s.parents("."+l[0])[0]||(s.data("display",s.css("display")).show().addClass("layui-layer-wrap").wrap(n[1]),i("#"+l[0]+a).find("."+l[5]).before(r))}()}():c.append(n[1]),i(".layui-layer-move")[0]||c.append(o.moveElem=u),e.layero=i("#"+l[0]+a),t.scrollbar||l.html.css("overflow","hidden").attr("layer-full",a)}).auto(a),2==t.type&&6==r.ie&&e.layero.find("iframe").attr("src",s[0]),4==t.type?e.tips():e.offset(),t.fixed&&n.on("resize",function(){e.offset(),(/^\d+%$/.test(t.area[0])||/^\d+%$/.test(t.area[1]))&&e.auto(a),4==t.type&&e.tips()}),t.time<=0||setTimeout(function(){r.close(e.index)},t.time),e.move().callback(),l.anim[t.anim]&&e.layero.addClass(l.anim[t.anim]).data("anim",!0)}},s.pt.auto=function(e){function t(e){e=s.find(e),e.height(f[1]-c-u-2*(0|parseFloat(e.css("padding"))))}var a=this,o=a.config,s=i("#"+l[0]+e);""===o.area[0]&&o.maxWidth>0&&(r.ie&&r.ie<8&&o.btn&&s.width(s.innerWidth()),s.outerWidth()>o.maxWidth&&s.width(o.maxWidth));var f=[s.innerWidth(),s.innerHeight()],c=s.find(l[1]).outerHeight()||0,u=s.find("."+l[6]).outerHeight()||0;switch(o.type){case 2:t("iframe");break;default:""===o.area[1]?o.fixed&&f[1]>=n.height()&&(f[1]=n.height(),t("."+l[5])):t("."+l[5])}return a},s.pt.offset=function(){var e=this,t=e.config,i=e.layero,a=[i.outerWidth(),i.outerHeight()],o="object"==typeof t.offset;e.offsetTop=(n.height()-a[1])/2,e.offsetLeft=(n.width()-a[0])/2,o?(e.offsetTop=t.offset[0],e.offsetLeft=t.offset[1]||e.offsetLeft):"auto"!==t.offset&&("t"===t.offset?e.offsetTop=0:"r"===t.offset?e.offsetLeft=n.width()-a[0]:"b"===t.offset?e.offsetTop=n.height()-a[1]:"l"===t.offset?e.offsetLeft=0:"lt"===t.offset?(e.offsetTop=0,e.offsetLeft=0):"lb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=0):"rt"===t.offset?(e.offsetTop=0,e.offsetLeft=n.width()-a[0]):"rb"===t.offset?(e.offsetTop=n.height()-a[1],e.offsetLeft=n.width()-a[0]):e.offsetTop=t.offset),t.fixed||(e.offsetTop=/%$/.test(e.offsetTop)?n.height()*parseFloat(e.offsetTop)/100:parseFloat(e.offsetTop),e.offsetLeft=/%$/.test(e.offsetLeft)?n.width()*parseFloat(e.offsetLeft)/100:parseFloat(e.offsetLeft),e.offsetTop+=n.scrollTop(),e.offsetLeft+=n.scrollLeft()),i.attr("minLeft")&&(e.offsetTop=n.height()-(i.find(l[1]).outerHeight()||0),e.offsetLeft=i.css("left")),i.css({top:e.offsetTop,left:e.offsetLeft})},s.pt.tips=function(){var e=this,t=e.config,a=e.layero,o=[a.outerWidth(),a.outerHeight()],r=i(t.follow);r[0]||(r=i("body"));var s={width:r.outerWidth(),height:r.outerHeight(),top:r.offset().top,left:r.offset().left},f=a.find(".layui-layer-TipsG"),c=t.tips[0];t.tips[1]||f.remove(),s.autoLeft=function(){s.left+o[0]-n.width()>0?(s.tipLeft=s.left+s.width-o[0],f.css({right:12,left:"auto"})):s.tipLeft=s.left},s.where=[function(){s.autoLeft(),s.tipTop=s.top-o[1]-10,f.removeClass("layui-layer-TipsB").addClass("layui-layer-TipsT").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left+s.width+10,s.tipTop=s.top,f.removeClass("layui-layer-TipsL").addClass("layui-layer-TipsR").css("border-bottom-color",t.tips[1])},function(){s.autoLeft(),s.tipTop=s.top+s.height+10,f.removeClass("layui-layer-TipsT").addClass("layui-layer-TipsB").css("border-right-color",t.tips[1])},function(){s.tipLeft=s.left-o[0]-10,s.tipTop=s.top,f.removeClass("layui-layer-TipsR").addClass("layui-layer-TipsL").css("border-bottom-color",t.tips[1])}],s.where[c-1](),1===c?s.top-(n.scrollTop()+o[1]+16)<0&&s.where[2]():2===c?n.width()-(s.left+s.width+o[0]+16)>0||s.where[3]():3===c?s.top-n.scrollTop()+s.height+o[1]+16-n.height()>0&&s.where[0]():4===c&&o[0]+16-s.left>0&&s.where[1](),a.find("."+l[5]).css({"background-color":t.tips[1],"padding-right":t.closeBtn?"30px":""}),a.css({left:s.tipLeft-(t.fixed?n.scrollLeft():0),top:s.tipTop-(t.fixed?n.scrollTop():0)})},s.pt.move=function(){var e=this,t=e.config,a=i(document),s=e.layero,l=s.find(t.move),f=s.find(".layui-layer-resize"),c={};return t.move&&l.css("cursor","move"),l.on("mousedown",function(e){e.preventDefault(),t.move&&(c.moveStart=!0,c.offset=[e.clientX-parseFloat(s.css("left")),e.clientY-parseFloat(s.css("top"))],o.moveElem.css("cursor","move").show())}),f.on("mousedown",function(e){e.preventDefault(),c.resizeStart=!0,c.offset=[e.clientX,e.clientY],c.area=[s.outerWidth(),s.outerHeight()],o.moveElem.css("cursor","se-resize").show()}),a.on("mousemove",function(i){if(c.moveStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1],l="fixed"===s.css("position");if(i.preventDefault(),c.stX=l?0:n.scrollLeft(),c.stY=l?0:n.scrollTop(),!t.moveOut){var f=n.width()-s.outerWidth()+c.stX,u=n.height()-s.outerHeight()+c.stY;af&&(a=f),ou&&(o=u)}s.css({left:a,top:o})}if(t.resize&&c.resizeStart){var a=i.clientX-c.offset[0],o=i.clientY-c.offset[1];i.preventDefault(),r.style(e.index,{width:c.area[0]+a,height:c.area[1]+o}),c.isResize=!0,t.resizing&&t.resizing(s)}}).on("mouseup",function(e){c.moveStart&&(delete c.moveStart,o.moveElem.hide(),t.moveEnd&&t.moveEnd(s)),c.resizeStart&&(delete c.resizeStart,o.moveElem.hide())}),e},s.pt.callback=function(){function e(){var e=a.cancel&&a.cancel(t.index,n);e===!1||r.close(t.index)}var t=this,n=t.layero,a=t.config;t.openLayer(),a.success&&(2==a.type?n.find("iframe").on("load",function(){a.success(n,t.index)}):a.success(n,t.index)),6==r.ie&&t.IE6(n),n.find("."+l[6]).children("a").on("click",function(){var e=i(this).index();if(0===e)a.yes?a.yes(t.index,n):a.btn1?a.btn1(t.index,n):r.close(t.index);else{var o=a["btn"+(e+1)]&&a["btn"+(e+1)](t.index,n);o===!1||r.close(t.index)}}),n.find("."+l[7]).on("click",e),a.shadeClose&&i("#layui-layer-shade"+t.index).on("click",function(){r.close(t.index)}),n.find(".layui-layer-min").on("click",function(){var e=a.min&&a.min(n);e===!1||r.min(t.index,a)}),n.find(".layui-layer-max").on("click",function(){i(this).hasClass("layui-layer-maxmin")?(r.restore(t.index),a.restore&&a.restore(n)):(r.full(t.index,a),setTimeout(function(){a.full&&a.full(n)},100))}),a.end&&(o.end[t.index]=a.end)},o.reselect=function(){i.each(i("select"),function(e,t){var n=i(this);n.parents("."+l[0])[0]||1==n.attr("layer")&&i("."+l[0]).length<1&&n.removeAttr("layer").show(),n=null})},s.pt.IE6=function(e){i("select").each(function(e,t){var n=i(this);n.parents("."+l[0])[0]||"none"===n.css("display")||n.attr({layer:"1"}).hide(),n=null})},s.pt.openLayer=function(){var e=this;r.zIndex=e.config.zIndex,r.setTop=function(e){var t=function(){r.zIndex++,e.css("z-index",r.zIndex+1)};return r.zIndex=parseInt(e[0].style.zIndex),e.on("mousedown",t),r.zIndex}},o.record=function(e){var t=[e.width(),e.height(),e.position().top,e.position().left+parseFloat(e.css("margin-left"))];e.find(".layui-layer-max").addClass("layui-layer-maxmin"),e.attr({area:t})},o.rescollbar=function(e){l.html.attr("layer-full")==e&&(l.html[0].style.removeProperty?l.html[0].style.removeProperty("overflow"):l.html[0].style.removeAttribute("overflow"),l.html.removeAttr("layer-full"))},e.layer=r,r.getChildFrame=function(e,t){return t=t||i("."+l[4]).attr("times"),i("#"+l[0]+t).find("iframe").contents().find(e)},r.getFrameIndex=function(e){return i("#"+e).parents("."+l[4]).attr("times")},r.iframeAuto=function(e){if(e){var t=r.getChildFrame("html",e).outerHeight(),n=i("#"+l[0]+e),a=n.find(l[1]).outerHeight()||0,o=n.find("."+l[6]).outerHeight()||0;n.css({height:t+a+o}),n.find("iframe").css({height:t})}},r.iframeSrc=function(e,t){i("#"+l[0]+e).find("iframe").attr("src",t)},r.style=function(e,t,n){var a=i("#"+l[0]+e),r=a.find(".layui-layer-content"),s=a.attr("type"),f=a.find(l[1]).outerHeight()||0,c=a.find("."+l[6]).outerHeight()||0;a.attr("minLeft");s!==o.type[3]&&s!==o.type[4]&&(n||(parseFloat(t.width)<=260&&(t.width=260),parseFloat(t.height)-f-c<=64&&(t.height=64+f+c)),a.css(t),c=a.find("."+l[6]).outerHeight(),s===o.type[2]?a.find("iframe").css({height:parseFloat(t.height)-f-c}):r.css({height:parseFloat(t.height)-f-c-parseFloat(r.css("padding-top"))-parseFloat(r.css("padding-bottom"))}))},r.min=function(e,t){var a=i("#"+l[0]+e),s=a.find(l[1]).outerHeight()||0,f=a.attr("minLeft")||181*o.minIndex+"px",c=a.css("position");o.record(a),o.minLeft[0]&&(f=o.minLeft[0],o.minLeft.shift()),a.attr("position",c),r.style(e,{width:180,height:s,left:f,top:n.height()-s,position:"fixed",overflow:"hidden"},!0),a.find(".layui-layer-min").hide(),"page"===a.attr("type")&&a.find(l[4]).hide(),o.rescollbar(e),a.attr("minLeft")||o.minIndex++,a.attr("minLeft",f)},r.restore=function(e){var t=i("#"+l[0]+e),n=t.attr("area").split(",");t.attr("type");r.style(e,{width:parseFloat(n[0]),height:parseFloat(n[1]),top:parseFloat(n[2]),left:parseFloat(n[3]),position:t.attr("position"),overflow:"visible"},!0),t.find(".layui-layer-max").removeClass("layui-layer-maxmin"),t.find(".layui-layer-min").show(),"page"===t.attr("type")&&t.find(l[4]).show(),o.rescollbar(e)},r.full=function(e){var t,a=i("#"+l[0]+e);o.record(a),l.html.attr("layer-full")||l.html.css("overflow","hidden").attr("layer-full",e),clearTimeout(t),t=setTimeout(function(){var t="fixed"===a.css("position");r.style(e,{top:t?0:n.scrollTop(),left:t?0:n.scrollLeft(),width:n.width(),height:n.height()},!0),a.find(".layui-layer-min").hide()},100)},r.title=function(e,t){var n=i("#"+l[0]+(t||r.index)).find(l[1]);n.html(e)},r.close=function(e){var t=i("#"+l[0]+e),n=t.attr("type"),a="layer-anim-close";if(t[0]){var s="layui-layer-wrap",f=function(){if(n===o.type[1]&&"object"===t.attr("conType")){t.children(":not(."+l[5]+")").remove();for(var a=t.find("."+s),r=0;r<2;r++)a.unwrap();a.css("display",a.data("display")).removeClass(s)}else{if(n===o.type[2])try{var f=i("#"+l[4]+e)[0];f.contentWindow.document.write(""),f.contentWindow.close(),t.find("."+l[5])[0].removeChild(f)}catch(c){}t[0].innerHTML="",t.remove()}"function"==typeof o.end[e]&&o.end[e](),delete o.end[e]};t.data("anim")&&t.addClass(a),i("#layui-layer-moves, #layui-layer-shade"+e).remove(),6==r.ie&&o.reselect(),o.rescollbar(e),t.attr("minLeft")&&(o.minIndex--,o.minLeft.push(t.attr("minLeft"))),setTimeout(function(){f()},r.ie&&r.ie<10||!t.data("anim")?0:200)}},r.closeAll=function(e){i.each(i("."+l[0]),function(){var t=i(this),n=e?t.attr("type")===e:1;n&&r.close(t.attr("times")),n=null})};var f=r.cache||{},c=function(e){return f.skin?" "+f.skin+" "+f.skin+"-"+e:""};r.prompt=function(e,t){var a="";if(e=e||{},"function"==typeof e&&(t=e),e.area){var o=e.area;a='style="width: '+o[0]+"; height: "+o[1]+';"',delete e.area}var s,l=2==e.formType?'":function(){return''}(),f=e.success;return delete e.success,r.open(i.extend({type:1,btn:["确定","取消"],content:l,skin:"layui-layer-prompt"+c("prompt"),maxWidth:n.width(),success:function(e){s=e.find(".layui-layer-input"),s.focus(),"function"==typeof f&&f(e)},resize:!1,yes:function(i){var n=s.val();""===n?s.focus():n.length>(e.maxlength||500)?r.tips("最多输入"+(e.maxlength||500)+"个字数",s,{tips:1}):t&&t(n,i,s)}},e))},r.tab=function(e){e=e||{};var t=e.tab||{},n=e.success;return delete e.success,r.open(i.extend({type:1,skin:"layui-layer-tab"+c("tab"),resize:!1,title:function(){var e=t.length,i=1,n="";if(e>0)for(n=''+t[0].title+"";i"+t[i].title+"";return n}(),content:'
      '+function(){var e=t.length,i=1,n="";if(e>0)for(n='
    • '+(t[0].content||"no content")+"
    • ";i'+(t[i].content||"no content")+"";return n}()+"
    ",success:function(t){var a=t.find(".layui-layer-title").children(),o=t.find(".layui-layer-tabmain").children();a.on("mousedown",function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0;var n=i(this),a=n.index();n.addClass("layui-layer-tabnow").siblings().removeClass("layui-layer-tabnow"),o.eq(a).show().siblings().hide(),"function"==typeof e.change&&e.change(a)}),"function"==typeof n&&n(t)}},e))},r.photos=function(t,n,a){function o(e,t,i){var n=new Image;return n.src=e,n.complete?t(n):(n.onload=function(){n.onload=null,t(n)},void(n.onerror=function(e){n.onerror=null,i(e)}))}var s={};if(t=t||{},t.photos){var l=t.photos.constructor===Object,f=l?t.photos:{},u=f.data||[],d=f.start||0;s.imgIndex=(0|d)+1,t.img=t.img||"img";var y=t.success;if(delete t.success,l){if(0===u.length)return r.msg("没有图片")}else{var p=i(t.photos),h=function(){u=[],p.find(t.img).each(function(e){var t=i(this);t.attr("layer-index",e),u.push({alt:t.attr("alt"),pid:t.attr("layer-pid"),src:t.attr("layer-src")||t.attr("src"),thumb:t.attr("src")})})};if(h(),0===u.length)return;if(n||p.on("click",t.img,function(){var e=i(this),n=e.attr("layer-index");r.photos(i.extend(t,{photos:{start:n,data:u,tab:t.tab},full:t.full}),!0),h()}),!n)return}s.imgprev=function(e){s.imgIndex--,s.imgIndex<1&&(s.imgIndex=u.length),s.tabimg(e)},s.imgnext=function(e,t){s.imgIndex++,s.imgIndex>u.length&&(s.imgIndex=1,t)||s.tabimg(e)},s.keyup=function(e){if(!s.end){var t=e.keyCode;e.preventDefault(),37===t?s.imgprev(!0):39===t?s.imgnext(!0):27===t&&r.close(s.index)}},s.tabimg=function(e){u.length<=1||(f.start=s.imgIndex-1,r.close(s.index),setTimeout(function(){r.photos(t,!0,e)},200))},s.event=function(){s.bigimg.hover(function(){s.imgsee.show()},function(){s.imgsee.hide()}),s.bigimg.find(".layui-layer-imgprev").on("click",function(e){e.preventDefault(),s.imgprev()}),s.bigimg.find(".layui-layer-imgnext").on("click",function(e){e.preventDefault(),s.imgnext()}),i(document).on("keyup",s.keyup)},s.loadi=r.load(1,{shade:!("shade"in t)&&.9,scrollbar:!1}),o(u[d].src,function(n){r.close(s.loadi),s.index=r.open(i.extend({type:1,id:"layui-layer-photos",area:function(){var a=[n.width,n.height],o=[i(e).width()-100,i(e).height()-100];if(!t.full&&(a[0]>o[0]||a[1]>o[1])){var r=[a[0]/o[0],a[1]/o[1]];r[0]>r[1]?(a[0]=a[0]/r[0],a[1]=a[1]/r[0]):r[0]'+(u[d].alt||
    '+(u.length>1?'':"")+'
    '+(u[d].alt||"")+""+s.imgIndex+"/"+u.length+"
    ",success:function(e,i){s.bigimg=e.find(".layui-layer-phimg"),s.imgsee=e.find(".layui-layer-imguide,.layui-layer-imgbar"),s.event(e),t.tab&&t.tab(u[d],e),"function"==typeof y&&y(e)},end:function(){s.end=!0,i(document).off("keyup",s.keyup)}},t))},function(){r.close(s.loadi),r.msg("当前图片地址异常
    是否继续查看下一张?",{time:3e4,btn:["下一张","不看了"],yes:function(){u.length>1&&s.imgnext(!0,!0)}})})}},o.run=function(t){i=t,n=i(e),l.html=i("html"),r.open=function(e){var t=new s(e);return t.index}},e.layui&&layui.define?(r.ready(),layui.define("jquery",function(t){r.path=layui.cache.dir,o.run(layui.jquery),e.layer=r,t("layer",r)})):"function"==typeof define&&define.amd?define(["jquery"],function(){return o.run(e.jQuery),r}):function(){o.run(e.jQuery),r.ready()}()}(window); -------------------------------------------------------------------------------- /WebRoot/js/util/kr_util.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 判断非空 3 | * 4 | * @param val 5 | * @returns {Boolean} 6 | */ 7 | function isEmpty(val) { 8 | val = $.trim(val); 9 | if (val == null) 10 | return true; 11 | if (val == undefined || val == 'undefined') 12 | return true; 13 | if (val == "") 14 | return true; 15 | if (val.length == 0) 16 | return true; 17 | if (!/[^(^\s*)|(\s*$)]/.test(val)) 18 | return true; 19 | return false; 20 | } 21 | 22 | function isNotEmpty(val) { 23 | return !isEmpty(val); 24 | } 25 | 26 | /** 27 | * 阻止事件冒泡 28 | * 29 | * @param e 30 | */ 31 | function stopBubble(e) { 32 | // 如果提供了事件对象,则这是一个非IE浏览器 33 | if (e && e.stopPropagation) 34 | // 因此它支持W3C的stopPropagation()方法 35 | e.stopPropagation(); 36 | else 37 | // 否则,我们需要使用IE的方式来取消事件冒泡 38 | window.event.cancelBubble = true; 39 | }; 40 | 41 | function jsonToString(obj) { 42 | var THIS = this; 43 | switch (typeof (obj)) { 44 | case 'string': 45 | return '"' + obj.replace(/(["\\])/g, '\\$1') + '"'; 46 | case 'array': 47 | return '[' + obj.map(THIS.jsonToString).join(',') + ']'; 48 | case 'object': 49 | if (obj instanceof Array) { 50 | var strArr = []; 51 | var len = obj.length; 52 | for (var i = 0; i < len; i++) { 53 | strArr.push(THIS.jsonToString(obj[i])); 54 | } 55 | return '[' + strArr.join(',') + ']'; 56 | } else if (obj == null) { 57 | return 'null'; 58 | 59 | } else { 60 | var string = []; 61 | for ( var property in obj) 62 | string.push(THIS.jsonToString(property) + ':' 63 | + THIS.jsonToString(obj[property])); 64 | return '{' + string.join(',') + '}'; 65 | } 66 | case 'number': 67 | return obj; 68 | case false: 69 | return obj; 70 | } 71 | } 72 | 73 | 74 | 75 | //判断两个元素是否相等 76 | function eqauls(str,tstr){ 77 | if(str == tstr){ 78 | return true; 79 | } 80 | return false; 81 | }; 82 | 83 | /** ******************************数组相关结束*********************************** */ 84 | /** 85 | * 禁止窗体选中 86 | */ 87 | function forbiddenSelect() { 88 | $(document).bind("selectstart", function() { 89 | return false; 90 | }); 91 | document.onselectstart = new Function("event.returnValue=false;"); 92 | $("*").css({ 93 | "-moz-user-select" : "none" 94 | }); 95 | } 96 | 97 | /* 窗体允许选中 */ 98 | function autoSelect() { 99 | $(document).bind("selectstart", function() { 100 | return true; 101 | }); 102 | document.onselectstart = new Function("event.returnValue=true;"); 103 | $("*").css({ 104 | "-moz-user-select" : "" 105 | }); 106 | }; 107 | 108 | 109 | /** 110 | * 对Date的扩展,将 Date 转化为指定格式的String 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 111 | * 可以用 1-2 个占位符 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字) eg: (new 112 | * Date()).format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423 (new 113 | * Date()).format("yyyy-MM-dd E HH:mm:ss") ==> 2009-03-10 二 20:09:04 (new 114 | * Date()).format("yyyy-MM-dd EE hh:mm:ss") ==> 2009-03-10 周二 08:09:04 (new 115 | * Date()).format("yyyy-MM-dd EEE hh:mm:ss") ==> 2009-03-10 星期二 08:09:04 (new 116 | * Date()).format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18 117 | */ 118 | Date.prototype.format = function(fmt) { 119 | var o = { 120 | "Y+" : this.getFullYear(), 121 | "M+" : this.getMonth() + 1, 122 | // 月份 123 | "d+" : this.getDate(), 124 | // 日 125 | "h+" : this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, 126 | // 小时 127 | "H+" : this.getHours(), 128 | // 小时 129 | "m+" : this.getMinutes(), 130 | // 分 131 | "s+" : this.getSeconds(), 132 | // 秒 133 | "q+" : Math.floor((this.getMonth() + 3) / 3), 134 | // 季度 135 | "S" : this.getMilliseconds() 136 | // 毫秒 137 | }; 138 | var week = { 139 | "0" : "/u65e5", 140 | "1" : "/u4e00", 141 | "2" : "/u4e8c", 142 | "3" : "/u4e09", 143 | "4" : "/u56db", 144 | "5" : "/u4e94", 145 | "6" : "/u516d" 146 | }; 147 | if (/(y+)/.test(fmt)) { 148 | fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "") 149 | .substr(4 - RegExp.$1.length)); 150 | } 151 | if (/(E+)/.test(fmt)) { 152 | fmt = fmt 153 | .replace( 154 | RegExp.$1, 155 | ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "/u661f/u671f" 156 | : "/u5468") 157 | : "") 158 | + week[this.getDay() + ""]); 159 | } 160 | for ( var k in o) { 161 | if (new RegExp("(" + k + ")").test(fmt)) { 162 | fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) 163 | : (("00" + o[k]).substr(("" + o[k]).length))); 164 | } 165 | } 166 | return fmt; 167 | }; 168 | 169 | /** 170 | * 将数字转换成对应的中文 将阿拉伯数字翻译成中文的大写数字 171 | * 172 | * @param {Object} 173 | * num 比如:1对应一 11:十一 101:一百零一 174 | * @return {TypeName} 175 | */ 176 | function tm_NumberToChinese(num) { 177 | var AA = new Array("零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"); 178 | var BB = new Array("", "十", "百", "仟", "萬", "億", "点", ""); 179 | var a = ("" + num).replace(/(^0*)/g, "").split("."), 180 | k = 0, 181 | re = ""; 182 | for (var i = a[0].length - 1; i >= 0; i--) { 183 | switch (k) { 184 | case 0: 185 | re = BB[7] + re; 186 | break; 187 | case 4: 188 | if (!new RegExp("0{4}//d{" + (a[0].length - i - 1) + "}$").test(a[0])) re = BB[4] + re; 189 | break; 190 | case 8: 191 | re = BB[5] + re; 192 | BB[7] = BB[5]; 193 | k = 0; 194 | break; 195 | } 196 | if (k % 4 == 2 && a[0].charAt(i + 2) != 0 && a[0].charAt(i + 1) == 0) re = AA[0] + re; 197 | if (a[0].charAt(i) != 0) re = AA[a[0].charAt(i)] + BB[k % 4] + re; 198 | k++; 199 | } 200 | 201 | if (a.length > 1) // 加上小数部分(如果有小数部分) 202 | { 203 | re += BB[6]; 204 | for (var i = 0; i < a[1].length; i++) re += AA[a[1].charAt(i)]; 205 | } 206 | if (re == '一十') re = "十"; 207 | if (re.match(/^一/) && re.length == 3) re = re.replace("一", ""); 208 | return re; 209 | }; 210 | 211 | 212 | 213 | /** 214 | * 获取窗体可见度高度 215 | * 216 | * @returns 217 | */ 218 | function getClientHeight() { 219 | var clientHeight = 0; 220 | if (document.body.clientHeight && document.documentElement.clientHeight) { 221 | clientHeight = (document.body.clientHeight < document.documentElement.clientHeight) ? document.body.clientHeight 222 | : document.documentElement.clientHeight; 223 | } else { 224 | clientHeight = (document.body.clientHeight > document.documentElement.clientHeight) ? document.body.clientHeight 225 | : document.documentElement.clientHeight; 226 | } 227 | return clientHeight; 228 | } 229 | 230 | 231 | /** 232 | * 获取窗体可见度宽度 233 | * 234 | * @returns 235 | */ 236 | function getClientWidth() { 237 | var clientWidth = 0; 238 | if (document.body.clientWidth && document.documentElement.clientWidth) { 239 | clientWidth = (document.body.clientWidth < document.documentElement.clientWidth) ? document.body.clientWidth 240 | : document.documentElement.clientWidth; 241 | } else { 242 | clientWidth = (document.body.clientWidth > document.documentElement.clientWidth) ? document.body.clientWidth 243 | : document.documentElement.clientWidth; 244 | } 245 | return clientWidth; 246 | } 247 | 248 | function getScrollHeight() { 249 | return Math.max(getClientHeight(), document.body.scrollHeight, 250 | document.documentElement.scrollHeight); 251 | } 252 | 253 | function getScrollTop() { 254 | var scrollTop = 0; 255 | if (document.documentElement && document.documentElement.scrollTop) { 256 | scrollTop = document.documentElement.scrollTop; 257 | } else if (document.body) { 258 | scrollTop = document.body.scrollTop; 259 | } 260 | return scrollTop; 261 | } 262 | 263 | /* 文件大小转换为MB GB KB格式 */ 264 | function tm_countFileSize(size) { 265 | var fsize = parseFloat(size, 2); 266 | var fileSizeString; 267 | if (fsize < 1024) { 268 | fileSizeString = fsize.toFixed(2) + "B"; 269 | } else if (fsize < 1048576) { 270 | fileSizeString = (fsize / 1024).toFixed(2) + "KB"; 271 | } else if (fsize < 1073741824) { 272 | fileSizeString = (fsize / 1024 / 1024).toFixed(2) + "MB"; 273 | } else if (fsize < 1024 * 1024 * 1024) { 274 | fileSizeString = (fsize / 1024 / 1024 / 1024).toFixed(2) + "GB"; 275 | } else { 276 | fileSizeString = "0B"; 277 | } 278 | return fileSizeString; 279 | }; 280 | 281 | /* 获取文件后缀 */ 282 | function tm_getExt(fileName) { 283 | if (fileName.lastIndexOf(".") == -1) 284 | return fileName; 285 | var pos = fileName.lastIndexOf(".") + 1; 286 | return fileName.substring(pos, fileName.length).toLowerCase(); 287 | } 288 | 289 | /* 获取文件名称 */ 290 | function tm_getFileName(fileName) { 291 | var pos = fileName.lastIndexOf("/") + 1; 292 | if (pos == -1) { 293 | return fileName; 294 | } else { 295 | return fileName.substring(pos, fileName.length); 296 | } 297 | } 298 | 299 | 300 | /** 301 | * 禁止窗体选中 302 | */ 303 | function tm_forbiddenSelect() { 304 | $(document).bind("selectstart", function() { 305 | return false; 306 | }); 307 | document.onselectstart = new Function("event.returnValue=false;"); 308 | $("*").css({ 309 | "-moz-user-select" : "none" 310 | }); 311 | } 312 | 313 | 314 | /* 窗体允许选中 */ 315 | function tm_autoSelect() { 316 | $(document).bind("selectstart", function() { 317 | return true; 318 | }); 319 | document.onselectstart = new Function("event.returnValue=true;"); 320 | $("*").css({ 321 | "-moz-user-select" : "" 322 | }); 323 | } 324 | 325 | //获取几秒钟以前 startTime==== Date 326 | function getTimeFormat(startTime) { 327 | var startTimeMills = startTime.getTime(); 328 | var endTimeMills = new Date().getTime(); 329 | var diff = parseInt((endTimeMills - startTimeMills) / 1000);//秒 330 | var day_diff = parseInt(Math.floor(diff / 86400));//天 331 | var buffer = Array(); 332 | if (day_diff < 0) { 333 | return "[error],时间越界..."; 334 | } else { 335 | if (day_diff == 0 && diff < 60) { 336 | if (diff <= 0) 337 | diff = 1; 338 | buffer.push(diff + "秒前"); 339 | } else if (day_diff == 0 && diff < 120) { 340 | buffer.push("1 分钟前"); 341 | } else if (day_diff == 0 && diff < 3600) { 342 | buffer.push(Math.round(Math.floor(diff / 60)) + "分钟前"); 343 | } else if (day_diff == 0 && diff < 7200) { 344 | buffer.push("1小时前"); 345 | } else if (day_diff == 0 && diff < 86400) { 346 | buffer.push(Math.round(Math.floor(diff / 3600)) + "小时前"); 347 | } else if (day_diff == 1) { 348 | buffer.push("1天前"); 349 | } else if (day_diff < 7) { 350 | buffer.push(day_diff + "天前"); 351 | } else if (day_diff < 30) { 352 | buffer.push(Math.round(Math.floor(day_diff / 7)) + " 星期前"); 353 | } else if (day_diff >= 30 && day_diff <= 179) { 354 | buffer.push(Math.round(Math.floor(day_diff / 30)) + "月前"); 355 | } else if (day_diff >= 180 && day_diff < 365) { 356 | buffer.push("半年前"); 357 | } else if (day_diff >= 365) { 358 | buffer.push(Math.round(Math.floor(day_diff / 30 / 12)) + "年前"); 359 | } 360 | } 361 | return buffer.toString(); 362 | }; 363 | 364 | 365 | String.prototype.trim = function(){ 366 | return this.replace(/(^\s*)|(\s*$)/g,""); 367 | }; 368 | 369 | String.prototype.isEmpty = function(){ 370 | var val = this; 371 | val = $.trim(val); 372 | if (val== null) 373 | return true; 374 | if (val == undefined || val == 'undefined') 375 | return true; 376 | if (val == "") 377 | return true; 378 | if (val.length == 0) 379 | return true; 380 | if (!/[^(^\s*)|(\s*$)]/.test(val)) 381 | return true; 382 | return false; 383 | }; 384 | 385 | String.prototype.isNotEmpty = function(){ 386 | return !this.isEmpty(); 387 | }; 388 | 389 | String.prototype.replaceAll = function(str,target){ 390 | return this.replace(new RegExp(str,"ig"),target); 391 | }; 392 | 393 | var tzUtil = { 394 | _position : function($dom,amark){//居中定位 395 | var windowWidth = $(window).width(); 396 | var windowHeight= $(window).height(); 397 | var width = $dom.width(); 398 | var height = $dom.height(); 399 | var left = (windowWidth - width)/2; 400 | var top = (windowHeight - height)/2; 401 | if(!amark)$dom.css("top",top).animate({left:left}); 402 | if(amark==0)$dom.animate({left:left,"top":top}); 403 | if(amark==1)$dom.css("left",left).animate({"top":top}); 404 | if(amark==2)$dom.css({left:left,"top":top}); 405 | return this; 406 | }, 407 | 408 | _positionParent : function($dom,$parent){//居中定位 409 | var parentWidth = $parent.width(); 410 | var parentHeight= $parent.height(); 411 | var width = $dom.width(); 412 | var height = $dom.height(); 413 | var left = (parentWidth - width)/2; 414 | var top = (parentHeight - height)/2; 415 | $dom.css({left:left,top:top}); 416 | return this; 417 | }, 418 | 419 | resize : function($dom){ 420 | var $this = this; 421 | $(window).resize(function(){ 422 | $this._position($dom); 423 | }); 424 | }, 425 | animates:function($dom,mark){ 426 | switch(mark){ 427 | case "fadeOut":$dom.toggleClass(tz_animateOut()).fadeOut("slow",function(){$(this).remove();});break; 428 | case "slideUp":$dom.toggleClass(tz_animateOut()).slideUp("slow",function(){$(this).remove();});break; 429 | case "fadeIn":$dom.toggleClass(tz_animateOut()).fadeIn("slow");break; 430 | case "slideDown":$dom.toggleClass(tz_animateOut()).slideDown("slow");break; 431 | case "left":$dom.toggleClass(tz_animateOut()).animate({left:0},300,function(){$(this).remove();});break; 432 | case "top":$dom.toggleClass(tz_animateOut()).animate({top:0},300,function(){$(this).remove();});break; 433 | } 434 | }, 435 | 436 | isEmpty:function(str){ 437 | val = $.trim(val); 438 | if (val == null) 439 | return true; 440 | if (val == undefined || val == 'undefined') 441 | return true; 442 | if (val == "") 443 | return true; 444 | if (val.length == 0) 445 | return true; 446 | if (!/[^(^\s*)|(\s*$)]/.test(val)) 447 | return true; 448 | return false; 449 | }, 450 | 451 | isNotEmpty:function(str){ 452 | return !this.isEmpty(str); 453 | }, 454 | getRandomColor : function(){ 455 | return '#'+Math.floor(Math.random()*16777215).toString(16); 456 | }, 457 | 458 | forbiddenSelect : function(){ 459 | $(document).bind("selectstart", function() { 460 | return false; 461 | }); 462 | document.onselectstart = new Function("event.returnValue=false;"); 463 | $("*").css({ 464 | "-moz-user-select" : "none" 465 | }); 466 | }, 467 | 468 | autoSelect : function() { 469 | $(document).bind("selectstart", function() { 470 | return true; 471 | }); 472 | document.onselectstart = new Function("event.returnValue=true;"); 473 | $("*").css({ 474 | "-moz-user-select" : "" 475 | }); 476 | } 477 | }; 478 | 479 | /* 判断一个元素释放包含在数组中。 */ 480 | Array.prototype.contains = function(obj) { 481 | var i = this.length; 482 | while (i--) { 483 | if (this[i] === obj) { 484 | return true; 485 | } 486 | } 487 | return false; 488 | }; 489 | 490 | 491 | var isArray = function(obj) { 492 | return Object.prototype.toString.call(obj) === '[object Array]'; 493 | }; 494 | 495 | var is_array = function(value) { 496 | return value && 497 | typeof value === 'object' && 498 | typeof value.length === 'number' && 499 | typeof value.splice === 'function' && 500 | !(value.propertyIsEnumerable('length')); 501 | }; 502 | 503 | /*日期工具类*/ 504 | $.tmDate = { 505 | /*转换日期*/ 506 | _transferDate : function(date){ 507 | if(typeof date =="string"){ 508 | return new Date(date.replace(/-/ig,"/")); 509 | }else{ 510 | return date; 511 | } 512 | }, 513 | /*格式化日期*/ 514 | _toString : function(date,pattern){ 515 | var d = this._transferDate(date); 516 | return d.format(pattern); 517 | }, 518 | 519 | /*获取两个时间相减的时间*/ 520 | _Date : function(date1,date2){ 521 | var dateTime = this._numMillSecond(date1,date2); 522 | return new Date(dateTime).format("yyyy-MM-dd"); 523 | }, 524 | 525 | //间隔年份 526 | _numYear : function(date1,date2){ 527 | var times = this._numDay(date1,date2); 528 | return Math.floor(times/365); 529 | }, 530 | 531 | //间隔月份 532 | _numMonth : function(date1,date2){ 533 | var times = this._numDay(date1,date2); 534 | return Math.floor(times/30); 535 | }, 536 | 537 | //间隔天数 538 | _numDay : function(date1,date2){ 539 | var times = this._numSecond(date1,date2); 540 | var hour = this._var().hour; 541 | var mills = this._var().mills; 542 | return Math.ceil(times/(mills * hour)); 543 | }, 544 | 545 | //间隔时 546 | _numHour : function(date1,date2){ 547 | return Math.floor(this._numMillSecond(date1,date2)/(1000*60*60)); 548 | }, 549 | 550 | //间隔分 551 | _numMinute : function(date1,date2){ 552 | return Math.floor(this._numMillSecond(date1,date2)/(1000*60)); 553 | }, 554 | 555 | //间隔秒数 556 | _numSecond : function(date1,date2){ 557 | return Math.floor(this._numMillSecond(date1,date2) / 1000); 558 | }, 559 | 560 | //间隔毫秒 561 | _numMillSecond : function(date1,date2){ 562 | var stimes = this._getTime(this._transferDate(date1)); 563 | var etimes = this._getTime(this._transferDate(date2)); 564 | return etimes - stimes; 565 | }, 566 | 567 | _var : function(){ 568 | return {hour:24,second:60,mills:3600,format:"yyyy-MM-dd",dateFormat:"yyyy-MM-dd HH:mm:ss"}; 569 | }, 570 | 571 | /*某个日期加上多少毫秒*/ 572 | _plusMillisSeconds : function(date,millisSeconds){ 573 | var dateTime = this._getTime(date); 574 | var mintimes = millisSeconds; 575 | var rdate = dateTime*1 + mintimes*1; 576 | return this._format(new Date(rdate)); 577 | }, 578 | /*某个日期加上多少秒*/ 579 | _plusSeconds : function(date,seconds){ 580 | var dateTime = this._getTime(date); 581 | var mintimes = seconds*1000; 582 | var rdate = dateTime*1 + mintimes*1; 583 | return this._format(new Date(rdate)); 584 | }, 585 | /*某个日期加上多少分钟*/ 586 | _plusMinutes : function(date,minutes){ 587 | var dateTime = this._getTime(date); 588 | var mintimes = minutes*60*1000; 589 | var rdate = dateTime*1 + mintimes*1; 590 | return this._format(new Date(rdate)); 591 | }, 592 | /*某个日期加上小时数*/ 593 | _plusHours : function(date,hours){ 594 | var dateTime = this._getTime(date); 595 | var mintimes = hours*60*60*1000; 596 | var rdate = dateTime + mintimes; 597 | return this._format(new Date(rdate)); 598 | }, 599 | /*某个日期加上天数*/ 600 | _plusDays : function(date,days){ 601 | var dateTime = this._getTime(date); 602 | var mintimes = days*60*60*1000*24; 603 | var rdate = dateTime*1 + mintimes*1; 604 | return this._format(new Date(rdate)); 605 | }, 606 | 607 | /*某个日期加上多少个月,这里是按照一个月30天来计算天数的*/ 608 | _plusMonths : function(date,months){ 609 | var dateTime = this._getTime(date); 610 | var mintimes = months*30*60*60*1000*24; 611 | var rdate = dateTime + mintimes*1; 612 | return this._format(new Date(rdate)); 613 | }, 614 | 615 | /*某个日期加上多少个年,这里是按照一个月365天来计算天数的,如果loop为true则按闰年计算*/ 616 | _plusYears : function(date,years,isLoop){ 617 | var dateTime = this._getTime(date); 618 | var day = 365; 619 | if(isLoop)day =366; 620 | var mintimes = years*day*60*60*1000*24; 621 | var rdate = dateTime + mintimes; 622 | return this._format(new Date(rdate)); 623 | }, 624 | 625 | /*某个日期加上某个日期,这样的操作视乎没什么意义*/ 626 | _plusDate : function(date1,date2){ 627 | var dateTime = this._getTime(date1); 628 | var dateTime2 = this._getTime(date2);; 629 | var rdate = dateTime + dateTime2; 630 | return this._format(new Date(rdate)); 631 | }, 632 | 633 | /*某个日期减去多少毫秒秒*/ 634 | _minusMillisSeconds : function(date,millisSeconds){ 635 | var dateTime = this._getTime(date); 636 | var mintimes = millisSeconds*1; 637 | var rdate = dateTime - mintimes; 638 | return this._format(new Date(rdate)); 639 | }, 640 | /*某个日期减去多少秒*/ 641 | _minusSeconds : function(date,seconds){ 642 | var dateTime = this._getTime(date); 643 | var mintimes = seconds*1000; 644 | var rdate = dateTime - mintimes; 645 | return this._format(new Date(rdate)); 646 | }, 647 | /*某个日期减去多少分钟*/ 648 | _minusMinutes : function(date,minutes){ 649 | var dateTime = this._getTime(date); 650 | var mintimes = minutes*60*1000; 651 | var rdate = dateTime - mintimes; 652 | return this._format(new Date(rdate)); 653 | }, 654 | /*某个日期减去小时数*/ 655 | _minusHours : function(date,hours){ 656 | var dateTime = this._getTime(date); 657 | var mintimes = hours*60*60*1000; 658 | var rdate = dateTime - mintimes; 659 | return this._format(new Date(rdate)); 660 | }, 661 | /*某个日期减去天数*/ 662 | _minusDays : function(date,days){ 663 | var dateTime = this._getTime(date); 664 | var mintimes = days*60*60*1000*24; 665 | var rdate = dateTime - mintimes; 666 | return this._format(new Date(rdate)); 667 | }, 668 | 669 | /*某个日期减去多少个月,这里是按照一个月30天来计算天数的*/ 670 | _minusMonths : function(date,months){ 671 | var dateTime = this._getTime(date); 672 | var mintimes = months*30*60*60*1000*24; 673 | var rdate = dateTime - mintimes; 674 | return this._format(new Date(rdate)); 675 | }, 676 | 677 | /*某个日期减去多少个年,这里是按照一个月365天来计算天数的*/ 678 | _minusYears : function(date,years,isLoop){ 679 | var dateTime = this._getTime(date); 680 | var day = 365; 681 | if(isLoop)day =366; 682 | var mintimes = years*day*60*60*1000*24; 683 | var rdate = dateTime - mintimes; 684 | return this._format(new Date(rdate)); 685 | }, 686 | 687 | /*某个日期减去某个日期,这样的操作视乎没什么意义*/ 688 | _minusDate : function(date1,date2){ 689 | var dateTime = this._getTime(date1); 690 | var dateTime2 = this._getTime(date2);; 691 | var rdate = dateTime - dateTime2; 692 | return this._format(new Date(rdate)); 693 | }, 694 | 695 | /*获取一个月有多少天*/ 696 | _getMonthOfDay :function(date1){ 697 | var currentMonth = this._getFirstDayOfMonth(date1); 698 | var nextMonth = this._getNextDayOfMonth(date1); 699 | return this._numDay(currentMonth,nextMonth); 700 | }, 701 | 702 | /*获取一年又多少天*/ 703 | _getYearOfDay : function(date){ 704 | var firstDayYear = this._getFirstDayOfYear(date); 705 | var lastDayYear = this._getLastDayOfYear(date); 706 | return Math.ceil(this._numDay(firstDayYear,lastDayYear)); 707 | }, 708 | 709 | /*某个日期是当年中的第几天*/ 710 | _getDayOfYear : function(date1){ 711 | return Math.ceil(this._numDay(this._getFirstDayOfYear(date1),date1)); 712 | }, 713 | 714 | /*某个日期是在当月中的第几天*/ 715 | _getDayOfMonth : function(date1){ 716 | return Math.ceil(this._numDay(this._getFirstDayOfMonth(date1),date1)); 717 | }, 718 | 719 | /*获取某个日期在这一年的第几周*/ 720 | _getDayOfYearWeek : function(date){ 721 | var numdays = this._getDayOfYear(date); 722 | return Math.ceil(numdays / 7); 723 | }, 724 | 725 | /*某个日期是在当月中的星期几*/ 726 | _getDayOfWeek : function(date1){ 727 | return this._getWeek(date1); 728 | }, 729 | 730 | /*获取在当前日期中的时间*/ 731 | _getHourOfDay : function(date){ 732 | return this._getHour(date); 733 | }, 734 | _eq : function(date1,date2){ 735 | var stime = this._getTime(this._transferDate(date1)); 736 | var etime = this._getTime(this._transferDate(date2)); 737 | return stime == etime ? true :false; 738 | }, 739 | /*某个日期是否晚于某个日期*/ 740 | _after : function(date1,date2){ 741 | var stime = this._getTime(this._transferDate(date1)); 742 | var etime = this._getTime(this._transferDate(date2)); 743 | return stime < etime ? true :false; 744 | }, 745 | 746 | /*某个日期是否早于某个日期*/ 747 | _before : function(date1,date2){ 748 | var stime = this._getTime(this._transferDate(date1)); 749 | var etime = this._getTime(this._transferDate(date2)); 750 | return stime > etime ? true :false; 751 | }, 752 | 753 | /*获取某年的第一天*/ 754 | _getFirstDayOfYear : function(date){ 755 | var year = this._getYear(date); 756 | var dateString = year+"-01-01 00:00:00"; 757 | return dateString; 758 | }, 759 | 760 | /*获取某年的最后一天*/ 761 | _getLastDayOfYear : function(date){ 762 | var year = this._getYear(date); 763 | var dateString = year+"-12-01 00:00:00"; 764 | var endDay = this._getMonthOfDay(dateString); 765 | return year+"-12-"+endDay+" 23:59:59"; 766 | }, 767 | 768 | /*获取某月的第一天*/ 769 | _getFirstDayOfMonth: function(date){ 770 | var year = this._getYear(date); 771 | var month = this._getMonth(date); 772 | var dateString = year +"-"+month+"-01 00:00:00"; 773 | return dateString; 774 | }, 775 | 776 | /*获取某月最后一天*/ 777 | _getLastDayOfMonth : function(date){ 778 | var endDay = this._getMonthOfDay(date); 779 | var year = this._getYear(date); 780 | var month = this._getMonth(date); 781 | return year +"-"+month+"-"+endDay+" 23:59:59"; 782 | }, 783 | /*一天的开始时间*/ 784 | _getFirstOfDay : function(date){ 785 | var year = this._getYear(date); 786 | var month = this._getMonth(date); 787 | var date = this._getDay(date); 788 | return year+"-"+month+"-"+date+" 00:00:00"; 789 | }, 790 | 791 | /*一天的结束时间*/ 792 | _getLastOfDay : function(date){ 793 | var year = this._getYear(date); 794 | var month = this._getMonth(date); 795 | var date = this._getDay(date); 796 | return year+"-"+month+"-"+date+" 23:59:59"; 797 | }, 798 | 799 | /*获取下个月的第一天*/ 800 | _getNextDayOfMonth: function(date){ 801 | var year = this._getYear(date); 802 | var month = this._getMonth(date); 803 | month = month * 1 +1; 804 | if(month>12){ 805 | year = year+1; 806 | month = month - 12; 807 | } 808 | month = month>9 ? month : "0"+month; 809 | var dateString = year +"-"+month+"-01 00:00:00"; 810 | return dateString; 811 | }, 812 | 813 | _getFirstOfWeek : function(date1){ 814 | var week = this._getWeek(date1); 815 | var date = this._minusDays(date1,week); 816 | var year = this._getYear(date); 817 | var month = this._getMonth(date); 818 | var date = this._getDay(date); 819 | return year+"-"+month+"-"+date+" 00:00:00"; 820 | }, 821 | 822 | _getLastOfWeek : function(date1){ 823 | var week = 6-this._getWeek(date1); 824 | var date = this._minusDays(date1,week); 825 | var year = this._getYear(date); 826 | var month = this._getMonth(date); 827 | var date = this._getDay(date); 828 | return year+"-"+month+"-"+date+" 23:59:59"; 829 | }, 830 | 831 | _getNow : function(){ 832 | return new Date(); 833 | }, 834 | _format : function(date){ 835 | return this._getYear(date)+"-"+this._getMonth(date)+"-"+this._getDay(date)+" "+this._getHour(date)+":"+this._getMinute(date)+":"+this._getSecond(date); 836 | }, 837 | _getDate :function(){ 838 | return this._getNow(); 839 | }, 840 | /*年*/ 841 | _getYear:function(date){ 842 | return this._transferDate(date).getFullYear(); 843 | }, 844 | 845 | /*月*/ 846 | _getMonth:function(date){ 847 | var month = this._transferDate(date).getMonth()+1; 848 | return month>9 ? month : "0"+month; 849 | }, 850 | 851 | /*日*/ 852 | _getDay:function(date){ 853 | var day = this._transferDate(date).getDate(); 854 | return day >9 ? day : "0"+day; 855 | }, 856 | 857 | /*获取今天星期几,如果为0代表星期日*/ 858 | _getWeek : function(date){ 859 | return this._transferDate(date).getDay(); 860 | }, 861 | 862 | /*时*/ 863 | _getHour : function(date){ 864 | var hour = this._transferDate(date).getHours(); 865 | return hour >9 ? hour : "0"+hour; 866 | }, 867 | 868 | /*12小时制时*/ 869 | _getHour12 : function(date){ 870 | var hour = this._transferDate(date).getHours(); 871 | return hour%12 == 0 ? 12 : hour % 12 872 | }, 873 | 874 | /*分*/ 875 | _getMinute : function(date){ 876 | var minutes = this._transferDate(date).getMinutes(); 877 | return minutes >9 ? minutes : "0"+minutes; 878 | }, 879 | 880 | /*秒*/ 881 | _getSecond : function(date){ 882 | var seconds = this._transferDate(date).getSeconds(); 883 | return seconds >9 ? seconds : "0"+seconds; 884 | }, 885 | 886 | /*毫秒*/ 887 | _getMillisecond : function(date){ 888 | return this._transferDate(date).getMilliseconds(); 889 | }, 890 | 891 | /*获取今天在当年是第几季度*/ 892 | _getPeriod : function(date){ 893 | var month = this._getMonth(date)*1; 894 | return Math.floor((month+3)/3) 895 | }, 896 | 897 | /*星期*/ 898 | _nowWeekChinies : function(date){ 899 | var nowWeek = this._getWeek(date); 900 | var day = ""; 901 | switch (nowWeek){ 902 | case 0:day="日";break; 903 | break; 904 | case 1:day="一";break; 905 | break; 906 | case 2:day="二";break; 907 | break; 908 | case 3:day="三";break; 909 | break; 910 | case 4:day="四";break; 911 | break; 912 | case 5:day="五";break; 913 | break; 914 | case 6:day="六";break; 915 | } 916 | return day; 917 | }, 918 | 919 | /*返回 1970 年 1 月 1 日至今的毫秒数。*/ 920 | _getTime : function(date){ 921 | return this._transferDate(date).getTime(); 922 | } 923 | }; 924 | /*date end*/ 925 | /*cookie*/ 926 | $.tmCookie = { 927 | setCookie : function(name, value,time,option){ 928 | var str=name+'='+escape(value); 929 | var date = new Date(); 930 | date.setTime(date.getTime()+this.getCookieTime(time)); 931 | str += "; expires=" + date.toGMTString(); 932 | if(option){ 933 | if(option.path) str+='; path='+option.path; 934 | if(option.domain) str+='; domain='+option.domain; 935 | if(option.secure) str+='; true'; 936 | } 937 | document.cookie=str; 938 | }, 939 | getCookie : function(name){ 940 | var arr = document.cookie.split('; '); 941 | if(arr.length==0) return ''; 942 | for(var i=0; i -1) { 1072 | arr.splice(index, 1); 1073 | } 1074 | return arr; 1075 | }, 1076 | removeObject : function(arr,item){ 1077 | for ( var i = 0; i < arr.length; i++) { 1078 | var jsonData = arr[i]; 1079 | for ( var key in jsonData) { 1080 | if (jsonData[key] == item) { 1081 | arr.splice(i, 1); 1082 | } 1083 | } 1084 | } 1085 | return arr; 1086 | }, 1087 | toArray : function(arrString,sp){ 1088 | if(sp==undefined)sp=","; 1089 | if(arrString==undefined)return this; 1090 | var arrs = arrString.split(sp); 1091 | return arrs; 1092 | }, 1093 | _numAscSort :function(a,b){ 1094 | return a-b; 1095 | }, 1096 | _numDescSort :function(a,b){ 1097 | return b-a; 1098 | }, 1099 | _sortAsc : function(x, y){ 1100 | if(x>y){ 1101 | return 1; 1102 | }else{ 1103 | return -1; 1104 | } 1105 | }, 1106 | _sortDesc : function (x, y){ 1107 | if(x>y){ 1108 | return -1; 1109 | }else{ 1110 | return 1; 1111 | } 1112 | } 1113 | 1114 | }; 1115 | /*手机*/ 1116 | function is_cellphoneNum(str) 1117 | { 1118 | var regExp = /^(\+86)?(13|18|15)\d{9}(?!\d)$/; 1119 | return regExp.test(str); 1120 | } 1121 | 1122 | /*邮件格式*/ 1123 | function is_email(str) 1124 | { 1125 | var regExp = /^([\w\.])+@\w+\.([\w\.])+$/; 1126 | return regExp.test(str); 1127 | } 1128 | /*array end*/ 1129 | 1130 | 1131 | function tz_animateIn(index){ 1132 | var animateIn = []; 1133 | animateIn.push("animated bounce");//0 1134 | animateIn.push("animated tada");//1 1135 | animateIn.push("animated swing");//2 1136 | animateIn.push("animated wobble");//3 1137 | animateIn.push("animated flip");//4 1138 | animateIn.push("animated flipInX");//5 1139 | animateIn.push("animated flipInY");//6 1140 | animateIn.push("animated fadeIn");//7 1141 | animateIn.push("animated fadeInUp");//8 1142 | animateIn.push("animated fadeInDown");//9 1143 | animateIn.push("animated fadeInLeft");//10 1144 | animateIn.push("animated fadeInRight");//11 1145 | animateIn.push("animated fadeInUpBig");//12 1146 | animateIn.push("animated fadeInDownBig");//13 1147 | animateIn.push("animated fadeInLeftBig");//14 1148 | animateIn.push("animated fadeInRightBig");//15 1149 | animateIn.push("animated bounceIn");//16 1150 | animateIn.push("animated bounceInUp");//17 1151 | animateIn.push("animated bounceInDown");//18 1152 | animateIn.push("animated bounceInLeft");//19 1153 | animateIn.push("animated bounceInRight");//20 1154 | animateIn.push("animated rotateIn");//21 1155 | animateIn.push("animated rotateInUpLeft");//22 1156 | animateIn.push("animated rotateInDownLeft");//23 1157 | animateIn.push("animated rotateInUpRight");//24 1158 | animateIn.push("animated rotateInDownRight");//25 1159 | animateIn.push("animated rollIn");//26 1160 | if(!index){ 1161 | var len = animateIn.length; 1162 | var r = Math.floor(Math.random()*(len-1)+1); 1163 | return animateIn[r]; 1164 | }else{ 1165 | return animateIn[index]; 1166 | } 1167 | } 1168 | 1169 | function tz_animateOut(index){ 1170 | var animateOut = []; 1171 | animateOut.push("animated flipOutX");//0 1172 | animateOut.push("animated flipOutY");//1 1173 | animateOut.push("animated fadeOut");//2 1174 | animateOut.push("animated fadeOutUp");//3 1175 | animateOut.push("animated fadeOutDown");//4 1176 | animateOut.push("animated fadeOutLeft");//5 1177 | animateOut.push("animated fadeOutRight");//6 1178 | animateOut.push("animated fadeOutUpBig");//7 1179 | animateOut.push("animated fadeOutDownBig");//8 1180 | animateOut.push("animated fadeOutLeftBig");//9 1181 | animateOut.push("animated fadeOutRightBig");//10 1182 | animateOut.push("animated bounceOut");//11 1183 | animateOut.push("animated bounceOutUp");//12 1184 | animateOut.push("animated bounceOutDown");//13 1185 | animateOut.push("animated bounceOutLeft");//14 1186 | animateOut.push("animated bounceOutRight");//15 1187 | animateOut.push("animated rotateOut");//16 1188 | animateOut.push("animated rotateOutUpLeft");//17 1189 | animateOut.push("animated rotateOutDownLeft");//18 1190 | animateOut.push("animated rotateOutDownRight");//19 1191 | animateOut.push("animated rollOut");//21 1192 | // animateOut.push("animated hinge");//20 1193 | if(!index){ 1194 | var len = animateOut.length; 1195 | var r = Math.floor(Math.random()*(len-1)+1); 1196 | return animateOut[r]; 1197 | }else{ 1198 | return animateOut[index]; 1199 | } 1200 | } 1201 | 1202 | 1203 | -------------------------------------------------------------------------------- /WebRoot/js/util/sg.js: -------------------------------------------------------------------------------- 1 | (function($){ 2 | /**********************silder*****************************/ 3 | for(i in document.images)document.images[i].ondragstart=function(){return false;}; 4 | $.fn.tzSlider = function(options){ 5 | var opts = $.extend({},$.fn.tzSlider.methods,$.fn.tzSlider.defaults,options); 6 | $("body").data("opts",opts); 7 | this.each(function(){ 8 | var optss = $.extend({},$("body").data("opts"),$.fn.tzSlider.optionAttr($(this))); 9 | opts.init($(this),optss); 10 | }); 11 | }; 12 | 13 | $.fn.tzSlider.methods = { 14 | init : function($slider,opts){ 15 | this.template($slider,opts); 16 | //参数初始化 17 | this.params($slider,opts); 18 | //事件的初始化 19 | this.events($slider,opts); 20 | }, 21 | 22 | template:function($slider,opts){ 23 | if(opts.horizontal){ 24 | $slider.addClass("tzui-slider tzui-slider-uhorizontal"); 25 | if(opts.height)$slider.height(opts.height); 26 | }else{ 27 | $slider.addClass("tzui-slider tzui-slider-horizontal"); 28 | if(opts.width)$slider.width(opts.width); 29 | } 30 | if(opts.bgcolor){ 31 | $slider.append("
    "); 32 | } 33 | $slider.append(""); 34 | }, 35 | 36 | params : function($slider,opts){ 37 | if(!opts.horizontal){ 38 | var maxWidth = $slider.width(); 39 | $slider.find(".tzui-slider-handle").css("left",(maxWidth * opts.percent)/100); 40 | if(opts.bgcolor)$slider.find(".tzui-slider-range").width(opts.percent+"%"); 41 | } 42 | 43 | if(opts.horizontal){ 44 | var maxHeight = $slider.height(); 45 | $slider.find(".tzui-slider-handle").css("top",(maxHeight * opts.percent)/100); 46 | if(opts.bgcolor)$slider.find(".tzui-slider-range").height(opts.percent+"%"); 47 | } 48 | 49 | if(!opts.silderColor){ 50 | if(opts.randomcolor && opts.bgcolor){ 51 | $slider.find(".tzui-slider-range").css("background",tzUtil.getRandomColor()); 52 | } 53 | }else{ 54 | $slider.find(".tzui-slider-range").css("background","#"+opts.silderColor); 55 | } 56 | 57 | if(opts.load)opts.load($slider,opts.percent); 58 | }, 59 | 60 | silderX:function($this,e){ 61 | var x= e.clientX;//获取当前鼠标按下去的x轴坐标, 62 | //拿滑块的距离 63 | var left = $this.offset().left; 64 | var nleft = x-left; 65 | var maxWidth = $this.width(); 66 | //赋予滑块的新的left 67 | $this.find(".tzui-slider-handle").css("left",nleft); 68 | //计算百分比 69 | var percent = Math.ceil((nleft/maxWidth)*100); 70 | $this.find(".tzui-slider-range").width(percent+"%"); 71 | }, 72 | 73 | silderY:function($this,e){ 74 | var y= e.clientY;//获取当前鼠标按下去的x轴坐标, 75 | //拿滑块的距离 76 | var top = $this.offset().top; 77 | var ntop = y-top; 78 | var maxHeight = $this.height(); 79 | //赋予滑块的新的left 80 | $this.find(".tzui-slider-handle").css("top",ntop); 81 | //计算百分比 82 | var percent = Math.ceil((ntop/maxHeight)*100); 83 | $this.find(".tzui-slider-range").height(percent+"%"); 84 | }, 85 | 86 | events : function($slider,opts){ 87 | var flag = false; 88 | //滑块事件绑定 89 | var obj = this; 90 | $slider.mousedown(function(e){ 91 | if(!opts.horizontal)obj.silderX($(this),e); 92 | if(opts.horizontal)obj.silderY($(this),e); 93 | }); 94 | 95 | //滑块拖动事件绑定 96 | $slider.find(".tzui-slider-handle").on("mousedown",function(e){ 97 | flag = true; 98 | var $this = $(this); 99 | var x = e.clientX;//获取当前鼠标按下去的x轴坐标, 100 | var y = e.clientY;//获取当前鼠标按下去的y轴坐标, 101 | var left = $this.position().left;//获取元素的绝对位置left 102 | var top = $this.position().top;//获取元素的绝对位置top 103 | var maxWidth = $this.parent().width();//获取滑块宽度 104 | var maxHeight = $this.parent().height();//获取滑块高度 105 | var sliderWidth = $this.width();//获取小滑块的宽度 106 | var sliderHeight= $this.height();//获取小滑块的高度 107 | var percent = 0; 108 | var horizontalMark = opts.horizontal; 109 | $(document).on("mousemove",function(ev){ 110 | if(flag){ 111 | if(!horizontalMark){ 112 | var nx = ev.clientX; 113 | var nleft = nx+left-x+(sliderWidth/2)-4 ; 114 | if(nleft<=0)nleft=0; 115 | if(nleft > maxWidth)nleft = maxWidth; 116 | $this.css({left:nleft}); 117 | percent = Math.ceil((nleft/maxWidth)*100); 118 | $slider.find(".tzui-slider-range").width(percent+"%"); 119 | }else{ 120 | var ny = ev.clientY; 121 | var ntop = ny+top-y+(sliderHeight/2)-4 ; 122 | if(ntop<=0)ntop=0; 123 | if(ntop > maxHeight)ntop = maxHeight; 124 | $this.css({top:ntop}); 125 | percent = Math.ceil((ntop/maxHeight)*100); 126 | $slider.find(".tzui-slider-range").height(percent+"%"); 127 | } 128 | } 129 | }).on("mouseup",function(){ 130 | flag = false; 131 | if(opts.callback)opts.callback($slider,percent); 132 | }); 133 | }).on("mouseup",function(){ 134 | flag = false; 135 | }); 136 | } 137 | }; 138 | 139 | $.fn.tzSlider.optionAttr = function($slider){ 140 | return { 141 | width:$slider.data("width"), 142 | height:$slider.data("height"), 143 | percent:$slider.data("percent"), 144 | bgcolor:$slider.data("bgcolor"), 145 | silderColor:$slider.data("sildercolor"), 146 | horizontal: $slider.data("horizontal") 147 | }; 148 | }; 149 | 150 | $.fn.tzSlider.defaults = { 151 | bgcolor :true, 152 | percent:20, 153 | width:0, 154 | height:0, 155 | horizontal:false, 156 | randomcolor:true, 157 | silderColor:"", 158 | load:function($silder,percent){ 159 | 160 | }, 161 | callback:function($silder,percent){ 162 | 163 | } 164 | }; 165 | 166 | $.fn.tmTip = function(options){ 167 | return this.each(function(){ 168 | var opts = $.extend({},$.fn.tmTip.defaults,options,$.fn.tmTip.parseOptions($(this))); 169 | if(opts.event=='hover'){ 170 | $(this).hover(function(){ 171 | tipInit($(this),opts); 172 | },function(){ 173 | if(opts.event!='click'){ 174 | $('.tm-tips').remove(); 175 | } 176 | }); 177 | } 178 | 179 | if(opts.event=='click'){ 180 | $(this).click(function(){ 181 | tipInit($(this),opts); 182 | }); 183 | } 184 | 185 | 186 | $(this).blur(function(){ 187 | $('.tm-tips').remove(); 188 | }); 189 | /*.mouseleave(function(){ 190 | $('.tm-tips').remove(); 191 | });*/ 192 | }); 193 | 194 | function tipInit($this,opts){ 195 | $('.tm-tips').remove(); 196 | var content = opts.tip; 197 | if(opts.proxy)content = $this.find(opts.proxy).html(); 198 | if(isEmpty(content))content = opts.title; 199 | if(isEmpty(content))content = $this.text(); 200 | if(isEmpty(content))content = "提示"; 201 | $("body").append('
    '); 202 | $('#tm-tip-content').css("textAlign",opts.contentAlign).html(content);//设置内容 203 | if(opts.width!=0){$(".tm-window-tip").css({width:opts.width});}/*设置高度如果高度设置为0:则为自动高度*/ 204 | if(opts.height!=0){$(".tm-window-tip").css({height:opts.height});}/*设置高度如果高度设置为0:则为自动高度*/ 205 | var _selfWidth = $(".tm-window-tip").width();//tip框的宽度 206 | var _selfHeight = $(".tm-window-tip").height();//tip框的高度 207 | var height = $this.height();/*元素自身高度*/ 208 | var width = $this.width();/*元素自身宽度*/ 209 | var offsetLeft = $this.offset().left;/*元素的相对左边距*/ 210 | var offsetTop = $this.offset().top;/*元素的相对顶部距离*/ 211 | var bodyWidth = $("body").innerWidth(); 212 | var bodyHeight = $("body").innerHeight(); 213 | var fixWidth = offsetLeft+_selfWidth+width; 214 | var fixHeight = offsetTop+_selfHeight+height; 215 | var left = 0; 216 | var top = 0; 217 | var arrowLeft = 0; 218 | var arrowTop = 0; 219 | 220 | /*如果offsetLeft=0的情况下*/ 221 | if(offsetLeft==0 || offsetLeft<_selfWidth){ 222 | if(opts.arrow=='rightTop')opts.arrow = "leftTop"; 223 | if(opts.arrow=='rightMiddle')opts.arrow = "leftMiddle"; 224 | if(opts.arrow=='rightBottom')opts.arrow = "leftBottom"; 225 | if(opts.arrow=='topRight')opts.arrow = "topLeft"; 226 | if(opts.arrow=='topMiddle')opts.arrow = "topLeft"; 227 | if(opts.arrow=='bottomMiddle')opts.arrow = "bottomLeft"; 228 | if(opts.arrow=='bottomRight')opts.arrow = "bottomLeft"; 229 | } 230 | 231 | if(offsetTop==0 || offsetTop < _selfHeight){ 232 | opts.arrow = "topMiddle"; 233 | } 234 | 235 | if(fixWidth > bodyWidth ){ 236 | if(opts.arrow=='topLeft')opts.arrow = "topRight"; 237 | if(opts.arrow=='topMiddle')opts.arrow = "topRight"; 238 | if(opts.arrow=='bottomMiddle')opts.arrow = "bottomRight"; 239 | if(opts.arrow=='bottomLeft')opts.arrow = "bottomRight"; 240 | if(opts.arrow=='leftTop')opts.arrow = "rightTop"; 241 | if(opts.arrow=='leftMiddle')opts.arrow = "rightMiddle"; 242 | if(opts.arrow=='leftBottom')opts.arrow = "rightBottom"; 243 | } 244 | 245 | if(fixHeight > bodyHeight){ 246 | opts.arrow = "bottomMiddle"; 247 | } 248 | 249 | 250 | if(opts.arrow=='topMiddle'){ 251 | left = offsetLeft - _selfWidth/2+width/2 ; 252 | top = offsetTop+height+10; 253 | arrowLeft = offsetLeft+width/2-5 ; 254 | arrowTop = offsetTop +height-2; 255 | } 256 | 257 | if(opts.arrow=='topLeft'){ 258 | left = offsetLeft + width/2; 259 | top = offsetTop+height+14; 260 | arrowLeft = offsetLeft+(width/2)+7; 261 | arrowTop = offsetTop +height+4; 262 | } 263 | 264 | if(opts.arrow=='topRight'){ 265 | left = offsetLeft - _selfWidth+width/2; 266 | top = offsetTop+height+10; 267 | arrowLeft = offsetLeft+width/2-16; 268 | arrowTop = offsetTop +height ; 269 | } 270 | 271 | if(opts.arrow=='bottomLeft'){ 272 | top = offsetTop-_selfHeight-13 ; 273 | left = offsetLeft +width/2; 274 | arrowLeft = offsetLeft+width/2+12 ; 275 | arrowTop = offsetTop-10; 276 | } 277 | 278 | if(opts.arrow=='bottomMiddle'){ 279 | top = offsetTop-_selfHeight-16 ; 280 | left = offsetLeft - _selfWidth/2 +width/2 ; 281 | arrowLeft = offsetLeft+width/2-4 ; 282 | arrowTop = offsetTop-10; 283 | } 284 | 285 | if(opts.arrow=='bottomRight'){ 286 | top = offsetTop-_selfHeight-13 ; 287 | left = offsetLeft -_selfWidth+width/2; 288 | arrowLeft = offsetLeft+width/2-18; 289 | arrowTop = offsetTop-10; 290 | } 291 | 292 | if(opts.arrow=='leftTop'){ 293 | left = offsetLeft +width+14; 294 | top = offsetTop; 295 | arrowLeft = offsetLeft+width+2; 296 | arrowTop = offsetTop+12; 297 | } 298 | if(opts.arrow=='leftMiddle'){ 299 | left = offsetLeft +width+12; 300 | top = offsetTop - _selfHeight/2+2; 301 | arrowLeft = offsetLeft+width-2; 302 | arrowTop = offsetTop; 303 | } 304 | if(opts.arrow=='leftBottom'){ 305 | left = offsetLeft +width+12; 306 | top = offsetTop-_selfHeight+12; 307 | arrowLeft = offsetLeft+width; 308 | arrowTop = offsetTop-1; 309 | } 310 | 311 | if(opts.arrow=='rightTop'){ 312 | left = offsetLeft -_selfWidth-16; 313 | top = offsetTop; 314 | arrowLeft = offsetLeft-12; 315 | arrowTop = offsetTop+14; 316 | } 317 | if(opts.arrow=='rightMiddle'){ 318 | left = offsetLeft -_selfWidth-16; 319 | top = offsetTop - _selfHeight/2+2; 320 | arrowLeft = offsetLeft-12; 321 | arrowTop = offsetTop; 322 | } 323 | if(opts.arrow=='rightBottom'){ 324 | left = offsetLeft -_selfWidth-16; 325 | top = offsetTop - _selfHeight; 326 | arrowLeft = offsetLeft-12; 327 | arrowTop = offsetTop-16; 328 | } 329 | if(!opts.hideArrow){ 330 | $(".tooltip-nightly-arrow").addClass("tooltip-nightly-"+opts.arrow); 331 | } 332 | if(isEmpty(opts.arrow))opts.arrow = "bottomMiddle"; 333 | var st = 2; 334 | opts.border = "2px solid #333"; 335 | opts.background = opts.background||"#333"; 336 | $(".tooltip-nightly-arrow").addClass("tooltip-nightly-"+opts.arrow+"-black"); 337 | $(".tooltip-nightly-arrow").css({left:(arrowLeft+opts.offLeft),top:(arrowTop+opts.offTop)}); 338 | $(".tm-window-tip").css({left:left+"px",top:(top+st),opacity:1,border:opts.border,background:opts.background,color:opts.fontColor}); 339 | $('.tm-tips').click(function(){ 340 | $(this).remove(); 341 | }); 342 | } 343 | }; 344 | 345 | $.fn.tmTip.parseOptions = function($target) { 346 | return { 347 | width : $target.attr("width"), 348 | height : $target.attr("height"), 349 | tip : $target.attr("tip"), 350 | title:$target.attr("title"), 351 | event:$target.attr("event"), 352 | arrow:$target.attr("arrow"), 353 | offLeft:$target.attr("offLeft"), 354 | offTop:$target.attr("offTop"), 355 | background:$target.attr("background"), 356 | border:$target.attr("border"), 357 | color:$target.attr("color"), 358 | proxy:$target.attr("proxy") 359 | }; 360 | }; 361 | $.fn.tmTip.defaults ={ 362 | width : 0,//宽度 363 | height : 0,//高度如果为0则为自动高度 364 | title:"",//如果tip为空用title 365 | event:"hover",//触发的事件类型 366 | arrow:"bottomMiddle", 367 | hideArrow:false,//是否隐藏方向箭头 368 | background:"",//设置背景 369 | border:"", 370 | proxy:"", 371 | tip : "",//内容 372 | contentAlign:"left", 373 | offLeft:0,//左部偏移 374 | offTop:0,//顶部移动 375 | color:"black" 376 | }; 377 | 378 | 379 | 380 | /********************tab***************************/ 381 | $.fn.tzTab = function(options){ 382 | var opts = $.extend({},$.fn.tzTab.methods,$.fn.tzTab.defaults,options); 383 | this.each(function(){ 384 | var optss = $.extend({},opts,$.fn.tzTab.parseOptions($(this))); 385 | opts.init($(this),optss); 386 | }); 387 | }; 388 | 389 | $.fn.tzTab.methods = { 390 | init : function($tab,opts){ 391 | $tab.addClass("tzui-tabs"); 392 | var $ul = $("
      "); 393 | var liHtml = ""; 394 | var contentHtml = ""; 395 | var jdata = opts.tabDatas; 396 | var length = jdata.length; 397 | var className = "tzui-state-default"; 398 | 399 | if(opts.index==0 || opts.index>length)opts.index=0;//边界判断 400 | for(var i=0;i"+jdata[i].title+""; 407 | contentHtml+="
      "+jdata[i].content+"
      "; 408 | className = ""; 409 | } 410 | $ul.html(liHtml); 411 | $tab.append($ul); 412 | //面板内容 413 | $tab.append(contentHtml); 414 | if(opts.width)$tab.width(opts.width); 415 | if(opts.height)$tab.height(opts.height); 416 | if(opts.background){ 417 | $tab.css("border","2px solid "+opts.background); 418 | $ul.css({"background":opts.background}); 419 | $ul.find("li>a").filter(function(){ 420 | if(!$(this).parent().hasClass("tzui-state-active")){ 421 | $(this).css({"background":opts.background,"color":"#fff"}); 422 | } 423 | }); 424 | } 425 | 426 | if(opts.linear && opts.border){ 427 | $tab.css("border","2px solid "+opts.border); 428 | $ul.css({"background":"linear-gradient("+opts.linear+")"}); 429 | $ul.find("li>a").filter(function(){ 430 | if(!$(this).parent().hasClass("tzui-state-active")){ 431 | $(this).css({"background":"linear-gradient("+opts.linear+")","color":"#fff"}); 432 | } 433 | }); 434 | } 435 | 436 | $tab.find(".tzui-tabs-nav > li").on(opts.event,function(){ 437 | var markFlag = $(this).hasClass("tzui-tabs-active"); 438 | if(markFlag)return; 439 | var tab = $(this).attr("tab"); 440 | $(this).addClass("tzui-tabs-active tzui-state-active").siblings().removeClass("tzui-tabs-active tzui-state-active"); 441 | $tab.find(".tzui-tabs-panel").hide(); 442 | var $content = $tab.find("#"+tab); 443 | $content.show(); 444 | $(this).find("a").removeAttr("style"); 445 | if(opts.linear && opts.border){ 446 | $(this).siblings().find("a").css({"background":"linear-gradient("+opts.linear+")","color":"#fff"}); 447 | }else{ 448 | $(this).siblings().find("a").css({"background":opts.background,"color":"#fff"}); 449 | } 450 | if(opts.callback)opts.callback($(this),$content); 451 | //当前元素解绑事件 452 | }); 453 | 454 | 455 | } 456 | }; 457 | 458 | $.fn.tzTab.parseOptions = function($target){ 459 | var datas = $target.find(".data").text(); 460 | var json = { 461 | width:$target.data("width"),//选项卡的宽度 462 | height:$target.data("height"),//选项卡的高度 463 | event:$target.data("event"),//选项卡的事件类型 464 | background:$target.data("background"), 465 | linear:$target.data("linear"), 466 | border:$target.data("border"), 467 | index:$target.data("index")//默认选择哪一个 468 | }; 469 | if(datas)json["tabDatas"]=eval("("+datas+")"); 470 | return json; 471 | }; 472 | 473 | $.fn.tzTab.defaults = { 474 | width:600,//选项卡的宽度 475 | height:300,//选项卡的高度 476 | event:"click",//选项卡的事件类型 477 | background:"#4684b2", 478 | linear:"", 479 | border:"", 480 | index:2,//默认选择哪一个 481 | callback:function($current,$content){ 482 | 483 | }, 484 | tabDatas:[ 485 | {title:"选项卡1",content:"士大夫收到111","url":"user.action"}, 486 | {title:"选项卡2",content:"士大夫收到22222","url":"delete.action"}, 487 | {title:"选项卡3",content:"选项卡3333"} 488 | ] 489 | }; 490 | 491 | 492 | /**********************drag***********************/ 493 | $.fn.tzDrag = function(options){ 494 | var opts = $.extend({},$.fn.tzDrag.methods,$.fn.tzDrag.defaults,options); 495 | this.each(function(){ 496 | var optss = $.extend({},opts,$.fn.tzDrag.parseOptions($(this))); 497 | opts.init($(this),optss); 498 | }); 499 | }; 500 | 501 | $.fn.tzDrag.methods = { 502 | init:function($dialog,opts){//层拖动 503 | var thisObj = this; 504 | var mark = false; 505 | // $dialog.css("position","absolute"); 506 | var $dialogClone = null; 507 | $dialog.on("mousedown",opts.handler,function(e){ 508 | //镜像 509 | tzUtil.forbiddenSelect(); 510 | if(opts.ghost)$dialogClone= thisObj.ghsot($dialog,opts); 511 | var $this = $(this).parent(); 512 | 513 | if(!opts.handler){ 514 | $this=$(this); 515 | } 516 | 517 | var x = e.clientX; 518 | var y = e.clientY; 519 | var left = $this.offset().left; 520 | var top = $this.offset().top; 521 | var w = $this.width(); 522 | var h = $this.height(); 523 | var offsetHeight = $this.parent().height() - h-2; 524 | //var offsetHeight = $(document).height() - h-2; 525 | var offsetWidth= $this.parent(). width() - w-2; 526 | var stop= $(window).scrollTop(); 527 | var jsonData = {}; 528 | jsonData.width=w; 529 | jsonData.height=h; 530 | mark = true; 531 | $(document).on("mousemove",function(e){ 532 | if(mark){ 533 | var nx = e.clientX; 534 | var ny = e.clientY; 535 | var nl = nx + left - x; 536 | var nt = ny + top - y - stop; 537 | if(nl<=0)nl=1; 538 | if(nt<=0)nt=1; 539 | if(nl>=offsetWidth)nl = offsetWidth; 540 | if(nt>=offsetHeight)nt = offsetHeight; 541 | jsonData.left = nl; 542 | jsonData.top = nt; 543 | if(opts.ghost){ 544 | $dialogClone.css({left:nl,top:nt}); 545 | }else{ 546 | $this.css({left:nl,top:nt}); 547 | } 548 | if(opts.move)opts.move(jsonData,$this); 549 | } 550 | 551 | }).on("mouseup",function(){ 552 | if(opts.ghost){ 553 | $dialogClone.remove(); 554 | $this.css({left:jsonData.left,top:jsonData.top}); 555 | } 556 | tzUtil.autoSelect(); 557 | if(opts.up)opts.up($this); 558 | mark = false; 559 | }); 560 | }); 561 | }, 562 | ghsot:function($dialog,opts){ 563 | var $dialogClone = $dialog.clone(); 564 | $dialogClone.css({"background":"#f9f9f9","opacity":0.5,"border":"1px dotted #ccc"}).find(".tzui-empty").empty(); 565 | $("body").append($dialogClone); 566 | return $dialogClone; 567 | } 568 | 569 | 570 | }; 571 | 572 | $.fn.tzDrag.parseOptions = function($dialog){ 573 | return { 574 | handler:$dialog.data("handler"), 575 | ghost:$dialog.data("ghost") 576 | }; 577 | }; 578 | 579 | $.fn.tzDrag.defaults = { 580 | handler:"",//拖动代理 581 | ghost:true,//是否产生镜像 582 | move:function(opts){ 583 | }, 584 | up:function(opts){ 585 | } 586 | 587 | }; 588 | 589 | 590 | var imgboxTimer = null; 591 | 592 | /*图集插件*/ 593 | $.fn.tzImgbox = function(options){ 594 | return this.each(function(){ 595 | var opts = null; 596 | var cache = $(this).data("tzImgbox"); 597 | if(cache){ 598 | opts = $.extend(cache.options,options); 599 | cache.options = opts; 600 | }else{ 601 | var opts = $.extend({},$.fn.tzImgbox.defaults,$.fn.tzImgbox.parseOptions($(this)),options); 602 | $(this).data("tzImgbox",{options:opts}); 603 | initImgbox($(this)); 604 | } 605 | var src = $(this).attr("src"); 606 | if(isEmpty(src))src = $(this).attr("_src"); 607 | if(opts.suffix)src = src.replace(opts.suffix,""); 608 | opts.imgArrs.push(src); 609 | }); 610 | }; 611 | 612 | function initImgbox($this){ 613 | var opts = $this.data("tzImgbox").options; 614 | $this.on(opts.eventType,function(e){ 615 | stopBubble(e); 616 | var title = $(this).attr("title"); 617 | if(isEmpty(title))title=""; 618 | $("body").append('
      '+ 619 | '
      '+ 620 | '
      '+ 621 | '
      '+ 622 | '
      '+ 623 | '
      '+ 624 | '
      '+ 625 | '
      '+ 626 | '
      '+ 627 | '
      '+ 628 | '
      '+ 629 | ''+ 630 | '
      '+ 631 | '
      '+title+'自动播放
      ' + 632 | ''+ 633 | ''+ 634 | '
      '+ 635 | ''+ 636 | '
      '); 637 | $("#tm-box-imgs").css({height:0,width:0}); 638 | var src = $(this).attr("src"); 639 | if(isEmpty(src))src = $(this).attr("_src"); 640 | if(isNotEmpty(opts.suffix))src=src.replace(opts.suffix,""); 641 | tzImgboxLoading(src,opts); 642 | $("#tm-box-wrap").width(opts.width); 643 | $("#tm-box-content").width(opts.width-20).height(opts.height); 644 | var vheight = $(window).height(); 645 | if(document.body.scrollHeight>$(window).height()){ 646 | vheight = document.body.scrollHeight; 647 | } 648 | $(".tm-ui-overdisplay").height(vheight); 649 | //if(opts.drag)$.fn.Tmui.methods._moveAll($("#tm-box-wrap"),".tm-box-bg"); 650 | //if(opts.drag)$("#tm-box-wrap").tmDrag({handle:$(".tm-box-bg")}); 651 | $(".tm-ui-overdisplay").click(function(){ 652 | $("#tm-box-loading").remove(); 653 | $(".tm-ui-overdisplay").fadeOut("fast",function(){ 654 | $(this).remove(); 655 | }); 656 | $("#tm-box-wrap").remove(); 657 | clearInterval(imgboxTimer); 658 | }); 659 | 660 | $.fn.tzImgbox.methods.resizeImgbox($this); 661 | if(isNotEmpty(opts.top)){ 662 | $("#tm-box-wrap").css("top",opts.top); 663 | } 664 | 665 | /*翻页控制*/ 666 | var index = $.tmArray.indexOf(opts.imgArrs,$(this).attr("src")); 667 | var imgArr = opts.imgArrs; 668 | $("#tm-box-left").click(function(){ 669 | clearInterval(imgboxTimer); 670 | if(index==0)index = imgArr.length; 671 | index--; 672 | tzImgboxLoading(imgArr[index],opts); 673 | }); 674 | 675 | $("#tm-box-right").click(function(){ 676 | clearInterval(imgboxTimer); 677 | index++; 678 | if(index== imgArr.length)index = 0; 679 | tzImgboxLoading(imgArr[index],opts); 680 | }); 681 | 682 | $("#tm-auto-play").click(function(){ 683 | var text = $(this).text(); 684 | if(text=='自动播放')$(this).text("暂停播放"); 685 | if(text=='暂停播放'){ 686 | clearInterval(imgboxTimer); 687 | $(this).text("自动播放"); 688 | return; 689 | } 690 | /*定时轮播*/ 691 | imgboxTimer = setInterval(function(){ 692 | index++; 693 | if(index == imgArr.length)index = 0; 694 | tzImgboxLoading(imgArr[index],opts); 695 | },opts.time*1000); 696 | }); 697 | /*翻页控制*/ 698 | }); 699 | }; 700 | 701 | function tzImgboxLoading(src,opts){ 702 | var img = new Image(); 703 | img.src = src; 704 | if(img.complete){ 705 | tzImgboxLoadingProxy(img,opts); 706 | }else{ 707 | img.onreadystatechange = function () { 708 | } 709 | img.onload = function () { 710 | tzImgboxLoadingProxy(img,opts); 711 | } 712 | img.onerror = function () { 713 | tmLoading("图片加载失败或没有找到...",1); 714 | } 715 | } 716 | }; 717 | 718 | function tzImgboxLoadingProxy(img,opts){ 719 | $("#tm-box-loading").remove(); 720 | var top = (getClientHeight() - opts.height) / 2 721 | $("#tm-box-wrap").append(''); 722 | var title = $("img[src='"+img.src+"']").attr("title") 723 | if(isEmpty(title)){ 724 | title = $("*[_src='"+img.src+"']").attr("title"); 725 | } 726 | $("#tm-box-loading").fadeIn(200,function(){ 727 | $(this).hide(); 728 | $("#tm-box-imgs").attr("src",img.src); 729 | $("#tm-box-tit").html(title); 730 | var width = img.width; 731 | var height = img.height; 732 | var bodyWidth = opts.width; 733 | var bodyHeight = opts.height; 734 | var box = $.fn.tzImgbox.methods.resizeImg(img,opts.bitWidth,opts.bitHeight); 735 | $("#tm-box-imgs").width(box.width).height(box.height); 736 | var width = $("#tm-box-imgs").width(); 737 | var height = $("#tm-box-imgs").height(); 738 | var left = (bodyWidth - width)/2-10; 739 | var top = (bodyHeight - height)/2 ; 740 | $("#tm-box-imgs").css({left:left,top:top}); 741 | }); 742 | } 743 | 744 | $.fn.tzImgbox.parseOptions = function($target) { 745 | return { 746 | 747 | } 748 | }; 749 | 750 | $.fn.tzImgbox.methods = { 751 | loadImg : function(src,$img){ 752 | var o= new Image(); 753 | o.src = src; 754 | if(o.complete){ 755 | $("#tm-box-loading").remove(); 756 | $img.attr("src",src); 757 | $img.show(); 758 | }else{ 759 | o.onload = function(){ 760 | $("#tm-box-loading").remove(); 761 | $img.attr("src",src); 762 | $img.show(); 763 | }; 764 | o.onerror = function(){ 765 | tmLoading("图片加载失败或者图片没有找到",1); 766 | }; 767 | } 768 | }, 769 | 770 | resizeImg:function (img,iwidth,iheight){ 771 | var image= img; 772 | var boxWH = {}; 773 | if(image.width>0 && image.height>0){ 774 | boxWH.width=image.width; 775 | boxWH.height=image.height; 776 | if(boxWH.width>iwidth){ 777 | boxWH.height = (boxWH.height*iwidth)/boxWH.width; 778 | boxWH.width = iwidth; 779 | 780 | } 781 | if(boxWH.height>iheight){ 782 | boxWH.width = (boxWH.width*iheight)/boxWH.height;; 783 | boxWH.height = iheight; 784 | } 785 | } 786 | return boxWH; 787 | } , 788 | 789 | resizeImgbox:function($this){ 790 | var bodyWidth = getClientWidth(); 791 | //var bodyHeight = getClientHeight(); 792 | var bodyHeight = $(window).height(); 793 | var offset =$this.offset(); 794 | var width = $("#tm-box-wrap").width(); 795 | var height = $("#tm-box-wrap").height(); 796 | var left = (bodyWidth - width)/2-15; 797 | var top = (bodyHeight - height)/2 - 30; 798 | $("#tm-box-wrap").css({left:left,top:top}); 799 | $("#tm-box-wrap").find("#tm-box-close").click(function(){ 800 | $(".tm-ui-overdisplay").fadeOut("fast",function(){ 801 | $(this).remove(); 802 | }); 803 | $("#tm-box-wrap").remove(); 804 | clearInterval(imgboxTimer); 805 | }); 806 | } 807 | } 808 | 809 | $.fn.tzImgbox.defaults ={ 810 | imgArrs:[], 811 | drag:true, 812 | width:960, 813 | height:420, 814 | bitWidth : 960, 815 | bitHeight: 550, 816 | eventType:"dblclick", 817 | suffix:"",//在实际开发的过程中,可能需要展示的是小图,而预览的时候看到的是大图片,比如:/images/aaa_small.jpg如果你填写了:"_small"--那么最终呈现的是/images/aaa.jpg 818 | time:2 819 | } 820 | /***********tzImgbox end**********/ 821 | 822 | })(jQuery); 823 | 824 | 825 | 826 | 827 | //jquery插件的定义方式 828 | var tzLoading = function(message,options){ 829 | var opts = $.extend({},options); 830 | this.init(message,opts.timeout,opts); 831 | }; 832 | 833 | tzLoading.prototype = { 834 | init : function(message,timeout,opts){ 835 | var $loading = this.template(message,opts); 836 | if($loading){ 837 | //定位 838 | tzUtil._position($loading).resize($loading); 839 | //事件绑定 840 | this.events($loading); 841 | //时间关闭 842 | this.timeout($loading,timeout); 843 | } 844 | }, 845 | 846 | template:function(content,opts){ 847 | var $loading = $("#tzloading"); 848 | if(content=="remove"){ 849 | tzUtil.animates($loading,"slideUp"); 850 | return; 851 | } 852 | if($loading.length==0){ 853 | if(content=="remove"){ 854 | tzUtil.animates($loading,"slideUp"); 855 | return; 856 | } 857 | $loading = $("
      "); 858 | var $loadingGif = $("
      "); 859 | var $loadingContent = $("
      "); 860 | $loadingContent.html(content); 861 | $loading.append($loadingGif).append($loadingContent); 862 | $("body").append($loading); 863 | if(opts.overlay){ 864 | $("body").append("
      "); 865 | $loading.next().click(function(){ 866 | $(this).remove(); 867 | $loading.trigger("click"); 868 | }); 869 | } 870 | }else{ 871 | $loading.find(".tzui-loading-cnt").html(content); 872 | } 873 | 874 | if(opts.height)$loading.height(opts.height); 875 | return $loading; 876 | }, 877 | 878 | events :function($loading){ 879 | $loading.click(function(){ 880 | tzUtil.animates($(this),"slideUp"); 881 | }); 882 | }, 883 | 884 | timeout:function($loading,timeout){ 885 | var timr = null; 886 | if(isNotEmpty(timeout+"") && timeout >0){ 887 | clearTimeout(timr); 888 | timr = setTimeout(function(){ 889 | //事件的触发 890 | $loading.trigger("click"); 891 | },timeout*500); 892 | } 893 | } 894 | }; 895 | 896 | var loading = function(message,timeout,overlay){ 897 | new tzLoading(message,{"timeout":timeout,overlay:overlay}); 898 | }; 899 | 900 | /*******************dialog**********************************/ 901 | //dialog的弹出层 902 | $.tzConfirm = function(options){ 903 | var opts = $.extend({},$.tzDialog.methods,$.tzDialog.defaults,options); 904 | opts.icon = "warn"; 905 | opts.init(opts); 906 | }; 907 | 908 | $.tzPrompt = function(options){ 909 | var opts = $.extend({},$.tzDialog.methods,$.tzDialog.defaults,options); 910 | var $dialog = opts.init(opts); 911 | var mw= opts.width - 68; 912 | $dialog.find(".tzdialog_message").html("

        "+opts.content+":

      " + 913 | "

      "); 914 | //这个确定按钮事件 915 | $dialog.find(".tzdialog_ok").off("click").on("click",function(){ 916 | var $input = $dialog.find(".tzdialog_message").find("input"); 917 | var value = $input.val().trim(); 918 | if(value==""){ 919 | loading("请输入内容!",2); 920 | $input.focus(); 921 | return; 922 | } 923 | if(opts.validator($input)){ 924 | if(opts.callback)opts.callback(value);//回调方法 925 | $dialog.next().remove(); 926 | tzUtil.animates($dialog,opts.animate); 927 | } 928 | }); 929 | }; 930 | 931 | $.tzAlert = function(options){ 932 | var opts = $.extend({},$.tzDialog.methods,$.tzDialog.defaults,options); 933 | opts.icon = "tip"; 934 | opts.init(opts); 935 | //var $dialog = opts.init(opts); 936 | // $dialog.find(".tzdialog_cancel").remove(); 937 | }; 938 | 939 | $.tzDialog = {}; 940 | 941 | $.tzDialog.methods = { 942 | //初始化 943 | init:function(opts){ 944 | var $dialog = this.template(opts); 945 | //弹出层事件初始化 946 | this.events($dialog,opts); 947 | this.params($dialog,opts); 948 | var btns = opts.buttons; 949 | for(var key in btns){ 950 | $dialog.append(""+key+"  "); 951 | } 952 | $dialog.find("a.btns").click(function(){ 953 | var text = $(this).text(); 954 | btns[text].call($dialog); 955 | }); 956 | 957 | return $dialog; 958 | }, 959 | params:function($dialog,opts){ 960 | if(opts.width)$dialog.width(opts.width); 961 | if(opts.height){ 962 | if(opts.height<=160)opts.height=160; 963 | $dialog.height(opts.height); 964 | } 965 | $dialog.find(".tzdialog_message").css({"textAlign":"center","lineHeight":opts.height-145+"px"}).height(opts.height-145); 966 | //弹出层居中 967 | tzUtil._position($dialog); 968 | //拖动事件的绑定 969 | if(opts.drag)$dialog.tzDrag({handler:".tzdialog_title","ghost":opts.ghost}); 970 | }, 971 | 972 | //弹出层的模板 973 | template : function(opts){ 974 | var $dialog = $("
      "+ 975 | "

      "+opts.title+"

      " + 976 | " x"+ 977 | "
      "+ 978 | "
      " + 979 | " " + 980 | " "+opts.content+"
      "+ 981 | "
      "+ 982 | " "+ 983 | " "+ 984 | "
      "+ 985 | "
      "+ 986 | "
      "); 987 | $("body").append($dialog).append("
      "); 988 | return $dialog; 989 | }, 990 | events:function($dialog,opts){ 991 | //这个确定按钮事件 992 | $dialog.find(".tzdialog_ok").on("click",function(){ 993 | if(opts.callback)opts.callback(true);//回调方法 994 | $dialog.next().remove(); 995 | tzUtil.animates($dialog,opts.animate); 996 | }); 997 | 998 | //关闭按钮事件 999 | $dialog.find(".tzdialog_cancel,.delete").on("click",function(){ 1000 | if(opts.callback)opts.callback(false);//回调方法 1001 | $dialog.next().remove(); 1002 | tzUtil.animates($dialog,opts.animate); 1003 | }); 1004 | 1005 | //响应事件 1006 | var timer = null; 1007 | $(window).resize(function(){ 1008 | clearTimeout(timer); 1009 | timer = setTimeout(function(){tzUtil._position($dialog);},30); 1010 | }); 1011 | } 1012 | }; 1013 | 1014 | //弹出层的默认参数 1015 | $.tzDialog.defaults = { 1016 | width:272, 1017 | handle:".tzdiaog_title", 1018 | height:166, 1019 | title:"标题", 1020 | icon:"success", 1021 | drag:true, 1022 | ghost:true, 1023 | value:"", 1024 | animate:"top", 1025 | cancelText:"取消", 1026 | sureText:"确定", 1027 | validator:function($input){ 1028 | return true; 1029 | }, 1030 | callback:function(ok){ 1031 | }, 1032 | content:"请输入内容..." 1033 | }; 1034 | 1035 | var ajaxTimeout = null; 1036 | $.tzAjax = { 1037 | request : function(options,dataJson){ 1038 | var opts = $.extend({},{limit:true,before:function(){ 1039 | },error:function(){ 1040 | 1041 | },callback:function(data){ 1042 | 1043 | }},options); 1044 | var _url = opts.url; 1045 | if(isEmpty(_url)){ 1046 | _url = basePath+"/"+opts.model+"/"+opts.method; 1047 | } 1048 | if(isNotEmpty(opts.params)){ 1049 | _url+="&"+opts.params; 1050 | } 1051 | 1052 | if(opts.limit){ 1053 | clearTimeout(ajaxTimeout); 1054 | ajaxTimeout = setTimeout(function(){ 1055 | $.tzAjax.ajaxMain(opts,_url,dataJson); 1056 | },200); 1057 | }else{ 1058 | $.tzAjax.ajaxMain(opts,_url,dataJson); 1059 | } 1060 | }, 1061 | ajaxMain:function(opts,_url,dataJson){ 1062 | $.ajax({ 1063 | type:"post", 1064 | data : dataJson, 1065 | url : _url, 1066 | beforeSend:function(){opts.before();}, 1067 | error:function(){loading("抱歉!因为操作不能够及时响应,请稍后在试...",1);opts.error();clearTimeout(ajaxTimeout);}, 1068 | success:function(data){ 1069 | if(data.result=="logout"){ 1070 | loading("session超时,请登录..."); 1071 | }else{ 1072 | if(opts.callback)opts.callback(data); 1073 | } 1074 | clearTimeout(ajaxTimeout); 1075 | } 1076 | }); 1077 | } 1078 | }; --------------------------------------------------------------------------------