HuaJingwen 6 anni fa
commit
1cc2c6d033
15 ha cambiato i file con 957 aggiunte e 0 eliminazioni
  1. 9 0
      dist/axios.min.js
  2. 264 0
      dist/index.js
  3. 19 0
      dist/swiper.min.js
  4. 50 0
      eg/base.js
  5. 77 0
      eg/slideshow.css
  6. 37 0
      eg/slideshow.html
  7. 135 0
      eg/slideshow.js
  8. BIN
      img/icon-price.png
  9. BIN
      img/icon.png
  10. BIN
      img/invinting.png
  11. BIN
      img/invinting2.png
  12. 223 0
      index.css
  13. 75 0
      index.html
  14. 16 0
      index.js
  15. 52 0
      inviting.html

File diff suppressed because it is too large
+ 9 - 0
dist/axios.min.js


+ 264 - 0
dist/index.js

@@ -0,0 +1,264 @@
1
+/*封装一些公用的事件或者公用的方法*/
2
+
3
+/*定义的一个命名空间*/
4
+window.my = {};
5
+/* 获取url参数 */
6
+my.getURLCode = function (){
7
+        var search = location.search.length > 0 ? location.search.substring(1) : '',
8
+              args = {},
9
+              items = search.length ? search.split('&') : [],
10
+              item = null,
11
+              name = null,
12
+              value = null,
13
+              i = 0,
14
+              len = items.length,
15
+              data = '';
16
+        for (i = 0; i < len; i++) {
17
+          item = items[i].split('=');
18
+          name = decodeURIComponent(item[0]);
19
+          value = decodeURIComponent(item[1]);
20
+          if (item.length) {args[name] = value }
21
+        }
22
+        return args;
23
+    },
24
+/*封装一个事件 过渡结束事件*/
25
+my.transitionEnd = function(dom,callback){
26
+    //1.给谁加事件
27
+    //2.事件触发后处理什么业务
28
+    if(!dom || typeof dom != 'object'){
29
+        //没dom的时候或者不是一个对象的时候 程序停止
30
+        return false;
31
+    }
32
+    dom.addEventListener('transitionEnd', function(){
33
+        callback && callback();
34
+    });
35
+    dom.addEventListener('webkitTransitionEnd', function(){
36
+        callback && callback();
37
+    });
38
+}
39
+
40
+//封装一个tap事件
41
+my.tap = function(dom,callback){
42
+    if(!dom || typeof dom != 'object'){
43
+        //没dom的时候或者不是一个对象的时候 程序停止
44
+        return false;
45
+    }
46
+
47
+    var isMove = false; //是否滑动过
48
+    var time = 0;   //刚刚触摸屏幕的事件  touchstart的触发事件
49
+
50
+    dom.addEventListener('touchstart',function(){
51
+        //记录触发这个事件的时间
52
+        time = Date.now();  //时间戳 毫秒
53
+    });
54
+    dom.addEventListener('touchmove',function(){
55
+        isMove = true;
56
+    });
57
+    window.addEventListener('touchend',function(e){
58
+        //1.没有滑动过
59
+        //2.响应事件在150ms以内   要求比click要响应快
60
+        if(!isMove && (Date.now()-time)<150 ){
61
+            callback && callback(e);
62
+        }
63
+
64
+        //重置参数
65
+        isMove = false;
66
+        time = 0;
67
+    });
68
+
69
+}
70
+/* to swiper */
71
+function startSwiper(imageCount) {
72
+    var banner = document.querySelector('.swiper-wrapper');   //轮播图大盒子
73
+    var imageBox = banner.querySelector('.swiper-wrapper .swiper-item');   //图片盒子
74
+    var pointBox = banner.querySelector('.swiper-wrapper .swiper-point');   //点盒子
75
+    var imageCount = imageCount; //页面中用来轮播的图片有5张不同的
76
+    var width = banner.offsetWidth;  //图片的宽度
77
+    var points = pointBox.querySelectorAll('li'); //所有的点
78
+
79
+    //加过渡
80
+    var addTransition = function(){
81
+        imageBox.style.transition = "all 0.3s";
82
+        imageBox.style.webkitTransition = "all 0.3s";/*做兼容*/
83
+    };
84
+    //清除过渡
85
+    var removeTransition = function(){
86
+        imageBox.style.transition = "none";
87
+        imageBox.style.webkitTransition = "none";
88
+    }
89
+    //定位
90
+    var setTranslateX = function(translateX){
91
+        var translateX = translateX + 375;
92
+        imageBox.style.transform = "translateX("+translateX+"px)";
93
+        imageBox.style.webkitTransform = "translateX("+translateX+"px)";
94
+    }
95
+
96
+    //自动轮播  定时器  无缝衔接  动画结束瞬间定位
97
+    var index = 1;
98
+    var timer = setInterval(function(){
99
+        index++ ;   //自动轮播到下一张
100
+        //改变定位  动画的形式去改变  transition transform translate
101
+        addTransition();    //加过渡动画
102
+        // console.log(index, -index * width);
103
+        setTranslateX(-index * width);  //定位
104
+    }, 3000);
105
+
106
+    //等过渡结束之后来做无缝衔接
107
+    my.transitionEnd(imageBox, function(){
108
+        //处理事件结束后的业务逻辑
109
+        if(index > imageCount ){
110
+            index = 1;
111
+        }else if(index <= 0){
112
+            index = imageCount;
113
+        }
114
+        removeTransition(); //清除过渡
115
+        setTranslateX(-index * width);  //定位
116
+        setPoint(); //设置底部显示当前图片对应的圆角
117
+    });
118
+
119
+    //改变当前样式  当前图片的索引
120
+    var setPoint = function(){
121
+        //清除上一次的now
122
+        for(var i = 0 ; i < points.length ; i++){
123
+            points[i].className = " ";
124
+        }
125
+        //给图片对应的点加上样式
126
+        points[index-1].className = "now";
127
+    }
128
+
129
+    /*
130
+     手指滑动的时候让轮播图滑动   touch事件  记录坐标轴的改变 改变轮播图的定位(位移css3)
131
+     当滑动的距离不超过一定的距离的时候  需要吸附回去  过渡的形式去做
132
+     当滑动超过了一定的距离  需要 跳到 下一张或者上一张  (滑动的方向) 一定的距离(屏幕的三分之一)
133
+     */
134
+    //touch事件
135
+    var startX = 0; //记录起始  刚刚触摸的点的位置 x的坐标
136
+    var moveX = 0;  //滑动的时候x的位置
137
+    var distanceX = 0;  //滑动的距离
138
+    var isMove = false; //是否滑动过
139
+
140
+    imageBox.addEventListener('touchstart', function(e){
141
+        clearInterval(timer);   //清除定时器
142
+        startX = e.touches[0].clientX;  //记录起始X
143
+    });
144
+
145
+    imageBox.addEventListener('touchmove',function(e){
146
+        moveX = e.touches[0].clientX;   //滑动时候的X
147
+        distanceX = moveX - startX; //计算移动的距离
148
+        //计算当前定位  -index*width+distanceX
149
+        removeTransition(); //清除过渡
150
+        setTranslateX(-index * width + distanceX);  //实时的定位
151
+        isMove = true;  //证明滑动过
152
+    });
153
+
154
+    //在模拟器上模拟的滑动会有问题 丢失的情况  最后在模拟器的时候用window
155
+    imageBox.addEventListener('touchend', function(e){
156
+        // 滑动超过 1/3 即为滑动有效,否则即为无效,则吸附回去
157
+        if(isMove && Math.abs(distanceX) > width/3){
158
+            //5.当滑动超过了一定的距离  需要 跳到 下一张或者上一张  (滑动的方向)*/
159
+            if(distanceX > 0){  //上一张
160
+                index --;
161
+            }
162
+            else{   //下一张
163
+                index ++;
164
+            }
165
+        }
166
+        addTransition();    //加过渡动画
167
+        setTranslateX(-index * width);    //定位
168
+
169
+        if(index > imageCount ){
170
+            index = 1;
171
+        }else if(index <= 0){
172
+            index = imageCount;
173
+        }
174
+        setPoint();
175
+
176
+        //重置参数
177
+        startX = 0;
178
+        moveX = 0;
179
+        distanceX = 0;
180
+        isMove = false;
181
+        //加定时器
182
+        clearInterval(timer);   //严谨 再清除一次定时器
183
+        timer= setInterval(function(){
184
+            index++ ;  //自动轮播到下一张
185
+            addTransition();    //加过渡动画
186
+            setTranslateX(-index * width);    //定位
187
+        },3000);
188
+    });
189
+}
190
+
191
+/*copy to clipboard*/
192
+function toCopy() {
193
+    if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
194
+    //区分iPhone设备
195
+        window.getSelection().removeAllRanges();//这段代码必须放在前面否则无效
196
+        var Url2=document.getElementById("biaoios");//要复制文字的节点
197
+        var range = document.createRange();
198
+        // 选中需要复制的节点
199
+        range.selectNode(Url2);
200
+        // 执行选中元素
201
+        window.getSelection().addRange(range);
202
+        // 执行 copy 操作
203
+        var successful = document.execCommand('copy');
204
+
205
+        // 移除选中的元素
206
+        window.getSelection().removeAllRanges();
207
+    }else{
208
+        var Url2=document.getElementById("biao1");//要复制文字的节点
209
+        Url2.select(); // 选择对象
210
+        document.execCommand("Copy"); // 执行浏览器复制命令
211
+    }
212
+}
213
+
214
+window.onload = function () {
215
+    var args = my.getURLCode();
216
+    var goods_id = args['goods_id'] || 0,
217
+         is_coupon = args['is_coupon'] || 0,
218
+         user_id = args['user_id'] || 0;
219
+    var btn = document.querySelector('.btn-wrapper .btn');
220
+    axios.post('/api/v2/goods/tdetail', {
221
+        goods_id: goods_id,
222
+        is_coupon: is_coupon,
223
+        user_id: user_id
224
+      })
225
+      .then(function (response) {
226
+        var res = response.data, data = null, html = '', imgList = [], swiperStr = '', pointStr = '', len = 0;
227
+        var swiper = document.querySelector('.swiper-wrapper .swiper-item'),
228
+              point = document.querySelector('.swiper-wrapper .swiper-point'),
229
+              detailsWrapper = document.querySelector('.details-wrapper')
230
+
231
+              ;
232
+        console.log(swiper);
233
+        if (res.errno == 0) {
234
+            data = res.rst.data;
235
+            imgList = res.rst.data.small_img;
236
+            len = imgList.length;
237
+            if (len > 0) {
238
+                for (var i = 0; i < len; i++) {
239
+                    swiperStr += '<li><a href="javascript: ;"><img src="'+ imgList[i] +'"></a></li>';
240
+                    if (i === 0) {
241
+                        pointStr += '<li  class="now"></li>';
242
+                    }else{
243
+                        pointStr += '<li></li>';
244
+                    }
245
+                }
246
+                 swiperStr += '<li><a href="javascript: ;"><img src="'+ imgList[0] +'"></a></li>';
247
+            }
248
+            html = '<h5 class="price"><span>券后 ¥</span><em>'+ data.discount_price +'</em><span class="icon icon-price">券&nbsp;&nbsp; '+ data.coupon_price
249
+ +'元</span></h5><div class="info"><p class="before-price">价格 <span>'+ data.price +'</span></p><p class="quantity"> 月销 '+ data.volume +'</p></div><p class="elli desc">'+ data.title +'</p>'
250
+            detailsWrapper.innerHTML = html;
251
+            swiper.innerHTML = swiperStr;
252
+            point.innerHTML = pointStr;
253
+            startSwiper(len);
254
+        }
255
+      })
256
+      .catch(function (error) {
257
+        console.log(error);
258
+      });
259
+
260
+      btn.addEventListener('click', function () {
261
+        console.log('test');
262
+            toCopy();
263
+      }, false)
264
+}

