update for consult update
Showing
4 changed files
with
213 additions
and
5 deletions
@@ -9,11 +9,18 @@ var $ = require('jquery'), | @@ -9,11 +9,18 @@ var $ = require('jquery'), | ||
9 | 9 | ||
10 | var commentsNum,consultsNum; | 10 | var commentsNum,consultsNum; |
11 | 11 | ||
12 | -var navtabEle = document.getElementById('nav-tab'), | 12 | +var consultFooterEle = $('.consult-content-footer')[0], |
13 | + consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle), | ||
14 | + | ||
15 | + navtabEle = document.getElementById('nav-tab'), | ||
13 | navtabHammer = navtabEle && new Hammer(navtabEle), | 16 | navtabHammer = navtabEle && new Hammer(navtabEle), |
14 | 17 | ||
15 | gotoConsultEle = document.getElementById('goto-consult'), | 18 | gotoConsultEle = document.getElementById('goto-consult'), |
16 | - gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle); | 19 | + gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle), |
20 | + | ||
21 | + readmore = document.getElementById('readmore'), | ||
22 | + readmoreHammer = readmore && new Hammer(readmore); | ||
23 | + | ||
17 | 24 | ||
18 | 25 | ||
19 | (function() { | 26 | (function() { |
@@ -63,9 +70,15 @@ if (navtabHammer) { | @@ -63,9 +70,15 @@ if (navtabHammer) { | ||
63 | }); | 70 | }); |
64 | } | 71 | } |
65 | 72 | ||
73 | +if (consultFooterHammer) { | ||
74 | + consultFooterHammer.on('tap', function() { | ||
75 | + location.href = $(consultFooterEle).data('href'); | ||
76 | + }); | ||
77 | +} | ||
78 | + | ||
66 | if (gotoConsultHammer) { | 79 | if (gotoConsultHammer) { |
67 | gotoConsultHammer.on('tap', function() { | 80 | gotoConsultHammer.on('tap', function() { |
68 | - location.href = $(gotoConsultEle).find('a').attr('href'); | 81 | + location.href = $(gotoConsultEle).data('href'); |
69 | }); | 82 | }); |
70 | } | 83 | } |
71 | 84 | ||
@@ -74,3 +87,22 @@ if ($('.goods-consults-page').length > 0) { | @@ -74,3 +87,22 @@ if ($('.goods-consults-page').length > 0) { | ||
74 | $('#yoho-header').css('position', 'fixed').css('top', '0'); | 87 | $('#yoho-header').css('position', 'fixed').css('top', '0'); |
75 | } | 88 | } |
76 | 89 | ||
90 | +if ($('.goods-consults-page').length > 0) { | ||
91 | + $('#yoho-footer').css('border-top', '1px solid #e0e0e0'); | ||
92 | +} | ||
93 | + | ||
94 | +if ($('.goods-consults .consult-item').length > 10) { | ||
95 | + $('.readmore').show(); | ||
96 | +} else { | ||
97 | + $('.readmore').hide(); | ||
98 | +} | ||
99 | + | ||
100 | +if (readmoreHammer) { | ||
101 | + readmoreHammer.on('tap', function() { | ||
102 | + $('.readmore').hide(); | ||
103 | + $('.goods-consults .consult-item:nth-child(n+11)').show(); | ||
104 | + return false; | ||
105 | + }); | ||
106 | +} | ||
107 | + | ||
108 | +require('./fav'); |
static/js/product/detail/fav.js
0 → 100755
1 | +/** | ||
2 | + * 商品详情咨询页 --点赞和帮助功能 | ||
3 | + * @author: Lynnic | ||
4 | + * @date: 2015/12/09 | ||
5 | + */ | ||
6 | + | ||
7 | + var $ = require('jquery'), | ||
8 | + Hammer = require('yoho.hammer'), | ||
9 | + tip = require('../../plugin/tip'); | ||
10 | + | ||
11 | +var goodsConsultsEle = $('#goods-consults')[0], | ||
12 | + goodsConsultsHammer = goodsConsultsEle && new Hammer(goodsConsultsEle); | ||
13 | + | ||
14 | +// $favBtn.on('click', function() { | ||
15 | +// var id = $(this).closest('.consult-item').data('id'), | ||
16 | +// $that = $(this), | ||
17 | +// count = $that.find('.count').html() - 0; | ||
18 | +// if (!$(this).hasClass('highlight')) { | ||
19 | +// $.ajax({ | ||
20 | +// method: 'post', | ||
21 | +// url: '/home/upxxDown', | ||
22 | +// data: { | ||
23 | +// consult_id: id | ||
24 | +// } | ||
25 | +// }).done(function(data) { | ||
26 | +// if (data.code === 200) { | ||
27 | +// $that.addClass('highlight'); | ||
28 | +// $that.find('.count').html(count+1); | ||
29 | +// } else if (data.code === 400) { | ||
30 | +// location.href = data.data;//未登录跳转登录页 | ||
31 | +// } | ||
32 | +// }).fail(function(data) { | ||
33 | +// $that.addClass('highlight'); | ||
34 | +// $that.find('.count').html(count+1); | ||
35 | +// }); | ||
36 | +// } | ||
37 | +// }); | ||
38 | + | ||
39 | +if (goodsConsultsHammer) { | ||
40 | + | ||
41 | + goodsConsultsHammer.on('tap', function(e) { | ||
42 | + | ||
43 | + var $this = $(e.target).closest('li'), | ||
44 | + id = $this.closest('.consult-item').data('id'), | ||
45 | + count = $this.find('.count').html() - 0, | ||
46 | + url; | ||
47 | + | ||
48 | + if (!$this.hasClass('highlight')) { | ||
49 | + | ||
50 | + if ($this.hasClass('fav')) { | ||
51 | + url = '/product/opt/fav'; | ||
52 | + } else if ($this.hasClass('usefull')) { | ||
53 | + url = '/product/opt/usefull'; | ||
54 | + } | ||
55 | + | ||
56 | + $.ajax({ | ||
57 | + method: 'post', | ||
58 | + url: url, | ||
59 | + data: { | ||
60 | + consult_id: id | ||
61 | + } | ||
62 | + }).done(function(data) { | ||
63 | + if (data.code === 200) { | ||
64 | + $this.addClass('highlight'); | ||
65 | + $this.find('.count').html(count + 1); | ||
66 | + } else if (data.code === 400) { | ||
67 | + location.href = data.data;//未登录跳转登录页 | ||
68 | + } | ||
69 | + }).fail(function(data) { | ||
70 | + tip.show('网络断开连接了~'); | ||
71 | + }); | ||
72 | + | ||
73 | + } | ||
74 | + }); | ||
75 | +} |
@@ -114,6 +114,60 @@ | @@ -114,6 +114,60 @@ | ||
114 | overflow: hidden; | 114 | overflow: hidden; |
115 | } | 115 | } |
116 | } | 116 | } |
117 | + .operation { | ||
118 | + width: 120%; | ||
119 | + height: pxToRem(60px); | ||
120 | + line-height: pxToRem(80px); | ||
121 | + position: relative; | ||
122 | + right: 12%; | ||
123 | + border-top: 1px solid #e0e0e0; | ||
124 | + margin-top: pxToRem(20px); | ||
125 | + | ||
126 | + li{ | ||
127 | + &.highlight{ | ||
128 | + color: $basicBtnC; | ||
129 | + } | ||
130 | + font-size:pxToRem(28px); | ||
131 | + float:left; | ||
132 | + width: 50%; | ||
133 | + text-align: center; | ||
134 | + color:$subFontC; | ||
135 | + .iconfont{ | ||
136 | + display: inline-block; | ||
137 | + padding-right: 5px; | ||
138 | + font-size: inherit; | ||
139 | + } | ||
140 | + } | ||
141 | + } | ||
142 | + } | ||
143 | + } | ||
144 | + .readmore{ | ||
145 | + display: block; | ||
146 | + height: pxToRem(88px); | ||
147 | + line-height: pxToRem(88px); | ||
148 | + background-color: #fff; | ||
149 | + text-align: center; | ||
150 | + color: $subFontC; | ||
151 | + margin-top: pxToRem(30px); | ||
152 | + border-top: 1px solid $borderC; | ||
153 | + border-bottom: 1px solid $borderC; | ||
154 | + font-size: pxToRem(28px); | ||
155 | + i{ | ||
156 | + font-size: inherit; | ||
157 | + } | ||
158 | + } | ||
159 | + .faq-title{ | ||
160 | + height: pxToRem(88px); | ||
161 | + line-height: pxToRem(88px); | ||
162 | + text-align: center; | ||
163 | + font-size: pxToRem(32px); | ||
164 | + } | ||
165 | + .goods-consults .faq-item{ | ||
166 | + @extend .consult-item; | ||
167 | + margin-top: 0; | ||
168 | + margin-bottom: pxToRem(30px); | ||
169 | + .answer{ | ||
170 | + border-bottom: none; | ||
117 | } | 171 | } |
118 | } | 172 | } |
119 | // .gap-block { | 173 | // .gap-block { |
@@ -174,6 +228,9 @@ | @@ -174,6 +228,9 @@ | ||
174 | &.focus { | 228 | &.focus { |
175 | color: #000; | 229 | color: #000; |
176 | } | 230 | } |
231 | + .comments-num { | ||
232 | + display: none; | ||
233 | + } | ||
177 | } | 234 | } |
178 | .comment-nav { | 235 | .comment-nav { |
179 | border-right: 1px solid #ccc; | 236 | border-right: 1px solid #ccc; |
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | <div class="goto-consult tap-hightlight" id="goto-consult" data-href="{{link}}"> | 3 | <div class="goto-consult tap-hightlight" id="goto-consult" data-href="{{link}}"> |
4 | <i class="iconfont consult-logo"></i> | 4 | <i class="iconfont consult-logo"></i> |
5 | <span>我要咨询</span> | 5 | <span>我要咨询</span> |
6 | - <a href="{{link}}" class="iconfont enter-consult-page"></a> | 6 | + <a href="javascript:;" class="iconfont enter-consult-page"></a> |
7 | </div> | 7 | </div> |
8 | {{# consults}} | 8 | {{# consults}} |
9 | <div class="goods-consults" id="goods-consults"> | 9 | <div class="goods-consults" id="goods-consults"> |
10 | {{#list}} | 10 | {{#list}} |
11 | - <div class="consult-item"> | 11 | + <div class="consult-item" data-id="{{consult-id}}"> |
12 | <div class="question"> | 12 | <div class="question"> |
13 | <span class="iconfont"></span> | 13 | <span class="iconfont"></span> |
14 | <p> | 14 | <p> |
@@ -21,10 +21,54 @@ | @@ -21,10 +21,54 @@ | ||
21 | <span class="iconfont"></span> | 21 | <span class="iconfont"></span> |
22 | <p>{{answer}}</p> | 22 | <p>{{answer}}</p> |
23 | </div> | 23 | </div> |
24 | + | ||
25 | + <ul class="operation"> | ||
26 | + <li class="fav {{#if fav}}highlight{{/if}}"> | ||
27 | + <i class="iconfont "></i> | ||
28 | + 赞 | ||
29 | + <i class="count">{{#if favNum}}{{favNum}}{{/if}}</i> | ||
30 | + </li> | ||
31 | + <li class="usefull {{#if usefull}}highlight{{/if}}"> | ||
32 | + <i class="iconfont "></i> | ||
33 | + 有用 | ||
34 | + <i class="count">{{#if usefullNum}}{{usefullNum}}{{/if}}</i> | ||
35 | + </li> | ||
36 | + </ul> | ||
37 | + | ||
24 | </div> | 38 | </div> |
39 | + | ||
40 | + | ||
25 | {{/list}} | 41 | {{/list}} |
26 | </div> | 42 | </div> |
27 | {{/ consults}} | 43 | {{/ consults}} |
28 | 44 | ||
45 | + <a href="javascript:;" id="readmore" class="readmore tap-hightlight" >查看更多 <i class="iconfont"></i></a> | ||
46 | + | ||
47 | + {{#faq}} | ||
48 | + <h1 class="faq-title"> | ||
49 | + 常见问题 | ||
50 | + </h1> | ||
51 | + {{/faq}} | ||
52 | + | ||
53 | + {{#faq}} | ||
54 | + <div class="goods-consults" style="margin-top:0"> | ||
55 | + {{#list}} | ||
56 | + <div class="faq-item"> | ||
57 | + <div class="question"> | ||
58 | + <span class="iconfont"></span> | ||
59 | + <p> | ||
60 | + {{question}} | ||
61 | + </p> | ||
62 | + </div> | ||
63 | + | ||
64 | + <div class="answer"> | ||
65 | + <span class="iconfont"></span> | ||
66 | + <p>{{answer}}</p> | ||
67 | + </div> | ||
68 | + </div> | ||
69 | + {{/list}} | ||
70 | + </div> | ||
71 | + {{/faq}} | ||
72 | + | ||
29 | </div> | 73 | </div> |
30 | {{> layout/footer}} | 74 | {{> layout/footer}} |
-
Please register or login to post a comment