├── README.md ├── images ├── banner.png ├── banner1.jpg ├── banner2.jpg ├── banner3.jpg ├── lazyload.png └── icons │ ├── left.png │ ├── pullUp.png │ ├── refresh.gif │ ├── checkImg.png │ ├── pullDown.png │ ├── returnTop.png │ └── toast-icon.png ├── demo ├── css │ ├── iscroll.css │ ├── preview.css │ ├── lazyload.css │ ├── bmap.css │ ├── date.css │ ├── zsmap.css │ ├── selector.css │ ├── waterfall.css │ ├── citypicker.css │ ├── dialog.css │ ├── index.css │ ├── drag.css │ ├── clip_image.css │ └── pull.css ├── bmap.html ├── drag.html ├── selector.html ├── iscroll.html ├── waterfall.html ├── js │ ├── preview.js │ ├── drag.js │ ├── iscroll.js │ ├── selector.js │ ├── date.js │ ├── bmap.js │ ├── citypicker.js │ ├── lazyload.js │ ├── clip_image.js │ ├── index.js │ ├── dialog.js │ ├── zsmap.js │ ├── waterfall.js │ └── pull.js ├── zsmap.html ├── citypicker.html ├── date.html ├── dialog.html ├── clip_image.html ├── index.html ├── pull.html ├── preview.html └── lazyload.html ├── error.html ├── js ├── error.js ├── app.js ├── waterfall_module.js ├── mobile_module.js ├── map_module.js ├── iscroll_module.js ├── sea.js ├── util_module.js ├── datepicker_module.js ├── jweixin-1.0.0.js ├── dialog_module.js ├── citypicker_module.js ├── iscroll.min.js ├── clip │ ├── hammer.js │ └── iscroll-zoom.js └── clip_module.js ├── index.html ├── resource └── wine_province.json └── css ├── datepicker.css ├── app.css ├── citypicker.css ├── dialog.css └── loading.css /README.md: -------------------------------------------------------------------------------- 1 | Hello mobileapp -------------------------------------------------------------------------------- /images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/banner.png -------------------------------------------------------------------------------- /images/banner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/banner1.jpg -------------------------------------------------------------------------------- /images/banner2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/banner2.jpg -------------------------------------------------------------------------------- /images/banner3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/banner3.jpg -------------------------------------------------------------------------------- /images/lazyload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/lazyload.png -------------------------------------------------------------------------------- /images/icons/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/left.png -------------------------------------------------------------------------------- /images/icons/pullUp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/pullUp.png -------------------------------------------------------------------------------- /images/icons/refresh.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/refresh.gif -------------------------------------------------------------------------------- /images/icons/checkImg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/checkImg.png -------------------------------------------------------------------------------- /images/icons/pullDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/pullDown.png -------------------------------------------------------------------------------- /images/icons/returnTop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/returnTop.png -------------------------------------------------------------------------------- /images/icons/toast-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/77424797/mobileapp/HEAD/images/icons/toast-icon.png -------------------------------------------------------------------------------- /demo/css/iscroll.css: -------------------------------------------------------------------------------- 1 | #iscroll_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | -------------------------------------------------------------------------------- /demo/bmap.html: -------------------------------------------------------------------------------- 1 | 地图 2 | 3 | 4 |
5 |
6 |
7 |
8 |
9 | -------------------------------------------------------------------------------- /demo/drag.html: -------------------------------------------------------------------------------- 1 | 可拖动元素 2 | 3 | 4 |
5 |
6 |
我是可以拖动的
7 |
8 |
-------------------------------------------------------------------------------- /demo/selector.html: -------------------------------------------------------------------------------- 1 | 仿ios下拉选择 2 | 3 | 4 |
5 |
6 |
请选择
7 |
8 |
-------------------------------------------------------------------------------- /demo/iscroll.html: -------------------------------------------------------------------------------- 1 | 轮播图 2 | 3 | 4 |
5 |
6 |
7 | 8 |
9 |
10 |
-------------------------------------------------------------------------------- /demo/css/preview.css: -------------------------------------------------------------------------------- 1 | #preview_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #preview_wrapper .prevoewImg{ 9 | width: 40%; 10 | border-radius: 8px; 11 | display: block; 12 | margin: 5px auto; 13 | } 14 | -------------------------------------------------------------------------------- /error.html: -------------------------------------------------------------------------------- 1 | 404 2 | 3 |
4 |
5 |

404

6 |

您访问的页面找不到!