File diff suppressed because it is too large
+ 19 - 0
dist/swiper.min.js


+ 50 - 0
eg/base.js

@@ -0,0 +1,50 @@
1
+/*封装一些公用的事件或者公用的方法*/
2
+
3
+/*定义的一个命名空间*/
4
+window.my = {};
5
+/*封装一个事件 过渡结束事件*/
6
+my.transitionEnd = function(dom,callback){
7
+    //1.给谁加事件
8
+    //2.事件触发后处理什么业务
9
+    if(!dom || typeof dom != 'object'){
10
+        //没dom的时候或者不是一个对象的时候 程序停止
11
+        return false;
12
+    }
13
+    dom.addEventListener('transitionEnd', function(){
14
+        callback && callback();
15
+    });
16
+    dom.addEventListener('webkitTransitionEnd', function(){
17
+        callback && callback();
18
+    });
19
+}
20
+
21
+//封装一个tap事件
22
+my.tap = function(dom,callback){
23
+    if(!dom || typeof dom != 'object'){
24
+        //没dom的时候或者不是一个对象的时候 程序停止
25
+        return false;
26
+    }
27
+
28
+    var isMove = false; //是否滑动过
29
+    var time = 0;   //刚刚触摸屏幕的事件  touchstart的触发事件
30
+
31
+    dom.addEventListener('touchstart',function(){
32
+        //记录触发这个事件的时间
33
+        time = Date.now();  //时间戳 毫秒
34
+    });
35
+    dom.addEventListener('touchmove',function(){
36
+        isMove = true;
37
+    });
38
+    window.addEventListener('touchend',function(e){
39
+        //1.没有滑动过
40
+        //2.响应事件在150ms以内   要求比click要响应快
41
+        if(!isMove && (Date.now()-time)<150 ){
42
+            callback && callback(e);
43
+        }
44
+
45
+        //重置参数
46
+        isMove = false;
47
+        time = 0;
48
+    });
49
+
50
+}

