sale vip专享列表页&注册bug code review by liuyue
Showing
10 changed files
with
187 additions
and
18 deletions
@@ -2,9 +2,14 @@ | @@ -2,9 +2,14 @@ | ||
2 | <div class="new-sale-page product-page yoho-page"> | 2 | <div class="new-sale-page product-page yoho-page"> |
3 | {{# saleList}} | 3 | {{# saleList}} |
4 | {{# saleBanner}} | 4 | {{# saleBanner}} |
5 | - <div class="banner-img" style="height: {{bannerHeight}}px;background:url({{img}}) no-repeat top center;"></div> | 5 | + <div class="sale-list-banner" style="height: {{bannerHeight}}px;"> |
6 | + <ul style="height: {{bannerHeight}}px;"> | ||
7 | + {{# list}} | ||
8 | + <li class="banner-img" style="background:url({{img}}) no-repeat top center;"></li> | ||
9 | + {{/ list}} | ||
10 | + </ul> | ||
11 | + </div> | ||
6 | {{/ saleBanner}} | 12 | {{/ saleBanner}} |
7 | - | ||
8 | <div class="center-content clearfix"> | 13 | <div class="center-content clearfix"> |
9 | {{# saleTitle}} | 14 | {{# saleTitle}} |
10 | <div class="header-title"> | 15 | <div class="header-title"> |
@@ -137,7 +137,7 @@ | @@ -137,7 +137,7 @@ | ||
137 | {{!-- sale列表 --}} | 137 | {{!-- sale列表 --}} |
138 | {{#if saleListPage}} | 138 | {{#if saleListPage}} |
139 | <script> | 139 | <script> |
140 | - seajs.use(['js/product/list', 'js/product/product'], function (list, product) { | 140 | + seajs.use(['js/product/list', 'js/product/product', 'js/product/banner'], function (list, product) { |
141 | 141 | ||
142 | product.init(4); | 142 | product.init(4); |
143 | window.onresize = function () { | 143 | window.onresize = function () { |
@@ -25,7 +25,7 @@ | @@ -25,7 +25,7 @@ | ||
25 | {{/ tags}} | 25 | {{/ tags}} |
26 | </div> | 26 | </div> |
27 | <div class="good-detail-img"> | 27 | <div class="good-detail-img"> |
28 | - <a class="good-thumb" href="{{url}}"> | 28 | + <a class="good-thumb" href="{{url}}" target="_blank"> |
29 | <img class="lazy" data-original="{{thumb}}"> | 29 | <img class="lazy" data-original="{{thumb}}"> |
30 | </a> | 30 | </a> |
31 | {{# isFew}} | 31 | {{# isFew}} |
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | {{/if}} | 37 | {{/if}} |
38 | </div> | 38 | </div> |
39 | <div class="good-detail-text"> | 39 | <div class="good-detail-text"> |
40 | - <a href="{{url}}">{{name}}</a> | 40 | + <a href="{{url}}" target="_blank">{{name}}</a> |
41 | <p class="price"> | 41 | <p class="price"> |
42 | {{# marketPrice}} | 42 | {{# marketPrice}} |
43 | <span class="market-price">¥{{.}}</span> | 43 | <span class="market-price">¥{{.}}</span> |
web-static/img/product/default-active.png
0 → 100644
1.16 KB
web-static/img/product/default-normal.png
0 → 100644
1.26 KB
@@ -417,6 +417,18 @@ function pwdFn($obj) { | @@ -417,6 +417,18 @@ function pwdFn($obj) { | ||
417 | // Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题 | 417 | // Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题 |
418 | // ( ▼-▼ )注册页和信息完善页面接口不同 | 418 | // ( ▼-▼ )注册页和信息完善页面接口不同 |
419 | exports.init = function(page) { | 419 | exports.init = function(page) { |
420 | + | ||
421 | + $('#agree-terms').click(function() { | ||
422 | + if ($(this).attr('notchecked')) { | ||
423 | + console.log(1); | ||
424 | + $(this).removeAttr('notchecked'); | ||
425 | + } else { | ||
426 | + console.log(2); | ||
427 | + $(this).attr('notchecked', 'true'); | ||
428 | + } | ||
429 | + | ||
430 | + }); | ||
431 | + | ||
420 | $registerPage.find('.va').keyup(function() { | 432 | $registerPage.find('.va').keyup(function() { |
421 | 433 | ||
422 | var j, | 434 | var j, |
@@ -438,7 +450,7 @@ exports.init = function(page) { | @@ -438,7 +450,7 @@ exports.init = function(page) { | ||
438 | 450 | ||
439 | } | 451 | } |
440 | 452 | ||
441 | - if (statusLen === 4 && $('#agree-terms').is(':checked')) { | 453 | + if (statusLen === 4 && !$('#agree-terms').attr('notchecked')) { |
442 | $registerBtn.removeClass('disable').removeAttr('disabled'); | 454 | $registerBtn.removeClass('disable').removeAttr('disabled'); |
443 | } else { | 455 | } else { |
444 | $registerBtn.addClass('disable').attr('disabled', 'true'); | 456 | $registerBtn.addClass('disable').attr('disabled', 'true'); |
@@ -515,18 +527,6 @@ exports.init = function(page) { | @@ -515,18 +527,6 @@ exports.init = function(page) { | ||
515 | }); | 527 | }); |
516 | 528 | ||
517 | // 防止粘贴密码 | 529 | // 防止粘贴密码 |
518 | - /*$('#pwd, #repwd').keydown(function (event) { | ||
519 | - | ||
520 | - console.log(event.ctrlKey); | ||
521 | - console.log(isPwd); | ||
522 | - console.log(event.keyCode); | ||
523 | - | ||
524 | - if (event.ctrlKey && isPwd && event.keyCode === 86) { | ||
525 | - $(this).val(pwdVal); | ||
526 | - } | ||
527 | - | ||
528 | - });*/ | ||
529 | - | ||
530 | $pwd[0].onpaste = function() { | 530 | $pwd[0].onpaste = function() { |
531 | return false; | 531 | return false; |
532 | }; | 532 | }; |
web-static/js/product/banner.js
0 → 100644
1 | +/* | ||
2 | + * author: chenglong | ||
3 | + */ | ||
4 | + | ||
5 | +var Slide = require('../common/yohoui/YH.slide'); | ||
6 | +var $ = require('yoho.jquery'); | ||
7 | + | ||
8 | +var $contain = $('.sale-list-banner'); | ||
9 | +var $item = $contain.find('li'); | ||
10 | +var index = 0; | ||
11 | +var pagationStr = ''; | ||
12 | +var pagationBoxStr = ''; | ||
13 | +var i; | ||
14 | +var current = true; | ||
15 | +var slide; | ||
16 | + | ||
17 | +for (i = 0; i < $item.length; i++) { | ||
18 | + | ||
19 | + if (i === 0) { | ||
20 | + pagationStr += '<span class="active"></span>'; | ||
21 | + } else { | ||
22 | + pagationStr += '<span></span>'; | ||
23 | + } | ||
24 | +} | ||
25 | + | ||
26 | +pagationBoxStr = '<div class="sale-list-pagation"><div>' + pagationStr + '</div></div>'; | ||
27 | + | ||
28 | +$contain.append($(pagationBoxStr)); | ||
29 | + | ||
30 | +slide = new Slide({ | ||
31 | + length: $item.length, | ||
32 | + loop: true, | ||
33 | + auto: true, | ||
34 | + timeout: 2, | ||
35 | + index: 0 | ||
36 | +}); | ||
37 | + | ||
38 | + | ||
39 | +slide.on('change', function(data) { | ||
40 | + if (current) { | ||
41 | + current = false; | ||
42 | + } else { | ||
43 | + return; | ||
44 | + } | ||
45 | + index++; | ||
46 | + | ||
47 | + | ||
48 | + $('.sale-list-pagation').find('span').removeClass('active'); | ||
49 | + $item.eq(data.from).animate({ | ||
50 | + opacity: 0 | ||
51 | + }, 300); | ||
52 | + $item.eq(data.to).css({ | ||
53 | + zIndex: index | ||
54 | + }).animate({ | ||
55 | + opacity: 1 | ||
56 | + }, 300, function() { | ||
57 | + current = true; | ||
58 | + }); | ||
59 | + | ||
60 | + $('.sale-list-pagation').find('span').eq(data.to).addClass('active'); | ||
61 | + | ||
62 | +}); | ||
63 | + | ||
64 | +$contain.hover(function() { | ||
65 | + if (current) { | ||
66 | + slide.pause(); | ||
67 | + } | ||
68 | + | ||
69 | +}, function() { | ||
70 | + slide.resume(); | ||
71 | +}); | ||
72 | + | ||
73 | +$('.sale-list-pagation span').click(function() { | ||
74 | + | ||
75 | + var index = $(this).index(); | ||
76 | + | ||
77 | + if (current) { | ||
78 | + slide.go(index); | ||
79 | + } | ||
80 | +}); | ||
81 | + | ||
82 | +slide.init(); |
1 | .new-sale-page { | 1 | .new-sale-page { |
2 | + | ||
3 | + /*Modify by chenglong.wang at 2016/1/18 | ||
4 | + *sale列表页面轮播图 | ||
5 | + */ | ||
6 | + .sale-list-banner { | ||
7 | + width: 100%; | ||
8 | + position: relative; | ||
9 | + | ||
10 | + ul { | ||
11 | + overflow: hidden; | ||
12 | + width: 100%; | ||
13 | + position: relative; | ||
14 | + z-index: 1; | ||
15 | + | ||
16 | + li { | ||
17 | + width: 100%; | ||
18 | + height: 100%; | ||
19 | + display: block; | ||
20 | + float: left; | ||
21 | + position: absolute; | ||
22 | + top: 0; | ||
23 | + left: 0; | ||
24 | + } | ||
25 | + } | ||
26 | + | ||
27 | + .sale-list-pagation { | ||
28 | + z-index: 2; | ||
29 | + position: absolute; | ||
30 | + left: 0; | ||
31 | + bottom: 50px; | ||
32 | + width: 100%; | ||
33 | + height: 20px; | ||
34 | + text-align: center; | ||
35 | + | ||
36 | + div { | ||
37 | + display: inline-block; | ||
38 | + } | ||
39 | + | ||
40 | + span { | ||
41 | + display: block; | ||
42 | + width: 20px; | ||
43 | + height: 20px; | ||
44 | + background: image_url('product/default-normal.png'); | ||
45 | + float: left; | ||
46 | + margin: 0 10px; | ||
47 | + cursor: pointer; | ||
48 | + | ||
49 | + &.active { | ||
50 | + background: image_url('product/default-active.png'); | ||
51 | + } | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
2 | .header-title { | 56 | .header-title { |
3 | position: relative; | 57 | position: relative; |
4 | width: 100%; | 58 | width: 100%; |
@@ -23,8 +23,33 @@ class Sale1Controller extends AbstractAction | @@ -23,8 +23,33 @@ class Sale1Controller extends AbstractAction | ||
23 | 'saleList' => array( | 23 | 'saleList' => array( |
24 | 'saleBanner' => array( | 24 | 'saleBanner' => array( |
25 | 'bannerHeight' => 350, | 25 | 'bannerHeight' => 350, |
26 | + 'list' => array( | ||
27 | + array( | ||
28 | + 'bannerHeight' => 350, | ||
26 | 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg' | 29 | 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg' |
27 | ), | 30 | ), |
31 | + array( | ||
32 | + 'bannerHeight' => 350, | ||
33 | + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450' | ||
34 | + ), | ||
35 | + array( | ||
36 | + 'bannerHeight' => 350, | ||
37 | + 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450' | ||
38 | + ), | ||
39 | + array( | ||
40 | + 'bannerHeight' => 350, | ||
41 | + 'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg' | ||
42 | + ), | ||
43 | + array( | ||
44 | + 'bannerHeight' => 350, | ||
45 | + 'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450' | ||
46 | + ), | ||
47 | + array( | ||
48 | + 'bannerHeight' => 350, | ||
49 | + 'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450' | ||
50 | + ) | ||
51 | + ) | ||
52 | + ), | ||
28 | 'saleTitle' => array( | 53 | 'saleTitle' => array( |
29 | 'name' => '全部商品', | 54 | 'name' => '全部商品', |
30 | 'count' => 540 | 55 | 'count' => 540 |
-
Please register or login to post a comment