7 |
返回
8 |
9 |
-------------------------------------------------------------------------------- /demo/waterfall.html: -------------------------------------------------------------------------------- 1 | 瀑布流 2 | 3 | 4 |
5 |
6 |
7 |
加载更多
8 |
9 |
-------------------------------------------------------------------------------- /demo/css/lazyload.css: -------------------------------------------------------------------------------- 1 | #lazyload_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #lazyload_wrapper .myimg{ 9 | width: 200px; 10 | height: 200px; 11 | border-radius: 8px; 12 | display: block; 13 | margin: 5px auto; 14 | } 15 | -------------------------------------------------------------------------------- /demo/js/preview.js: -------------------------------------------------------------------------------- 1 | var preview=(function(){ 2 | U.fillHead('#preview_wrapper'); 3 | var scroll = I.initIscroll('preview_wrapper', 45); 4 | initPage(); 5 | function initPage() { 6 | I.initPreview({'selector':_('.prevoewImg')}); 7 | } 8 | return {'initPage':function(){ 9 | return null; 10 | }}; 11 | })() 12 | -------------------------------------------------------------------------------- /js/error.js: -------------------------------------------------------------------------------- 1 | var error=(function(){ 2 | var scroll=I.initIscroll('error_wrapper',0); 3 | initPage(); 4 | function initPage(){ 5 | initEvent(); 6 | } 7 | function initEvent(){ 8 | _('.back').uclick(function(){ 9 | history.go(-1); 10 | }); 11 | } 12 | return {'initPage':function(){ 13 | return initPage(); 14 | }} 15 | })(); 16 | -------------------------------------------------------------------------------- /demo/js/drag.js: -------------------------------------------------------------------------------- 1 | var drag=(function(){ 2 | U.fillHead('#drag_wrapper'); 3 | var scroll = I.initIscroll('drag_wrapper', 45); 4 | initPage(); 5 | function initPage() { 6 | U.dragElement($('#drag_wrapper .drag')); 7 | U.dragElement($('#drag_wrapper header')); 8 | } 9 | return {'initPage':function(){ 10 | return initPage(); 11 | }}; 12 | })() 13 | -------------------------------------------------------------------------------- /demo/zsmap.html: -------------------------------------------------------------------------------- 1 | 地图 2 | 3 | 4 |
5 |
6 | 12 |
13 |
14 | -------------------------------------------------------------------------------- /demo/css/bmap.css: -------------------------------------------------------------------------------- 1 | #bmap_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #bmap_wrapper .menu div{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/css/date.css: -------------------------------------------------------------------------------- 1 | #date_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #date_wrapper .menu div{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/citypicker.html: -------------------------------------------------------------------------------- 1 | 城市选择 2 | 3 | 4 | 5 |
6 |
7 | 11 |
12 |
-------------------------------------------------------------------------------- /demo/css/zsmap.css: -------------------------------------------------------------------------------- 1 | #zsmap_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #zsmap_wrapper .menu div{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | min-height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/css/selector.css: -------------------------------------------------------------------------------- 1 | #selector_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #selector_wrapper .chose{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/css/waterfall.css: -------------------------------------------------------------------------------- 1 | #waterfall_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #waterfall_wrapper .more{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/date.html: -------------------------------------------------------------------------------- 1 | 时间选择 2 | 3 | 4 | 5 |
6 |
7 | 11 |
12 |
-------------------------------------------------------------------------------- /demo/css/citypicker.css: -------------------------------------------------------------------------------- 1 | #citypicker_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #citypicker_wrapper .menu div{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | -------------------------------------------------------------------------------- /demo/css/dialog.css: -------------------------------------------------------------------------------- 1 | #dialog_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #dialog_wrapper .menu div{ 9 | background: #0097FF; 10 | text-align: center; 11 | margin: 10px auto; 12 | width: 80%; 13 | height: 40px; 14 | line-height: 40px; 15 | border-radius: 4px; 16 | color: white; 17 | } 18 | 19 | 20 | -------------------------------------------------------------------------------- /demo/dialog.html: -------------------------------------------------------------------------------- 1 | 弹窗 2 | 3 | 4 |
5 |
6 | 14 |
15 |
16 | -------------------------------------------------------------------------------- /demo/css/index.css: -------------------------------------------------------------------------------- 1 | #wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #wrapper .menu{ 9 | padding-bottom: 10px; 10 | } 11 | #wrapper .menu div{ 12 | background: #0097FF; 13 | text-align: center; 14 | margin: 10px auto; 15 | width: 80%; 16 | height: 40px; 17 | line-height: 40px; 18 | border-radius: 4px; 19 | color: white; 20 | } 21 | -------------------------------------------------------------------------------- /demo/css/drag.css: -------------------------------------------------------------------------------- 1 | #drag_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #drag_wrapper .drag{ 9 | background: #0097FF; 10 | text-align: center; 11 | width: 40%; 12 | height: 40px; 13 | border-radius: 4px; 14 | color: white; 15 | line-height: 40px; 16 | position: absolute; 17 | left: 30%; 18 | top: 100px; 19 | } 20 | -------------------------------------------------------------------------------- /demo/js/iscroll.js: -------------------------------------------------------------------------------- 1 | var iscroll=(function(){ 2 | U.fillHead('#iscroll_wrapper'); 3 | var scroll = I.initIscroll('iscroll_wrapper', 45); 4 | initPage(); 5 | function initPage() { 6 | var images =['images/banner.png','images/banner.png','images/banner.png','images/banner.png','images/banner.png']; 7 | I.initScrollImg({'images':images,'speed':2000}); 8 | } 9 | return {'initPage':function(){ 10 | return null; 11 | }}; 12 | })() 13 | -------------------------------------------------------------------------------- /demo/clip_image.html: -------------------------------------------------------------------------------- 1 | 图片裁剪 2 | 3 | 4 |
5 |
6 |
7 |
8 | 9 |
上传
10 |
截取
11 |
12 |
13 |
-------------------------------------------------------------------------------- /demo/js/selector.js: -------------------------------------------------------------------------------- 1 | var selector=(function(){ 2 | U.fillHead('#selector_wrapper'); 3 | var scroll = I.initIscroll('selector_wrapper', 45); 4 | initPage(); 5 | function initPage() { 6 | var array =['选择1','选择2','选择3','选择4','选择5']; 7 | D.initSelect({selector:_('.chose'),selectArray:array,callback:function(result){ 8 | _('.chose').html(result); 9 | }}); 10 | } 11 | return {'initPage':function(){ 12 | return null; 13 | }}; 14 | })() 15 | -------------------------------------------------------------------------------- /demo/js/date.js: -------------------------------------------------------------------------------- 1 | var date=(function(){ 2 | U.fillHead('#date_wrapper'); 3 | var scroll = I.initIscroll('date_wrapper', 45); 4 | initPage(); 5 | function initEvent(){ 6 | } 7 | function initPage() { 8 | Dt.datePicker({selector:_('.menu div').eq(0),format:'yyyy-MM-dd','minYear':2000}); 9 | Dt.datePicker({selector:_('.menu div').eq(1),format:'yyyy-MM-dd HH:mm:ss',minYear:2000}); 10 | initEvent(); 11 | } 12 | return {'initPage':function(){ 13 | return null; 14 | }}; 15 | })() 16 | -------------------------------------------------------------------------------- /demo/js/bmap.js: -------------------------------------------------------------------------------- 1 | var bmap=(function(){ 2 | U.fillHead('#bmap_wrapper'); 3 | var myLocation; 4 | initPage(); 5 | function initPage() { 6 | if(myLocation==null){ 7 | M.getLocation(function(json){ 8 | myLocation=json; 9 | M.initMap({'longitude':myLocation.longitude,'latitude':myLocation.latitude}); 10 | }); 11 | }else{ 12 | M.initMap({'longitude':myLocation.longitude,'latitude':myLocation.latitude}); 13 | } 14 | } 15 | return {'initPage':function(){ 16 | return initPage(); 17 | }}; 18 | })() 19 | -------------------------------------------------------------------------------- /demo/css/clip_image.css: -------------------------------------------------------------------------------- 1 | #clip_image_wrapper{ 2 | margin-top: 45px; 3 | } 4 | #clip_image_wrapper .clip_area { 5 | height: 240px; 6 | } 7 | #clip_image_wrapper .upload_btn,#clip_image_wrapper .clip_btn{ 8 | background: #0097FF; 9 | text-align: center; 10 | margin: 10px auto; 11 | width: 80%; 12 | height: 40px; 13 | line-height: 40px; 14 | border-radius: 4px; 15 | color: white; 16 | } 17 | #clip_image_wrapper .show { 18 | margin: 0 auto; 19 | width: 100px; 20 | height: 100px; 21 | border-radius: 50%; 22 | } 23 | -------------------------------------------------------------------------------- /demo/index.html: -------------------------------------------------------------------------------- 1 | 首页 2 | 3 | 4 |
5 |
6 | 20 |
21 |
-------------------------------------------------------------------------------- /demo/pull.html: -------------------------------------------------------------------------------- 1 | 下拉刷新、上拉加载更多 2 | 3 | 4 |
5 |
6 |
7 | 下拉可以刷新 8 |
9 |
10 |
11 | 上拉加载更多... 12 |
13 |
14 |
-------------------------------------------------------------------------------- /demo/preview.html: -------------------------------------------------------------------------------- 1 | 图片预览 2 | 3 | 4 |
5 |
6 | 7 | 8 | 9 | 10 |
11 |
-------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /demo/css/pull.css: -------------------------------------------------------------------------------- 1 | #pull_wrapper{ 2 | width: 100%; 3 | height: 100%; 4 | font-size: 14px; 5 | max-width: 640px; 6 | margin-top: 45px; 7 | } 8 | #pull_pullDown{ 9 | text-align: center; 10 | position: relative; 11 | height: 60px; 12 | line-height: 60px; 13 | } 14 | .pullDownIcon{ 15 | width: 25px; 16 | position: absolute; 17 | top: 17px; 18 | } 19 | .pullDownLabel{ 20 | font-size: 14px; 21 | margin-left: 30px; 22 | color: #828282; 23 | } 24 | #pull_pullUp{ 25 | text-align: center; 26 | position: relative; 27 | height: 40px; 28 | line-height: 40px; 29 | } 30 | .pullUpIcon{ 31 | width: 25px; 32 | position: absolute; 33 | top: 8px; 34 | } 35 | .pullUpLabel{ 36 | font-size: 14px; 37 | margin-left: 30px; 38 | color: #828282; 39 | } -------------------------------------------------------------------------------- /demo/js/citypicker.js: -------------------------------------------------------------------------------- 1 | var citypicker=(function(){ 2 | U.fillHead('#citypicker_wrapper'); 3 | var scroll = I.initIscroll('citypicker_wrapper', 45); 4 | initPage(); 5 | function initEvent(){ 6 | _('.menu div').eq(0).uclick(function(event){ 7 | C.cityPicker({ 8 | 'callback': function(json) { 9 | _('.menu div').eq(0).html(json.provinceName+json.cityName+json.areaName); 10 | } 11 | }); 12 | }); 13 | _('.menu div').eq(1).uclick(function(event){ 14 | C.cityPicker({ 15 | 'layout':2, 16 | 'callback': function(json) { 17 | _('.menu div').eq(1).html(json.provinceName+json.cityName+json.areaName); 18 | } 19 | }); 20 | }); 21 | } 22 | function initPage() { 23 | initEvent(); 24 | } 25 | return {'initPage':function(){ 26 | return null; 27 | }}; 28 | })() 29 | -------------------------------------------------------------------------------- /demo/js/lazyload.js: -------------------------------------------------------------------------------- 1 | var lazyload = (function() { 2 | U.fillHead('#lazyload_wrapper'); 3 | var scroll; 4 | initPage(); 5 | 6 | function initPage() { 7 | initIscroll(); 8 | } 9 | 10 | function initIscroll() { 11 | $('#lazyload_wrapper').height($(window).height() - 45); 12 | scroll = new iScroll("lazyload_wrapper", { 13 | scrollbarClass: 'myScrollbar', 14 | useTransition: false, 15 | onScrollMove: function() { 16 | I.lazyload({'lazyImages':_('.lazyload'),'height':$('#lazyload_wrapper').height(),'scroll':this}); 17 | }, 18 | onScrollEnd: function() { 19 | I.lazyload({'lazyImages':_('.lazyload'),'height':$('#lazyload_wrapper').height(),'scroll':this}); 20 | } 21 | }); 22 | I.lazyload({'lazyImages':_('.lazyload'),'height':$('#lazyload_wrapper').height(),'scroll':scroll}); 23 | } 24 | return {'initPage': function() { 25 | return null; 26 | } 27 | }; 28 | })() -------------------------------------------------------------------------------- /js/app.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-08-01 4 | * 5 | * 初始化js(主入口) 6 | * 7 | */ 8 | 9 | var U,D,I,Dt,W,M,C;//工具模块、弹窗模块、Iscroll模块、日期选择模块、瀑布流、地图、省市级联动 10 | window.onload = function(){ 11 | //通过sea.js加载需要用到的js模块 12 | seajs.use(['zepto.min.js','mobile_module.js','iscroll.min.js','iscroll_module.js', 13 | 'dialog_module.js','util_module.js','datepicker_module.js','waterfall_module.js', 14 | 'map_module.js','citypicker_module.js'] 15 | ,function(zepto,mobile,iscrollm,iscroll,dialog,util,datepicker,waterfall,map,city){ 16 | U=util; 17 | D=dialog; 18 | I=iscroll; 19 | Dt=datepicker; 20 | W=waterfall; 21 | M=map; 22 | C=city; 23 | D.initLoadOpt(2) 24 | D.initLoadPage(3,'#33B5E5'); 25 | mobile.init({'enableTouch':true});//初始化路由模块 26 | if(location.href.indexOf('#')>-1){ 27 | location.href=location.href.substring(location.href.indexOf('#'),location.href.length); 28 | }else{ 29 | location.href='#demo/index.html'; 30 | } 31 | }); 32 | } -------------------------------------------------------------------------------- /demo/js/clip_image.js: -------------------------------------------------------------------------------- 1 | var clip_image = (function() { 2 | define(['clip_module.js'], function(require, exports, module) { 3 | var clip = require('clip_module'); 4 | U.fillHead('#clip_image_wrapper'); 5 | initPage(); 6 | 7 | function initEvent() { 8 | clip.clipImage("#clip_image_wrapper .clip_area", { 9 | size: [200, 200], 10 | circle:true, 11 | outputSize: [100, 100], 12 | file: "#clip_image_wrapper .file", 13 | view: "#clip_image_wrapper .show", 14 | ok: "#clip_image_wrapper .clip_btn", 15 | loadStart: function() { 16 | D.loadOpt(true); 17 | }, 18 | loadComplete: function() { 19 | D.loadOpt(false); 20 | }, 21 | clipFinish: function(dataURL) { 22 | } 23 | }); 24 | _('#clip_image_wrapper .upload_btn').uclick(function(){ 25 | _('.file').click(); 26 | }); 27 | 28 | } 29 | 30 | function initPage() { 31 | initEvent(); 32 | } 33 | }); 34 | return { 35 | 'initPage': function() { 36 | return null; 37 | } 38 | }; 39 | })() -------------------------------------------------------------------------------- /demo/js/index.js: -------------------------------------------------------------------------------- 1 | var index=(function(){ 2 | U.fillHead('#wrapper'); 3 | var scroll = I.initIscroll('wrapper', 45); 4 | initPage(); 5 | 6 | function initEvent() { 7 | _('.menu div').eq(0).uclick(function() { 8 | location.href = '#demo/dialog.html'; 9 | }); 10 | _('.menu div').eq(1).uclick(function() { 11 | location.href = '#demo/iscroll.html'; 12 | }); 13 | _('.menu div').eq(2).uclick(function() { 14 | location.href = '#demo/date.html'; 15 | }); 16 | _('.menu div').eq(3).uclick(function() { 17 | location.href = '#demo/selector.html'; 18 | }); 19 | _('.menu div').eq(4).uclick(function() { 20 | location.href = '#demo/waterfall.html'; 21 | }); 22 | _('.menu div').eq(5).uclick(function() { 23 | location.href = '#demo/lazyload.html'; 24 | }); 25 | _('.menu div').eq(6).uclick(function() { 26 | location.href = '#demo/citypicker.html'; 27 | }); 28 | _('.menu div').eq(7).uclick(function() { 29 | location.href = '#demo/zsmap.html'; 30 | }); 31 | _('.menu div').eq(8).uclick(function() { 32 | location.href = '#demo/preview.html'; 33 | }); 34 | _('.menu div').eq(9).uclick(function() { 35 | location.href = '#demo/pull.html'; 36 | }); 37 | _('.menu div').eq(10).uclick(function() { 38 | location.href = '#demo/drag.html'; 39 | }); 40 | _('.menu div').eq(11).uclick(function() { 41 | location.href = '#demo/clip_image.html'; 42 | }); 43 | } 44 | function initPage() { 45 | initEvent(); 46 | } 47 | return {'initPage':function(){ 48 | return null; 49 | }}; 50 | })() 51 | -------------------------------------------------------------------------------- /demo/js/dialog.js: -------------------------------------------------------------------------------- 1 | var dialog=(function(){ 2 | U.fillHead('#dialog_wrapper'); 3 | var scroll = I.initIscroll('dialog_wrapper', 45); 4 | initPage(); 5 | function initEvent() { 6 | _('.menu div').eq(0).uclick(function(){//成功弹框 7 | console.info(1) 8 | D.toast(true,'我是成功',function(){//回调 9 | _('.menu div').eq(0).html('成功回调'); 10 | }) 11 | }); 12 | _('.menu div').eq(1).uclick(function(){//失败弹框 13 | D.toast(false,'我是失败',function(){//回调 14 | _('.menu div').eq(1).html('失败回调'); 15 | }) 16 | }); 17 | _('.menu div').eq(2).uclick(function(){//确定or取消 18 | D.okCancle({'txt':'我是提示文字','okTxt':'我是确定文字','ok':function(){//确定回调 19 | _('.menu div').eq(2).html('确定回调'); 20 | },'cancle':function(){//取消回调 21 | _('.menu div').eq(2).html('取消回调'); 22 | }}) 23 | }); 24 | _('.menu div').eq(3).uclick(function(){ 25 | D.confirm({'txt':'我是提示内容','title':'我的提示标题','ok':function(){ 26 | _('.menu div').eq(3).html('确定回调'); 27 | },'cancle':function(){//取消回调 28 | _('.menu div').eq(3).html('取消回调'); 29 | }}) 30 | }); 31 | _('.menu div').eq(4).uclick(function(){//确定or取消 32 | D.tip({'callback':function(){ 33 | D.toast(true,'回调'); 34 | }}); 35 | }); 36 | _('.menu div').eq(5).uclick(function(){ 37 | D.confirmInput({'txt':'请输入姓名','title':'标题','ok':function(result){ 38 | D.toast(true,result); 39 | },'cancle':function(result){//取消回调 40 | D.toast(false,result); 41 | }}) 42 | }); 43 | } 44 | 45 | function initPage() { 46 | initEvent(); 47 | } 48 | return {'initPage':function(){ 49 | return initPage(); 50 | }}; 51 | })() 52 | -------------------------------------------------------------------------------- /demo/js/zsmap.js: -------------------------------------------------------------------------------- 1 | var zsmap=(function(){ 2 | U.fillHead('#zsmap_wrapper'); 3 | var scroll = I.initIscroll('zsmap_wrapper', 45); 4 | var myLocation; 5 | initPage(); 6 | function initEvent(){ 7 | _('.menu div').eq(0).unbind('click').click(function(){ 8 | M.getLocation(function(json){ 9 | myLocation=json; 10 | _('.menu div').eq(0).html('经度:'+json.longitude+',纬度:'+json.latitude); 11 | }); 12 | }); 13 | _('.menu div').eq(1).unbind('click').click(function(){ 14 | if(myLocation==null){ 15 | M.getLocation(function(json){ 16 | myLocation=json; 17 | M.getAddressByLocation(myLocation.longitude,myLocation.latitude,function(json){ 18 | _('.menu div').eq(1).html(json.formatted_address); 19 | }); 20 | }); 21 | }else{ 22 | M.getAddressByLocation(myLocation.longitude,myLocation.latitude,function(json){ 23 | _('.menu div').eq(1).html(json.formatted_address); 24 | }); 25 | } 26 | }); 27 | _('.menu div').eq(2).unbind('click').click(function(){ 28 | location.href='#demo/bmap.html'; 29 | }); 30 | _('.menu div').eq(3).unbind('click').click(function(){ 31 | if(myLocation==null){ 32 | M.getLocation(function(json){ 33 | myLocation=json; 34 | M.toNavigation({longitude:myLocation.longitude,latitude:myLocation.latitude,name:'天安数码城'}); 35 | }); 36 | }else{ 37 | M.toNavigation({longitude:myLocation.longitude,latitude:myLocation.latitude,name:'天安数码城'}); 38 | } 39 | }); 40 | } 41 | function initPage() { 42 | initEvent(); 43 | } 44 | return {'initPage':function(){ 45 | return null; 46 | }}; 47 | })() 48 | -------------------------------------------------------------------------------- /resource/wine_province.json: -------------------------------------------------------------------------------- 1 | { 2 | "RECORDS":[ 3 | { 4 | "id":1, 5 | "province_name":"北京" 6 | }, 7 | { 8 | "id":2, 9 | "province_name":"天津" 10 | }, 11 | { 12 | "id":3, 13 | "province_name":"河北" 14 | }, 15 | { 16 | "id":4, 17 | "province_name":"山西" 18 | }, 19 | { 20 | "id":5, 21 | "province_name":"内蒙古" 22 | }, 23 | { 24 | "id":6, 25 | "province_name":"辽宁" 26 | }, 27 | { 28 | "id":7, 29 | "province_name":"吉林" 30 | }, 31 | { 32 | "id":8, 33 | "province_name":"黑龙江" 34 | }, 35 | { 36 | "id":9, 37 | "province_name":"上海" 38 | }, 39 | { 40 | "id":10, 41 | "province_name":"江苏" 42 | }, 43 | { 44 | "id":11, 45 | "province_name":"浙江" 46 | }, 47 | { 48 | "id":12, 49 | "province_name":"安徽" 50 | }, 51 | { 52 | "id":13, 53 | "province_name":"福建" 54 | }, 55 | { 56 | "id":14, 57 | "province_name":"江西" 58 | }, 59 | { 60 | "id":15, 61 | "province_name":"山东" 62 | }, 63 | { 64 | "id":16, 65 | "province_name":"河南" 66 | }, 67 | { 68 | "id":17, 69 | "province_name":"湖北" 70 | }, 71 | { 72 | "id":18, 73 | "province_name":"湖南" 74 | }, 75 | { 76 | "id":19, 77 | "province_name":"广东" 78 | }, 79 | { 80 | "id":20, 81 | "province_name":"广西" 82 | }, 83 | { 84 | "id":21, 85 | "province_name":"海南" 86 | }, 87 | { 88 | "id":22, 89 | "province_name":"重庆" 90 | }, 91 | { 92 | "id":23, 93 | "province_name":"四川" 94 | }, 95 | { 96 | "id":24, 97 | "province_name":"贵州" 98 | }, 99 | { 100 | "id":25, 101 | "province_name":"云南" 102 | }, 103 | { 104 | "id":26, 105 | "province_name":"西藏" 106 | }, 107 | { 108 | "id":27, 109 | "province_name":"陕西" 110 | }, 111 | { 112 | "id":28, 113 | "province_name":"甘肃" 114 | }, 115 | { 116 | "id":29, 117 | "province_name":"青海" 118 | }, 119 | { 120 | "id":30, 121 | "province_name":"宁夏" 122 | }, 123 | { 124 | "id":31, 125 | "province_name":"新疆" 126 | }, 127 | { 128 | "id":32, 129 | "province_name":"香港" 130 | }, 131 | { 132 | "id":33, 133 | "province_name":"澳门" 134 | }, 135 | { 136 | "id":34, 137 | "province_name":"台湾" 138 | } 139 | ] 140 | } -------------------------------------------------------------------------------- /css/datepicker.css: -------------------------------------------------------------------------------- 1 | /*----日期选择样式库----*/ 2 | #dpicker_mask{ 3 | width: 100%; 4 | max-width: 640px; 5 | position: fixed; 6 | top: 0px; 7 | height: 100%; 8 | background: black; 9 | z-index: 11; 10 | opacity: 0.5; 11 | } 12 | #dpicker{ 13 | width: 100%; 14 | height: 285px; 15 | background: white; 16 | position: fixed; 17 | bottom: 0px; 18 | max-width: 640px; 19 | z-index: 12; 20 | } 21 | #d_header{ 22 | height: 45px; 23 | line-height: 45px; 24 | } 25 | #dpicker_cancle{ 26 | color: #0097FF; 27 | margin-left: 15px; 28 | float: left; 29 | } 30 | #dpicker_ok{ 31 | color: #0097FF; 32 | float: right; 33 | margin-right: 15px; 34 | } 35 | #d_body{ 36 | height: 200px; 37 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 100%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 38 | } 39 | #year_wrapper .d_year,#month_wrapper .d_month,#day_wrapper .d_day,#hour_wrapper .d_hour,#minute_wrapper .d_minute{ 40 | height:40px ; 41 | line-height: 40px; 42 | } 43 | #year_wrapper,#month_wrapper,#day_wrapper,#hour_wrapper,#minute_wrapper{ 44 | text-align: center; 45 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 0%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 46 | float: left; 47 | } 48 | #d_selecter_top{ 49 | height: 1px; 50 | border-bottom: 1px solid #cccccc; 51 | position: absolute; 52 | z-index: 1; 53 | width: 100%; 54 | bottom: 120px; 55 | } 56 | #d_selecter_fotter{ 57 | height: 1px; 58 | border-bottom: 1px solid #cccccc; 59 | position: absolute; 60 | z-index: 1; 61 | width: 100%; 62 | bottom: 80px; 63 | } 64 | #d_title{ 65 | height: 40px; 66 | line-height: 40px; 67 | } 68 | #d_title div{ 69 | float: left; 70 | width: 20%; 71 | text-align: center; 72 | } 73 | 74 | @-webkit-keyframes pickerUp{ 75 | 0%{ 76 | -webkit-transform:translate(0px,285px); 77 | } 78 | 100%{ 79 | -webkit-transform: translate(0px,0px); 80 | } 81 | } 82 | .pickerUp{ 83 | -webkit-animation: pickerUp 0.3s 0s 1 forwards; 84 | } 85 | @-webkit-keyframes pickerDown{ 86 | 0%{ 87 | -webkit-transform:translate(0px,0px); 88 | } 89 | 100%{ 90 | -webkit-transform: translate(0px,285px); 91 | } 92 | } 93 | .pickerDown{ 94 | -webkit-animation: pickerDown 0.3s 0s 1 forwards; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /js/waterfall_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-09-01 4 | * 5 | * 瀑布流 6 | * 7 | * selector 选择器 8 | * count 列数 9 | * images 填充的图片数组 10 | * callback 填充之后的回调函数 11 | */ 12 | define(['zepto.min.js','dialog_module.js'],function(require, exports, module){ 13 | var D = require('dialog_module'); 14 | function loadWaterfall(conf){ 15 | var config={}; 16 | var config={ 17 | selector:$('#waterfall'), 18 | count:2, 19 | images:new Array(), 20 | callback:null 21 | }; 22 | $.extend(config, conf); 23 | if(config.selector.find('div').length<=0){ 24 | for (var i=0;i'); 26 | } 27 | config.selector.css('overflow','auto'); 28 | config.selector.find('div').css({'position':'relative','float':'left','width':$('body').width()/config.count+'px'}); 29 | } 30 | D.loadOpt(true); 31 | loadlist(config,0); 32 | } 33 | function loadImg(opt) { 34 | var img = new Image(); 35 | var complete = false; 36 | var t = setTimeout(function() { 37 | if(!complete && opt.onTimeout) opt.onTimeout(); 38 | complete = true; 39 | }, opt.timeout || 5000); 40 | img.onload = function() { 41 | clearTimeout(t); 42 | if(!complete && opt.onComplete) opt.onComplete(this); 43 | complete = true; 44 | } 45 | img.src = opt.url; 46 | } 47 | function loadlist(config,index) { 48 | loadImg({ 49 | url: config.images[index], 50 | onComplete: function(img) { 51 | if(++index < config.images.length) { 52 | loadlist(config,index); 53 | } 54 | var dom=config.selector.find('div').eq(0); 55 | $(config.selector.find('div')).each(function(i){ 56 | if(dom.height()>$(this).height()){ 57 | dom=$(this); 58 | } 59 | }); 60 | dom.append(img); 61 | config.selector.find('img').css({'width':'90%','margin':'10px auto 0px auto','display':'block','border-radius':'5px'}); 62 | if(config.images.length==index){ 63 | D.loadOpt(false); 64 | if(config.callback){ 65 | config.callback(); 66 | } 67 | } 68 | }, 69 | onTimeout: function() { 70 | if(++index < config.images.length) { 71 | loadlist(config,index); 72 | } 73 | } 74 | }); 75 | } 76 | var exports = { 77 | loadWaterfall:function(conf){ 78 | loadWaterfall(conf); 79 | } 80 | }; 81 | module.exports = exports; 82 | }); -------------------------------------------------------------------------------- /css/app.css: -------------------------------------------------------------------------------- 1 | * { 2 | padding: 0; 3 | margin: 0; 4 | list-style: none; 5 | } 6 | 7 | body { 8 | margin: 0 auto; 9 | max-width: 640px; 10 | background-color: #F0F5F9; 11 | color: #333; 12 | font-family: 'Microsoft YaHei'; 13 | overflow: hidden!important; 14 | } 15 | 16 | .page{ 17 | position: absolute; 18 | width: 100%; 19 | max-width: 640px; 20 | } 21 | 22 | /*切换动画*/ 23 | .pt-page-moveToLeft { 24 | -webkit-animation: moveToLeft .5s ease both; 25 | } 26 | 27 | .pt-page-moveFromLeft { 28 | -webkit-animation: moveFromLeft .5s ease both; 29 | } 30 | 31 | .pt-page-moveToRight { 32 | -webkit-animation: moveToRight .5s ease both; 33 | } 34 | 35 | .pt-page-moveFromRight { 36 | -webkit-animation: moveFromRight .5s ease both; 37 | } 38 | @-webkit-keyframes moveToLeft { 39 | to { -webkit-transform: translateX(-100%); } 40 | } 41 | 42 | @-webkit-keyframes moveFromLeft { 43 | from { -webkit-transform: translateX(-100%); } 44 | } 45 | 46 | @-webkit-keyframes moveToRight { 47 | to { -webkit-transform: translateX(100%); } 48 | } 49 | 50 | @-webkit-keyframes moveFromRight { 51 | from { -webkit-transform: translateX(100%); } 52 | } 53 | 54 | /*ERROR*/ 55 | #error_wrapper{ 56 | background: #ECECEC; 57 | } 58 | #error_wrapper p:first-child { 59 | text-align: center; 60 | font-family: cursive; 61 | font-size: 100px; 62 | font-weight: bold; 63 | line-height: 100px; 64 | letter-spacing: 5px; 65 | color: #fff; 66 | margin-top: 100px; 67 | } 68 | #error_wrapper p:first-child span { 69 | cursor: pointer; 70 | text-shadow: 0px 0px 2px #686868, 71 | 0px 1px 1px #ddd, 72 | 0px 2px 1px #d6d6d6, 73 | 0px 3px 1px #ccc, 74 | 0px 4px 1px #c5c5c5, 75 | 0px 5px 1px #c1c1c1, 76 | 0px 6px 1px #bbb, 77 | 0px 7px 1px #777, 78 | 0px 8px 3px rgba(100, 100, 100, 0.4), 79 | 0px 9px 5px rgba(100, 100, 100, 0.1), 80 | 0px 10px 7px rgba(100, 100, 100, 0.15), 81 | 0px 11px 9px rgba(100, 100, 100, 0.2), 82 | 0px 12px 11px rgba(100, 100, 100, 0.25), 83 | 0px 13px 15px rgba(100, 100, 100, 0.3); 84 | -webkit-transition: all .1s linear; 85 | transition: all .1s linear; 86 | } 87 | #error_wrapper p:not(:first-child) { 88 | text-align: center; 89 | color: #666; 90 | font-size: 14px; 91 | text-shadow: 0 1px 0 #fff; 92 | letter-spacing: 1px; 93 | margin-top: 30px; 94 | } 95 | #error_wrapper .back{ 96 | width: 100px; 97 | height: 25px; 98 | margin: 40px auto; 99 | text-align: center; 100 | line-height: 25px; 101 | font-size: 14px; 102 | background: white; 103 | border-radius: 4px; 104 | box-shadow: 0px 0px 2px #686868, 0px 1px 1px #ddd, 0px 2px 1px #d6d6d6, 0px 3px 1px #ccc, 0px 4px 1px #c5c5c5, 0px 5px 1px #c1c1c1, 0px 6px 1px #bbb, 0px 7px 1px #777, 0px 8px 3px rgba(100, 100, 100, 0.4), 0px 9px 5px rgba(100, 100, 100, 0.1), 0px 10px 7px rgba(100, 100, 100, 0.15), 0px 10px 9px rgba(100, 100, 100, 0.2), 0px 8px 0px rgba(100, 100, 100, 0.25), 0px 0px 0px rgba(100, 100, 100, 0.3); 105 | } 106 | -------------------------------------------------------------------------------- /demo/js/waterfall.js: -------------------------------------------------------------------------------- 1 | var waterfall=(function(){ 2 | U.fillHead('#waterfall_wrapper'); 3 | var scroll = I.initIscroll('waterfall_wrapper', 45); 4 | initPage(); 5 | function initEvent(){ 6 | $('#waterfall_wrapper .more').unbind('click').click(function(){ 7 | var images=['http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 8 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 9 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 10 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 11 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 12 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160728162515_828.jpg', 13 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 14 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 15 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 16 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 17 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 18 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160728162515_828.jpg', 19 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 20 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 21 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 22 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 23 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg'] 24 | W.loadWaterfall({'images':images,'callback':function(){ 25 | scroll.refresh(); 26 | }}); 27 | }); 28 | } 29 | function initPage() { 30 | $('#waterfall').html(''); 31 | var images=['http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 32 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 33 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 34 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 35 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 36 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160728162515_828.jpg', 37 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 38 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 39 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 40 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 41 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 42 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160728162515_828.jpg',] 43 | W.loadWaterfall({'images':images,'count':3,'callback':function(){ 44 | scroll.refresh(); 45 | }}); 46 | initEvent(); 47 | } 48 | return {'initPage':function(){ 49 | }} 50 | })() 51 | -------------------------------------------------------------------------------- /demo/lazyload.html: -------------------------------------------------------------------------------- 1 | 图片懒加载 2 | 3 | 4 |
5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 |
-------------------------------------------------------------------------------- /js/mobile_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-08-01 4 | * 5 | * web单页应用模块 6 | * 7 | * store 库存 8 | * enableTouch 是否启用滑动切换页面 9 | */ 10 | define(['zepto.min.js'],function(require, exports, module){ 11 | var store={} 12 | left_in = 'pt-page-moveFromLeft'; //从左进入 13 | left_out = 'pt-page-moveToLeft'; //从左退出 14 | right_in = 'pt-page-moveFromRight'; //从右进入 15 | right_out = 'pt-page-moveToRight'; //从右退出 16 | var hideTimeOut; 17 | var config={ 18 | enableTouch:false, 19 | } 20 | function request(type,url,data,async,dataType,callback){ 21 | $.ajax({ 22 | type : type, 23 | url : url, 24 | data :data, 25 | async : async, 26 | dataType : dataType, 27 | success : function(json) { 28 | if(callback){ 29 | callback(json); 30 | }else{ 31 | console.log('error:'+url); 32 | } 33 | }, 34 | error:function(json){ 35 | jumpPage('error.html'); 36 | } 37 | }); 38 | } 39 | function ajax(type,url,data,dataType,callback){ 40 | request(type,url,data,dataType,true,callback); 41 | } 42 | //获取当前页面dom元素 43 | window._=function(selector){ 44 | return $('.current_page').find(selector); 45 | } 46 | //防止重复注册事件 47 | $.fn.uclick=function(callback){ 48 | this.unbind('click').click(function(){ 49 | callback(); 50 | }); 51 | } 52 | function bindTouch(){//绑定滑动切换页面事件 53 | var pressX = 0,spanX=0; 54 | $('body')[0].addEventListener('touchmove', function(event) { 55 | if(event.targetTouches.length == 1) { 56 | var touch = event.targetTouches[0]; 57 | spanX = touch.pageX - pressX; 58 | } 59 | }, false); 60 | $('body')[0].addEventListener('touchstart', function(event) { 61 | if(event.targetTouches.length == 1) { 62 | var touch = event.targetTouches[0]; 63 | pressX = touch.pageX; 64 | } 65 | }, false); 66 | $('body')[0].addEventListener('touchend', function(event) { 67 | if(spanX > 200) { 68 | history.go(-1) 69 | } else if(spanX<-200){ 70 | history.go(1) 71 | } 72 | spanX=0; 73 | }, false); 74 | } 75 | function jumpPage(pageUrl) { 76 | var hash=""; 77 | if(pageUrl==null){ 78 | hash = location.hash.replace("#&", "").replace(/^#/, ""); //获取URL锚部分(从 # 号开始的部分)。 79 | }else{ 80 | hash=pageUrl; 81 | } 82 | var pageId=hash.substring(0, hash.indexOf('.html')).replace(/\//g, '_'); 83 | //判断库存中是否存在该页面 84 | if(store[pageId] == null) { 85 | D.loadPage(true); 86 | //不存在:发送AJAx请求加载页面 87 | ajax('get', hash, null, 'html', function(html) { 88 | var pageHtml = $('
' + html + '
'); 89 | $('body').append('
' + html + '
'); 90 | //保存页面到库存中 91 | store[pageId] = { 92 | 'title': pageHtml.find('title').html() 93 | }; 94 | //获取页面当中的js文件地址(css文件加载页面会同时加载) 95 | var jsArray = new Array(); 96 | $(pageHtml.find('script')).each(function() { 97 | var url=location.href.substring(0,location.href.indexOf('index.html')); 98 | jsArray[jsArray.length] =url+$(this).attr('src'); 99 | }); 100 | $('title').html(store[pageId].title); 101 | var dom = $('.current_page'); 102 | dom.removeClass(right_in).removeClass(left_in).removeClass('current_page').addClass(left_out); 103 | clearTimeout(hideTimeOut); 104 | hideTimeOut = setTimeout(function() { 105 | dom.hide(); 106 | }, 500); 107 | $('#' + pageId).addClass('current_page'); 108 | //加载js文件 109 | seajs.use(jsArray, function() { 110 | D.loadPage(false); 111 | //添加动画效果 112 | if(JSON.stringify(store).split(',').length > 1) { 113 | $('#' + pageId).addClass(right_in); 114 | } 115 | }); 116 | }); 117 | } else { 118 | D.loadPage(false); 119 | D.loadOpt(false); 120 | $('#search_box').remove(); 121 | $('#preview_page').remove(); 122 | prevPage = $('.page').index($('.current_page')); 123 | curPage = $('.page').index($('#' + pageId)); 124 | if(prevPage != curPage) { 125 | var dom = $('.current_page'); 126 | dom.removeClass(left_in).removeClass(right_in); 127 | dom.removeClass('current_page'); 128 | clearTimeout(hideTimeOut); 129 | hideTimeOut = setTimeout(function() { 130 | dom.hide(); 131 | }, 500); 132 | if(prevPage > curPage) { //返回效果 133 | dom.addClass(right_out); 134 | $('#' + pageId).show().removeClass(left_out).removeClass(right_out).addClass(left_in).addClass('current_page'); 135 | } else { //前进效果 136 | dom.addClass(left_out); 137 | $('#' + pageId).show().removeClass(left_out).removeClass(right_out).addClass(right_in).addClass('current_page'); 138 | } 139 | $('title').html(store[pageId].title); 140 | } 141 | //重新初始化当前页面 142 | var page = pageId.substring(pageId.indexOf('_') + 1, pageId.length); 143 | eval(page + '.initPage()'); 144 | } 145 | } 146 | var exports = { 147 | init:function(conf){ 148 | $.extend(config,conf); 149 | if(config.enableTouch){ 150 | bindTouch(); 151 | } 152 | window.addEventListener("popstate", function() {//监听地址变化 153 | jumpPage(); 154 | }); 155 | }, 156 | jumpPage:function(pageUrl){ 157 | jumpPage(pageUrl) 158 | } 159 | }; 160 | module.exports = exports; 161 | }); -------------------------------------------------------------------------------- /css/citypicker.css: -------------------------------------------------------------------------------- 1 | /*----省市级联动样式库----*/ 2 | 3 | #city_picker{ 4 | position: fixed; 5 | top: 0px; 6 | width: 100%; 7 | max-width: 640px; 8 | height: 100%; 9 | z-index: 9; 10 | background: white; 11 | } 12 | #cp_head{ 13 | position: fixed; 14 | top: 0px; 15 | height: 45px; 16 | line-height: 45px; 17 | text-align: center; 18 | color: white; 19 | background: #0097ff; 20 | width: 100%; 21 | max-width: 640px; 22 | font-size: 17px; 23 | border-bottom: 1px solid #E6E6E6; 24 | } 25 | #cp_head img{ 26 | position: absolute; 27 | left: 10px; 28 | width: 25px; 29 | top: 10px; 30 | } 31 | #address_menu{ 32 | position: fixed; 33 | top: 46px; 34 | width: 100%; 35 | max-width: 640px; 36 | height: 45px; 37 | line-height: 45px; 38 | background: white; 39 | border-bottom: 1px solid #E6E6E6; 40 | } 41 | #address_menu div{ 42 | float: left; 43 | width: 33.3%; 44 | text-align: center; 45 | font-size: 16px; 46 | } 47 | #address_menu span{ 48 | display: block; 49 | border-bottom: 3px solid #0097FF; 50 | width: 50%; 51 | margin: 0 auto; 52 | margin-top: -3px; 53 | } 54 | 55 | 56 | 57 | #province_page{ 58 | position: fixed; 59 | top: 92px; 60 | width: 100%; 61 | max-width: 640px; 62 | z-index: 10; 63 | font-size: 14px; 64 | } 65 | #province_list div{ 66 | height: 40px; 67 | line-height: 40px; 68 | text-indent: 20px; 69 | border-bottom: 1px solid #E6E6E6; 70 | } 71 | #city_page{ 72 | position: fixed; 73 | top: 92px; 74 | width: 100%; 75 | max-width: 640px; 76 | display: none; 77 | z-index: 11; 78 | font-size: 14px; 79 | } 80 | #city_list div{ 81 | height: 40px; 82 | line-height: 40px; 83 | text-indent: 20px; 84 | border-bottom: 1px solid #E6E6E6; 85 | } 86 | 87 | #area_page{ 88 | position: fixed; 89 | top: 92px; 90 | width: 100%; 91 | max-width: 640px; 92 | display: none; 93 | z-index: 12; 94 | font-size: 14px; 95 | } 96 | #area_list div{ 97 | height: 40px; 98 | line-height: 40px; 99 | text-indent: 20px; 100 | border-bottom: 1px solid #E6E6E6; 101 | } 102 | 103 | 104 | @-webkit-keyframes cp_right_in { 105 | 0% { 106 | -webkit-transform: translate(640px, 0px); 107 | } 108 | 100% { 109 | -webkit-transform: translate(0px, 0px); 110 | } 111 | } 112 | @-webkit-keyframes cp_left_in { 113 | 0% { 114 | -webkit-transform: translate(-640px, 0px); 115 | } 116 | 100% { 117 | -webkit-transform: translate(0px, 0px); 118 | } 119 | } 120 | @-webkit-keyframes cp_right_out { 121 | 0% { 122 | -webkit-transform: translate(0px, 0px); 123 | } 124 | 100% { 125 | -webkit-transform: translate(640px, 0px); 126 | } 127 | } 128 | @-webkit-keyframes cp_left_out { 129 | 0% { 130 | -webkit-transform: translate(0px, 0px); 131 | } 132 | 100% { 133 | -webkit-transform: translate(-640px, 0px); 134 | } 135 | } 136 | 137 | .cp_right_in { 138 | -webkit-animation: cp_right_in 0.4s 0s 1 forwards; 139 | } 140 | .cp_left_in { 141 | -webkit-animation: cp_left_in 0.4s 0s 1 forwards; 142 | } 143 | .cp_left_out { 144 | -webkit-animation: cp_left_out 0.6s 0s 1 forwards 145 | } 146 | .cp_right_out{ 147 | -webkit-animation: cp_right_out 0.6s 0s 1 forwards; 148 | } 149 | .cp_check{ 150 | color: #0097FF; 151 | } 152 | .cp_check img{ 153 | width: 17px; 154 | vertical-align: initial; 155 | margin-left: 15px; 156 | } 157 | 158 | 159 | 160 | /* 仿ios选择器 */ 161 | #ios_cpicker_mask{ 162 | width: 100%; 163 | max-width: 640px; 164 | position: fixed; 165 | top: 0px; 166 | height: 100%; 167 | background: black; 168 | z-index: 11; 169 | opacity: 0.5; 170 | } 171 | #ios_cpicker{ 172 | width: 100%; 173 | height: 285px; 174 | background: white; 175 | position: fixed; 176 | bottom: 0px; 177 | max-width: 640px; 178 | z-index: 12; 179 | } 180 | #c_header{ 181 | height: 45px; 182 | line-height: 45px; 183 | } 184 | #cpicker_cancle{ 185 | color: #0097FF; 186 | margin-left: 15px; 187 | float: left; 188 | } 189 | #cpicker_ok{ 190 | color: #0097FF; 191 | float: right; 192 | margin-right: 15px; 193 | } 194 | #c_body{ 195 | height: 200px; 196 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 100%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 197 | } 198 | #ios_province_wrapper div div,#ios_city_wrapper div div,#ios_area_wrapper div div{ 199 | height:40px ; 200 | line-height: 40px; 201 | overflow: hidden; 202 | } 203 | #ios_province_wrapper,#ios_city_wrapper,#ios_area_wrapper{ 204 | text-align: center; 205 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 0%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 206 | float: left; 207 | width: 33.33%; 208 | font-size: 14px; 209 | } 210 | #c_selecter_top{ 211 | height: 1px; 212 | border-bottom: 1px solid #cccccc; 213 | position: absolute; 214 | z-index: 1; 215 | width: 100%; 216 | bottom: 120px; 217 | } 218 | #c_selecter_fotter{ 219 | height: 1px; 220 | border-bottom: 1px solid #cccccc; 221 | position: absolute; 222 | z-index: 1; 223 | width: 100%; 224 | bottom: 80px; 225 | } 226 | #c_title{ 227 | height: 40px; 228 | line-height: 40px; 229 | } 230 | #c_title div{ 231 | float: left; 232 | width: 33.3%; 233 | text-align: center; 234 | } 235 | 236 | @-webkit-keyframes pickerUp{ 237 | 0%{ 238 | -webkit-transform:translate(0px,285px); 239 | } 240 | 100%{ 241 | -webkit-transform: translate(0px,0px); 242 | } 243 | } 244 | .pickerUp{ 245 | -webkit-animation: pickerUp 0.3s 0s 1 forwards; 246 | } 247 | @-webkit-keyframes pickerDown{ 248 | 0%{ 249 | -webkit-transform:translate(0px,0px); 250 | } 251 | 100%{ 252 | -webkit-transform: translate(0px,285px); 253 | } 254 | } 255 | .pickerDown{ 256 | -webkit-animation: pickerDown 0.3s 0s 1 forwards; 257 | } 258 | -------------------------------------------------------------------------------- /js/map_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-09-01 4 | * 百度地图 坐标、城市、两点距离、地图 5 | */ 6 | define(['zepto.min.js', 'dialog_module.js'], function(require, exports, module) { 7 | var D = require('dialog_module'); 8 | var exports = { 9 | //获取当前坐标 10 | getLocation: function(callback) { 11 | var options = { 12 | enableHighAccuracy: true, 13 | maximumAge: 1000 14 | } 15 | var position = { 16 | 'success': false, 17 | 'longitude': 113.711664, 18 | 'latitude': 22.996389 19 | }; 20 | D.toast(true, '正在定位...'); 21 | if(navigator.geolocation) { 22 | navigator.geolocation.getCurrentPosition(function(position) { 23 | //地理位置获取成功 24 | position['success'] = true; 25 | position['longitude'] = position.coords.longitude; //经度 26 | position['latitude'] = position.coords.latitude; //纬度 27 | callback(position); 28 | }, function(error) { 29 | //地址位置获取失败 30 | switch(error.code) { 31 | case 1: 32 | D.toast(false, "位置服务被拒绝"); 33 | break; 34 | case 2: 35 | D.toast(false, "暂时获取不到位置信息"); 36 | break; 37 | case 3: 38 | D.toast(false, "获取信息超时"); 39 | break; 40 | case 4: 41 | D.toast(false, "未知错误"); 42 | break; 43 | } 44 | callback(position); 45 | }, options); 46 | } else { 47 | D.toast(false, '不支持获取地理位置!'); 48 | callback(position); 49 | } 50 | }, 51 | //通过坐标获取当前地址 52 | getAddressByLocation: function(longitude, latitude, callback) { 53 | D.loadOpt(true); 54 | $.ajax({ 55 | url: 'http://api.map.baidu.com/geocoder/v2/?ak=btsVVWf0TM1zUBEbzFz6QqWF&callback=renderReverse&location=' + latitude + ',' + longitude + '&output=json&pois=1', 56 | type: "get", 57 | dataType: "jsonp", 58 | jsonp: "callback", 59 | success: function(data) { 60 | var address = { 61 | country: data.result.addressComponent.country, //国家 62 | province: data.result.addressComponent.province, //省区 63 | city: data.result.addressComponent.city, //城市 64 | district: data.result.addressComponent.district, //区县 65 | street: data.result.addressComponent.street, //街道 66 | formatted_address: data.result.formatted_address, //完整地址 67 | longitude: longitude, //经度 68 | latitude: latitude //纬度 69 | }; 70 | D.loadOpt(false); 71 | if(typeof callback == "function") { 72 | callback(address); 73 | } 74 | } 75 | }); 76 | }, 77 | //根据坐标获取两点距离 78 | getDistance: function(lat1, lng1, lat2, lng2) { 79 | var radLat1 = lat1 * Math.PI / 180.0; 80 | var radLat2 = lat2 * Math.PI / 180.0; 81 | var a = radLat1 - radLat2; 82 | var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0; 83 | var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); 84 | s = s * 6378137.0 / 1000; //单位km 85 | s = Math.round(s * 10000) / 10000.0; 86 | return s.toFixed(2); 87 | }, 88 | //初始化地图 89 | initMap: function(conf) { 90 | var config = { 91 | container: 'map', 92 | longitude: 113.711664, 93 | latitude: 22.996389, 94 | height: $(window).height(), 95 | callback: null 96 | } 97 | $.extend(config, conf); 98 | var map = new BMap.Map(config.container); 99 | var point = new BMap.Point(config.longitude, config.latitude); //定义一个中心点坐标 100 | map.centerAndZoom(point, 17); 101 | marker = new BMap.Marker(point); 102 | map.addOverlay(marker); 103 | $('#' + config.container).height(config.height); 104 | if(config.callback) { 105 | config.callback(); 106 | } 107 | }, 108 | //GPS转换成百度坐标. 109 | convertorBd:function(longitude,latitude,callback){ 110 | seajs.use(['http://developer.baidu.com/map/jsdemo/demo/convertor.js'],function(){ 111 | BMap.Convertor.translate(new BMap.Point(longitude,latitude),0,callback); 112 | }); 113 | }, 114 | //百度坐标转换成火星坐标 115 | bdConverToGPS:function(longitude,latitude){ 116 | var x_pi = 3.14159265358979324 * 3000.0 / 180.0; 117 | var x = longitude - 0.0065 118 | var y = latitude - 0.006; 119 | var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); 120 | var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); 121 | gg_lon = z * Math.cos(theta); 122 | gg_lat = z * Math.sin(theta); 123 | return {"lng":gg_lon,"lat":gg_lat}; 124 | }, 125 | //打开导航页面 126 | toNavigation: function(conf) { 127 | var config = { 128 | longitude: 113.711664, 129 | latitude: 22.996389, 130 | } 131 | $.extend(config, conf); 132 | var ua = window.navigator.userAgent.toLowerCase(); 133 | if(ua.match(/MicroMessenger/i) == 'micromessenger') { 134 | var point = exports.bdConverToGPS(config.longitude, config.latitude); 135 | $.getJSON('http://pay.52pb.net/wxcore/jssdk?callback=?&appId=wx30c8fd970ac0c480&url=' + location.href, function(json) { 136 | seajs.use(['jweixin-1.0.0.js'], function(wx) { 137 | wx.config({ 138 | debug: false, 139 | appId: json.params.appid, 140 | timestamp: json.params.timestamp, 141 | nonceStr: json.params.nonceStr, 142 | signature: json.params.signature, 143 | jsApiList: ['openLocation'] 144 | }); 145 | wx.openLocation({ 146 | latitude: point.lat, // 纬度 147 | longitude: point.lng, // 经度 148 | name: config.name, // 位置名 149 | address: config.name, // 地址详情说明 150 | scale: 25, // 地图缩放级别,整形值,范围从1~28。默认为最大 151 | infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转 152 | }); 153 | }); 154 | }); 155 | } else { 156 | location.href = 'http://api.map.baidu.com/marker?location=' + config.latitude + ',' + config.longitude + '&title=' + config.name + '&name=' + config.name + '&content=' + config.name + '&output=html&src=weiba|weiweb'; 157 | } 158 | } 159 | }; 160 | module.exports = exports; 161 | }); -------------------------------------------------------------------------------- /demo/js/pull.js: -------------------------------------------------------------------------------- 1 | var pull=(function(){ 2 | U.fillHead('#pull_wrapper'); 3 | var scroll; 4 | initIscroll(); 5 | initPage(); 6 | function initPage() { 7 | $('.content').html(''); 8 | loadDate(); 9 | } 10 | function loadDate(){ 11 | var images=['http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 12 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 13 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 14 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 15 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 16 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 17 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 18 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 19 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 20 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 21 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 22 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 23 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160829172635_19.jpg', 24 | 'http://www.freshtimess.com:8889//uploadfile/product_images/20160824152634_866.png', 25 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 26 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 27 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 28 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 29 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 30 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 31 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 32 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 33 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160823170835_136.jpg', 34 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg', 35 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160830094631_842.jpg', 36 | 'http://www.freshtimess.com:8889//uploadfile/product_other_images/20160729173631_940.jpg'] 37 | W.loadWaterfall({'selector':_('.content'),'images':images,'count':3,'callback':function(){ 38 | scroll.refresh(); 39 | }}); 40 | scroll.refresh(); 41 | } 42 | function initIscroll(){ 43 | $('#pull_wrapper').height($(window).height()-45); 44 | pullDownEl = document.getElementById('pull_pullDown'); 45 | pullDownOffset = pullDownEl.offsetHeight; 46 | pullUpEl = document.getElementById('pull_pullUp'); 47 | pullUpOffset = pullUpEl.offsetHeight; 48 | scroll = new iScroll('pull_wrapper', { 49 | scrollbarClass: 'myScrollbar', 50 | useTransition: false, 51 | topOffset: pullDownOffset, 52 | onRefresh: function() { 53 | if(pullDownEl.className.match('loading')) { 54 | pullDownEl.className = ''; 55 | pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...'; 56 | $(pullDownEl.querySelector('.pullDownIcon')).attr('src','images/icons/pullDown.png'); 57 | } else if(pullUpEl.className.match('loading')) { 58 | pullUpEl.className = ''; 59 | pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...'; 60 | $(pullUpEl.querySelector('.pullUpIcon')).attr('src','images/icons/pullUp.png'); 61 | } 62 | }, 63 | onScrollMove: function() { 64 | if(this.y > 15 && !pullDownEl.className.match('flip')) { 65 | pullDownEl.className = 'flip'; 66 | pullDownEl.querySelector('.pullDownLabel').innerHTML = '松手开始更新...'; 67 | $(pullDownEl.querySelector('.pullDownIcon')).attr('src','images/icons/pullUp.png'); 68 | this.minScrollY = 0; 69 | } else if(this.y < 15 && pullDownEl.className.match('flip')) { 70 | pullDownEl.className = ''; 71 | pullDownEl.querySelector('.pullDownLabel').innerHTML = '下拉刷新...'; 72 | $(pullDownEl.querySelector('.pullDownIcon')).attr('src','images/icons/pullDown.png'); 73 | this.minScrollY = -pullDownOffset; 74 | } else if(this.y < (this.maxScrollY - 15) && !pullUpEl.className.match('flip')) { 75 | pullUpEl.className = 'flip'; 76 | pullUpEl.querySelector('.pullUpLabel').innerHTML = '松手开始更新...'; 77 | $(pullUpEl.querySelector('.pullUpIcon')).attr('src','images/icons/pullDown.png'); 78 | this.maxScrollY = this.maxScrollY; 79 | } else if(this.y > (this.maxScrollY + 15) && pullUpEl.className.match('flip')) { 80 | pullUpEl.className = ''; 81 | pullUpEl.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...'; 82 | $(pullUpEl.querySelector('.pullUpIcon')).attr('src','images/icons/pullUp.png'); 83 | this.maxScrollY = pullUpOffset; 84 | } 85 | }, 86 | onScrollEnd: function() { 87 | if(pullDownEl.className.match('flip')) { 88 | pullDownEl.className = 'loading'; 89 | pullDownEl.querySelector('.pullDownLabel').innerHTML = '加载中...'; 90 | $(pullDownEl.querySelector('.pullDownIcon')).attr('src','images/icons/refresh.gif'); 91 | initPage(); 92 | } else if(pullUpEl.className.match('flip')) { 93 | pullUpEl.className = 'loading'; 94 | pullUpEl.querySelector('.pullUpLabel').innerHTML = '加载中...'; 95 | $(pullUpEl.querySelector('.pullUpIcon')).attr('src','images/icons/refresh.gif'); 96 | loadDate(); 97 | } 98 | I.backTop(scroll,$('#pull_wrapper'),35); 99 | } 100 | }); 101 | } 102 | return {'initPage':function(){ 103 | null; 104 | }} 105 | })() 106 | -------------------------------------------------------------------------------- /js/iscroll_module.js: -------------------------------------------------------------------------------- 1 | /* 2 | * author zk(QQ:77424797) 3 | * date 2016-08-02 4 | * 5 | * 基于Iscroll的滚动模块 6 | */ 7 | 8 | define(['zepto.min.js', 'iscroll.min.js'], function(require, exports, module) { 9 | var imgIntArrat={}; 10 | var exports = { 11 | //初始化滚动控件 12 | initIscroll: function(IDSelector, height) { 13 | $('#' + IDSelector).height($(window).height() - height); 14 | return new iScroll(IDSelector, { 15 | scrollbarClass: 'myScrollbar' 16 | }); 17 | }, 18 | //初始化轮播图 19 | initScrollImg: function(conf) { 20 | var config={ 21 | selector:'scrollImg', //父元素选择器 22 | images:new Array(), //图片数组 23 | speed:2000, //切换时间 24 | direction:'left' 25 | } 26 | $.extend(config, conf); 27 | var scroll = $('
') 28 | var list = $(""); 29 | $('#'+config.selector).append(scroll); 30 | $('#'+config.selector).append(list).css('position', 'relative'); 31 | $(config.images).each(function(i) { 32 | scroll.append(''); 33 | list.append('
  • '); 34 | }); 35 | list.find('li').eq(0).css("background-color", "#5953a1"); 36 | var width = $('body')[0].clientWidth; 37 | scroll.find('img').css("width", width + "px"); 38 | scroll.css('width', config.images.length * width + "px"); 39 | var myScroll = new iScroll(config.selector, { 40 | snap: true, 41 | momentum: false, 42 | vScroll: false, 43 | hScroll: true, 44 | hScrollbar: false, 45 | onScrollEnd: function() { 46 | clearInterval(imgIntArrat[config.selector]); 47 | imgIntArrat[config.selector] = setInterval(a, config.speed); 48 | $('#' + config.selector + ' .indexList li').css("background-color", "white"); 49 | if(config.direction=='right'){ 50 | $('#' + config.selector + ' .indexList li').eq(config.images.length-1-this.currPageX).css("background-color", "#5953a1"); 51 | }else{ 52 | $('#' + config.selector + ' .indexList li').eq(this.currPageX).css("background-color", "#5953a1"); 53 | } 54 | } 55 | }); 56 | if(config.direction=='right'){ 57 | myScroll.scrollToPage(config.images.length - 1,0,0); 58 | } 59 | function a() { 60 | if(config.direction=='left'){ 61 | myScroll.scrollToPage(myScroll.currPageX == config.images.length - 1 ? 0 : myScroll.currPageX + 1); 62 | }else{ 63 | myScroll.scrollToPage(myScroll.currPageX == 0 ? config.images.length - 1 : myScroll.currPageX - 1); 64 | } 65 | } 66 | clearInterval(imgIntArrat[config.selector]); 67 | imgIntArrat[config.selector] = setInterval(a, config.speed); 68 | list.css('margin-left', ($('body')[0].clientWidth - list[0].clientWidth) / 2); 69 | }, 70 | //图片懒加载 71 | lazyload: function(conf) { 72 | var config={ 73 | lazyImages:$('img'), //懒加载的图片 74 | height:$('#wrapper').height(), //高度 75 | scroll:null //滚动控件 76 | } 77 | $.extend(config,conf); 78 | $(config.lazyImages).each(function(i) { 79 | if(this.offsetTop <= (-config.scroll.y) + config.height) { 80 | var imgDom = $(this).removeClass('lazyload'); 81 | var img = new Image(); 82 | img.src = $(this).attr('data-src'); 83 | img.onload = function() { 84 | imgDom.attr('src', img.src).fadeIn(200); 85 | } 86 | config.scroll.refresh(); 87 | } 88 | }); 89 | }, 90 | //图片预览 91 | initPreview:function(conf){ 92 | var config={ 93 | selector:$('img'), 94 | images:null 95 | } 96 | $.extend(config,conf); 97 | config.selector.unbind('click').click(function(event){ 98 | event.stopPropagation(); 99 | var indexImg=$(this).parent().find('img').index($(this)); 100 | var preview_scroll=$('
    ') 101 | var prevoew_index=$('
    1/'+$(this).parent().find('img').length+'
    ') 102 | var preview_page=$('
    '); 103 | $('body').append(preview_page); 104 | preview_page.append(preview_scroll); 105 | preview_page.append(prevoew_index); 106 | var width=$('body').width(); 107 | $(this).parent().find('img').each(function(i){ 108 | preview_scroll.append(''); 109 | preview_scroll.find('img').css({"width":width+"px"}); 110 | preview_scroll.find('img').eq(i).css({'margin-top':(preview_scroll.height()-width)/2+"px"}); 111 | var img=new Image(); 112 | img.src=$(this).attr('src'); 113 | img.onload=function(){ 114 | preview_scroll.find('img').eq(i).css({'margin-top':(preview_scroll.height()-preview_scroll.find('img').eq(i).height())/2+"px"}); 115 | } 116 | }); 117 | preview_scroll.css('width', $(this).parent().find('img').length * width+"px"); 118 | var myScroll = new iScroll("preview_page", { 119 | snap: true, 120 | momentum: false, 121 | vScroll: false, 122 | hScroll: true, 123 | hScrollbar: false, 124 | bounce:false, 125 | onScrollEnd : function() { 126 | $('.prevoew_index span').html(this.currPageX+1); 127 | } 128 | }); 129 | myScroll.scrollToPage(indexImg,0,0); 130 | $('#preview_scroll').unbind('click').click(function(){ 131 | $('#preview_page').remove(""); 132 | }); 133 | }); 134 | }, 135 | //返回顶部 136 | backTop: function(scroll,wrapper,bottom) { 137 | bottom = bottom == null ? 70 : bottom; 138 | if((-scroll.y) > wrapper.height() * 1.2) { 139 | if(wrapper.find('.backTop').length <= 0) { 140 | wrapper.append(''); 141 | wrapper.find('.backTop').fadeIn(200).click(function() { 142 | scroll.scrollTo(0, 0, 500); 143 | }); 144 | } 145 | } else { 146 | wrapper.find('.backTop').remove(); 147 | } 148 | }, 149 | }; 150 | module.exports = exports; 151 | }); -------------------------------------------------------------------------------- /js/sea.js: -------------------------------------------------------------------------------- 1 | /*! Sea.js 2.2.3 | seajs.org/LICENSE.md */ 2 | !function(a,b){function c(a){return function(b){return{}.toString.call(b)=="[object "+a+"]"}}function d(){return B++}function e(a){return a.match(E)[0]}function f(a){for(a=a.replace(F,"/");a.match(G);)a=a.replace(G,"/");return a=a.replace(H,"$1/")}function g(a){var b=a.length-1,c=a.charAt(b);return"#"===c?a.substring(0,b):".js"===a.substring(b-2)||a.indexOf("?")>0||".css"===a.substring(b-3)||"/"===c?a:a+".js"}function h(a){var b=v.alias;return b&&x(b[a])?b[a]:a}function i(a){var b=v.paths,c;return b&&(c=a.match(I))&&x(b[c[1]])&&(a=b[c[1]]+c[2]),a}function j(a){var b=v.vars;return b&&a.indexOf("{")>-1&&(a=a.replace(J,function(a,c){return x(b[c])?b[c]:a})),a}function k(a){var b=v.map,c=a;if(b)for(var d=0,e=b.length;e>d;d++){var f=b[d];if(c=z(f)?f(a)||a:a.replace(f[0],f[1]),c!==a)break}return c}function l(a,b){var c,d=a.charAt(0);if(K.test(a))c=a;else if("."===d)c=f((b?e(b):v.cwd)+a);else if("/"===d){var g=v.cwd.match(L);c=g?g[0]+a.substring(1):a}else c=v.base+a;return 0===c.indexOf("//")&&(c=location.protocol+c),c}function m(a,b){if(!a)return"";a=h(a),a=i(a),a=j(a),a=g(a);var c=l(a,b);return c=k(c)}function n(a){return a.hasAttribute?a.src:a.getAttribute("src",4)}function o(a,b,c,d){var e=T.test(a),f=M.createElement(e?"link":"script");c&&(f.charset=c),A(d)||f.setAttribute("crossorigin",d),p(f,b,e,a),e?(f.rel="stylesheet",f.href=a):(f.async=!0,f.src=a),U=f,S?R.insertBefore(f,S):R.appendChild(f),U=null}function p(a,c,d,e){function f(){a.onload=a.onerror=a.onreadystatechange=null,d||v.debug||R.removeChild(a),a=null,c()}var g="onload"in a;return!d||!W&&g?(g?(a.onload=f,a.onerror=function(){D("error",{uri:e,node:a}),f()}):a.onreadystatechange=function(){/loaded|complete/.test(a.readyState)&&f()},b):(setTimeout(function(){q(a,c)},1),b)}function q(a,b){var c=a.sheet,d;if(W)c&&(d=!0);else if(c)try{c.cssRules&&(d=!0)}catch(e){"NS_ERROR_DOM_SECURITY_ERR"===e.name&&(d=!0)}setTimeout(function(){d?b():q(a,b)},20)}function r(){if(U)return U;if(V&&"interactive"===V.readyState)return V;for(var a=R.getElementsByTagName("script"),b=a.length-1;b>=0;b--){var c=a[b];if("interactive"===c.readyState)return V=c}}function s(a){var b=[];return a.replace(Y,"").replace(X,function(a,c,d){d&&b.push(d)}),b}function t(a,b){this.uri=a,this.dependencies=b||[],this.exports=null,this.status=0,this._waitings={},this._remain=0}if(!a.seajs){var u=a.seajs={version:"2.2.3"},v=u.data={},w=c("Object"),x=c("String"),y=Array.isArray||c("Array"),z=c("Function"),A=c("Undefined"),B=0,C=v.events={};u.on=function(a,b){var c=C[a]||(C[a]=[]);return c.push(b),u},u.off=function(a,b){if(!a&&!b)return C=v.events={},u;var c=C[a];if(c)if(b)for(var d=c.length-1;d>=0;d--)c[d]===b&&c.splice(d,1);else delete C[a];return u};var D=u.emit=function(a,b){var c=C[a],d;if(c)for(c=c.slice();d=c.shift();)d(b);return u},E=/[^?#]*\//,F=/\/\.\//g,G=/\/[^/]+\/\.\.\//,H=/([^:/])\/\//g,I=/^([^/:]+)(\/.+)$/,J=/{([^{]+)}/g,K=/^\/\/.|:\//,L=/^.*?\/\/.*?\//,M=document,N=e(M.URL),O=M.scripts,P=M.getElementById("seajsnode")||O[O.length-1],Q=e(n(P)||N);u.resolve=m;var R=M.head||M.getElementsByTagName("head")[0]||M.documentElement,S=R.getElementsByTagName("base")[0],T=/\.css(?:\?|$)/i,U,V,W=+navigator.userAgent.replace(/.*(?:AppleWebKit|AndroidWebKit)\/(\d+).*/,"$1")<536;u.request=o;var X=/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^\/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,Y=/\\\\/g,Z=u.cache={},$,_={},ab={},bb={},cb=t.STATUS={FETCHING:1,SAVED:2,LOADING:3,LOADED:4,EXECUTING:5,EXECUTED:6};t.prototype.resolve=function(){for(var a=this,b=a.dependencies,c=[],d=0,e=b.length;e>d;d++)c[d]=t.resolve(b[d],a.uri);return c},t.prototype.load=function(){var a=this;if(!(a.status>=cb.LOADING)){a.status=cb.LOADING;var c=a.resolve();D("load",c);for(var d=a._remain=c.length,e,f=0;d>f;f++)e=t.get(c[f]),e.statusf;f++)e=Z[c[f]],e.status=cb.EXECUTING)return c.exports;c.status=cb.EXECUTING;var e=c.uri;a.resolve=function(a){return t.resolve(a,e)},a.async=function(b,c){return t.use(b,c,e+"_async_"+d()),a};var f=c.factory,g=z(f)?f(a,c.exports={},c):f;return g===b&&(g=c.exports),delete c.factory,c.exports=g,c.status=cb.EXECUTED,D("exec",c),g},t.resolve=function(a,b){var c={id:a,refUri:b};return D("resolve",c),c.uri||u.resolve(c.id,b)},t.define=function(a,c,d){var e=arguments.length;1===e?(d=a,a=b):2===e&&(d=c,y(a)?(c=a,a=b):c=b),!y(c)&&z(d)&&(c=s(""+d));var f={id:a,uri:t.resolve(a),deps:c,factory:d};if(!f.uri&&M.attachEvent){var g=r();g&&(f.uri=g.src)}D("define",f),f.uri?t.save(f.uri,f):$=f},t.save=function(a,b){var c=t.get(a);c.statusf;f++)b[f]=Z[d[f]].exec();c&&c.apply(a,b),delete e.callback},e.load()},t.preload=function(a){var b=v.preload,c=b.length;c?t.use(b,function(){b.splice(0,c),t.preload(a)},v.cwd+"_preload_"+d()):a()},u.use=function(a,b){return t.preload(function(){t.use(a,b,v.cwd+"_use_"+d())}),u},t.define.cmd={},a.define=t.define,u.Module=t,v.fetchedList=ab,v.cid=d,u.require=function(a){var b=t.get(t.resolve(a));return b.status0){ 62 | params[this.substring(0,this.indexOf('='))]=this.substring(this.indexOf('=')+1,this.length); 63 | } 64 | }) 65 | return params[name]; 66 | } 67 | function removeUrlParam(url,name) { 68 | var i2 = new RegExp('[\?]' + name + '([=]*)([^&]*)', 'i'); 69 | if (url.match(i2) != null) { 70 | return url.replace(i2, ''); 71 | } 72 | } 73 | function isWeiXin(){ 74 | var ua = window.navigator.userAgent.toLowerCase(); 75 | if(ua.match(/MicroMessenger/i) == 'micromessenger'){ 76 | return true; 77 | }else{ 78 | return false; 79 | } 80 | } 81 | function request(type,url,data,async,callback){ 82 | $.ajax({ 83 | type : type, 84 | url : basepath+'/apiModule/'+url, 85 | //url : 'http://192.168.1.124:8080/apiModule/'+url, 86 | data :data, 87 | async : async, 88 | dataType : "json", 89 | success : function(json) { 90 | if(callback){ 91 | callback(json); 92 | }else{ 93 | console.log('error:'+url); 94 | } 95 | } 96 | }); 97 | } 98 | function ajax(url,data,callback){ 99 | request('post',url,data,true,callback); 100 | } 101 | 102 | function ajaxAsync(url,data,callback){ 103 | request('post',url,data,false,callback); 104 | } 105 | var exports = { 106 | homeurl:homeurl, 107 | basepath:basepath, 108 | imageurl:'http://192.168.1.34:8888/', 109 | getParam:getParam, 110 | writeCookie:function(name, value, time){ 111 | writeCookie(name, value, time); 112 | }, 113 | removeCookie:function(name){ 114 | removeCookie(name); 115 | }, 116 | readCookie:function(name){ 117 | return readCookie(name); 118 | }, 119 | isWeiXin:isWeiXin, 120 | getWxUser:function(){ 121 | getWxUser(); 122 | }, 123 | ajax:function(url,data,callback){ 124 | ajax(url,data,callback); 125 | }, 126 | ajaxAsync:function(url,data,callback){ 127 | ajaxAsync(url,data,callback); 128 | }, 129 | //填充顶部导航 130 | fillHead:function(selector){ 131 | $(selector).append('
    '+ 132 | '
    '+ 133 | ''+ 134 | '
    '+ 135 | '
    '+$('title').html()+'
    '+ 136 | '
    '); 137 | $(selector+' header').css({'color':'white','position':'absolute','top':'0px','z-index':'10','width':'100%','max-width':'640px','height':'45px','line-height':'45px','font-size':'17px','background-color':'#0097FF'}); 138 | $(selector+' .back').uclick(function(){history.go(-1);}); 139 | }, 140 | //填充底部菜单 141 | fillFooter:function(selector){ 142 | var footer = $(''); 143 | footer.css({'z-index':'10','position':'absolute','color':'white','bottom':'-50px','width':'100%','height':'50px','background-color':'#0097FF','font-size': '12px','max-width':'640px','font-family':'Microsoft YaHei'}); 144 | var menus = [{'log':'menuIcon.png','txt':'菜单'}, 145 | {'log':'menuIcon.png','txt':'菜单'}, 146 | {'log':'menuIcon.png','txt':'菜单'}, 147 | {'log':'menuIcon.png','txt':'菜单'}, 148 | {'log':'menuIcon.png','txt':'菜单'}, 149 | ]; 150 | for(var i=0;i
    '+menus[i].txt+'
    '); 152 | } 153 | $(selector).append(footer); 154 | footer.find('.ci_item').click(function(){ 155 | var selMenu = $(selector+' footer').find('.selMenu'); 156 | if(selMenu!=null&&selMenu.length>0){ 157 | selMenu.css('color','#969696'); 158 | } 159 | $(this).css('color','#17A1FE'); 160 | var index = $(this).index(); 161 | if(index==0){ 162 | }if(index==1){ 163 | }if(index==2){ 164 | }if(index==3){ 165 | }if(index==4){ 166 | } 167 | }); 168 | }, 169 | dragElement:function(dom){//拖动元素 170 |    var element =dom[0] ; 171 |    var oW,oH; 172 |    element.addEventListener("touchstart", function(e) { 173 | console.info(1) 174 |    var touches = e.touches[0]; 175 |     oW = touches.clientX - element.offsetLeft; 176 |     oH = touches.clientY - element.offsetTop; 177 |     document.addEventListener("touchmove",defaultEvent,false);//阻止页面的滑动默认事件 178 |    },false); 179 |    element.addEventListener("touchmove", function(e) { 180 |     var touches = e.touches[0]; 181 |     var oLeft = touches.clientX - oW; 182 |     var oTop = touches.clientY - oH; 183 |     if(oLeft < 0) { 184 |      oLeft = 0; 185 |     }else if(oLeft > document.documentElement.clientWidth - element.offsetWidth) { 186 |      oLeft = (document.documentElement.clientWidth - element.offsetWidth); 187 |     } 188 |     element.style.left = oLeft + "px"; 189 |     element.style.top = oTop + "px"; 190 |   },false); 191 |    element.addEventListener("touchend",function() { 192 |     document.removeEventListener("touchmove",defaultEvent,false); 193 |    },false); 194 |    function defaultEvent(e) { 195 |     e.preventDefault(); 196 |    } 197 | } 198 | }; 199 | module.exports = exports; 200 | }); -------------------------------------------------------------------------------- /css/dialog.css: -------------------------------------------------------------------------------- 1 | /*----弹窗样式库----*/ 2 | #message_mask { 3 | position: fixed; 4 | width: 100%; 5 | height: 100%; 6 | left: 0px; 7 | top: 0px; 8 | z-index: 20; 9 | background: white; 10 | opacity: 0; 11 | } 12 | 13 | .messge-box{ 14 | width: 180px; 15 | height: 110px; 16 | position: fixed; 17 | top: 0; 18 | z-index: 19; 19 | margin: 0px auto; 20 | font-size: 14px; 21 | color: white; 22 | text-align: center; 23 | } 24 | .message-mark{ 25 | width: 100%; 26 | height: 100%; 27 | z-index: -1; 28 | position: absolute; 29 | background: black; 30 | opacity: 0.8; 31 | border-radius: 7px; 32 | } 33 | .messge-box-icon{ 34 | width: 40px; 35 | height: 40px; 36 | display: inline-block; 37 | margin: 20px auto 10px auto; 38 | position: relative; 39 | overflow: hidden; 40 | } 41 | 42 | .info-icon { 43 | background-position: 0px 0px!important; 44 | } 45 | .succee-icon { 46 | background-position: 0px -40px!important; 47 | } 48 | 49 | 50 | .message-toast-icon { 51 | background: url(../images/icons/toast-icon.png) no-repeat; 52 | background-size: 100%; 53 | display: inline-block; 54 | height: 40px; 55 | width: 40px; 56 | } 57 | 58 | 59 | 60 | #confirm-box{ 61 | position: fixed; 62 | height: 100%; 63 | width: 100%; 64 | top: 0px; 65 | z-index: 20; 66 | max-width: 640px; 67 | } 68 | #confirm-box .confirm-mask{ 69 | position: fixed; 70 | z-index: 5; 71 | width: 100%; 72 | background: black; 73 | height: 100%; 74 | opacity: 0.5; 75 | max-width: 640px; 76 | } 77 | #confirm-box .confirm{ 78 | position: fixed; 79 | z-index: 6; 80 | width: 100%; 81 | height: 140px; 82 | max-width: 640px; 83 | bottom: 0px; 84 | } 85 | #confirm-box .cancle{ 86 | height: 40px; 87 | background: white; 88 | width: 94%; 89 | margin-left: 3%; 90 | border-radius: 8px; 91 | color: #057BFF; 92 | font-size: 16px; 93 | text-align: center; 94 | line-height: 40px; 95 | } 96 | #confirm-box .ok{ 97 | height: 40px; 98 | background: white; 99 | width: 94%; 100 | margin-left: 3%; 101 | border-radius: 0px 0px 8px 8px; 102 | color: red; 103 | font-size: 16px; 104 | text-align: center; 105 | line-height: 40px; 106 | margin-bottom: 10px; 107 | } 108 | #confirm-box .confirm-txt{ 109 | height: 40px; 110 | background: white; 111 | width: 94%; 112 | margin-left: 3%; 113 | border-radius: 8px 8px 0px 0px; 114 | color: #9C9C9C; 115 | font-size: 15px; 116 | text-align: center; 117 | line-height: 40px; 118 | border-bottom: 1px solid #EAEAEC; 119 | } 120 | @-webkit-keyframes confirmUp{ 121 | 0%{ 122 | -webkit-transform:translate(0px,170px); 123 | } 124 | 100%{ 125 | -webkit-transform: translate(0px,0px); 126 | } 127 | } 128 | .confirmUp{ 129 | -webkit-animation: confirmUp 0.3s 0s 1 forwards; 130 | } 131 | @-webkit-keyframes confirmDown{ 132 | 0%{ 133 | -webkit-transform:translate(0px,0px); 134 | } 135 | 100%{ 136 | -webkit-transform: translate(0px,170px); 137 | } 138 | } 139 | .confirmDown{ 140 | -webkit-animation: confirmDown 0.3s 0s 1 forwards; 141 | } 142 | 143 | 144 | 145 | 146 | 147 | 148 | #select_mask{ 149 | width: 100%; 150 | max-width: 640px; 151 | position: fixed; 152 | top: 0px; 153 | height: 100%; 154 | background: black; 155 | z-index: 11; 156 | opacity: 0.5; 157 | } 158 | #select_picker{ 159 | width: 100%; 160 | height: 245px; 161 | background: white; 162 | position: fixed; 163 | bottom: 0px; 164 | max-width: 640px; 165 | z-index: 12; 166 | } 167 | #select_header{ 168 | height: 45px; 169 | line-height: 45px; 170 | } 171 | #select_cancle{ 172 | color: #0097FF; 173 | margin-left: 15px; 174 | float: left; 175 | } 176 | #select_ok{ 177 | color: #0097FF; 178 | float: right; 179 | margin-right: 15px; 180 | } 181 | #select_body{ 182 | height: 200px; 183 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 100%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 184 | } 185 | #select_wrapper .m_select{ 186 | height:40px ; 187 | line-height: 40px; 188 | } 189 | #select_wrapper{ 190 | text-align: center; 191 | -webkit-mask: -webkit-gradient(linear,0% 30%,0% 0%,from(rgba(222,187,71,1)),to(rgba(36,142,36,0))); 192 | } 193 | #select_top{ 194 | height: 1px; 195 | border-bottom: 1px solid #cccccc; 196 | position: absolute; 197 | z-index: 1; 198 | width: 100%; 199 | bottom: 120px; 200 | } 201 | #select_fotter{ 202 | height: 1px; 203 | border-bottom: 1px solid #cccccc; 204 | position: absolute; 205 | z-index: 1; 206 | width: 100%; 207 | bottom: 80px; 208 | } 209 | 210 | @-webkit-keyframes selectUp{ 211 | 0%{ 212 | -webkit-transform:translate(0px,285px); 213 | } 214 | 100%{ 215 | -webkit-transform: translate(0px,0px); 216 | } 217 | } 218 | .selectUp{ 219 | -webkit-animation: selectUp 0.3s 0s 1 forwards; 220 | } 221 | @-webkit-keyframes selectDown{ 222 | 0%{ 223 | -webkit-transform:translate(0px,0px); 224 | } 225 | 100%{ 226 | -webkit-transform: translate(0px,285px); 227 | } 228 | } 229 | .selectDown{ 230 | -webkit-animation: selectDown 0.3s 0s 1 forwards; 231 | } 232 | 233 | 234 | .pullDown{ 235 | text-align: center; 236 | position: relative; 237 | height: 60px; 238 | line-height: 60px; 239 | } 240 | .pullDownIcon{ 241 | width: 25px; 242 | position: absolute; 243 | top: 17px; 244 | } 245 | .pullDownLabel{ 246 | font-size: 14px; 247 | margin-left: 30px; 248 | color: #828282; 249 | } 250 | .pullUp{ 251 | text-align: center; 252 | position: relative; 253 | height: 40px; 254 | line-height: 40px; 255 | } 256 | .pullUpIcon{ 257 | width: 25px; 258 | position: absolute; 259 | top: 8px; 260 | } 261 | .pullUpLabel{ 262 | font-size: 14px; 263 | margin-left: 30px; 264 | color: #828282; 265 | } 266 | 267 | .current_page{ 268 | z-index: 1; 269 | } 270 | 271 | 272 | @-webkit-keyframes bounceIn { 273 | 0% { 274 | opacity: 0; 275 | -webkit-transform: scale(.5); 276 | transform: scale(.5) 277 | } 278 | 100% { 279 | opacity: 1; 280 | -webkit-transform: scale(1); 281 | transform: scale(1) 282 | } 283 | } 284 | .bounceIn{ 285 | -webkit-animation:bounceIn 0.1s 0s 1 forwards; 286 | } 287 | 288 | 289 | #alert_mask{ 290 | background: black; 291 | opacity: 0.8; 292 | position: fixed; 293 | z-index: 10; 294 | width: 100%; 295 | max-width: 640px; 296 | top: 0px; 297 | height: 100%; 298 | } 299 | #alert_box{ 300 | background: white; 301 | position: fixed; 302 | width: 80%; 303 | left: 10%; 304 | z-index: 11; 305 | top: 10px; 306 | font-size: 14px; 307 | text-align: center; 308 | border-radius: 5px; 309 | } 310 | #alert_title{ 311 | color: #333; 312 | height: 40px; 313 | line-height: 40px; 314 | } 315 | #alert_txt{ 316 | color: #888; 317 | padding: 10px 0px; 318 | } 319 | #alert_ok{ 320 | color: #0BB20C; 321 | height: 42px; 322 | line-height: 42px; 323 | border-top: 1px solid #E6E6E6; 324 | } 325 | #alert_confirm,#alert_cancle{ 326 | float: right; 327 | height: 42px; 328 | line-height: 42px; 329 | border-top: 1px solid #E6E6E6; 330 | color: #0BB20C; 331 | } 332 | #alert_cancle{ 333 | color: #333; 334 | border-right: 1px solid #E6E6E6; 335 | } 336 | #alert_box input{ 337 | width: 80%; 338 | border: 1px solid #eeeeee; 339 | height: 30px; 340 | text-indent: 10px; 341 | } 342 | 343 | 344 | -------------------------------------------------------------------------------- /js/datepicker_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-08-17 4 | * 5 | * 时间选择器 6 | * params 参数 7 | * selector 选择器 8 | * format 日期格式 9 | * minYear 最小年份 10 | * maxYear 最大年份 11 | * initial 初始化时间 12 | * ------------------------------- 13 | * css文件 datepicker.css 14 | */ 15 | define(['zepto.min.js','iscroll.min.js'],function(require, exports, module){ 16 | function datePicker(params){ 17 | var config={ 18 | selector:'#datepicker', 19 | format:'yyyy-MM-dd HH:mm', 20 | minYear:new Date().getFullYear(), 21 | maxYear:new Date().getFullYear()+100, 22 | initial:(new Date().getFullYear()+'-'+(new Date().getMonth()+1)+'-'+new Date().getDate()+" "+new Date().getHours()+":"+new Date().getMinutes()+":"+new Date().getSeconds()), 23 | selectYear:new Date().getFullYear(), 24 | selectMonth:new Date().getMonth()+1 25 | }; 26 | $.extend(config, params); 27 | config.selector.uclick(function(){ 28 | $('#dpicker_mask,#dpicker').remove(); 29 | $('body').append('
    取消
    确定
    '); 30 | var year_scroll,month_scroll,day_scroll,hour_scroll,minute_scroll,max,showCount=0; 31 | if(config.format.indexOf('yyyy')>-1){ 32 | $('#d_title').append('
    '); 33 | $('#d_body').append('
    '); 34 | $('#d_body').append('
    '); 35 | $('#year_wrapper,#month_wrapper').height(280); 36 | for(var i=config.minYear;i<=config.maxYear;i++){$('
    '+i+'
    ').insertBefore('.end_year');} 37 | for(var i=1;i<=12;i++){$('
    '+(i<10?'0'+i:i)+'
    ').insertBefore('.end_month');} 38 | year_scroll=new iScroll('year_wrapper',{scrollbarClass: 'myScrollbar',bounce:false,snap: 'div', 39 | onScrollEnd: function () { 40 | config.selectYear=$('.d_year').eq(-this.y/40+2).html(); 41 | if(config.selectYear !=null && config.selectYear!=""){ 42 | loadDay(); 43 | } 44 | } 45 | }); 46 | month_scroll=new iScroll('month_wrapper',{scrollbarClass: 'myScrollbar',bounce:false,snap: 'div', 47 | onScrollEnd: function () { 48 | config.selectMonth=$('.d_month').eq(-this.y/40+2).html(); 49 | if(config.selectMonth !=null && config.selectMonth!=""){ 50 | loadDay(); 51 | } 52 | } 53 | }); 54 | loadDay(); 55 | showCount+=3; 56 | } 57 | function loadDay(){ 58 | max = new Date(config.selectYear,config.selectMonth,0).getDate(); 59 | if($('#day_wrapper').length>0){ 60 | var diff=max-($('.d_day').length-6); 61 | if(diff<0){ 62 | for(var i=diff;i<0;i++){$('.end_day').prev().remove();} 63 | }else{ 64 | for(var i=diff;i>0;i--){$('
    '+(parseInt($('.end_day').prev().html())+1)+'
    ').insertBefore('.end_day');} 65 | } 66 | day_scroll.refresh(); 67 | }else{ 68 | $('
    ').insertAfter('#month_wrapper'); 69 | for(var i=1;i<=max;i++){$('
    '+(i<10?'0'+i:i)+'
    ').insertBefore('.end_day');} 70 | $('#day_wrapper').height(280); 71 | day_scroll=new iScroll('day_wrapper',{ scrollbarClass: 'myScrollbar','bounce':false,snap: 'div'}); 72 | } 73 | } 74 | if(config.format.indexOf('HH')>-1){ 75 | $('#d_title').append('
    '); 76 | $('#d_body').append('
    '); 77 | $('#d_body').append('
    '); 78 | for(var i=0;i<=23;i++){$('
    '+(i<10?'0'+i:i)+'
    ').insertBefore('.end_hour');} 79 | for(var i=0;i<=59;i++){$('
    '+(i<10?'0'+i:i)+'
    ').insertBefore('.end_minute');} 80 | $('#hour_wrapper,#minute_wrapper').height(280); 81 | hour_scroll=new iScroll('hour_wrapper',{ scrollbarClass: 'myScrollbar','bounce':false,snap: 'div'}); 82 | minute_scroll=new iScroll('minute_wrapper',{ scrollbarClass: 'myScrollbar','bounce':false,snap: 'div'}); 83 | showCount+=2; 84 | } 85 | $('#year_wrapper,#month_wrapper,#day_wrapper,#hour_wrapper,#minute_wrapper,#d_title div').css({'width':(100/showCount)+"%"}); 86 | var nowTime=config.selector.html()==""&&config.selector.html()!=null?config.initial:config.selector.html(); 87 | var formatReg=/^[0-9]{4}-[0][1-9]|[10-12]{1}-[0][1-9]|[10-31]$/; 88 | if(nowTime!=null && nowTime!="" && formatReg.test(nowTime)){ 89 | if(config.format.indexOf('yyyy')>-1){ 90 | var year=nowTime.substring(0,nowTime.indexOf('-')); 91 | year_scroll.scrollTo(0,-(year-$('.d_year').eq(2).html())*40,0); 92 | var month=nowTime.substring(nowTime.indexOf('-')+1,nowTime.lastIndexOf('-')); 93 | month_scroll.scrollTo(0,-(month-$('.d_month').eq(2).html())*40,0); 94 | var day=nowTime.substring(nowTime.lastIndexOf('-')+1,nowTime.lastIndexOf('-')+3); 95 | day_scroll.scrollTo(0,-(day-$('.d_day').eq(2).html())*40,0); 96 | } 97 | if(config.format.indexOf('HH')>-1){ 98 | var hour=nowTime.substring(nowTime.indexOf(':')-2,nowTime.indexOf(':')); 99 | hour_scroll.scrollTo(0,-(hour-$('.d_hour').eq(2).html())*40,0); 100 | var minute=nowTime.substring(nowTime.indexOf(':')+1,nowTime.lastIndexOf(':')); 101 | minute_scroll.scrollTo(0,-(minute-$('.d_minute').eq(2).html())*40,0); 102 | } 103 | } 104 | $('#dpicker_ok').click(function(){ 105 | var time; 106 | if(config.format.indexOf('yyyy')>-1 && config.format.indexOf('HH')>-1){ 107 | var year=$('.d_year').eq(-year_scroll.y/40+2).html(); 108 | var month=$('.d_month').eq(-month_scroll.y/40+2).html(); 109 | var day=$('.d_day').eq(-day_scroll.y/40+2).html(); 110 | var hour=$('.d_hour').eq(-hour_scroll.y/40+2).html(); 111 | var minute=$('.d_minute').eq(-minute_scroll.y/40+2).html(); 112 | time=year+'-'+month+'-'+day+' '+hour+':'+minute+':00'; 113 | }else if(config.format.indexOf('yyyy')>-1){ 114 | var year=$('.d_year').eq(-year_scroll.y/40+2).html(); 115 | var month=$('.d_month').eq(-month_scroll.y/40+2).html(); 116 | var day=$('.d_day').eq(-day_scroll.y/40+2).html(); 117 | time=year+'-'+month+'-'+day; 118 | }else if(config.format.indexOf('HH')>-1){ 119 | var hour=$('.d_hour').eq(-hour_scroll.y/40+2).html(); 120 | var minute=$('.d_minute').eq(-minute_scroll.y/40+2).html(); 121 | time=hour+':'+minute+':00'; 122 | } 123 | config.selector.html(time); 124 | $('#dpicker_cancle').click(); 125 | }); 126 | $('#dpicker_cancle,#dpicker_mask').click(function(){ 127 | $('#dpicker_mask').hide(); 128 | $('#dpicker').removeClass('pickerUp').addClass('pickerDown'); 129 | }); 130 | }); 131 | 132 | } 133 | var exports = { 134 | datePicker:function(params){//初始化日期选择控件 135 | datePicker(params); 136 | } 137 | }; 138 | module.exports = exports; 139 | }); -------------------------------------------------------------------------------- /js/jweixin-1.0.0.js: -------------------------------------------------------------------------------- 1 | !function(a,b){"function"==typeof define&&(define.amd||define.cmd)?define(function(){return b(a)}):b(a,!0)}(this,function(a,b){function c(b,c,d){a.WeixinJSBridge?WeixinJSBridge.invoke(b,e(c),function(a){g(b,a,d)}):j(b,d)}function d(b,c,d){a.WeixinJSBridge?WeixinJSBridge.on(b,function(a){d&&d.trigger&&d.trigger(a),g(b,a,c)}):d?j(b,d):j(b,c)}function e(a){return a=a||{},a.appId=E.appId,a.verifyAppId=E.appId,a.verifySignType="sha1",a.verifyTimestamp=E.timestamp+"",a.verifyNonceStr=E.nonceStr,a.verifySignature=E.signature,a}function f(a){return{timeStamp:a.timestamp+"",nonceStr:a.nonceStr,"package":a.package,paySign:a.paySign,signType:a.signType||"SHA1"}}function g(a,b,c){var d,e,f;switch(delete b.err_code,delete b.err_desc,delete b.err_detail,d=b.errMsg,d||(d=b.err_msg,delete b.err_msg,d=h(a,d),b.errMsg=d),c=c||{},c._complete&&(c._complete(b),delete c._complete),d=b.errMsg||"",E.debug&&!c.isInnerInvoke&&alert(JSON.stringify(b)),e=d.indexOf(":"),f=d.substring(e+1)){case"ok":c.success&&c.success(b);break;case"cancel":c.cancel&&c.cancel(b);break;default:c.fail&&c.fail(b)}c.complete&&c.complete(b)}function h(a,b){var e,f,c=a,d=p[c];return d&&(c=d),e="ok",b&&(f=b.indexOf(":"),e=b.substring(f+1),"confirm"==e&&(e="ok"),"failed"==e&&(e="fail"),-1!=e.indexOf("failed_")&&(e=e.substring(7)),-1!=e.indexOf("fail_")&&(e=e.substring(5)),e=e.replace(/_/g," "),e=e.toLowerCase(),("access denied"==e||"no permission to execute"==e)&&(e="permission denied"),"config"==c&&"function not exist"==e&&(e="ok"),""==e&&(e="fail")),b=c+":"+e}function i(a){var b,c,d,e;if(a){for(b=0,c=a.length;c>b;++b)d=a[b],e=o[d],e&&(a[b]=e);return a}}function j(a,b){if(!(!E.debug||b&&b.isInnerInvoke)){var c=p[a];c&&(a=c),b&&b._complete&&delete b._complete,console.log('"'+a+'",',b||"")}}function k(){0!=D.preVerifyState&&(u||v||E.debug||"6.0.2">z||D.systemType<0||A||(A=!0,D.appId=E.appId,D.initTime=C.initEndTime-C.initStartTime,D.preVerifyTime=C.preVerifyEndTime-C.preVerifyStartTime,H.getNetworkType({isInnerInvoke:!0,success:function(a){var b,c;D.networkType=a.networkType,b="http://open.weixin.qq.com/sdk/report?v="+D.version+"&o="+D.preVerifyState+"&s="+D.systemType+"&c="+D.clientVersion+"&a="+D.appId+"&n="+D.networkType+"&i="+D.initTime+"&p="+D.preVerifyTime+"&u="+D.url,c=new Image,c.src=b}})))}function l(){return(new Date).getTime()}function m(b){w&&(a.WeixinJSBridge?b():q.addEventListener&&q.addEventListener("WeixinJSBridgeReady",b,!1))}function n(){H.invoke||(H.invoke=function(b,c,d){a.WeixinJSBridge&&WeixinJSBridge.invoke(b,e(c),d)},H.on=function(b,c){a.WeixinJSBridge&&WeixinJSBridge.on(b,c)})}var o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H;if(!a.jWeixin)return o={config:"preVerifyJSAPI",onMenuShareTimeline:"menu:share:timeline",onMenuShareAppMessage:"menu:share:appmessage",onMenuShareQQ:"menu:share:qq",onMenuShareWeibo:"menu:share:weiboApp",onMenuShareQZone:"menu:share:QZone",previewImage:"imagePreview",getLocation:"geoLocation",openProductSpecificView:"openProductViewWithPid",addCard:"batchAddCard",openCard:"batchViewCard",chooseWXPay:"getBrandWCPayRequest"},p=function(){var b,a={};for(b in o)a[o[b]]=b;return a}(),q=a.document,r=q.title,s=navigator.userAgent.toLowerCase(),t=navigator.platform.toLowerCase(),u=!(!t.match("mac")&&!t.match("win")),v=-1!=s.indexOf("wxdebugger"),w=-1!=s.indexOf("micromessenger"),x=-1!=s.indexOf("android"),y=-1!=s.indexOf("iphone")||-1!=s.indexOf("ipad"),z=function(){var a=s.match(/micromessenger\/(\d+\.\d+\.\d+)/)||s.match(/micromessenger\/(\d+\.\d+)/);return a?a[1]:""}(),A=!1,B=!1,C={initStartTime:l(),initEndTime:0,preVerifyStartTime:0,preVerifyEndTime:0},D={version:1,appId:"",initTime:0,preVerifyTime:0,networkType:"",preVerifyState:1,systemType:y?1:x?2:-1,clientVersion:z,url:encodeURIComponent(location.href)},E={},F={_completes:[]},G={state:0,data:{}},m(function(){C.initEndTime=l()}),H={config:function(a){E=a,j("config",a);var b=E.check===!1?!1:!0;m(function(){var a,d,e;if(b)c(o.config,{verifyJsApiList:i(E.jsApiList)},function(){F._complete=function(a){C.preVerifyEndTime=l(),G.state=1,G.data=a},F.success=function(){D.preVerifyState=0},F.fail=function(a){F._fail?F._fail(a):G.state=-1};var a=F._completes;return a.push(function(){k()}),F.complete=function(){for(var c=0,d=a.length;d>c;++c)a[c]();F._completes=[]},F}()),C.preVerifyStartTime=l();else{for(G.state=1,a=F._completes,d=0,e=a.length;e>d;++d)a[d]();F._completes=[]}}),E.beta&&n()},ready:function(a){0!=G.state?a():(F._completes.push(a),!w&&E.debug&&a())},error:function(a){"6.0.2">z||B||(B=!0,-1==G.state?a(G.data):F._fail=a)},checkJsApi:function(a){var b=function(a){var c,d,b=a.checkResult;for(c in b)d=p[c],d&&(b[d]=b[c],delete b[c]);return a};c("checkJsApi",{jsApiList:i(a.jsApiList)},function(){return a._complete=function(a){if(x){var c=a.checkResult;c&&(a.checkResult=JSON.parse(c))}a=b(a)},a}())},onMenuShareTimeline:function(a){d(o.onMenuShareTimeline,{complete:function(){c("shareTimeline",{title:a.title||r,desc:a.title||r,img_url:a.imgUrl||"",link:a.link||location.href,type:a.type||"link",data_url:a.dataUrl||""},a)}},a)},onMenuShareAppMessage:function(a){d(o.onMenuShareAppMessage,{complete:function(){c("sendAppMessage",{title:a.title||r,desc:a.desc||"",link:a.link||location.href,img_url:a.imgUrl||"",type:a.type||"link",data_url:a.dataUrl||""},a)}},a)},onMenuShareQQ:function(a){d(o.onMenuShareQQ,{complete:function(){c("shareQQ",{title:a.title||r,desc:a.desc||"",img_url:a.imgUrl||"",link:a.link||location.href},a)}},a)},onMenuShareWeibo:function(a){d(o.onMenuShareWeibo,{complete:function(){c("shareWeiboApp",{title:a.title||r,desc:a.desc||"",img_url:a.imgUrl||"",link:a.link||location.href},a)}},a)},onMenuShareQZone:function(a){d(o.onMenuShareQZone,{complete:function(){c("shareQZone",{title:a.title||r,desc:a.desc||"",img_url:a.imgUrl||"",link:a.link||location.href},a)}},a)},startRecord:function(a){c("startRecord",{},a)},stopRecord:function(a){c("stopRecord",{},a)},onVoiceRecordEnd:function(a){d("onVoiceRecordEnd",a)},playVoice:function(a){c("playVoice",{localId:a.localId},a)},pauseVoice:function(a){c("pauseVoice",{localId:a.localId},a)},stopVoice:function(a){c("stopVoice",{localId:a.localId},a)},onVoicePlayEnd:function(a){d("onVoicePlayEnd",a)},uploadVoice:function(a){c("uploadVoice",{localId:a.localId,isShowProgressTips:0==a.isShowProgressTips?0:1},a)},downloadVoice:function(a){c("downloadVoice",{serverId:a.serverId,isShowProgressTips:0==a.isShowProgressTips?0:1},a)},translateVoice:function(a){c("translateVoice",{localId:a.localId,isShowProgressTips:0==a.isShowProgressTips?0:1},a)},chooseImage:function(a){c("chooseImage",{scene:"1|2",count:a.count||9,sizeType:a.sizeType||["original","compressed"],sourceType:a.sourceType||["album","camera"]},function(){return a._complete=function(a){if(x){var b=a.localIds;b&&(a.localIds=JSON.parse(b))}},a}())},previewImage:function(a){c(o.previewImage,{current:a.current,urls:a.urls},a)},uploadImage:function(a){c("uploadImage",{localId:a.localId,isShowProgressTips:0==a.isShowProgressTips?0:1},a)},downloadImage:function(a){c("downloadImage",{serverId:a.serverId,isShowProgressTips:0==a.isShowProgressTips?0:1},a)},getNetworkType:function(a){var b=function(a){var c,d,e,b=a.errMsg;if(a.errMsg="getNetworkType:ok",c=a.subtype,delete a.subtype,c)a.networkType=c;else switch(d=b.indexOf(":"),e=b.substring(d+1)){case"wifi":case"edge":case"wwan":a.networkType=e;break;default:a.errMsg="getNetworkType:fail"}return a};c("getNetworkType",{},function(){return a._complete=function(a){a=b(a)},a}())},openLocation:function(a){c("openLocation",{latitude:a.latitude,longitude:a.longitude,name:a.name||"",address:a.address||"",scale:a.scale||28,infoUrl:a.infoUrl||""},a)},getLocation:function(a){a=a||{},c(o.getLocation,{type:a.type||"wgs84"},function(){return a._complete=function(a){delete a.type},a}())},hideOptionMenu:function(a){c("hideOptionMenu",{},a)},showOptionMenu:function(a){c("showOptionMenu",{},a)},closeWindow:function(a){a=a||{},c("closeWindow",{},a)},hideMenuItems:function(a){c("hideMenuItems",{menuList:a.menuList},a)},showMenuItems:function(a){c("showMenuItems",{menuList:a.menuList},a)},hideAllNonBaseMenuItem:function(a){c("hideAllNonBaseMenuItem",{},a)},showAllNonBaseMenuItem:function(a){c("showAllNonBaseMenuItem",{},a)},scanQRCode:function(a){a=a||{},c("scanQRCode",{needResult:a.needResult||0,scanType:a.scanType||["qrCode","barCode"]},function(){return a._complete=function(a){var b,c;y&&(b=a.resultStr,b&&(c=JSON.parse(b),a.resultStr=c&&c.scan_code&&c.scan_code.scan_result))},a}())},openProductSpecificView:function(a){c(o.openProductSpecificView,{pid:a.productId,view_type:a.viewType||0,ext_info:a.extInfo},a)},addCard:function(a){var e,f,g,h,b=a.cardList,d=[];for(e=0,f=b.length;f>e;++e)g=b[e],h={card_id:g.cardId,card_ext:g.cardExt},d.push(h);c(o.addCard,{card_list:d},function(){return a._complete=function(a){var c,d,e,b=a.card_list;if(b){for(b=JSON.parse(b),c=0,d=b.length;d>c;++c)e=b[c],e.cardId=e.card_id,e.cardExt=e.card_ext,e.isSuccess=e.is_succ?!0:!1,delete e.card_id,delete e.card_ext,delete e.is_succ;a.cardList=b,delete a.card_list}},a}())},chooseCard:function(a){c("chooseCard",{app_id:E.appId,location_id:a.shopId||"",sign_type:a.signType||"SHA1",card_id:a.cardId||"",card_type:a.cardType||"",card_sign:a.cardSign,time_stamp:a.timestamp+"",nonce_str:a.nonceStr},function(){return a._complete=function(a){a.cardList=a.choose_card_info,delete a.choose_card_info},a}())},openCard:function(a){var e,f,g,h,b=a.cardList,d=[];for(e=0,f=b.length;f>e;++e)g=b[e],h={card_id:g.cardId,code:g.code},d.push(h);c(o.openCard,{card_list:d},a)},chooseWXPay:function(a){c(o.chooseWXPay,f(a),a)}},b&&(a.wx=a.jWeixin=H),H}); -------------------------------------------------------------------------------- /css/loading.css: -------------------------------------------------------------------------------- 1 | 2 | /*-----loading加载样式库-----*/ 3 | 4 | .loadOpt-mask { 5 | height: 100%; 6 | width: 100%; 7 | position: fixed; 8 | z-index: 13; 9 | } 10 | 11 | .loadPage-mask { 12 | height: 100%; 13 | width: 100%; 14 | position: fixed; 15 | z-index: 14; 16 | background: white; 17 | } 18 | 19 | .loadOpt, 20 | .loadPage { 21 | position: fixed; 22 | z-index: 14; 23 | height: 100px; 24 | width: 100px; 25 | text-align: center; 26 | } 27 | .loadPage{ 28 | z-index: 15; 29 | } 30 | 31 | /*----------loading1-----------*/ 32 | 33 | .loading-mask-1 { 34 | position: absolute; 35 | background: black; 36 | z-index: -1; 37 | padding: 50px; 38 | opacity: 0.5; 39 | border-radius: 5px; 40 | } 41 | 42 | @-webkit-keyframes load-1 { 43 | 0%, 44 | 100% { 45 | height: 40px; 46 | } 47 | 50% { 48 | height: 60px; 49 | margin-top: -20px; 50 | } 51 | } 52 | 53 | .loading-1 { 54 | margin-top: 40px; 55 | } 56 | 57 | .loading-1 span { 58 | display: inline-block; 59 | width: 8px; 60 | height: 100%; 61 | border-radius: 4px; 62 | background: white; 63 | -webkit-animation: load-1 1.04s ease infinite; 64 | margin-right: 5px; 65 | } 66 | 67 | .loading-1 span:nth-child(2) { 68 | -webkit-animation-delay: 0.13s; 69 | } 70 | 71 | .loading-1 span:nth-child(3) { 72 | -webkit-animation-delay: 0.26s; 73 | } 74 | 75 | .loading-1 span:nth-child(4) { 76 | -webkit-animation-delay: 0.39s; 77 | } 78 | 79 | .loading-1 span:nth-child(5) { 80 | -webkit-animation-delay: 0.52s; 81 | margin-right: 0px; 82 | } 83 | 84 | 85 | /*----------loading2-----------*/ 86 | 87 | .loading-mask-2 { 88 | position: absolute; 89 | background: black; 90 | z-index: -1; 91 | padding: 50px; 92 | opacity: 0.5; 93 | border-radius: 5px; 94 | } 95 | 96 | .loading-2 { 97 | margin-top: 30px; 98 | } 99 | 100 | .loading-2 span { 101 | display: inline-block; 102 | width: 8px; 103 | height: 100%; 104 | background: white; 105 | border-radius: 4px; 106 | -webkit-animation: load-2 1s ease infinite; 107 | margin-right: 5px; 108 | } 109 | 110 | @-webkit-keyframes load-2 { 111 | 0%, 112 | 100% { 113 | height: 40px; 114 | } 115 | 50% { 116 | height: 70px; 117 | margin-top: -15px; 118 | margin-bottom: -15px; 119 | } 120 | } 121 | 122 | .loading-2 span:nth-child(2) { 123 | -webkit-animation-delay: 0.2s; 124 | } 125 | 126 | .loading-2 span:nth-child(3) { 127 | -webkit-animation-delay: 0.4s; 128 | } 129 | 130 | .loading-2 span:nth-child(4) { 131 | -webkit-animation-delay: 0.6s; 132 | } 133 | 134 | .loading-2 span:nth-child(5) { 135 | -webkit-animation-delay: 0.8s; 136 | margin-right: 0px; 137 | } 138 | 139 | 140 | /*----------loading3-----------*/ 141 | 142 | .loading-3 { 143 | margin-top: 30px; 144 | } 145 | 146 | .loading-mask-3 { 147 | position: absolute; 148 | background: black; 149 | z-index: -1; 150 | padding: 50px; 151 | opacity: 0.8; 152 | border-radius: 5px; 153 | } 154 | 155 | .loading-3 { 156 | position: absolute; 157 | margin: auto; 158 | top: 0; 159 | bottom: 0; 160 | left: 0; 161 | right: 0; 162 | width: 6.250em; 163 | height: 6.250em; 164 | -webkit-animation: loading-3-rotate 2.4s linear infinite; 165 | } 166 | 167 | .loading-3 .white { 168 | top: 0; 169 | bottom: 0; 170 | left: 0; 171 | right: 0; 172 | background: white; 173 | opacity: 0; 174 | -webkit-animation: flash 2.4s linear infinite; 175 | } 176 | 177 | .loading-3 div { 178 | position: absolute; 179 | margin: auto; 180 | width: 2.4em; 181 | height: 2.4em; 182 | border-radius: 100%; 183 | -webkit-transition: all 1s ease; 184 | } 185 | 186 | .loading-3 div:nth-child(2) { 187 | top: 0; 188 | bottom: 0; 189 | left: 0; 190 | background: #FF4444; 191 | -webkit-animation: dotsY 2.4s linear infinite; 192 | } 193 | 194 | .loading-3 div:nth-child(3) { 195 | left: 0; 196 | right: 0; 197 | top: 0; 198 | background: #FFBB33; 199 | -webkit-animation: dotsX 2.4s linear infinite; 200 | } 201 | 202 | .loading-3 div:nth-child(4) { 203 | top: 0; 204 | bottom: 0; 205 | right: 0; 206 | background: #99CC00; 207 | -webkit-animation: dotsY 2.4s linear infinite; 208 | } 209 | 210 | .loading-3 div:nth-child(5) { 211 | left: 0; 212 | right: 0; 213 | bottom: 0; 214 | background: #33B5E5; 215 | -webkit-animation: dotsX 2.4s linear infinite; 216 | -moz-animation: dotsX 2.4s linear infinite; 217 | -o-animation: dotsX 2.4s linear infinite; 218 | animation: dotsX 2.4s linear infinite; 219 | } 220 | 221 | @-webkit-keyframes loading-3-rotate { 222 | 0% { 223 | -webkit-transform: rotate( 0); 224 | } 225 | 10% { 226 | width: 6.250em; 227 | height: 6.250em; 228 | } 229 | 66% { 230 | width: 2.4em; 231 | height: 2.4em; 232 | } 233 | 100% { 234 | -webkit-transform: rotate(360deg); 235 | width: 6.250em; 236 | height: 6.250em; 237 | } 238 | } 239 | 240 | @-webkit-keyframes dotsY { 241 | 66% { 242 | opacity: .1; 243 | width: 2.4em; 244 | } 245 | 77% { 246 | opacity: 1; 247 | width: 0; 248 | } 249 | } 250 | 251 | @-webkit-keyframes dotsX { 252 | 66% { 253 | opacity: .1; 254 | height: 2.4em; 255 | } 256 | 77% { 257 | opacity: 1; 258 | height: 0; 259 | } 260 | } 261 | 262 | @-webkit-keyframes flash { 263 | 33% { 264 | opacity: 0; 265 | border-radius: 0%; 266 | } 267 | 55% { 268 | opacity: .6; 269 | border-radius: 100%; 270 | } 271 | 66% { 272 | opacity: 0; 273 | } 274 | } 275 | 276 | 277 | /*----------loading4-----------*/ 278 | 279 | @-webkit-keyframes loading-4 { 280 | 0% { 281 | -webkit-transform: scale(0); 282 | opacity: 0; 283 | } 284 | 5% { 285 | opacity: 1; 286 | } 287 | 100% { 288 | -webkit-transform: scale(1); 289 | opacity: 0; 290 | } 291 | } 292 | 293 | .loading-4 { 294 | position: relative; 295 | -webkit-transform: translateY(-30px); 296 | } 297 | 298 | .loading-4> div:nth-child(2) { 299 | -webkit-animation-delay: 0.2s; 300 | } 301 | 302 | .loading-4> div:nth-child(3) { 303 | -webkit-animation-delay: 0.4s; 304 | } 305 | 306 | .loading-4> div { 307 | background-color: #fff; 308 | border-radius: 100%; 309 | margin: 2px; 310 | -webkit-animation-fill-mode: both; 311 | position: absolute; 312 | left: 20px; 313 | top: 50px; 314 | opacity: 0; 315 | margin: 0; 316 | width: 60px; 317 | height: 60px; 318 | -webkit-animation: loading-4 1s 0s linear infinite; 319 | } 320 | 321 | 322 | /*----------loading5-----------*/ 323 | 324 | @-webkit-keyframes loading-5 { 325 | 50% { 326 | opacity: 0.3; 327 | -webkit-transform: scale(0.4); 328 | transform: scale(0.4); 329 | } 330 | 100% { 331 | opacity: 1; 332 | -webkit-transform: scale(1); 333 | transform: scale(1); 334 | } 335 | } 336 | 337 | .loading-5 { 338 | position: relative; 339 | margin-left: 40px; 340 | margin-top: 40px; 341 | } 342 | 343 | .loading-5> div:nth-child(1) { 344 | top: 25px; 345 | left: 0; 346 | -webkit-animation: loading-5 1s 0s infinite linear; 347 | } 348 | 349 | .loading-5> div:nth-child(2) { 350 | top: 17.04545px; 351 | left: 17.04545px; 352 | -webkit-animation: loading-5 1s 0.12s infinite linear; 353 | } 354 | 355 | .loading-5> div:nth-child(3) { 356 | top: 0; 357 | left: 25px; 358 | -webkit-animation: loading-5 1s 0.24s infinite linear; 359 | } 360 | 361 | .loading-5> div:nth-child(4) { 362 | top: -17.04545px; 363 | left: 17.04545px; 364 | -webkit-animation: loading-5 1s 0.36s infinite linear; 365 | } 366 | 367 | .loading-5> div:nth-child(5) { 368 | top: -25px; 369 | left: 0; 370 | -webkit-animation: loading-5 1s 0.48s infinite linear; 371 | } 372 | 373 | .loading-5> div:nth-child(6) { 374 | top: -17.04545px; 375 | left: -17.04545px; 376 | -webkit-animation: loading-5 1s 0.6s infinite linear; 377 | } 378 | 379 | .loading-5> div:nth-child(7) { 380 | top: 0; 381 | left: -25px; 382 | -webkit-animation: loading-5 1s 0.72s infinite linear; 383 | } 384 | 385 | .loading-5> div:nth-child(8) { 386 | top: 17.04545px; 387 | left: -17.04545px; 388 | -webkit-animation: loading-5 1s 0.84s infinite linear; 389 | } 390 | 391 | .loading-5> div { 392 | background-color: #fff; 393 | width: 15px; 394 | height: 15px; 395 | border-radius: 100%; 396 | margin: 2px; 397 | -webkit-animation-fill-mode: both; 398 | position: absolute; 399 | } 400 | 401 | 402 | /*----------loading6-----------*/ 403 | 404 | @-webkit-keyframes rotate_pacman_half_down { 405 | 0% { 406 | -webkit-transform: rotate(90deg); 407 | } 408 | 50% { 409 | -webkit-transform: rotate(0deg); 410 | } 411 | 100% { 412 | -webkit-transform: rotate(90deg); 413 | } 414 | } 415 | 416 | @-webkit-keyframes rotate_pacman_half_up { 417 | 0% { 418 | -webkit-transform: rotate(270deg); 419 | } 420 | 50% { 421 | -webkit-transform: rotate(360deg); 422 | } 423 | 100% { 424 | -webkit-transform: rotate(270deg); 425 | } 426 | } 427 | 428 | @-webkit-keyframes pacman-balls { 429 | 75% { 430 | opacity: 0.7; 431 | } 432 | 100% { 433 | -webkit-transform: translate(-80px, -6.25px); 434 | } 435 | } 436 | 437 | .loading-6 { 438 | position: relative; 439 | margin-top: 30px; 440 | margin-left: 5px; 441 | } 442 | 443 | .loading-6> div:nth-child(2) { 444 | -webkit-animation: pacman-balls 1s 0s infinite linear; 445 | } 446 | 447 | .loading-6> div:nth-child(3) { 448 | -webkit-animation: pacman-balls 1s 0.33s infinite linear; 449 | } 450 | 451 | .loading-6> div:nth-child(4) { 452 | -webkit-animation: pacman-balls 1s 0.66s infinite linear; 453 | } 454 | 455 | .loading-6> div:nth-child(5) { 456 | -webkit-animation: pacman-balls 1s 0.99s infinite linear; 457 | } 458 | 459 | .loading-6> div:first-of-type { 460 | width: 0px; 461 | height: 0px; 462 | border-right: 20px solid transparent; 463 | border-top: 20px solid #fff; 464 | border-left: 20px solid #fff; 465 | border-bottom: 20px solid #fff; 466 | border-radius: 20px; 467 | -webkit-animation: rotate_pacman_half_up 0.5s 0s infinite; 468 | } 469 | 470 | .loading-6> div:nth-child(2) { 471 | width: 0px; 472 | height: 0px; 473 | border-right: 20px solid transparent; 474 | border-top: 20px solid #fff; 475 | border-left: 20px solid #fff; 476 | border-bottom: 20px solid #fff; 477 | border-radius: 20px; 478 | -webkit-animation: rotate_pacman_half_down 0.5s 0s infinite; 479 | margin-top: -40px; 480 | } 481 | 482 | .loading-6> div:nth-child(3), 483 | .loading-6> div:nth-child(4), 484 | .loading-6> div:nth-child(5), 485 | .loading-6> div:nth-child(6) { 486 | background-color: #fff; 487 | width: 15px; 488 | height: 15px; 489 | border-radius: 100%; 490 | margin: 2px; 491 | width: 10px; 492 | height: 10px; 493 | position: absolute; 494 | -webkit-transform: translate(0, -6.25px); 495 | top: 20px; 496 | left: 80px; 497 | z-index: -1; 498 | } 499 | 500 | 501 | /*-------loading7---------*/ 502 | 503 | .loading-7 { 504 | margin-top: 44px; 505 | position: relative; 506 | } 507 | 508 | .loading-7 div { 509 | width: 15px; 510 | height: 15px; 511 | background-color: #FFF; 512 | -moz-border-radius: 50% 50% 50% 50%; 513 | -webkit-border-radius: 50% 50% 50% 50%; 514 | border-radius: 50% 50% 50% 50%; 515 | position: absolute; 516 | } 517 | 518 | .loading-7 div:nth-child(1) { 519 | -webkit-animation: loading-7-move 2s linear infinite; 520 | } 521 | 522 | .loading-7 div:nth-child(2) { 523 | -webkit-animation: loading-7-move 2s linear infinite -.4s; 524 | } 525 | 526 | .loading-7 div:nth-child(3) { 527 | -webkit-animation: loading-7-move 2s linear infinite -.8s; 528 | } 529 | 530 | .loading-7 div:nth-child(4) { 531 | -webkit-animation: loading-7-move 2s linear infinite -1.2s; 532 | } 533 | 534 | .loading-7 div:nth-child(5) { 535 | -webkit-animation: loading-7-move 2s linear infinite -1.6s; 536 | } 537 | 538 | @-webkit-keyframes loading-7-move { 539 | 0% { 540 | left: 85px; 541 | top: 0 542 | } 543 | 80% { 544 | left: 0; 545 | top: 0; 546 | } 547 | 85% { 548 | left: 0; 549 | top: -15px; 550 | width: 15px; 551 | height: 15px; 552 | } 553 | 90% { 554 | width: 30px; 555 | height: 15px; 556 | } 557 | 95% { 558 | left: 85px; 559 | top: -15px; 560 | width: 15px; 561 | height: 15px; 562 | } 563 | 100% { 564 | left: 85px; 565 | top: 0; 566 | } 567 | } 568 | -------------------------------------------------------------------------------- /js/dialog_module.js: -------------------------------------------------------------------------------- 1 | /* 2 | * author zk(QQ:77424797) 3 | * date 2016-08-02 4 | * 5 | * 弹窗模块 6 | */ 7 | 8 | define(['zepto.min.js'], function(require, exports, module) { 9 | var toastTimeOut; 10 | var loadPage; 11 | var loadPageBgColor; 12 | var loadOpt; 13 | var exports = { 14 | initLoadOpt:function(loading){//初始化加载 15 | switch(loading){ 16 | case 1: 17 | loadOpt='
    '; 18 | break; 19 | case 2: 20 | loadOpt='
    '; 21 | break; 22 | case 3: 23 | loadOpt='
    ' 24 | break; 25 | case 4: 26 | loadOpt='
    '; 27 | break; 28 | case 5: 29 | loadOpt='
    ' 30 | break; 31 | case 6: 32 | loadOpt='
    '; 33 | break; 34 | case 7: 35 | loadOpt='
    ' 36 | } 37 | }, 38 | initLoadPage:function(loading,bg){//初始化加载 39 | loadPageBgColor=bg==null?'black':bg; 40 | switch(loading){ 41 | case 1: 42 | loadPage='
    '; 43 | break; 44 | case 2: 45 | loadPage='
    '; 46 | break; 47 | case 3: 48 | loadPage='
    ' 49 | break; 50 | case 4: 51 | loadPage='
    '; 52 | break; 53 | case 5: 54 | loadPage='
    ' 55 | break; 56 | case 6: 57 | loadPage='
    '; 58 | break; 59 | case 7: 60 | loadPage='
    '; 61 | break; 62 | case 8: 63 | loadPage='Loading…'; 64 | } 65 | }, 66 | //显示/隐藏操作加载框 67 | loadOpt: function(open) { 68 | if(open) { 69 | $('body').append('
    '+loadOpt+'
    '); 70 | $('.loadOpt').css({'top':($(window).height()-$('.loadOpt').height())/2,'left':($(window).width()-$('.loadOpt').width())/2}); 71 | } else { 72 | $('.loadOpt,.loadOpt-mask').remove(); 73 | } 74 | }, 75 | //显示/隐藏页面加载框 76 | loadPage: function(open) { 77 | if(open) { 78 | $('body').append('
    '+loadPage+'
    '); 79 | $('.loadPage').css({'top':($(window).height()-$('.loadPage').height())/2,'left':($(window).width()-$('.loadPage').width())/2}); 80 | $('.loadPage .loading-1 span,.loadPage .loading-2 span,.loadPage .loading-4 div,.loadPage .loading-5 div,.loadPage .loading-7 div').css('background',loadPageBgColor); 81 | $('.loadPage .loading-6 div').eq(2).css('background',loadPageBgColor); 82 | $('.loadPage .loading-6 div').eq(3).css('background',loadPageBgColor); 83 | $('.loadPage .loading-6 div').eq(4).css('background',loadPageBgColor); 84 | $('.loadPage .loading-6 div').eq(0).css('border-color',loadPageBgColor).css('border-right-color','transparent'); 85 | $('.loadPage .loading-6 div').eq(1).css('border-color',loadPageBgColor).css('border-right-color','transparent'); 86 | } else { 87 | $('.loadPage,.loadPage-mask').remove(); 88 | } 89 | }, 90 | //提示框 91 | tip: function(conf) { 92 | var config = { 93 | title: '提示', 94 | txt: '错误提示', 95 | ok: '我知道了', 96 | callback: null 97 | }; 98 | $.extend(config, conf); 99 | $('body').append('
    ' + 100 | '
    ' + 101 | '
    ' + config.title + '
    ' + 102 | '
    ' + config.txt + '
    ' + 103 | '
    ' + config.ok + '
    ' + 104 | '
    '); 105 | $('#alert_box').css('top', ($(window).height() - $('#alert_box').height()) / 2 + 'px').addClass('bounceIn'); 106 | $('#alert_ok').click(function() { 107 | $('#alert_mask,#alert_box').remove(); 108 | if(config.callback) { 109 | config.callback(); 110 | } 111 | }); 112 | }, 113 | //确认提示框 114 | confirm: function(conf) { 115 | var config = { 116 | title: '提示标题', 117 | txt: '提示内容', 118 | ok: null, 119 | cancle: null 120 | }; 121 | $.extend(config, conf); 122 | $('body').append('
    ' + 123 | '
    ' + 124 | '
    ' + config.title + '
    ' + 125 | '
    ' + config.txt + '
    ' + 126 | '
    确定
    ' + 127 | '
    取消
    ' + 128 | '
    '); 129 | $('#alert_confirm,#alert_cancle').width(($('#alert_box').width() - 1) / 2); 130 | $('#alert_box').css('top', ($(window).height() - $('#alert_box').height()) / 2 + 'px').addClass('bounceIn'); 131 | $('#alert_confirm').click(function() { 132 | $('#alert_mask,#alert_box').remove(); 133 | if(config.ok) { 134 | config.ok(); 135 | } 136 | }); 137 | $('#alert_cancle').click(function() { 138 | $('#alert_mask,#alert_box').remove(); 139 | if(config.cancle) { 140 | config.cancle(); 141 | } 142 | }); 143 | }, 144 | //带输入的提示框 145 | confirmInput: function(conf) { 146 | var config = { 147 | title: '提示标题', 148 | txt: '提示内容', 149 | ok: null, 150 | cancle: null 151 | }; 152 | $.extend(config, conf); 153 | $('body').append('
    ' + 154 | '
    ' + 155 | '
    ' + config.title + '
    ' + 156 | '
    ' + 157 | '
    确定
    ' + 158 | '
    取消
    ' + 159 | '
    '); 160 | $('#alert_confirm,#alert_cancle').width(($('#alert_box').width() - 1) / 2); 161 | $('#alert_box').css('top', ($(window).height() - $('#alert_box').height()) / 2 + 'px').addClass('bounceIn'); 162 | $('#alert_confirm').click(function() { 163 | if(config.ok) { 164 | config.ok($('#alert_txt input').val()); 165 | } 166 | $('#alert_mask,#alert_box').remove(); 167 | }); 168 | $('#alert_cancle').click(function() { 169 | if(config.cancle) { 170 | config.cancle($('#alert_txt input').val()); 171 | } 172 | $('#alert_mask,#alert_box').remove(); 173 | }); 174 | }, 175 | //确定or取消提示框(底部) 176 | okCancle: function(params) { 177 | var config = { 178 | txt: '确定/取消?', 179 | okTxt: '确定', 180 | cancleTxt: '取消', 181 | ok: null, 182 | cancle: null 183 | }; 184 | $.extend(config, params); 185 | $('body').append('
    ' + 186 | '
    ' + 187 | '
    ' + 188 | '
    ' + config.txt + '
    ' + 189 | '
    ' + config.okTxt + '
    ' + 190 | '
    ' + config.cancleTxt + '
    ' + 191 | '
    ' + 192 | '
    '); 193 | $('#confirm-box .ok').click(function() { 194 | $('.confirm').removeClass('confirmUp').addClass('confirmDown'); 195 | $('.confirm-mask').remove() 196 | setTimeout(function() { 197 | $('#confirm-box').remove(); 198 | }, 300); 199 | if(config.ok) { 200 | config.ok(); 201 | } 202 | }); 203 | $('#confirm-box .cancle,#confirm-box .confirm-mask').click(function() { 204 | $('.confirm').removeClass('confirmUp').addClass('confirmDown'); 205 | $('.confirm-mask').remove() 206 | setTimeout(function() { 207 | $('#confirm-box').remove(); 208 | }, 300); 209 | if(config.cancle) { 210 | config.cancle(); 211 | } 212 | }); 213 | }, 214 | //淡入淡出定时小时提示框 215 | toast: function(flag, msg, callback) { 216 | $('.messge-box').remove(); 217 | $('#message_mask').remove(); 218 | clearTimeout(toastTimeOut); 219 | $('body').prepend('
    '); 220 | $('.messge-box').css('left', ($(window).width() - 180) / 2 + 'px'); 221 | $('.messge-box').css('top', ($(window).height() - 110) / 2 + 'px'); 222 | $('.messge-box-content').html(msg.toString()); 223 | $('.message-toast-icon').addClass(flag ? 'succee-icon' : 'info-icon'); 224 | toastTimeOut = setTimeout(function() { 225 | $('.messge-box').removeClass('bounceIn').fadeOut(function() { 226 | $('.messge-box').remove(); 227 | $('#message_mask').remove(); 228 | }); 229 | if(callback) { 230 | callback(); 231 | } 232 | }, 1500); 233 | $('#message_mask').click(function() { 234 | clearTimeout(toastTimeOut); 235 | $('.messge-box').removeClass('bounceIn').fadeOut(function() { 236 | $('.messge-box').remove(); 237 | $('#message_mask').remove(); 238 | }); 239 | if(callback) { 240 | callback(); 241 | } 242 | }); 243 | }, 244 | //仿ios选择控件 245 | initSelect: function(params) { 246 | var config = { 247 | selector: $('#select'),//选择器 248 | selectArray: new Array(),//选择列表 249 | callback: null //回调函数 250 | }; 251 | $.extend(config, params); 252 | config.selector.click(function(event) { 253 | event.stopPropagation(); 254 | $('#select_mask,#select_picker').remove(); 255 | $('body').append('
    取消
    确定
    '); 256 | $('#select_body').append('
    '); 257 | $('#select_wrapper').height(240); 258 | $(config.selectArray).each(function() { 259 | $('
    ' + this + '
    ').insertBefore('.end_select'); 260 | }); 261 | var select_scroll = new iScroll('select_wrapper', { 262 | scrollbarClass: 'myScrollbar', 263 | bounce: false, 264 | snap: 'div' 265 | }); 266 | var index = config.selector.html() == "" || config.selector.html() == null ? 0 : config.selectArray.indexOf(config.selector.html()); 267 | select_scroll.scrollTo(0, -index * 40, 0); 268 | $('#select_ok').click(function() { 269 | index = -select_scroll.y / 40; 270 | if(config.callback) { 271 | config.callback(config.selectArray[index]); 272 | } 273 | $('#select_cancle').click(); 274 | }); 275 | $('#select_cancle,#select_mask').click(function() { 276 | $('#select_mask').hide(); 277 | $('#select_picker').removeClass('selectUp').addClass('selectDown'); 278 | }); 279 | }); 280 | } 281 | }; 282 | 283 | module.exports = exports; 284 | }); -------------------------------------------------------------------------------- /js/citypicker_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * author zk(QQ:77424797) 3 | * date 2016-08-17 4 | * 省、市、区联动 5 | * 6 | * layout 样式 7 | * headBg 头部背景颜色 8 | * headColor 头部文字颜色 9 | * headTxt 头部文字 10 | * borderColor 请选择底部边框颜色 11 | * backImg 返回按钮图片地址 12 | * checkClass 选中的样式名称 13 | * checkImg 选中的图片 14 | * selectArea 是否需要查询区域 15 | * callback 回调函数(provinceId:省编号,provinceName:省名称,cityId:市编号,cityName:市名称,areaId:区域编号,areaName:区域名称) 16 | * ------------------------------- 17 | * css文件 citypicker.css 18 | * 19 | */ 20 | define(['zepto.min.js', 'iscroll.min.js', 'iscroll_module.js', 'dialog_module.js', 'util_module.js'], function(require, exports, module) { 21 | var U = require('util_module'); 22 | var D = require('dialog_module'); 23 | var province_scroll; 24 | var city_scroll; 25 | var area_scroll; 26 | var provinceJson; 27 | var cityJson; 28 | var areaJson; 29 | var config; 30 | var page_in = "cp_left_in cp_right_in"; 31 | var page_out = "cp_left_out cp_right_out"; 32 | function loadDate(callback) { 33 | D.loadOpt(true); 34 | $.getJSON('resource/wine_province.json', function(json) { 35 | provinceJson = json; 36 | $.getJSON('resource/wine_city.json', function(json) { 37 | cityJson = json; 38 | $.getJSON('resource/wine_area.json', function(json) { 39 | areaJson = json; 40 | D.loadOpt(false); 41 | callback(); 42 | }); 43 | }); 44 | }); 45 | } 46 | 47 | function initPicker() { 48 | if(config.layout == 1) { 49 | if($('#city_picker div').length > 0) { 50 | if($('#address_menu div').eq(2).html() != null) { 51 | $('#area_page').removeClass(page_in).removeClass(page_out).show(); 52 | } else if($('#address_menu div').eq(1).html() != null) { 53 | $('#city_page').removeClass(page_in).removeClass(page_out).show(); 54 | } else if($('#address_menu div').eq(0).html() != null) { 55 | $('#province_page').removeClass(page_in).removeClass(page_out).show(); 56 | } 57 | province_scroll.refresh(); 58 | city_scroll.refresh(); 59 | area_scroll.refresh(); 60 | $('#city_picker').removeClass(page_out).addClass('cp_right_in'); 61 | return; 62 | } 63 | $('body').append('
    '); 64 | $('#city_picker').append('
    ' + config.headTxt + '
    '); 65 | $('#city_picker').append('
    请选择
    ') 66 | $('#city_picker').append('
    '); 67 | $('#city_picker').append('
    '); 68 | $('#city_picker').append('
    '); 69 | $('#province_wrapper,#city_wrapper,#area_wrapper').height($(window).height() - 92); 70 | province_scroll = new iScroll('province_wrapper', { 71 | scrollbarClass: 'myScrollbar' 72 | }); 73 | city_scroll = new iScroll('city_wrapper', { 74 | scrollbarClass: 'myScrollbar' 75 | }); 76 | area_scroll = new iScroll('area_wrapper', { 77 | scrollbarClass: 'myScrollbar' 78 | }); 79 | $('#cp_head').click(function() { 80 | $('#province_page,#city_page,#area_page').hide(); 81 | $('#city_picker').removeClass(page_in).addClass('cp_right_out'); 82 | }); 83 | if($('#province_list div').length <= 0) { 84 | $(provinceJson.RECORDS).each(function() { 85 | $('#province_list').append('
    ' + this.province_name + '
    ') 86 | }); 87 | province_scroll.refresh(); 88 | $('#province_list div').unbind('click').click(function() { 89 | var provinceName = $(this).html(); 90 | var provinceId = $(this).attr('provinceId'); 91 | $('#province_list div').removeClass(config.checkClass).find('img').remove(); 92 | $(this).addClass(config.checkClass).append(''); 93 | $('#city_list').html(""); 94 | $(cityJson.RECORDS).each(function() { 95 | if(this.province_id == provinceId) { 96 | $('#city_list').append('
    ' + this.city_name + '
    ') 97 | } 98 | city_scroll.refresh(); 99 | }); 100 | city_scroll.refresh(); 101 | $('#address_menu div').eq(0).html(provinceName).attr('provinceId', provinceId).find('img').remove(); 102 | $('#address_menu').append('
    请选择
    '); 103 | $('#province_page').removeClass(page_in).addClass('cp_left_out'); 104 | $('#city_page').show().removeClass(page_out).addClass('cp_right_in'); 105 | $('#province').unbind('click').click(function() { 106 | $('#city_page,#area_page').removeClass(page_in).addClass('cp_right_out'); 107 | $('#province_page').show().removeClass(page_out).addClass('cp_left_in'); 108 | $('#city,#area').remove(); 109 | province_scroll.refresh(); 110 | $('#province').append(''); 111 | }); 112 | $('#city_list div').unbind('click').click(function() { 113 | var cityName = $(this).html(); 114 | var cityId = $(this).attr('cityId'); 115 | if(config.selectArea) { 116 | $('#city_list div').removeClass(config.checkClass).find('img').remove(); 117 | $(this).addClass(config.checkClass).append(''); 118 | $('#area_list').html(''); 119 | $(areaJson.RECORDS).each(function() { 120 | if(this.city_id == cityId) { 121 | $('#area_list').append('
    ' + this.area_name + '
    '); 122 | area_scroll.refresh(); 123 | } 124 | }); 125 | area_scroll.refresh(); 126 | $('#address_menu div').eq(1).html(cityName).attr('cityId', cityId).find('img').remove(); 127 | $('#address_menu').append('
    请选择
    '); 128 | $('#city_page').removeClass(page_in).addClass('cp_left_out'); 129 | $('#area_page').show().removeClass(page_out).addClass('cp_right_in'); 130 | $('#city').unbind('click').click(function() { 131 | $('#area_page').removeClass(page_in).addClass('cp_right_out'); 132 | $('#city_page').show().removeClass(page_out).addClass('cp_left_in'); 133 | $('#area').remove(); 134 | $('#city').append(''); 135 | city_scroll.refresh(); 136 | }); 137 | $('#area_list div').unbind('click').click(function() { 138 | var areaName = $(this).html(); 139 | var areaId = $(this).attr('areaId'); 140 | $('#area_list div').removeClass(config.checkClass).find('img').remove(); 141 | $(this).addClass(config.checkClass).append(''); 142 | $('#address_menu div').eq(2).html(areaName).attr('areaId', areaId).append('').find('img').remove(); 143 | $('#cp_head').click(); 144 | if(config.callback) { 145 | config.callback({ 146 | provinceId: $('#address_menu div').eq(0).attr('provinceId'), 147 | provinceName: $('#address_menu div').eq(0).html(), 148 | cityId: $('#address_menu div').eq(1).attr('cityId'), 149 | cityName: $('#address_menu div').eq(1).html(), 150 | areaId: areaId, 151 | areaName: areaName 152 | }); 153 | } 154 | }); 155 | } else { 156 | $('#cp_head').click(); 157 | $('#city_list div').removeClass(config.checkClass).find('img').remove(); 158 | $(this).addClass(config.checkClass).append(''); 159 | $('#address_menu div').eq(1).html(cityName).attr('cityId', cityId).find('img').remove(); 160 | $('#city').append(''); 161 | if(config.callback) { 162 | config.callback({ 163 | provinceId: $('#address_menu div').eq(0).attr('provinceId'), 164 | provinceName: $('#address_menu div').eq(0).html(), 165 | cityId: $('#address_menu div').eq(1).attr('cityId'), 166 | cityName: $('#address_menu div').eq(1).html(), 167 | }); 168 | } 169 | } 170 | }); 171 | }); 172 | } 173 | } else { 174 | if($('#ios_cpicker .city').length > 0) { 175 | $('#ios_cpicker_mask').show().css('opacity', '0.5'); 176 | $('#ios_cpicker').removeClass('pickerDown').addClass('pickerUp'); 177 | return; 178 | } 179 | $('#ios_cpicker_mask,#ios_cpicker').remove(); 180 | $('body').append('
    取消
    确定
    '); 181 | $('#c_body').append('
    '); 182 | $('#c_body').append('
    '); 183 | $('#c_body').append('
    '); 184 | $('#ios_province_wrapper,#ios_city_wrapper,#ios_area_wrapper').height(280); 185 | province_scroll = new iScroll('ios_province_wrapper', { 186 | scrollbarClass: 'myScrollbar', 187 | bounce: false, 188 | snap: 'div', 189 | onScrollEnd: function() { 190 | $('.city,.area').remove(); 191 | loadCity($('.province').eq(-province_scroll.y / 40).attr('provinceId')); 192 | } 193 | }); 194 | city_scroll = new iScroll('ios_city_wrapper', { 195 | scrollbarClass: 'myScrollbar', 196 | bounce: false, 197 | snap: 'div', 198 | onScrollEnd: function() { 199 | $('.area').remove(); 200 | loadArea($('.city').eq(-city_scroll.y / 40).attr('cityId')); 201 | } 202 | }); 203 | area_scroll = new iScroll('ios_area_wrapper', { 204 | scrollbarClass: 'myScrollbar', 205 | bounce: false, 206 | snap: 'div' 207 | }); 208 | $(provinceJson.RECORDS).each(function() { 209 | $('
    ' + this.province_name + '
    ').insertBefore('.end_province'); 210 | }); 211 | loadCity($('.province').eq(0).attr('provinceId')); 212 | province_scroll.refresh(); 213 | 214 | function loadCity(provinceId) { 215 | $(cityJson.RECORDS).each(function() { 216 | if(this.province_id == provinceId) { 217 | $('
    ' + this.city_name + '
    ').insertBefore('.end_city'); 218 | } 219 | }); 220 | loadArea($('.city').eq(0).attr('cityId')); 221 | $('#ios_city_wrapper').fadeIn(100); 222 | city_scroll.refresh(); 223 | } 224 | 225 | function loadArea(cityId) { 226 | $(areaJson.RECORDS).each(function() { 227 | if(this.city_id == cityId) { 228 | $('
    ' + this.area_name + '
    ').insertBefore('.end_area'); 229 | } 230 | }); 231 | $('#ios_area_wrapper').fadeIn(100); 232 | area_scroll.refresh(); 233 | area_scroll.scrollTo(0, 0, 0); 234 | } 235 | $('#cpicker_ok').click(function() { 236 | if(config.callback) { 237 | config.callback({ 238 | provinceId: $('.province').eq(-province_scroll.y / 40).attr('provinceId'), 239 | provinceName: $('.province').eq(-province_scroll.y / 40).html(), 240 | cityId: $('.city').eq(-city_scroll.y / 40).attr('cityId'), 241 | cityName: $('.city').eq(-city_scroll.y / 40).html(), 242 | areaId: $('.area').eq(-area_scroll.y / 40).attr('areaId'), 243 | areaName: $('.area').eq(-area_scroll.y / 40).html() 244 | }); 245 | } 246 | $('#cpicker_cancle').click(); 247 | }); 248 | $('#cpicker_cancle,#ios_cpicker_mask').click(function() { 249 | $('#ios_cpicker_mask').hide(); 250 | $('#ios_cpicker').removeClass('pickerUp').addClass('pickerDown'); 251 | }); 252 | } 253 | } 254 | 255 | function cityPicker(params) { 256 | config = { 257 | selector: $('#citypicker'), 258 | layout: 1, 259 | headBg: '#0097FF', 260 | headColor: 'white', 261 | headTxt: '地址选择', 262 | borderColor: '#0097FF', 263 | backImg: 'images/icons/left.png', 264 | checkClass: 'cp_check', 265 | checkImg: 'images/icons/checkImg.png', 266 | selectArea: true, 267 | callback: null, 268 | }; 269 | $.extend(config, params); 270 | if(provinceJson == null) { 271 | loadDate(function() { 272 | initPicker(); 273 | }); 274 | } else { 275 | initPicker(); 276 | } 277 | 278 | } 279 | var exports = { 280 | cityPicker: function(params) { 281 | cityPicker(params); 282 | } 283 | }; 284 | module.exports = exports; 285 | }); -------------------------------------------------------------------------------- /js/iscroll.min.js: -------------------------------------------------------------------------------- 1 | eval(function(p,a,c,k,e,d){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(u(Z,L){D J=1I,V=L.3F("2W").w,m=(u(){D b="t,4L,4J,4V,4P".3Y(","),c,d=0,a=b.17;1X(;dd[a+"2M"]){q(!d.r.2I){e=d[a+"32"]-J.1k((b-d[a+"2M"])*3);q(e<8){e=8}d[a+"23"].w[a=="h"?"27":"29"]=e+"16";b=d[a+"2M"]+(d[a+"32"]-e)}11{b=d[a+"2M"]}}}d[a+"1s"].w[2x]="0";d[a+"1s"].w.2i=c&&d.r.2h?"0":"1";d[a+"23"].w[W]="1W("+(a=="h"?b+"16,0)":"0,"+b+"16)")+O},3V:u(c){D d=s,h=F?c.1h[0]:c,g,b,a,e,f;q(!d.2y){A}q(d.r.3a){d.r.3a.15(d,c)}q(d.r.1m||d.r.1l){d.3B(0)}d.1v=18;d.1u=18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.B).5K(b,s,!!a)},5H:u(){D a=s;a.B.w[W]="";a.1t=18;a.1B=18;a.28("h");a.28("v");a.1c(2D,Z);a.1c(2C);a.1c(K,Z);a.1c(25,Z);a.1c(H,Z);q(!a.r.5I){a.1c("3v");a.1c("3p")}q(a.r.1m){a.1c(1H)}q(a.r.3u){5M(a.4I)}q(a.r.3y){a.r.3y.15(a)}},21:u(){D e=s,c,f,a,g,b=0,d=0;q(e.Ce.1r);e.1t=e.1S&&e.r.1t;e.1B=e.20&&e.r.1B&&e.1T>e.1r;c=e.2F(e.1G);e.2m=-c.1i;e.2l=-c.1j;q(3w e.r.1V=="67"){e.1a=[];e.1f=[];g=e.B.68(e.r.1V);1X(f=0,a=g.17;f=e.14){e.1a[d]=b;b=b-e.1L;d++}q(e.14%e.1L){e.1a[e.1a.17]=e.14-e.1a[e.1a.17-1]+e.1a[e.1a.17-1]}b=0;d=0;e.1f=[];2K(b>=e.E){e.1f[d]=b;b=b-e.1r;d++}q(e.E%e.1r){e.1f[e.1f.17]=e.E-e.1f[e.1f.17-1]+e.1f[e.1f.17-1]}}}e.28("h");e.28("v");q(!e.1o){e.B.w[X]="0";e.1N(1Z)}},1C:u(b,a,c,d){D e=s,f=b,g,h;e.3A();q(!f.17){f=[{x:b,y:a,1e:c,3O:d}]}1X(g=0,h=f.17;g0?0:b.1id.1g?d.1g:b.1jd.1a.17-1?d.1a.17-1:e;f=f<0?0:f>d.1f.17-1?d.1f.17-1:f;d.1P=e;d.1O=f;a=d.1a[e];b=d.1f[f]}11{a=-d.1L*e;b=-d.1r*f;q(a0?0:f.xf.1g?f.1g:f.y35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(9(2n,3r,56,1e){\'6S 6w\';7 46=[\'\',\'6t\',\'6u\',\'6G\',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d(!U){U=4y}7 x=2C[U[0]]-2w[U[0]],y=2C[U[1]]-2w[U[1]];e 1t.7K(y,x)*7N/1t.7O}9 5i(1S,1W){e 3l(1W[1],1W[0],3c)-3l(1S[1],1S[0],3c)}9 5h(1S,1W){e 2J(1W[0],1W[1],3c)/2J(1S[0],1S[1],3c)}7 5A={5p:N,5y:1z,5x:C};7 5w=\'5p\';7 5B=\'5y 5x\';9 2m(){6.2u=5w;6.1U=5B;6.37=B;6.3m=J;R.T(6,W)}O(2m,R,{F:9 7L(n){7 u=5A[n.z];d(u&N&&n.4V===0){6.3m=B}d(u&1z&&n.7M!==1){u=C}d(!6.3m||!6.37){e}d(u&C){6.3m=J}6.1I(6.h,u,{k:[n],2S:[n],1b:3n,X:n})}});7 53={5u:N,5t:1z,50:C,4Z:L,7F:L};7 59={2:2g,3:5q,4:3n,5:5v};7 4o=\'5u\';7 4n=\'5t 50 4Z\';d(2n.7y){4o=\'7z\';4n=\'7w 7x 7A\'}9 2Y(){6.2u=4o;6.1U=4n;R.T(6,W);6.1u=(6.h.m.7D=[])}O(2Y,R,{F:9 7E(n){7 1u=6.1u;7 4p=J;7 54=n.z.5H().7B(\'57\',\'\');7 u=53[54];7 1b=59[n.1b]||n.1b;7 3q=(1b==2g);7 2o=1O(1u,n.4X,\'4X\');d(u&N&&(n.4V===0||3q)){d(2o<0){1u.1D(n);2o=1u.w-1}}r d(u&(C|L)){4p=B}d(2o<0){e}1u[2o]=n;6.1I(6.h,u,{k:1u,2S:[n],1b:1b,X:n});d(4p){1u.3H(2o,1)}}});7 6c={34:N,3A:1z,3z:C,3p:L};7 68=\'34\';7 6d=\'34 3A 3z 3p\';9 3D(){6.2A=68;6.1U=6d;6.3f=J;R.T(6,W)}O(3D,R,{F:9 7C(n){7 z=6c[n.z];d(z===N){6.3f=B}d(!6.3f){e}7 1c=63.15(6,n,z);d(z&(C|L)&&1c[0].w-1c[1].w===0){6.3f=J}6.1I(6.h,z,{k:1c[0],2S:1c[1],1b:2g,X:n})}});9 63(n,z){7 3u=2X(n.1c);7 4f=2X(n.1P);d(z&(C|L)){3u=4t(3u.48(4f),\'2e\',B)}e[3u,4f]}7 6n={34:N,3A:1z,3z:C,3p:L};7 6e=\'34 3A 3z 3p\';9 2y(){6.2A=6e;6.1N={};R.T(6,W)}O(2y,R,{F:9 7T(n){7 z=6n[n.z];7 1c=6m.15(6,n,z);d(!1c){e}6.1I(6.h,z,{k:1c[0],2S:1c[1],1b:2g,X:n})}});9 6m(n,z){7 2d=2X(n.1c);7 1N=6.1N;d(z&(N|1z)&&2d.w===1){1N[2d[0].2e]=B;e[2d,2d]}7 i,2V,1P=2X(n.1P),3e=[],E=6.E;2V=2d.7S(9(36){e 4u(36.E,E)});d(z===N){i=0;V(i<2V.w){1N[2V[i].2e]=B;i++}}i=0;V(i<1P.w){d(1N[1P[i].2e]){3e.1D(1P[i])}d(z&(C|L)){4l 1N[1P[i].2e]}i++}d(!3e.w){e}e[4t(2V.48(3e),\'2e\',B),3e]}9 30(){R.T(6,W);7 F=2M(6.F,6);6.36=2f 2y(6.h,F);6.2j=2f 2m(6.h,F)}O(30,R,{F:9 7P(h,41,1k){7 3q=(1k.1b==2g),5I=(1k.1b==3n);d(3q){6.2j.37=J}r d(5I&&!6.2j.37){e}d(41&(C|L)){6.2j.37=B}6.1I(h,41,1k)},1C:9 1C(){6.36.1C();6.2j.1C()}});7 4g=2x(5D.3X,\'1f\');7 4c=4g!==1e;7 4F=\'49\';7 4L=\'7R\';7 3V=\'7Q\';7 2q=\'2k\';7 2z=\'4A-x\';7 2l=\'4A-y\';9 33(h,1y){6.h=h;6.3d(1y)}33.1q={3d:9(1y){d(1y==4F){1y=6.49()}d(4c){6.h.D.3X[4g]=1y}6.I=1y.5H().5G()},2W:9(){6.3d(6.h.f.1f)},49:9(){7 I=[];1a(6.h.G,9(p){d(3s(p.f.1F,[p])){I=I.48(p.1B())}});e 5Q(I.7U(\' \'))},6h:9(c){d(4c){e}7 X=c.X;7 j=c.5U;d(6.h.m.5X){X.40();e}7 I=6.I;7 5Z=1K(I,2q);7 3a=1K(I,2l);7 2a=1K(I,2z);d(5Z||(3a&&j&19)||(2a&&j&1w)){e 6.5Y(X)}},5Y:9(X){6.h.m.5X=B;X.40()}};9 5Q(I){d(1K(I,2q)){e 2q}7 2a=1K(I,2z);7 3a=1K(I,2l);d(2a&&3a){e 2z+\' \'+2l}d(2a||3a){e 2a?2z:2l}d(1K(I,3V)){e 3V}e 4L}7 2p=1;7 S=2;7 1M=4;7 1o=8;7 1i=1o;7 1Y=16;7 13=32;9 1g(f){6.2P=5T();6.h=14;6.f=1L(f||{},6.17);6.f.1F=4C(6.f.1F,B);6.l=2p;6.27={};6.1m=[]}1g.1q={17:{},3d:9(f){1p(6.f,f);6.h&&6.h.1f.2W();e 6},3N:9(t){d(1Q(t,\'3N\',6)){e 6}7 27=6.27;t=2Q(t,6);d(!27[t.2P]){27[t.2P]=t;t.3N(6)}e 6},5V:9(t){d(1Q(t,\'5V\',6)){e 6}t=2Q(t,6);4l 6.27[t.2P];e 6},3K:9(t){d(1Q(t,\'3K\',6)){e 6}7 1m=6.1m;t=2Q(t,6);d(1O(1m,t)===-1){1m.1D(t);t.3K(6)}e 6},5W:9(t){d(1Q(t,\'5W\',6)){e 6}t=2Q(t,6);7 4S=1O(6.1m,t);d(4S>-1){6.1m.3H(4S,1)}e 6},67:9(){e 6.1m.w>0},6k:9(t){e!!6.27[t.2P]},A:9(c){7 2O=6;7 l=6.l;9 A(5E){2O.h.A(2O.f.q+(5E?5J(l):\'\'),c)}d(l<1o){A(B)}A();d(l>=1o){A(B)}},3O:9(c){d(6.5L()){e 6.A(c)}6.l=13},5L:9(){7 i=0;V(i<6.1m.w){d(!(6.1m[i].l&(13|2p))){e J}i++}e B},3R:9(1k){7 3t=1p({},1k);d(!3s(6.f.1F,[6,3t])){6.1J();6.l=13;e}d(6.l&(1i|1Y|13)){6.l=2p}6.l=6.2R(3t);d(6.l&(S|1M|1o|1Y)){6.3O(3t)}},2R:9(1k){},1B:9(){},1J:9(){}};9 5J(l){d(l&1Y){e\'7V\'}r d(l&1o){e\'1W\'}r d(l&1M){e\'79\'}r d(l&S){e\'1S\'}e\'\'}9 4P(j){d(j==24){e\'7a\'}r d(j==1X){e\'5s\'}r d(j==21){e\'77\'}r d(j==22){e\'78\'}e\'\'}9 2Q(t,p){7 h=p.h;d(h){e h.3P(t)}e t}9 12(){1g.T(6,W)}O(12,1g,{17:{k:1},1l:9(c){7 4I=6.f.k;e 4I===0||c.k.w===4I},2R:9(c){7 l=6.l;7 u=c.u;7 47=l&(S|1M);7 4H=6.1l(c);d(47&&(u&L||!4H)){e l|1Y}r d(47||4H){d(u&C){e l|1o}r d(!(l&S)){e S}e l|1M}e 13}});9 2T(){12.T(6,W);6.4R=14;6.4T=14}O(2T,12,{17:{q:\'4A\',18:10,k:1,j:3T},1B:9(){7 j=6.f.j;7 I=[];d(j&19){I.1D(2l)}d(j&1w){I.1D(2z)}e I},6b:9(c){7 f=6.f;7 3y=B;7 1v=c.1v;7 j=c.j;7 x=c.11;7 y=c.Z;d(!(j&f.j)){d(f.j&19){j=(x===0)?2s:(x<0)?21:22;3y=x!=6.4R;1v=1t.1j(c.11)}r{j=(y===0)?2s:(y<0)?1X:24;3y=y!=6.4T;1v=1t.1j(c.Z)}}c.j=j;e 3y&&1v>f.18&&j&f.j},1l:9(c){e 12.1q.1l.15(6,c)&&(6.l&S||(!(6.l&S)&&6.6b(c)))},A:9(c){6.4R=c.11;6.4T=c.Z;7 j=4P(c.j);d(j){6.h.A(6.f.q+j,c)}6.2v.A.15(6,c)}});9 3E(){12.T(6,W)}O(3E,12,{17:{q:\'7e\',18:0,k:2},1B:9(){e[2q]},1l:9(c){e 6.2v.1l.15(6,c)&&(1t.1j(c.3v-1)>6.f.18||6.l&S)},A:9(c){6.2v.A.15(6,c);d(c.3v!==1){7 5b=c.3v<1?\'3w\':\'7b\';6.h.A(6.f.q+5b,c)}}});9 3Y(){1g.T(6,W);6.1T=14;6.1G=14}O(3Y,1g,{17:{q:\'7c\',k:1,2N:71,18:5},1B:9(){e[4L]},2R:9(c){7 f=6.f;7 3G=c.k.w===f.k;7 3S=c.1vf.2N;6.1G=c;d(!3S||!3G||(c.u&(C|L)&&!51)){6.1J()}r d(c.u&N){6.1J();6.1T=3Q(9(){6.l=1i;6.3O()},f.2N,6)}r d(c.u&C){e 1i}e 13},1J:9(){60(6.1T)},A:9(c){d(6.l!==1i){e}d(c&&(c.u&C)){6.h.A(6.f.q+\'5s\',c)}r{6.1G.1r=2K();6.h.A(6.f.q,6.1G)}}});9 3U(){12.T(6,W)}O(3U,12,{17:{q:\'5R\',18:0,k:2},1B:9(){e[2q]},1l:9(c){e 6.2v.1l.15(6,c)&&(1t.1j(c.5f)>6.f.18||6.l&S)}});9 3J(){12.T(6,W)}O(3J,12,{17:{q:\'5S\',18:10,Q:0.65,j:19|1w,k:1},1B:9(){e 2T.1q.1B.15(6)},1l:9(c){7 j=6.f.j;7 Q;d(j&(19|1w)){Q=c.Q}r d(j&19){Q=c.1Z}r d(j&1w){Q=c.20}e 6.2v.1l.15(6,c)&&j&c.j&&c.1v>6.f.18&&1j(Q)>6.f.Q&&c.u&C},A:9(c){7 j=4P(c.j);d(j){6.h.A(6.f.q+j,c)}6.h.A(6.f.q,c)}});9 2U(){1g.T(6,W);6.3I=J;6.3C=J;6.1T=14;6.1G=14;6.2h=0}O(2U,1g,{17:{q:\'5O\',k:1,4b:1,3L:72,2N:6Z,18:2,69:10},1B:9(){e[3V]},2R:9(c){7 f=6.f;7 3G=c.k.w===f.k;7 3S=c.1v35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(C(f,a,e){F h=f.7j||f.6f||f.6g||f.6e||f.6h||C(i){f.2Q(i,1G/60)};F c=(C(){F m={};F n=a.41("3Z").I;F k=(C(){F r=["t","6j","6i","6l","6k"],p,q=0,o=r.U;1f(;q0){x=v?v/2.5*(s/8):0;p=e.M(u)+x;t=p/s}}E{2T:e.N(x),2R:t}};F j=l("2r");m.3c(m,{4Q:j!==Q,4U:l("6m")16 n,5h:"6n"16 f,5k:f.6s||f.5r,4S:l("6t")16 n});m.2Z=/6u /.31(f.5G.5F)&&!(/6v\\/\\d/.31(f.5G.5F));m.3c(m.I={},{2r:j,2A:l("2A"),1R:l("1R"),5I:l("5I"),4z:l("4z")});m.4y=C(p,q){F o=3e 5D("(^|\\\\s)"+q+"(\\\\s|$)");E o.31(p.1U)};m.4a=C(p,q){A(m.4y(p,q)){E}F o=p.1U.4w(" ");o.30(q);p.1U=o.6S(" ")};m.4b=C(p,q){A(!m.4y(p,q)){E}F o=3e 5D("(^|\\\\s)"+q+"(\\\\s|$)","g");p.1U=p.1U.4t(o," ")};m.4q=C(o){F q=-o.2X,p=-o.42;3M(o=o.6R){q-=o.2X;p-=o.42}E{14:q,18:p}};m.2i=C(q,p){1f(F o 16 p){A(p[o].31(q[o])){E K}}E Q};m.3c(m.1W={},{2f:1,28:1,2p:1,2o:2,23:2,2m:2,2g:3,21:3,2k:3,4O:3,4M:3,4N:3});m.3c(m.2V={},{53:{I:"4n-4x(0.25, 0.46, 0.45, 0.6U)",2q:C(o){E o*(2-o)}},4k:{I:"4n-4x(0.1, 0.57, 0.1, 1)",2q:C(o){E e.4C(1-(--o*o))}},6T:{I:"4n-4x(0.6O, 0.6N, 0.32, 1.6Q)",2q:C(p){F o=4;E(p=p-1)*p*((o+1)*p+o)+1}},2j:{I:"",2q:C(o){A((o/=1)<(1/2.75)){E 7.3h*o*o}D{A(o<(2/2.75)){E 7.3h*(o-=(1.5/2.75))*o+0.75}D{A(o<(2.5/2.75)){E 7.3h*(o-=(2.25/2.75))*o+0.6P}D{E 7.3h*(o-=(2.70/2.75))*o+0.6Z}}}}},72:{I:"",2q:C(o){F p=0.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.1o=6.B.3k&&6.O<0;6.1k=6.B.2W&&6.S<0;A(!6.1o){6.O=0;6.2B=6.1h}A(!6.1k){6.S=0;6.2x=6.1e}6.4o=0;6.1X=0;6.1P=0;6.1O=c.4q(6.J);6.Z("1v");6.3a(6.B.2l)},1s:C(j,i){A(!6.1n[j]){6.1n[j]=[]}6.1n[j].30(i)},7S:C(k,j){A(!6.1n[k]){E}F i=6.1n[k].7R(j);A(i>-1){6.1n[k].7P(i,1)}},Z:C(m){A(!6.1n[m]){E}F k=0,j=6.1n[m].U;A(!j){E}1f(;k0;A(!j||(6.B.1F&&k.I)){6.5e(k.I);6.3m(j);6.2b(i,l)}D{6.5V(i,l,j,k.2q)}},7D:C(j,k,i,n,m){j=j.7L?j:6.H.4E(j);A(!j){E}F l=c.4q(j);l.14-=6.1O.14;l.18-=6.1O.18;A(i===K){i=e.N(j.3d/2-6.J.3d/2)}A(n===K){n=e.N(j.1Z/2-6.J.1Z/2)}l.14-=i||0;l.18-=n||0;l.14=l.14>0?0:l.14<6.O?6.O:l.14;l.18=l.18>0?0:l.18<6.S?6.S:l.18;k=k===1A||k===3i||k==="7B"?e.X(e.M(6.x-l.14),e.M(6.y-l.18)):k;6.1i(l.14,l.18,k,m)},3m:C(k){k=k||0;6.1S[c.I.1R]=k+"4m";A(!k&&c.2Z){6.1S[c.I.1R]="0.48"}A(6.19){1f(F j=6.19.U;j--;){6.19[j].3C(k)}}},5e:C(k){6.1S[c.I.2A]=k;A(6.19){1f(F j=6.19.U;j--;){6.19[j].2A(k)}}},2b:C(j,l){A(6.B.2z){6.1S[c.I.2r]="5p("+j+"1d,"+l+"1d) V("+6.V+") "+6.2P}D{j=e.N(j);l=e.N(l);6.1S.14=j+"1d";6.1S.18=l+"1d"}6.x=j;6.y=l;A(6.19){1f(F k=6.19.U;k--;){6.19[k].4r()}}},4v:C(i){F j=i?c.15:c.1g,k=6.B.7F?6.J:f;j(f,"69",6);j(f,"2e",6);A(6.B.2h){j(6.J,"2h",6,K)}A(!6.B.4e){j(6.J,"2o",6);j(k,"23",6);j(k,"4H",6);j(k,"2m",6)}A(c.5k&&!6.B.4f){j(6.J,c.1m("2g"),6);j(k,c.1m("21"),6);j(k,c.1m("4I"),6);j(k,c.1m("2k"),6)}A(c.5h&&!6.B.4L){j(6.J,"2f",6);j(k,"28",6);j(k,"4P",6);j(k,"2p",6)}j(6.H,"5v",6);j(6.H,"5w",6);j(6.H,"5t",6);j(6.H,"61",6)},3L:C(){F j=f.7O(6.H,3i),i,k;A(6.B.2z){j=j[c.I.2r].4w(")")[0].4w(", ");i=+(j[12]||j[4]);k=+(j[13]||j[5])}D{i=+j.14.4t(/[^-\\d.]/g,"");k=+j.18.4t(/[^-\\d.]/g,"")}E{x:i,y:k}},54:C(){F l=6.B.7X,n=1T 6.B.2H!="2y",p=[],k;F o=6;6.19=[];A(6.B.2H){A(6.B.2W){k={27:d("v",l,6.B.2H),2J:l,2w:K,3D:n,2e:6.B.4g,1q:6.B.4J,1J:6.B.4F,1L:Q};6.J.4G(k.27);p.30(k)}A(6.B.3k){k={27:d("h",l,6.B.2H),2J:l,2w:K,3D:n,2e:6.B.4g,1q:6.B.4J,1J:6.B.4F,2d:Q};6.J.4G(k.27);p.30(k)}}A(6.B.19){p=p.7Q(6.B.19)}1f(F m=p.U;m--;){6.19.30(3e b(6,p[m]))}C j(r){1f(F q=o.19.U;q--;){r.55(o.19[q])}}A(6.B.4F){6.1s("1V",C(){j(C(){6.1J()})});6.1s("56",C(){j(C(){6.1J()})});6.1s("3x",C(){j(C(){6.1J(1)})});6.1s("4d",C(){j(C(){6.1J(1,K)})})}6.1s("1v",C(){j(C(){6.1v()})});6.1s("26",C(){j(C(){6.26()});7G 6.19})},5f:C(){6.1S[c.I.4z]="0 0"},67:C(k){F j=e.M(k.T[0].R-k.T[1].R),i=e.M(k.T[0].P-k.T[1].P);6.4V=e.4C(j*j+i*i);6.3f=6.V;6.2M=e.M(k.T[0].R+k.T[1].R)/2+6.1O.14-6.x;6.2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(7H(j)){j=0}l=6.V+j*0.7J;6.2C(l,k.R,k.P,0);k.11();k.2G()},58:C(){c.1g(6.J,"3R",6);c.1g(6.J,"3S",6);c.1g(6.J,"43",6);6.1s("26",C(){c.15(6.J,"3R",6);c.15(6.J,"3S",6);c.15(6.J,"43",6)})},5y:C(m){A(!6.1E){E}m.11();m.2G();F k,j,n,l,i=6;A(6.2u===1A){i.Z("3x")}3j(6.2u);6.2u=2Q(C(){i.Z("1V");i.2u=1A},5c);A("3P"16 m){A(m.7K===1){k=-m.3P*6.B.2c;j=-m.2Y*6.B.2c}D{k=-m.3P;j=-m.2Y}}D{A("5a"16 m){k=m.5a/3Q*6.B.2c;j=m.3v/3Q*6.B.2c}D{A("2K"16 m){k=j=m.2K/3Q*6.B.2c}D{A("2I"16 m){k=j=-m.2I/3*6.B.2c}D{E}}}}k*=6.B.3B;j*=6.B.3B;A(!6.1k){k=j;j=0}A(6.B.1t){n=6.W.R;l=6.W.P;A(k>0){n--}D{A(k<0){n++}}A(j>0){l--}D{A(j<0){l++}}6.2a(n,l);E}n=6.x+e.N(6.1o?k:0);l=6.y+e.N(6.1k?j:0);A(n>0){n=0}D{A(n<6.O){n=6.O}}A(l>0){l=0}D{A(l<6.S){l=6.S}}6.1i(n,l,0)},59:C(){6.W={};A(1T 6.B.1t=="2y"){6.B.1t=6.H.7I(6.B.1t)}6.1s("1v",C(){F s=0,q,o=0,k,r,p,u=0,t,w=6.B.7N||6.1h,v=6.B.7M||6.1e,j;6.L=[];A(!6.1h||!6.1e||!6.2B||!6.2x){E}A(6.B.1t===K){r=e.N(w/2);p=e.N(v/2);3M(u>-6.2B){6.L[s]=[];q=0;t=0;3M(t>-6.2x){6.L[s][q]={x:e.X(u,6.O),y:e.X(t,6.S),1b:w,1c:v,3K:u-r,3I:t-p};t-=v;q++}u-=w;s++}}D{j=6.B.1t;q=j.U;k=-1;1f(;s6.O){o++}}}6.2a(6.W.R||0,6.W.P||0,0);A(6.B.2t%1===0){6.3H=6.B.2t;6.3G=6.B.2t}D{6.3H=e.N(6.L[6.W.R][6.W.P].1b*6.B.2t);6.3G=e.N(6.L[6.W.R][6.W.P].1c*6.B.2t)}});6.1s("3V",C(){F i=6.B.3E||e.X(e.X(e.1x(e.M(6.x-6.1I),1G),e.1x(e.M(6.y-6.1K),1G)),1C);6.2a(6.W.R+6.1X,6.W.P+6.1P,i)})},4c:C(k,p){A(!6.L.U){E{x:0,y:0,R:0,P:0}}F o=0,n=6.L.U,j=0;A(e.M(k-6.5j)<6.3H&&e.M(p-6.5d)<6.3G){E 6.W}A(k>0){k=0}D{A(k<6.O){k=6.O}}A(p>0){p=0}D{A(p<6.S){p=6.S}}1f(;o=6.L[o][0].3K){k=6.L[o][0].x;Y}}n=6.L[o].U;1f(;j=6.L[0][j].3I){p=6.L[0][j].y;Y}}A(o==6.W.R){o+=6.1X;A(o<0){o=0}D{A(o>=6.L.U){o=6.L.U-1}}k=6.L[o][0].x}A(j==6.W.P){j+=6.1P;A(j<0){j=0}D{A(j>=6.L[0].U){j=6.L[0].U-1}}p=6.L[0][j].y}E{x:k,y:p,R:o,P:j}},2a:C(i,n,j,m){m=m||6.B.1M;A(i>=6.L.U){i=6.L.U-1}D{A(i<0){i=0}}A(n>=6.L[i].U){n=6.L[i].U-1}D{A(n<0){n=0}}F l=6.L[i][n].x,k=6.L[i][n].y;j=j===1A?6.B.3E||e.X(e.X(e.1x(e.M(l-6.x),1G),e.1x(e.M(k-6.y),1G)),1C):j;6.W={x:l,y:k,R:i,P:n};6.1i(l,k,j,m)},7T:C(j,l){F i=6.W.R,k=6.W.P;i++;A(i>=6.L.U&&6.1k){i=0;k++}6.2a(i,k,j,l)},7V:C(j,l){F i=6.W.R,k=6.W.P;i--;A(i<0&&6.1k){i=0;k--}6.2a(i,k,j,l)},4R:C(l){F k={64:33,63:34,62:35,5X:36,14:37,5T:38,2v:39,5S:40};F j;A(1T 6.B.1a=="7f"){1f(j 16 6.B.1a){A(1T 6.B.1a[j]=="2y"){6.B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"2p":G"2k":G"4N":G"2m":G"4P":G"4I":G"5C":G"4H":A(6.3T){6.66(i);E}6.3w(i);Y;G"69":G"2e":6.6a();Y;G"5v":G"5w":G"5t":G"61":6.5z(i);Y;G"3R":G"43":G"3S":A(6.B.7k=="2C"){6.5x(i);E}6.5y(i);Y;G"3U":6.5n(i);Y}}};C d(l,j,k){F m=a.41("3Z"),i=a.41("3Z");A(k===K){m.I.2N="5l:5m;z-7h:7i";i.I.2N="-77-2D-3X:2S-2D;-78-2D-3X:2S-2D;2D-3X:2S-2D;5l:5m;74:5q(0,0,0,0.5);2S:5J 76 5q(3J,3J,3J,0.9);2S-7b:7c"}i.1U="79";A(l=="h"){A(k===K){m.I.2N+=";1c:5M;14:2s;2v:2s;3t:0";i.I.1c="3g%"}m.1U="7a"}D{A(k===K){m.I.2N+=";1b:5M;3t:2s;18:2s;2v:5J";i.I.1b="3g%"}m.1U="7v"}m.I.2N+=";7w:7t";A(!j){m.I.7u="3n"}m.4G(i);E m}C b(j,k){6.J=1T k.27=="2y"?a.4E(k.27):k.27;6.2n=6.J.I;6.1y=6.J.5O[0];6.17=6.1y.I;6.H=j;6.B={1L:K,2d:K,2J:Q,2e:K,2w:Q,1q:Q,1J:Q,5Q:0,5L:0};1f(F l 16 k){6.B[l]=k[l]}6.3u=1;6.3s=1;6.1Y=0;6.1N=0;A(6.B.2J){A(!6.B.4L){c.1g(6.1y,"2f",6);c.1g(f,"2p",6)}A(!6.B.4f){c.1g(6.1y,c.1m("2g"),6);c.1g(f,c.1m("2k"),6)}A(!6.B.4e){c.1g(6.1y,"2o",6);c.1g(f,"2m",6)}}A(6.B.1J){6.2n[c.I.2r]=6.H.2P;6.2n[c.I.1R]=c.2Z?"0.48":"7z";6.2n.6b="0"}}b.5E={5B:C(i){4B(i.1H){G"2f":G"2g":G"4O":G"2o":6.3A(i);Y;G"28":G"21":G"4M":G"23":6.3z(i);Y;G"2p":G"2k":G"4N":G"2m":G"4P":G"4I":G"5C":G"4H":6.3w(i);Y}},26:C(){A(6.B.2J){c.15(6.1y,"2f",6);c.15(6.1y,c.1m("2g"),6);c.15(6.1y,"2o",6);c.15(f,"28",6);c.15(f,c.1m("21"),6);c.15(f,"23",6);c.15(f,"2p",6);c.15(f,c.1m("2k"),6);c.15(f,"2m",6)}A(6.B.2w){6.J.7A.7x(6.J)}},3A:C(j){F i=j.T?j.T[0]:j;j.11();j.2G();6.3C();6.1j=K;6.1Q=Q;6.4i=i.R;6.4h=i.P;6.2F=c.1r();A(!6.B.4L){c.1g(f,"28",6)}A(!6.B.4f){c.1g(f,c.1m("21"),6)}A(!6.B.4e){c.1g(f,"23",6)}6.H.Z("4d")},3z:C(n){F j=n.T?n.T[0]:n,k,i,o,m,l=c.1r();A(!6.1Q){6.H.Z("3x")}6.1Q=K;k=j.R-6.4i;6.4i=j.R;i=j.P-6.4h;6.4h=j.P;o=6.x+k;m=6.y+i;6.5s(o,m);n.11();n.2G()},3w:C(k){A(!6.1j){E}6.1j=Q;k.11();k.2G();c.15(f,"28",6);c.15(f,c.1m("21"),6);c.15(f,"23",6);A(6.H.B.1t){F i=6.H.4c(6.H.x,6.H.y);F j=6.B.3E||e.X(e.X(e.1x(e.M(6.H.x-i.x),1G),e.1x(e.M(6.H.y-i.y),1G)),1C);A(6.H.x!=i.x||6.H.y!=i.y){6.H.1X=0;6.H.1P=0;6.H.W=i;6.H.1i(i.x,i.y,j,6.H.B.1M)}}A(6.1Q){6.H.Z("1V")}},3C:C(i){i=i||0;6.17[c.I.1R]=i+"4m";A(!i&&c.2Z){6.17[c.I.1R]="0.48"}},2A:C(i){6.17[c.I.2A]=i},1v:C(){6.3C();A(6.B.1L&&!6.B.2d){6.17.47=6.H.1o?"44":"3n"}D{A(6.B.2d&&!6.B.1L){6.17.47=6.H.1k?"44":"3n"}D{6.17.47=6.H.1o||6.H.1k?"44":"3n"}}A(6.H.1o&&6.H.1k){c.4a(6.J,"5H");c.4b(6.J,"5N");A(6.B.2w&&6.B.3D){A(6.B.1L){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V"&&6.1c!=6.1p){6.1c=6.1p;6.17.1c=6.1c+"1d"}}}}6.x=i;6.y=j;A(6.H.B.2z){6.17[c.I.2r]="5p("+i+"1d,"+j+"1d)"+6.H.2P}D{6.17.14=i+"1d";6.17.18=j+"1d"}},5s:C(i,j){A(i<0){i=0}D{A(i>6.1Y){i=6.1Y}}A(j<0){j=0}D{A(j>6.1N){j=6.1N}}i=6.B.1L?e.N(i/6.3u):6.H.x;j=6.B.2d?e.N(j/6.3s):6.H.y;6.H.1i(i,j)},1J:C(l,k){A(k&&!6.68){E}3j(6.4l);6.4l=3i;F j=l?7n:7o,i=l?0:1C;l=l?"1":"0";6.2n[c.I.1R]=j+"4m";6.4l=2Q((C(m){6.2n.6b=m;6.68=+m}).7l(6,l),i)}};g.7m=c;A(1T 4p!="1A"&&4p.5R){4p.5R=g}D{f.7r=g}})(7s,7p,7q);',62,494,'||||||this||||||||||||||||||||||||||||||if|options|function|else|return|var|case|scroller|style|wrapper|true|pages|abs|round|maxScrollX|pageY|false|pageX|maxScrollY|touches|length|scale|currentPage|max|break|_0||preventDefault|||left|removeEvent|in|indicatorStyle|top|indicators|keyBindings|width|height|px|wrapperHeight|for|addEvent|wrapperWidth|scrollTo|initiated|hasVerticalScroll|eventPassthrough|prefixPointerEvent|_1|hasHorizontalScroll|indicatorHeight|shrink|getTime|on|snap|indicatorWidth|refresh|isInTransition|min|indicator|keyAcceleration|undefined|zoomMax|300|zoomMin|enabled|useTransition|1000|type|startX|fade|startY|listenX|bounceEasing|maxPosY|wrapperOffset|directionY|moved|transitionDuration|scrollerStyle|typeof|className|scrollEnd|eventType|directionX|maxPosX|offsetHeight||pointermove||mousemove|directionLocked||destroy|el|touchmove|tap|goToPage|_2|mouseWheelSpeed|listenY|resize|touchstart|pointerdown|click|preventDefaultException|bounce|pointerup|bounceTime|mouseup|wrapperStyle|mousedown|touchend|fn|transform|2px|snapThreshold|wheelTimeout|right|defaultScrollbars|scrollerHeight|string|useTransform|transitionTimingFunction|scrollerWidth|zoom|box|directionLockThreshold|startTime|stopPropagation|scrollbars|detail|interactive|wheelDelta|originY|originX|cssText|target|translateZ|setTimeout|duration|border|destination|momentum|ease|scrollY|offsetLeft|deltaY|isBadAndroid|push|test|||||||||resetPosition|isAnimating|extend|offsetWidth|new|startScale|100|5625|null|clearTimeout|scrollX|minBoundaryX|_5|none|vertical|minBoundaryY|maxBoundaryX|maxBoundaryY|sizeRatioY|bottom|sizeRatioX|wheelDeltaY|_6|scrollStart|resizePolling|_4|_3|invertWheelDirection|transitionTime|customStyle|snapSpeed|toUpperCase|snapThresholdY|snapThresholdX|cy|255|cx|getComputedPosition|while|pointX|pointY|deltaX|120|wheel|mousewheel|scaled|keydown|flick|distX|sizing|distY|div||createElement|offsetTop|DOMMouseScroll|block|||display|001s|clientWidth|addClass|removeClass|_8|beforeScrollStart|disableMouse|disablePointer|resizeScrollbars|lastPointY|lastPointX|clientHeight|circular|fadeTimeout|ms|cubic|endTime|module|offset|updatePosition|horizontal|replace|substr|_7|split|bezier|hasClass|transformOrigin|pow|switch|sqrt|freeScroll|querySelector|fadeScrollbars|appendChild|mousecancel|pointercancel|shrinkScrollbars|zoomStart|disableTouch|MSPointerMove|MSPointerUp|MSPointerDown|touchcancel|hasTransform|_11|hasTransition|tagName|hasPerspective|touchesDistanceStart|resizeTimeout|INPUT|TEXTAREA|deceleration||HWCompositing|SELECT|quadratic|_15|call|scrollCancel||_9|_10|wheelDeltaX|_13|400|absStartY|_12|_14|changedTouches|hasTouch|zoomEnd|absStartX|hasPointer|position|absolute|_20|createEvent|translate|rgba|MSPointerEvent|_19|oTransitionEnd|8px|transitionend|webkitTransitionEnd|_16|_18|_17|charAt|handleEvent|MSPointerCancel|RegExp|prototype|appVersion|navigator|iScrollBothScrollbars|transitionDelay|1px|enable|speedRatioY|7px|iScrollLoneScrollbar|children|clip|speedRatioX|exports|down|up|Date|_22|keyTime|home|200|dispatchEvent||MSTransitionEnd|end|pageDown|pageUp|_23|_25|_21|visible|orientationchange|_24|opacity|MSPointer|removeEventListener|oRequestAnimationFrame|webkitRequestAnimationFrame|mozRequestAnimationFrame|msRequestAnimationFrame|MozT|webkitT|OT|msT|perspective|ontouchstart|now|ransform|0006|addEventListener|PointerEvent|transition|Android|Chrome|screenY|version|clientY|clientX|initMouseEvent|mouseWheel|screenX|view|BUTTON|_26|600|334|altKey|ctrlKey|metaKey|shiftKey|button|885|175|9375|275|offsetParent|join|back|94|Event|PI|MouseEvents|initEvent|984375|625|sin|elastic|disable|background||solid|webkit|moz|iScrollIndicator|iScrollHorizontalScrollbar|radius|3px|keyCode|default|object|charCodeAt|index|9999|requestAnimationFrame|wheelAction|bind|utils|250|500|document|Math|IScroll|window|hidden|pointerEvents|iScrollVerticalScrollbar|overflow|removeChild|ignoreBoundaries|0ms|parentNode|auto|scrollBy|scrollToElement|arguments|bindToWrapper|delete|isNaN|querySelectorAll|01|deltaMode|nodeType|snapStepY|snapStepX|getComputedStyle|splice|concat|indexOf|off|next|apply|prev|slice|interactiveScrollbars'.split('|'),0,{})) 2 | -------------------------------------------------------------------------------- /js/clip_module.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 依赖插件 3 | * - iscroll-zoom.js 4 | * - hammer.js 5 | * - lrz.all.bundle.js 6 | * 7 | * @brief 支持手势的裁图插件 8 | * 在移动设备上双指捏合为缩放,双指旋转可根据旋转方向每次旋转90度 9 | * 在PC设备上鼠标滚轮为缩放,每次双击则顺时针旋转90度 10 | * @option_param {array} size 截取框的宽和高组成的数组。默认值为[260,260] 11 | * @option_param {array} outputSize 输出图像的宽和高组成的数组。默认值为[0,0],表示输出图像原始大小 12 | * @option_param {string} outputType 指定输出图片的类型,可选 "jpg" 和 "png" 两种种类型,默认为 "jpg" 13 | * @option_param {string} file 上传图片的控件的选择器或者DOM对象 14 | * @option_param {string} source 需要裁剪图片的url地址。该参数表示当前立即开始裁剪的图片,不需要使用file控件获取。注意,该参数不支持跨域图片。 15 | * @option_param {string} view 显示截取后图像的容器的选择器或者DOM对象 16 | * @option_param {string} ok 确认截图按钮的选择器或者DOM对象 17 | * @option_param {function} loadStart 开始加载的回调函数。this指向 fileReader 对象,并将正在加载的 file 对象作为参数传入 18 | * @option_param {function} loadComplete 加载完成的回调函数。this指向图片对象,并将图片地址作为参数传入 19 | * @option_param {function} loadError 加载失败的回调函数。this指向 fileReader 对象,并将错误事件的 event 对象作为参数传入 20 | * @option_param {function} clipFinish 裁剪完成的回调函数。this指向原图片对象,会将裁剪出的图像数据DataURL作为参数传入 21 | * @option_param {object} lrzOption lrz压缩插件的配置参数 22 | * @lrzOption_param {Number} width 图片最大不超过的宽度,默认为原图宽度,高度不设时会适应宽度。 23 | * @lrzOption_param {Number} height 图片最大不超过的高度,默认为原图高度,宽度不设时会适应高度。 24 | * @lrzOption_param {Number} quality 图片压缩质量,取值 0 - 1,默认为0.7。 25 | */ 26 | define(['zepto.min.js', 'clip/iscroll-zoom.js', 'clip/hammer.js', 'clip/lrz.all.bundle.js'], function(require, exports, module) { 27 | var defaultOption = { 28 | size: [260, 260], 29 | outputSize: [0, 0], 30 | outputType: "jpg", 31 | file: "", 32 | source: "", 33 | view: "", 34 | ok: "", 35 | circle:false, 36 | loadStart: function() {}, 37 | loadComplete: function() {}, 38 | loadError: function() {}, 39 | clipFinish: function() {}, 40 | lrzOption: {quality:1} 41 | } 42 | 43 | function clipImage(container, option) { 44 | var size = option.size, 45 | circle=option.circle, 46 | outputSize = option.outputSize, 47 | lrzOption = option.lrzOption, 48 | outputType = option.outputType || "image/jpeg", 49 | file = option.file, 50 | source = option.source, 51 | view = option.view, 52 | ok = option.ok, 53 | loadStart = option.loadStart, 54 | loadComplete = option.loadComplete, 55 | loadError = option.loadError, 56 | clipFinish = option.clipFinish; 57 | 58 | var clipWidth = size[0] || 260, 59 | clipHeight = size[1] || 260, 60 | outputWidth = Math.max(outputSize[0], 0), 61 | outputHeight = Math.max(outputSize[1], 0); 62 | 63 | var $img, 64 | imgWidth, imgHeight, //图片当前的宽高 65 | imgLoaded; //图片是否已经加载完成 66 | 67 | var $container, // 容器,包含裁剪视图层和遮罩层 68 | $clipView, // 裁剪视图层,包含移动层 69 | $moveLayer, // 移动层,包含旋转层 70 | $rotateLayer, // 旋转层 71 | $view, // 最终截图后呈现的视图容器 72 | canvas = document.createElement("canvas"), // 图片裁剪用到的画布 73 | hammerManager, 74 | myScroll, // 图片的scroll对象,包含图片的位置与缩放信息 75 | containerWidth, 76 | containerHeight; 77 | 78 | var atRotation, // 是否正在旋转中 79 | curX, // 旋转层的当前X坐标 80 | curY, // 旋转层的当前Y坐标 81 | curAngle; // 旋转层的当前角度 82 | 83 | if(outputType === "jpg") { 84 | outputType = "image/jpeg"; 85 | } else if(outputType === "png") { 86 | outputType = "image/png"; 87 | } 88 | 89 | if(source) { 90 | createImg(source); 91 | } 92 | 93 | if($(file).length) { 94 | $(file).attr("accept", "image/*"); 95 | $(file).on("change", function() { 96 | if(!this.files.length) return; 97 | var files = this.files[0]; 98 | if(!/image\/\w+/.test(files.type)) { 99 | console.log("图片格式不正确,请选择正确格式的图片文件!"); 100 | return false; 101 | } else { 102 | var fileReader = new FileReader(); 103 | fileReader.onload = function(e) { 104 | lrz(files, lrzOption).then(function(rst) { 105 | createImg(rst.base64); 106 | }).catch(function(err) { 107 | loadError.call(this, err); 108 | }); 109 | }; 110 | fileReader.onerror = function(e) { 111 | loadError.call(this, e); 112 | }; 113 | fileReader.readAsDataURL(files); // 读取文件内容 114 | loadStart.call(fileReader, files); 115 | } 116 | }); 117 | } 118 | 119 | init(); 120 | initScroll(); 121 | initEvent(); 122 | 123 | $(ok).click(function() { //裁剪图片 124 | if(!imgLoaded) { 125 | console.log("亲,当前没有图片可以裁剪!"); 126 | } else { 127 | var local = loaclToLoacl($moveLayer, $clipView); 128 | var scale = myScroll.scale; 129 | var ctx = canvas.getContext("2d"); 130 | ctx.clearRect(0, 0, canvas.width, canvas.height); 131 | ctx.save(); 132 | 133 | if(!outputWidth || !outputHeight) { 134 | canvas.width = clipWidth / scale; 135 | canvas.height = clipHeight / scale; 136 | } else { 137 | canvas.width = outputWidth; 138 | canvas.height = outputHeight; 139 | ctx.scale(outputWidth / clipWidth * scale, outputHeight / clipHeight * scale); 140 | } 141 | ctx.translate(curX - local.x / scale, curY - local.y / scale); 142 | ctx.rotate(curAngle * Math.PI / 180); 143 | ctx.drawImage($img[0], 0, 0); 144 | ctx.restore(); 145 | try { 146 | var dataURL = canvas.toDataURL(outputType, 1); 147 | } catch(e) { 148 | throw new Error("截图失败!当前图片源文件可能存在跨域问题,请确保图片与应用同源。如果您是在本地环境下执行本程序,请更换至服务器环境。"); 149 | } 150 | $view.css("background-image", "url(" + dataURL + ")"); 151 | clipFinish.call($img[0], dataURL); 152 | } 153 | }); 154 | resize(); 155 | $(window).resize(resize); 156 | 157 | function initScroll() { 158 | var options = { 159 | zoom: true, 160 | scrollX: true, 161 | scrollY: true, 162 | freeScroll: true, 163 | mouseWheel: true, 164 | wheelAction: "zoom" 165 | } 166 | myScroll = new IScroll($clipView[0], options); 167 | } 168 | 169 | function resetScroll() { 170 | curX = 0; 171 | curY = 0; 172 | curAngle = 0; 173 | $rotateLayer.css({ 174 | "width": imgWidth, 175 | "height": imgHeight 176 | }); 177 | setTransform($rotateLayer, curX, curY, curAngle); 178 | calculateScale(imgWidth, imgHeight); 179 | myScroll.zoom(myScroll.options.zoomStart); 180 | refreshScroll(imgWidth, imgHeight,true); 181 | var posX = (clipWidth - imgWidth * myScroll.options.zoomStart) * .5, 182 | posY = (clipHeight - imgHeight * myScroll.options.zoomStart) * .5; 183 | myScroll.scrollTo(posX, posY); 184 | } 185 | 186 | function refreshScroll(width, height,flag) { 187 | $moveLayer.css({ 188 | "width": width, 189 | "height": height 190 | }); 191 | // 在移动设备上,尤其是Android设备,当为一个元素重置了宽高时 192 | // 该元素的offsetWidth/offsetHeight、clientWidth/clientHeight等属性并不会立即更新,导致相关的js程序出现错误 193 | // iscroll 在刷新方法中正是使用了 offsetWidth/offsetHeight 来获取scroller元素($moveLayer)的宽高 194 | // 因此需要手动将元素重新添加进文档,迫使浏览器强制更新元素的宽高 195 | //$clipView.append($moveLayer); 196 | if(flag){ 197 | setTimeout(function(){ 198 | myScroll.refresh(); 199 | },50); 200 | }else{ 201 | myScroll.refresh(); 202 | } 203 | } 204 | 205 | function initEvent() { 206 | var is_mobile = !!navigator.userAgent.match(/mobile/i); 207 | if(is_mobile) { 208 | hammerManager = new Hammer($moveLayer[0]); 209 | hammerManager.add(new Hammer.Rotate()); 210 | 211 | var rotation, rotateDirection; 212 | hammerManager.on("rotatemove", function(e) { 213 | if(atRotation) return; 214 | rotation = e.rotation; 215 | if(rotation > 180) { 216 | rotation -= 360; 217 | } else if(rotation < -180) { 218 | rotation += 360; 219 | } 220 | rotateDirection = rotation > 0 ? 1 : rotation < 0 ? -1 : 0; 221 | }); 222 | hammerManager.on("rotateend", function(e) { 223 | if(atRotation) return; 224 | 225 | if(Math.abs(rotation) > 30) { 226 | if(rotateDirection == 1) { 227 | // 顺时针 228 | rotateCW(e.center); 229 | } else if(rotateDirection == -1) { 230 | // 逆时针 231 | rotateCCW(e.center); 232 | } 233 | } 234 | }); 235 | } else { 236 | $moveLayer.on("dblclick", function(e) { 237 | rotateCW({ 238 | x: e.clientX, 239 | y: e.clientY 240 | }); 241 | }); 242 | } 243 | } 244 | 245 | function rotateCW(point) { 246 | rotateBy(90, point); 247 | } 248 | 249 | function rotateCCW(point) { 250 | rotateBy(-90, point); 251 | } 252 | 253 | function rotateBy(angle, point) { 254 | if(atRotation) return; 255 | atRotation = true; 256 | var loacl; 257 | if(!point) { 258 | loacl = loaclToLoacl($moveLayer, $clipView, clipWidth * .5, clipHeight * .5); 259 | } else { 260 | loacl = globalToLoacl($moveLayer, point.x, point.y); 261 | } 262 | var origin = calculateOrigin(curAngle, loacl), // 旋转中使用的参考点坐标 263 | originX = origin.x, 264 | originY = origin.y, 265 | 266 | // 旋转层以零位为参考点旋转到新角度后的位置,与以当前计算的参考点“从零度”旋转到新角度后的位置,之间的左上角偏移量 267 | offsetX = 0, 268 | offsetY = 0, 269 | // 移动层当前的位置(即旋转层旋转前的位置),与旋转层以当前计算的参考点从当前角度旋转到新角度后的位置,之间的左上角偏移量 270 | parentOffsetX = 0, 271 | parentOffsetY = 0, 272 | 273 | newAngle = curAngle + angle, 274 | 275 | curImgWidth, // 移动层的当前宽度 276 | curImgHeight; // 移动层的当前高度 277 | 278 | if(newAngle == 90 || newAngle == -270) { 279 | offsetX = originX + originY; 280 | offsetY = originY - originX; 281 | 282 | if(newAngle > curAngle) { 283 | parentOffsetX = imgHeight - originX - originY; 284 | parentOffsetY = originX - originY; 285 | } else if(newAngle < curAngle) { 286 | parentOffsetX = (imgHeight - originY) - (imgWidth - originX); 287 | parentOffsetY = originX + originY - imgHeight; 288 | } 289 | 290 | curImgWidth = imgHeight; 291 | curImgHeight = imgWidth; 292 | } else if(newAngle == 180 || newAngle == -180) { 293 | offsetX = originX * 2; 294 | offsetY = originY * 2; 295 | 296 | if(newAngle > curAngle) { 297 | parentOffsetX = (imgWidth - originX) - (imgHeight - originY); 298 | parentOffsetY = imgHeight - (originX + originY); 299 | } else if(newAngle < curAngle) { 300 | parentOffsetX = imgWidth - (originX + originY); 301 | parentOffsetY = (imgHeight - originY) - (imgWidth - originX); 302 | } 303 | 304 | curImgWidth = imgWidth; 305 | curImgHeight = imgHeight; 306 | } else if(newAngle == 270 || newAngle == -90) { 307 | offsetX = originX - originY; 308 | offsetY = originX + originY; 309 | 310 | if(newAngle > curAngle) { 311 | parentOffsetX = originX + originY - imgWidth; 312 | parentOffsetY = (imgWidth - originX) - (imgHeight - originY); 313 | } else if(newAngle < curAngle) { 314 | parentOffsetX = originY - originX; 315 | parentOffsetY = imgWidth - originX - originY; 316 | } 317 | 318 | curImgWidth = imgHeight; 319 | curImgHeight = imgWidth; 320 | } else if(newAngle == 0 || newAngle == 360 || newAngle == -360) { 321 | offsetX = 0; 322 | offsetY = 0; 323 | 324 | if(newAngle > curAngle) { 325 | parentOffsetX = originX - originY; 326 | parentOffsetY = originX + originY - imgWidth; 327 | } else if(newAngle < curAngle) { 328 | parentOffsetX = originX + originY - imgHeight; 329 | parentOffsetY = originY - originX; 330 | } 331 | 332 | curImgWidth = imgWidth; 333 | curImgHeight = imgHeight; 334 | } 335 | // 将触摸点设为旋转时的参考点 336 | // 改变参考点的同时,要计算坐标的偏移,从而保证图片位置不发生变化 337 | if(curAngle == 0) { 338 | curX = 0; 339 | curY = 0; 340 | } else if(curAngle == 90 || curAngle == -270) { 341 | curX -= originX + originY; 342 | curY -= originY - originX; 343 | } else if(curAngle == 180 || curAngle == -180) { 344 | curX -= originX * 2; 345 | curY -= originY * 2; 346 | } else if(curAngle == 270 || curAngle == -90) { 347 | curX -= originX - originY; 348 | curY -= originX + originY; 349 | } 350 | curX = curX.toFixed(2) - 0; 351 | curY = curY.toFixed(2) - 0; 352 | setTransform($rotateLayer, curX, curY, curAngle, originX, originY); 353 | 354 | // 开始旋转 355 | setTransition($rotateLayer, curX, curY, newAngle, 200, function() { 356 | atRotation = false; 357 | curAngle = newAngle % 360; 358 | // 旋转完成后将参考点设回零位 359 | // 同时加上偏移,保证图片位置看上去没有变化 360 | // 这里要另外要加上父容器(移动层)零位与自身之间的偏移量 361 | curX += offsetX + parentOffsetX; 362 | curY += offsetY + parentOffsetY; 363 | curX = curX.toFixed(2) - 0; 364 | curY = curY.toFixed(2) - 0; 365 | setTransform($rotateLayer, curX, curY, curAngle); 366 | // 相应的父容器(移动层)要减去与旋转层之间的偏移量 367 | // 这样看上去就好像图片没有移动 368 | myScroll.scrollTo( 369 | myScroll.x - parentOffsetX * myScroll.scale, 370 | myScroll.y - parentOffsetY * myScroll.scale 371 | ); 372 | calculateScale(curImgWidth, curImgHeight); 373 | if(myScroll.scale < myScroll.options.zoomMin) { 374 | myScroll.zoom(myScroll.options.zoomMin); 375 | } 376 | 377 | refreshScroll(curImgWidth, curImgHeight); 378 | }); 379 | } 380 | 381 | 382 | function resize() { 383 | hideAction($container, function() { 384 | containerWidth = $container.width(); 385 | containerHeight = $container.height(); 386 | }); 387 | } 388 | 389 | function loaclToLoacl($layerOne, $layerTwo, x, y) { // 计算$layerTwo上的x、y坐标在$layerOne上的坐标 390 | x = x || 0; 391 | y = y || 0; 392 | var layerOneOffset, layerTwoOffset; 393 | hideAction($layerOne, function() { 394 | layerOneOffset = $layerOne.offset(); 395 | }); 396 | hideAction($layerTwo, function() { 397 | layerTwoOffset = $layerTwo.offset(); 398 | }); 399 | return { 400 | x: layerTwoOffset.left - layerOneOffset.left + x, 401 | y: layerTwoOffset.top - layerOneOffset.top + y 402 | }; 403 | } 404 | 405 | function globalToLoacl($layer, x, y) { // 计算相对于窗口的x、y坐标在$layer上的坐标 406 | x = x || 0; 407 | y = y || 0; 408 | var layerOffset; 409 | hideAction($layer, function() { 410 | layerOffset = $layer.offset(); 411 | }); 412 | return { 413 | x: x + $(window).scrollLeft() - layerOffset.left, 414 | y: y + $(window).scrollTop() - layerOffset.top 415 | }; 416 | } 417 | 418 | function hideAction(jq, func) { 419 | if(typeof(func) == "function") func.call(this); 420 | } 421 | 422 | function calculateOrigin(curAngle, point) { 423 | var scale = myScroll.scale; 424 | var origin = {}; 425 | if(curAngle == 0) { 426 | origin.x = point.x / scale; 427 | origin.y = point.y / scale; 428 | } else if(curAngle == 90 || curAngle == -270) { 429 | origin.x = point.y / scale; 430 | origin.y = imgHeight - point.x / scale; 431 | } else if(curAngle == 180 || curAngle == -180) { 432 | origin.x = imgWidth - point.x / scale; 433 | origin.y = imgHeight - point.y / scale; 434 | } else if(curAngle == 270 || curAngle == -90) { 435 | origin.x = imgWidth - point.y / scale; 436 | origin.y = point.x / scale; 437 | } 438 | return origin; 439 | } 440 | 441 | function getScale(w1, h1, w2, h2) { 442 | var sx = w1 / w2; 443 | var sy = h1 / h2; 444 | return sx > sy ? sx : sy; 445 | } 446 | 447 | function calculateScale(width, height) { 448 | myScroll.options.zoomMin = getScale(clipWidth, clipHeight, width, height); 449 | myScroll.options.zoomMax = Math.max(1, myScroll.options.zoomMin); 450 | myScroll.options.zoomStart = Math.min(myScroll.options.zoomMax, getScale(containerWidth, containerHeight, width, height)); 451 | } 452 | //创建图片 453 | function createImg(src) { 454 | if($img) { 455 | $rotateLayer.html('');// 删除旧的图片以释放内存,防止IOS设备的webview崩溃 456 | } 457 | $img = $("").css({"user-select": "none","pointer-events": "none"}); 458 | $img.on('load', function() { 459 | imgLoaded = true; 460 | $rotateLayer.append(this); 461 | hideAction.call(this, $img, function() { 462 | imgWidth = this.naturalWidth; 463 | imgHeight = this.naturalHeight; 464 | }); 465 | hideAction($moveLayer, function() { 466 | resetScroll(); 467 | }); 468 | loadComplete.call(this, this.src); 469 | }); 470 | $img.attr("src", src); 471 | } 472 | 473 | function setTransform($obj, x, y, angle, originX, originY) { 474 | originX = originX || 0; 475 | originY = originY || 0; 476 | var style = {}; 477 | style[prefix + "transform"] = "translateZ(0) translate(" + x + "px," + y + "px) rotate(" + angle + "deg)"; 478 | style[prefix + "transform-origin"] = originX + "px " + originY + "px"; 479 | $obj.css(style); 480 | } 481 | 482 | function setTransition($obj, x, y, angle, dur, fn) { 483 | console.info(1) 484 | // 这里需要先读取之前设置好的transform样式,强制浏览器将该样式值渲染到元素 485 | // 否则浏览器可能出于性能考虑,将暂缓样式渲染,等到之后所有样式设置完成后再统一渲染 486 | // 这样就会导致之前设置的位移也被应用到动画中 487 | $obj.css(prefix + "transform"); 488 | $obj.css(prefix + "transition", prefix + "transform " + dur + "ms"); 489 | $obj.one(transitionEnd, function() { 490 | $obj.css(prefix + "transition", ""); 491 | fn.call(this); 492 | }); 493 | $obj.css(prefix + "transform", "translateZ(0) translate(" + x + "px," + y + "px) rotate(" + angle + "deg)"); 494 | } 495 | 496 | function init() { 497 | // 初始化容器 498 | $container = $(container).css({ 499 | "user-select": "none", 500 | "overflow": "hidden" 501 | }); 502 | if($container.css("position") == "static") $container.css("position", "relative"); 503 | // 创建裁剪视图层 504 | $clipView = $("
    ").css({ 505 | "position": "absolute", 506 | "left": "50%", 507 | "top": "50%", 508 | "width": clipWidth, 509 | "height": clipHeight, 510 | "margin-left": -clipWidth / 2, 511 | "margin-top": -clipHeight / 2 512 | }).appendTo($container); 513 | $moveLayer = $("
    ").appendTo($clipView); 514 | $rotateLayer = $("
    ").appendTo($moveLayer); 515 | // 创建遮罩 516 | var $mask = $("
    ").css({ 517 | "position": "absolute", 518 | "width": clipWidth, 519 | "height": clipHeight, 520 | 'border':$container.height()+'px solid rgba(0, 0, 0, 0.498039)', 521 | 'top':-($container.height()+clipHeight)/2+'px', 522 | 'left':-(($container.height()*2+clipHeight)-$container.width())/2+'px', 523 | "pointer-events": "none" 524 | }).appendTo($container); 525 | var $mask_view=$('
    ').css({ 526 | 'border':'1px dashed rgb(221, 221, 221)', 527 | 'height':clipHeight, 528 | 'margin-left':-1, 529 | 'margin-top':-1, 530 | }).appendTo($mask); 531 | if(circle){ 532 | $mask_view.css('border-radius','50%'); 533 | $mask.css('border-radius','50%'); 534 | } 535 | // 初始化视图容器 536 | $view = $(view); 537 | if($view.length) { 538 | $view.css({ 539 | "background-color": "#666", 540 | "background-repeat": "no-repeat", 541 | "background-position": "center", 542 | "background-size": "contain" 543 | }); 544 | } 545 | } 546 | 547 | //销毁 548 | function destroy() { 549 | $(file).off("change"); 550 | $(file) = null; 551 | if(hammerManager) { 552 | hammerManager.off("rotatemove"); 553 | hammerManager.off("rotateend"); 554 | hammerManager.destroy(); 555 | hammerManager = null; 556 | } else { 557 | $moveLayer.off("dblclick"); 558 | } 559 | myScroll.destroy(); 560 | myScroll = null; 561 | $container.empty(); 562 | $container = null; 563 | $clipView = null; 564 | $moveLayer = null; 565 | $rotateLayer = null; 566 | 567 | $view.css({ 568 | "background-color": "", 569 | "background-repeat": "", 570 | "background-position": "", 571 | "background-size": "" 572 | }); 573 | $view = null; 574 | } 575 | } 576 | 577 | //css3兼容性 578 | var prefix = '', 579 | transitionEnd; 580 | (function() { 581 | var eventPrefix, 582 | vendors = { 583 | Webkit: 'webkit', 584 | Moz: '', 585 | O: 'o' 586 | }, 587 | testEl = document.documentElement, 588 | normalizeEvent = function(name) { 589 | return eventPrefix ? eventPrefix + name : name.toLowerCase() 590 | }; 591 | for(var i in vendors) { 592 | if(testEl.style[i + 'TransitionProperty'] !== undefined) { 593 | prefix = '-' + i.toLowerCase() + '-'; 594 | eventPrefix = vendors[i]; 595 | break; 596 | } 597 | } 598 | transitionEnd = normalizeEvent('TransitionEnd'); 599 | })(); 600 | 601 | var exports = { 602 | clipImage: function(container, option) { 603 | clipImage(container, option); 604 | } 605 | }; 606 | module.exports = exports; 607 | }); --------------------------------------------------------------------------------