+ 77 - 0
eg/slideshow.css

@@ -0,0 +1,77 @@
1
+*,
2
+::before,
3
+::after{
4
+    padding: 0;
5
+    margin: 0;
6
+    -webkit-box-sizing: border-box;/*兼容移动端主流浏览器*/
7
+    box-sizing: border-box;
8
+    -webkit-tap-highlight-color: transparent;/*清除移动端点击高亮效果*/
9
+}
10
+body{
11
+    font-family:Microsoft YaHei,sans-serif;/*移动端默认的字体*/
12
+    font-size: 14px;
13
+    color: #333;
14
+}
15
+ol,ul{
16
+    list-style: none;
17
+}
18
+/*清除浮动*/
19
+.clearfix::before,
20
+.clearfix::after{
21
+    content: "";
22
+    display: block;
23
+    height: 0;
24
+    line-height: 0;
25
+    visibility: hidden;
26
+    clear: both;
27
+}
28
+
29
+.layout{
30
+    width: 100%;
31
+    max-width: 750px;
32
+    min-width: 320px;
33
+    margin: 0 auto;
34
+    position: relative;
35
+}
36
+.banner{
37
+    width: 100%;
38
+    overflow: hidden;
39
+    position: relative;
40
+}
41
+.banner ul:first-child{
42
+    width: 1000%;
43
+    -webkit-transform: translateX(-10%);
44
+    transform: translateX(-10%);
45
+}
46
+.banner ul:first-child li{
47
+    width: 10%;
48
+    float: left;
49
+}
50
+.banner ul:first-child li a{
51
+    display: block;
52
+    width: 100%;
53
+}
54
+.banner ul:first-child li a img{
55
+    width: 100%;
56
+    display: block;
57
+}
58
+.banner ul:last-child{
59
+    position: absolute;
60
+    bottom: 6px;
61
+    width: 100%;
62
+    text-align: center;
63
+}
64
+.banner ul:last-child li{
65
+    width: 6px;
66
+    height: 6px;
67
+    border: 1px solid #fff;
68
+    border-radius: 50%;
69
+    display: inline-block;
70
+    margin-left: 10px;
71
+}
72
+.banner ul:last-child li:first-child{
73
+    margin-left: 0;
74
+}
75
+.banner ul:last-child li.now{
76
+    background: #fff;
77
+}

+ 37 - 0
eg/slideshow.html

@@ -0,0 +1,37 @@
1
+<!DOCTYPE html>
2
+<html lang="en">
3
+<head>
4
+    <meta charset="UTF-8">
5
+    <meta name="viewport"
6
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7
+    <title></title>
8
+    <link rel="stylesheet" href="slideshow.css">
9
+</head>
10
+<body>
11
+<!-- <div class="layout"> -->
12
+    <div class="banner">
13
+        <ul class="clearfix">
14
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180409/1523252985675069.jpg"></a></li>
15
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180518/1526629597825769.jpg"></a></li>
16
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180502/1525253753560504.png"></a></li>
17
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20171123/1511420419308673.png"></a></li>
18
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180521/1526897525753766.png"></a></li>
19
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180509/1525849287291571.jpg"></a></li>
20
+            <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180515/1526368416232243.png"></a></li>
21
+        </ul>
22
+        <ul>
23
+            <li class="now"></li>
24
+            <li></li>
25
+            <li></li>
26
+            <li></li>
27
+            <li></li>
28
+            <li></li>
29
+            <li></li>
30
+        </ul>
31
+    </div>
32
+<!-- </div> -->
33
+
34
+<script src="base.js"></script>
35
+<script src="slideshow.js"></script>
36
+</body>
37
+</html>

+ 135 - 0
eg/slideshow.js

@@ -0,0 +1,135 @@
1
+/**
2
+ * Created by libo on 2017/11/9.
3
+ */
4
+window.onload = function(){
5
+    /*
6
+     * 1.×Ô¶¯ÂÖ²¥  ¶¨Ê±Æ÷  ÎÞ·ìÏÎ½Ó  ¶¯»­½áÊø˲¼ä¶¨Î»
7
+     * 2.µãÐèÒªËæ×ÅÂÖ²¥µÄ¹ö¶¯¸Ä±ä¶ÔÓ¦µÄµã  ¸Ä±äµ±Ç°Ñùʽ  µ±Ç°Í¼Æ¬µÄË÷Òý
8
+     * 3.ÊÖÖ¸»¬¶¯µÄʱºòÈÃÂÖ²¥Í¼»¬¶¯   touchʼþ  ¼Ç¼×ø±êÖáµÄ¸Ä±ä ¸Ä±äÂÖ²¥Í¼µÄ¶¨Î»£¨Î»ÒÆcss3£©
9
+     * 4.µ±»¬¶¯µÄ¾àÀë²»³¬¹ýÒ»¶¨µÄ¾àÀëµÄʱºò  ÐèÒªÎü¸½»ØÈ¥  ¹ý¶ÉµÄÐÎʽȥ×ö
10
+     * 5.µ±»¬¶¯³¬¹ýÁËÒ»¶¨µÄ¾àÀë  ÐèÒª Ìøµ½ ÏÂÒ»ÕÅ»òÕßÉÏÒ»ÕÅ  £¨»¬¶¯µÄ·½Ïò£© Ò»¶¨µÄ¾àÀ루ÆÁÄ»µÄÈý·ÖÖ®Ò»£©
11
+     * */
12
+
13
+    var imageCount = 7; //Ò³ÃæÖÐÓÃÀ´ÂÖ²¥µÄͼƬÓÐ5ÕŲ»Í¬µÄ
14
+    //ÂÖ²¥Í¼´óºÐ×Ó
15
+    var banner = document.querySelector('.banner');
16
+    //ͼƬµÄ¿í¶È
17
+    var width = banner.offsetWidth;
18
+    //ͼƬºÐ×Ó
19
+    var imageBox = banner.querySelector('ul:first-child');
20
+    //µãºÐ×Ó
21
+    var pointBox = banner.querySelector('ul:last-child');
22
+    //ËùÓеĵã
23
+    var points = pointBox.querySelectorAll('li');
24
+
25
+    //¹«Ó÷½·¨
26
+    //¼Ó¹ý¶É
27
+    var addTransition = function(){
28
+        imageBox.style.transition = "all 0.3s";
29
+        imageBox.style.webkitTransition = "all 0.3s";/*×ö¼æÈÝ*/
30
+    };
31
+    //Çå³ý¹ý¶É
32
+    var removeTransition = function(){
33
+        imageBox.style.transition = "none";
34
+        imageBox.style.webkitTransition = "none";
35
+    }
36
+    //¶¨Î»
37
+    var setTranslateX = function(translateX){
38
+        var translateX = translateX + 375
39
+        imageBox.style.transform = "translateX("+translateX+"px)";
40
+        imageBox.style.webkitTransform = "translateX("+translateX+"px)";
41
+    }
42
+
43
+    //¹¦ÄÜʵÏÖ
44
+    //×Ô¶¯ÂÖ²¥  ¶¨Ê±Æ÷  ÎÞ·ìÏÎ½Ó  ¶¯»­½áÊø˲¼ä¶¨Î»
45
+    var index = 1;
46
+    var timer = setInterval(function(){
47
+        index++ ;   //×Ô¶¯ÂÖ²¥µ½ÏÂÒ»ÕÅ
48
+        addTransition();    //¼Ó¹ý¶É¶¯»­
49
+        setTranslateX(-index * width);  //¶¨Î»
50
+    },3000);
51
+
52
+    //µÈ¹ý¶É½áÊøÖ®ºóÀ´×öÎÞ·ìÏνÓ
53
+    my.transitionEnd(imageBox, function(){
54
+        //´¦Àíʼþ½áÊøºóµÄÒµÎñÂß¼­
55
+        if(index > imageCount ){
56
+            index = 1;
57
+        }else if(index <= 0){
58
+            index = imageCount;
59
+        }
60
+        removeTransition(); //Çå³ý¹ý¶É
61
+        setTranslateX(-index * width);  //¶¨Î»
62
+        setPoint(); //ÉèÖõײ¿ÏÔʾµ±Ç°Í¼Æ¬¶ÔÓ¦µÄÔ²½Ç
63
+    });
64
+
65
+    //¸Ä±äµ±Ç°Ñùʽ  µ±Ç°Í¼Æ¬µÄË÷Òý
66
+    var setPoint = function(){
67
+        //Çå³ýÉÏÒ»´ÎµÄnow
68
+        for(var i = 0 ; i < points.length ; i++){
69
+            points[i].className = " ";
70
+        }
71
+        //¸øͼƬ¶ÔÓ¦µÄµã¼ÓÉÏÑùʽ
72
+        points[index-1].className = "now";
73
+    }
74
+
75
+    /*
76
+     ÊÖÖ¸»¬¶¯µÄʱºòÈÃÂÖ²¥Í¼»¬¶¯   touchʼþ  ¼Ç¼×ø±êÖáµÄ¸Ä±ä ¸Ä±äÂÖ²¥Í¼µÄ¶¨Î»£¨Î»ÒÆcss3£©
77
+     µ±»¬¶¯µÄ¾àÀë²»³¬¹ýÒ»¶¨µÄ¾àÀëµÄʱºò  ÐèÒªÎü¸½»ØÈ¥  ¹ý¶ÉµÄÐÎʽȥ×ö
78
+     µ±»¬¶¯³¬¹ýÁËÒ»¶¨µÄ¾àÀë  ÐèÒª Ìøµ½ ÏÂÒ»ÕÅ»òÕßÉÏÒ»ÕÅ  £¨»¬¶¯µÄ·½Ïò£© Ò»¶¨µÄ¾àÀ루ÆÁÄ»µÄÈý·ÖÖ®Ò»£©
79
+     */
80
+    //touchʼþ
81
+    var startX = 0; //¼Ç¼Æðʼ  ¸Õ¸Õ´¥ÃþµÄµãµÄλÖà xµÄ×ø±ê
82
+    var moveX = 0;  //»¬¶¯µÄʱºòxµÄλÖÃ
83
+    var distanceX = 0;  //»¬¶¯µÄ¾àÀë
84
+    var isMove = false; //ÊÇ·ñ»¬¶¯¹ý
85
+
86
+    imageBox.addEventListener('touchstart', function(e){
87
+        clearInterval(timer);   //Çå³ý¶¨Ê±Æ÷
88
+        startX = e.touches[0].clientX;  //¼Ç¼ÆðʼX
89
+    });
90
+
91
+    imageBox.addEventListener('touchmove',function(e){
92
+        moveX = e.touches[0].clientX;   //»¬¶¯Ê±ºòµÄX
93
+        distanceX = moveX - startX; //¼ÆËãÒƶ¯µÄ¾àÀë
94
+        //¼ÆË㵱ǰ¶¨Î»  -index*width+distanceX
95
+        removeTransition(); //Çå³ý¹ý¶É
96
+        setTranslateX(-index * width + distanceX);  //ʵʱµÄ¶¨Î»
97
+        isMove = true;  //Ö¤Ã÷»¬¶¯¹ý
98
+    });
99
+
100
+    //ÔÚÄ£ÄâÆ÷ÉÏÄ£ÄâµÄ»¬¶¯»áÓÐÎÊÌâ ¶ªÊ§µÄÇé¿ö  ×îºóÔÚÄ£ÄâÆ÷µÄʱºòÓÃwindow
101
+    imageBox.addEventListener('touchend', function(e){
102
+        // »¬¶¯³¬¹ý 1/3 ¼´Îª»¬¶¯ÓÐЧ£¬·ñÔò¼´ÎªÎÞЧ£¬ÔòÎü¸½»ØÈ¥
103
+        if(isMove && Math.abs(distanceX) > width/3){
104
+            //5.µ±»¬¶¯³¬¹ýÁËÒ»¶¨µÄ¾àÀë  ÐèÒª Ìøµ½ ÏÂÒ»ÕÅ»òÕßÉÏÒ»ÕÅ  £¨»¬¶¯µÄ·½Ïò£©*/
105
+            if(distanceX > 0){  //ÉÏÒ»ÕÅ
106
+                index --;
107
+            }
108
+            else{   //ÏÂÒ»ÕÅ
109
+                index ++;
110
+            }
111
+        }
112
+        addTransition();    //¼Ó¹ý¶É¶¯»­
113
+        setTranslateX(-index * width);    //¶¨Î»
114
+
115
+        if(index > imageCount ){
116
+            index = 1;
117
+        }else if(index <= 0){
118
+            index = imageCount;
119
+        }
120
+        setPoint();
121
+
122
+        //ÖØÖòÎÊý
123
+        startX = 0;
124
+        moveX = 0;
125
+        distanceX = 0;
126
+        isMove = false;
127
+        //¼Ó¶¨Ê±Æ÷
128
+        clearInterval(timer);   //ÑϽ÷ ÔÙÇå³ýÒ»´Î¶¨Ê±Æ÷
129
+        timer= setInterval(function(){
130
+            index++ ;  //×Ô¶¯ÂÖ²¥µ½ÏÂÒ»ÕÅ
131
+            addTransition();    //¼Ó¹ý¶É¶¯»­
132
+            setTranslateX(-index * width);    //¶¨Î»
133
+        },3000);
134
+    });
135
+};

BIN
img/icon-price.png


BIN
img/icon.png


BIN
img/invinting.png


BIN
img/invinting2.png


+ 223 - 0
index.css

@@ -0,0 +1,223 @@
1
+html,
2
+body,
3
+div,
4
+h3, h4, h5, h6, p,
5
+span, em, i,
6
+::before,
7
+::after{
8
+    padding: 0;
9
+    margin: 0;
10
+    -webkit-box-sizing: border-box;
11
+    box-sizing: border-box;
12
+    -webkit-tap-highlight-color: transparent;
13
+}
14
+ol, ul{
15
+    list-style: none;
16
+    padding: 0;
17
+    margin: 0;
18
+}
19
+body{
20
+    font-size: 14px;
21
+    color: #333;
22
+}
23
+em, i{
24
+    font-style: normal;
25
+}
26
+.clearfix::before,
27
+.clearfix::after{
28
+    content: "";
29
+    display: block;
30
+    height: 0;
31
+    line-height: 0;
32
+    visibility: hidden;
33
+    clear: both;
34
+}
35
+.elli{
36
+    display: box;
37
+    overflow: hidden;
38
+    text-overflow: ellipsis;
39
+    display: -webkit-box;
40
+    -webkit-line-clamp: 2;
41
+    -webkit-box-orient: vertical;
42
+}
43
+
44
+
45
+.download-wrapper {
46
+    display: flex;
47
+    display: -webkit-flex;
48
+    width: 100%;
49
+    height: 0.92rem;
50
+    align-items: center;
51
+    justify-content: center;
52
+    padding: 0.1rem 0.2rem;
53
+    background: #F4F4F4;
54
+}
55
+.download-wrapper .img-box{
56
+    flex: 0 0 0.72rem;
57
+    margin-right: 12px;
58
+}
59
+.download-wrapper .img-box img{
60
+    width: 100%;
61
+    height: 100%;
62
+}
63
+.download-wrapper .content{
64
+    flex: 1;
65
+}
66
+.download-wrapper .content .title{
67
+    font-size: 16px;
68
+    font-weight: 500;
69
+    line-height: 20px;
70
+}
71
+.download-wrapper .content .text{
72
+    font-size: 10px;
73
+    color: #666;
74
+    line-height: 14px;
75
+}
76
+.download-wrapper button{
77
+    flex: 0 0 1.48rem;
78
+    height: 0.56rem;
79
+    margin: auto;
80
+    background: linear-gradient(-90deg, #FF6900, #FFA500);
81
+    border-radius: 28px;
82
+    border: 0 none;
83
+    font-size: 14px;
84
+    color: #FFFFFF;
85
+}
86
+/*. download-wrapper .img-box,
87
+.download-wrapper .content,
88
+.download-wrapper button{
89
+} */
90
+.swiper-wrapper{
91
+    width: 7.5rem;
92
+    height: 7.5rem;
93
+    /*background-color: #f5f5f5;*/
94
+    /*width: 100%;*/
95
+    overflow: hidden;
96
+    position: relative;
97
+}
98
+.swiper-wrapper .swiper-item{
99
+    width: 1000%;
100
+    /*-webkit-transform: translateX(-10%);*/
101
+    /*transform: translateX(-10%);*/
102
+}
103
+.swiper-wrapper .swiper-item li{
104
+    width: 10%;
105
+    float: left;
106
+}
107
+.swiper-wrapper .swiper-item li a{
108
+    display: block;
109
+    width: 100%;
110
+}
111
+.swiper-wrapper .swiper-item li a img{
112
+    display: block;
113
+    width: 100%;
114
+}
115
+.swiper-wrapper .swiper-point{
116
+    position: absolute;
117
+    bottom: 6px;
118
+    width: 100%;
119
+    text-align: center;
120
+}
121
+.swiper-wrapper .swiper-point li{
122
+    width: 3px;
123
+    height: 3px;
124
+    border-radius: 50%;
125
+    display: inline-block;
126
+    margin-left: 10px;
127
+    background: #CFCFCF;
128
+}
129
+.swiper-wrapper .swiper-point li:first-child{
130
+    margin-left: 0;
131
+}
132
+.swiper-wrapper .swiper-point li.now{
133
+    width: 8px;
134
+    background: #fff;
135
+    border-radius: 0;
136
+}
137
+
138
+.details-wrapper{
139
+    display: flex;
140
+    display: -webkit-flex;
141
+    flex-direction: column;
142
+    width: 100%;
143
+    padding: 0 0.2rem;
144
+}
145
+.details-wrapper .price{
146
+    margin-top: 16px;
147
+    font-size: 0px;
148
+    font-weight: normal;
149
+}
150
+.details-wrapper .price span{
151
+    color: #FF1E00;
152
+    font-size: 12px;
153
+    font-weight: normal;
154
+}
155
+.details-wrapper .price em{
156
+    line-height: 30px;
157
+    font-size: 22px;
158
+    color: #FF1E00;
159
+}
160
+span.icon.icon-price{
161
+    display: inline-block;
162
+    vertical-align: top;
163
+    width: 1.28rem;
164
+    height: 0.28rem;
165
+    margin-top: 9px;
166
+    margin-left: 10px;
167
+    background: url('img/icon-price.png') no-repeat center center;
168
+    -webkit-background-size: 100% 100%;
169
+    background-size: 100% 100%;
170
+    font-size: 10px;
171
+    color: #fff;
172
+    padding: 0px 5px;
173
+}
174
+
175
+.details-wrapper .info{
176
+    display: flex;
177
+    display: -webkit-flex;
178
+    justify-content: space-between;
179
+    align-items: center;
180
+    height: 18px;
181
+    margin: 9px 0 5px;
182
+    color: #878787;
183
+    font-size: 13px;
184
+}
185
+.details-wrapper .desc{
186
+    font-size: 15px;
187
+    line-height: 20px;
188
+}
189
+.btn-wrapper{
190
+    position: fixed;
191
+    bottom: 0;
192
+    left: 0;
193
+    width: 100%;
194
+    height: 50px;
195
+}
196
+.btn-wrapper .btn{
197
+    width: 100%;
198
+    height: 100%;
199
+    border: 0 none;
200
+    font-size: 16px;
201
+    color: #fff;
202
+    background: linear-gradient(90deg, #FF9000, #FF5000);
203
+}
204
+.btn-wrapper .btn em{
205
+    font-weight: 500;
206
+}
207
+
208
+/*.step-wrapper{
209
+    margin: 30px auto;
210
+    font-size: 14px;
211
+    line-height: 20px;
212
+    padding-left: 0.2rem;
213
+}
214
+.inviting-pic{
215
+    width: 5.6rem;
216
+    height: 7.76rem;
217
+    box-shadow: 0 4px 13px rgba(0, 0, 0, 0.15);
218
+    margin: 0 auto;
219
+    border-radius: 10px;
220
+}*/
221
+
222
+
223
+

+ 75 - 0
index.html

@@ -0,0 +1,75 @@
1
+<html>
2
+    <head>
3
+        <meta charset="utf-8">
4
+        <title></title>
5
+        <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
6
+        <meta name="format-detection" content="telephone=no,address=no,email=no" />
7
+        <meta name="mobileOptimized" content="width" />
8
+        <meta name="handheldFriendly" content="true" />
9
+        <meta name="apple-mobile-web-app-capable" content="yes" />
10
+        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
11
+        <meta name="description" content="" />
12
+        <meta name="keywords" content=""/>
13
+        <script>
14
+            ;(function() {
15
+              var docEl = document.documentElement,
16
+              resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
17
+              clientWidth = docEl.clientWidth;
18
+              s();
19
+              window.addEventListener(resizeEvt, s, false);
20
+
21
+              function s() {
22
+                docEl.style.fontSize = 50.0 * (clientWidth / 375) + 'px';
23
+              }
24
+            })();
25
+        </script>
26
+        <script>
27
+              var _ua = navigator.userAgent;
28
+              if (!!_ua.match(/.*OS\s([\d_]+)/) || !!_ua.match(/(Android)\s+([\d.]+)/)) {
29
+                document.write('<style>body{min-width:320px;min-height:320px;}</style>');
30
+              }
31
+        </script>
32
+        <link rel="stylesheet" type="text/css" href="index.css">
33
+        <style type="text/css" media="screen">
34
+        </style>
35
+    </head>
36
+    <body>
37
+        <div class="download-wrapper">
38
+            <div class="img-box"><img src="img/icon.png" alt=""></div>
39
+            <div class="content">
40
+              <h6 class="title">省钱达人</h6>
41
+              <p class="text">购物省钱,分享赚钱,更多奖励等你来</p>
42
+            </div>
43
+            <button type="button">下载APP</button>
44
+        </div>
45
+        <div class="swiper-wrapper">
46
+              <ul class="clearfix swiper-item">
47
+                  <li><a href="javascript: ;"><img src="http://img.henhaojie.com/Homeact/20180409/1523252985675069.jpg"></a></li>
48
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180518/1526629597825769.jpg"></a></li>
49
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180502/1525253753560504.png"></a></li>
50
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20171123/1511420419308673.png"></a></li>
51
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180521/1526897525753766.png"></a></li>
52
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180509/1525849287291571.jpg"></a></li>
53
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180515/1526368416232243.png"></a></li>
54
+                  <li><a href="#"><img src="http://img.henhaojie.com/Homeact/20180409/1523252985675069.jpg"></a></li>
55
+              </ul>
56
+              <ul class="swiper-point">
57
+                  <li class="now"></li>
58
+                  <li></li>
59
+                  <li></li>
60
+                  <li></li>
61
+                  <li></li>
62
+                  <li></li>
63
+                  <li></li>
64
+              </ul>
65
+        </div>
66
+        <div class="details-wrapper">
67
+        </div>
68
+        <input readOnly="true" style="outline: none;border: 0px; color: rgba(0,0,0,0.0);position: absolute;left:-200px; background-color: transparent" id="biao1" value="要复制的内容"/>
69
+        <div id="biaoios" style=";position: absolute;left:-200px; color: rgba(0,0,0,0);background-color: transparent">要复制的内容</div>
70
+        <div class="btn-wrapper"><button class="btn">点击复制淘口令,打开淘宝去购买</button></div>
71
+        <script src="dist/axios.min.js" type="text/javascript" charset="utf-8"></script>
72
+        <script src="dist/swiper.min.js" type="text/javascript" charset="utf-8"></script>
73
+        <script src="dist/index.js" type="text/javascript" charset="utf-8"></script>
74
+    </body>
75
+</html>

+ 16 - 0
index.js

@@ -0,0 +1,16 @@
1
+window.onload = function () {
2
+    var mySwiper = new Swiper ('.swiper-container', {
3
+        direction: 'vertical',
4
+        loop: true,
5
+
6
+        // // 如果需要分页器
7
+        // pagination: '.swiper-pagination',
8
+
9
+        // // 如果需要前进后退按钮
10
+        // nextButton: '.swiper-button-next',
11
+        // prevButton: '.swiper-button-prev',
12
+
13
+        // // 如果需要滚动条
14
+        // scrollbar: '.swiper-scrollbar',
15
+      })
16
+}

+ 52 - 0
inviting.html

@@ -0,0 +1,52 @@
1
+<html>
2
+    <head>
3
+        <meta charset="utf-8">
4
+        <title></title>
5
+        <meta name="viewport" content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
6
+        <meta name="format-detection" content="telephone=no,address=no,email=no" />
7
+        <meta name="mobileOptimized" content="width" />
8
+        <meta name="handheldFriendly" content="true" />
9
+        <meta name="apple-mobile-web-app-capable" content="yes" />
10
+        <meta name="apple-mobile-web-app-status-bar-style" content="black" />
11
+        <meta name="description" content="" />
12
+        <meta name="keywords" content=""/>
13
+        <script>
14
+            ;(function() {
15
+              var docEl = document.documentElement,
16
+              resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
17
+              clientWidth = docEl.clientWidth;
18
+              s();
19
+              window.addEventListener(resizeEvt, s, false);
20
+
21
+              function s() {
22
+                docEl.style.fontSize = 50.0 * (clientWidth / 375) + 'px';
23
+              }
24
+            })();
25
+        </script>
26
+        <script>
27
+              var _ua = navigator.userAgent;
28
+              if (!!_ua.match(/.*OS\s([\d_]+)/) || !!_ua.match(/(Android)\s+([\d.]+)/)) {
29
+                document.write('<style>body{min-width:320px;min-height:320px;}</style>');
30
+              }
31
+        </script>
32
+        <link rel="stylesheet" type="text/css" href="dist/index.css">
33
+        <style type="text/css" media="screen">
34
+        </style>
35
+    </head>
36
+    <body>
37
+        <div class="download-wrapper">
38
+            <div class="img-box"><img src="img/icon.png" alt=""></div>
39
+            <div class="content">
40
+              <h6 class="title">省钱达人</h6>
41
+              <p class="text">购物省钱,分享赚钱,更多奖励等你来</p>
42
+            </div>
43
+            <button type="button">下载APP</button>
44
+        </div>
45
+        <p class="step-wrapper">1.下载APP——2选择微信登录——3成为省钱达人</p>
46
+        <div class="inviting-pic"><img src="" alt=""></div>
47
+        <div class="btn-wrapper"><button class="btn">点击复制邀请码:<em>JSKD737</em></button></div>
48
+        <script src="dist/axios.min.js" type="text/javascript" charset="utf-8"></script>
49
+        <script type="text/javascript" charset="utf-8">
50
+        </script>
51
+    </body>
52
+</html>