Authored by Rock Zhang

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into hotfix/apichange-bug

Code Review By Rock Zhang
@@ -16,7 +16,7 @@ use Api\Sign; @@ -16,7 +16,7 @@ use Api\Sign;
16 */ 16 */
17 class SearchData 17 class SearchData
18 { 18 {
19 - 19 +
20 /** 20 /**
21 * 获取搜索的服务地址 21 * 获取搜索的服务地址
22 * 22 *
@@ -29,9 +29,9 @@ class SearchData @@ -29,9 +29,9 @@ class SearchData
29 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer'); 29 defined('APPLICATION_ENV') || define('APPLICATION_ENV', 'developer');
30 switch (APPLICATION_ENV) { 30 switch (APPLICATION_ENV) {
31 case 'release': 31 case 'release':
32 - case 'test':  
33 - case 'preview':  
34 return 'http://100.98.132.63/yohosearch/search.json'; 32 return 'http://100.98.132.63/yohosearch/search.json';
  33 + case 'test':
  34 + case 'preview':
35 case 'developer': 35 case 'developer':
36 default: 36 default:
37 return 'http://101.200.31.165/yohosearch/search.json'; 37 return 'http://101.200.31.165/yohosearch/search.json';
@@ -148,7 +148,7 @@ class SearchData @@ -148,7 +148,7 @@ class SearchData
148 if (!isset($condition['order'])) { 148 if (!isset($condition['order'])) {
149 $param['order'] = $orderMaps['s_t_desc']; 149 $param['order'] = $orderMaps['s_t_desc'];
150 } else { 150 } else {
151 - $param['order'] = $orderMaps[ $condition['order'] ]; 151 + $param['order'] = $orderMaps[$condition['order']];
152 } 152 }
153 if (!isset($condition['page'])) { 153 if (!isset($condition['page'])) {
154 $param['page'] = 1; 154 $param['page'] = 1;
@@ -5,9 +5,8 @@ @@ -5,9 +5,8 @@
5 * @date: 2015/10/19 5 * @date: 2015/10/19
6 */ 6 */
7 7
8 -var $ = require('jquery');  
9 -  
10 -// Hammer = require('yoho.hammer'); 8 +var $ = require('jquery'),
  9 + Hammer = require('yoho.hammer');
11 10
12 var $filter; 11 var $filter;
13 12
@@ -113,8 +112,7 @@ function subClassifyTapEvt($this) { @@ -113,8 +112,7 @@ function subClassifyTapEvt($this) {
113 112
114 //初始化筛选 113 //初始化筛选
115 function initFilter(opt) { 114 function initFilter(opt) {
116 -  
117 - // var filterHammer; 115 + var filterHammer;
118 116
119 //注册回调 117 //注册回调
120 fCbFn = opt.fCbFn; 118 fCbFn = opt.fCbFn;
@@ -127,8 +125,8 @@ function initFilter(opt) { @@ -127,8 +125,8 @@ function initFilter(opt) {
127 125
128 $filter = $('.filter-mask'); 126 $filter = $('.filter-mask');
129 127
130 - // filterHammer = new Hammer($filter[0]);  
131 - $filter.on('touchend', function(e) { 128 + filterHammer = new Hammer($filter[0]);
  129 + filterHammer.on('tap', function(e) {
132 var $this = $(e.target), 130 var $this = $(e.target),
133 $cur; 131 $cur;
134 132
@@ -147,7 +145,7 @@ function initFilter(opt) { @@ -147,7 +145,7 @@ function initFilter(opt) {
147 //tap classify 145 //tap classify
148 $cur = $this.closest('.classify-item'); 146 $cur = $this.closest('.classify-item');
149 147
150 - e.stopPropagation(); 148 + e.srcEvent.stopPropagation();
151 149
152 classifyTapEvt($cur); 150 classifyTapEvt($cur);
153 } 151 }
@@ -183,4 +181,4 @@ exports.showFilter = showFilter; @@ -183,4 +181,4 @@ exports.showFilter = showFilter;
183 181
184 exports.hideFilter = hideFilter; 182 exports.hideFilter = hideFilter;
185 183
186 -exports.resetFilter = resetFilter;  
  184 +exports.resetFilter = resetFilter;
  1 +/**
  2 + * 我要咨询提交页面
  3 + * @author: liangzhifeng<zhifeng.liang@yoho.cn>
  4 + * @date: 2015/12/01
  5 + */
  6 +var $ = require('jquery'),
  7 + tip = require('../../plugin/tip'),
  8 + loading = require('../../plugin/loading');
  9 +
  10 +var $consultForm = $('.consult-form'),
  11 + $submit = $('#submit'),
  12 + $content = $('#content'),
  13 + productId = $('#product_id').val(),
  14 + isSubmiting;
  15 +
  16 +$submit.on('touchend', function() {
  17 + $content.blur();
  18 + $consultForm.submit();
  19 + return false;
  20 +}).on('touchstart', function() {
  21 + $(this).addClass('highlight');
  22 +}).on('touchend touchcancel', function() {
  23 + $(this).removeClass('highlight');
  24 +});
  25 +
  26 +$content.on('focus', function() {
  27 + if ($content.val() === '请输入咨询内容') {
  28 + $content.val('');
  29 + }
  30 +}).on('blur', function() {
  31 + if ($content.val() === '') {
  32 + $content.val('请输入咨询内容');
  33 + }
  34 +});
  35 +
  36 +// 提交表单请求
  37 +$consultForm.on('submit', function() {
  38 + var content;
  39 +
  40 + if (isSubmiting) {
  41 + return false;
  42 + }
  43 +
  44 + // 简单的表单校验
  45 + content = $content.val();
  46 + if (!content || content === '请输入咨询内容') {
  47 + tip.show('咨询内容不能为空');
  48 + return false;
  49 + }
  50 +
  51 + isSubmiting = true;
  52 + loading.showLoadingMask();
  53 + $.ajax({
  54 + method: 'POST',
  55 + url: '/product/detail/consultsubmit',
  56 + data: {
  57 + product_id: productId,
  58 + content: content
  59 + }
  60 + }).then(function(res) {
  61 + if ($.type(res) !== 'object') {
  62 + res = {};
  63 + }
  64 + if (res.code !== 200) {
  65 + tip.show(res.message || '网络出了点问题~');
  66 + isSubmiting = false;
  67 + loading.hideLoadingMask();
  68 + } else {
  69 + window.history.go(-1);
  70 + }
  71 + }).fail(function() {
  72 + tip.show('网络出了点问题~');
  73 + isSubmiting = false;
  74 + });
  75 + return false;
  76 +});
@@ -9,10 +9,9 @@ var $ = require('jquery'), @@ -9,10 +9,9 @@ var $ = require('jquery'),
9 Hammer = require('yoho.hammer'), 9 Hammer = require('yoho.hammer'),
10 tip = require('../../plugin/tip'); 10 tip = require('../../plugin/tip');
11 11
12 -var likeHammer = new Hammer(document.getElementById('likeBtn'));  
13 -var addToCartHammer = new Hammer(document.getElementById('addtoCart'));  
14 -  
15 -var productId = $('#productId').val(); 12 +var likeHammer = new Hammer(document.getElementById('likeBtn')),
  13 + addToCartHammer = new Hammer(document.getElementById('addtoCart')),
  14 + productId = $('#productId').val();
16 15
17 likeHammer.on('tap', function(e) { 16 likeHammer.on('tap', function(e) {
18 var opt, 17 var opt,
@@ -8,4 +8,5 @@ require('./newsale/newarrival'); @@ -8,4 +8,5 @@ require('./newsale/newarrival');
8 require('./newsale/discount'); 8 require('./newsale/discount');
9 require('./list'); 9 require('./list');
10 require('./detail/detail'); 10 require('./detail/detail');
11 -require('./detail/desc');  
  11 +require('./detail/loadmore');
  12 +require('./detail/consultform');
@@ -157,6 +157,9 @@ @@ -157,6 +157,9 @@
157 margin-top: -$height / 2; 157 margin-top: -$height / 2;
158 158
159 } 159 }
  160 + .del-fav {
  161 + text-indent: 0;
  162 + }
160 } 163 }
161 164
162 span { 165 span {
@@ -114,6 +114,10 @@ $basicBtnC:#eb0313; @@ -114,6 +114,10 @@ $basicBtnC:#eb0313;
114 background-color: #000; 114 background-color: #000;
115 color: #fff; 115 color: #fff;
116 } 116 }
  117 + .yohood-tag {
  118 + background-color: #000;
  119 + color: #fff;
  120 + }
117 .limit-tag { 121 .limit-tag {
118 border: 1px solid #000; 122 border: 1px solid #000;
119 background-color: #fff; 123 background-color: #fff;
@@ -131,7 +135,7 @@ $basicBtnC:#eb0313; @@ -131,7 +135,7 @@ $basicBtnC:#eb0313;
131 // overflow: hidden; 135 // overflow: hidden;
132 } 136 }
133 .banner-top-single{ 137 .banner-top-single{
134 - height:pxToRem(600px); 138 +
135 width: pxToRem(448px); 139 width: pxToRem(448px);
136 margin:pxToRem(30px) pxToRem(72px); 140 margin:pxToRem(30px) pxToRem(72px);
137 overflow: hidden; 141 overflow: hidden;
@@ -130,9 +130,10 @@ @@ -130,9 +130,10 @@
130 div { 130 div {
131 text-align: center; 131 text-align: center;
132 &.cell { 132 &.cell {
  133 + line-height: pxToRem(53px);
133 font-size: pxToRem(24px); 134 font-size: pxToRem(24px);
134 background-color: $tableCellC; 135 background-color: $tableCellC;
135 - padding: pxToRem(15px) pxToRem(40px); 136 + padding: 0 pxToRem(40px);
136 border: 1px solid #fff; 137 border: 1px solid #fff;
137 } 138 }
138 } 139 }
@@ -143,14 +144,15 @@ @@ -143,14 +144,15 @@
143 #reference-swiper-container { 144 #reference-swiper-container {
144 .first-group { 145 .first-group {
145 width: pxToRem(70px); 146 width: pxToRem(70px);
146 - margin-top: pxToRem(66px);  
147 - .avatar {  
148 - // line-height: pxToRem(40px);  
149 - display: inline-block;  
150 - width: pxToRem(40px);  
151 - border-radius: 50%;  
152 - height: pxToRem(40px);  
153 - margin: pxToRem(12px) 0; 147 + margin-top: pxToRem(55px);
  148 + div{
  149 + height: pxToRem(55px);
  150 + .avatar {
  151 + display: inline-block;
  152 + width: pxToRem(40px);
  153 + border-radius: 50%;
  154 + margin-top:pxToRem(7px);
  155 + }
154 } 156 }
155 } 157 }
156 } 158 }
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 <form class="consult-form" url="{{formUrl}}"> 3 <form class="consult-form" url="{{formUrl}}">
4 <textarea id="content" name="content">请输入咨询内容</textarea> 4 <textarea id="content" name="content">请输入咨询内容</textarea>
5 <input type="hidden" id="product_id" value="{{productId}}"> 5 <input type="hidden" id="product_id" value="{{productId}}">
6 - <a type="submit">提交</a> 6 + <a type="submit" id="submit">提交</a>
7 </form> 7 </form>
8 </div> 8 </div>
9 {{> layout/footer}} 9 {{> layout/footer}}
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 <p class="good-tag sale-tag">SALE</p> 13 <p class="good-tag sale-tag">SALE</p>
14 {{/ is_discount}} 14 {{/ is_discount}}
15 {{# is_yohoood}} 15 {{# is_yohoood}}
16 - <div class="good-tag yohood-tag"></div> 16 + <div class="good-tag yohood-tag">新品节</div>
17 {{/ is_yohoood}} 17 {{/ is_yohoood}}
18 {{# is_limited}} 18 {{# is_limited}}
19 <p class="good-tag limit-tag">限量商品</p> 19 <p class="good-tag limit-tag">限量商品</p>
@@ -95,7 +95,7 @@ @@ -95,7 +95,7 @@
95 {{else}} 95 {{else}}
96 <div class="nodata"> 96 <div class="nodata">
97 <span>暂无商品评价和咨询</span> 97 <span>暂无商品评价和咨询</span>
98 - <a href="/product/detail/consultform" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a> 98 + <a href="{{link}}" class="go-consult">我要咨询<span class="iconfont">&#xe604;</span></a>
99 </div> 99 </div>
100 {{/if}} 100 {{/if}}
101 {{/if}} 101 {{/if}}
@@ -113,6 +113,7 @@ @@ -113,6 +113,7 @@
113 {{/ enterStore}} 113 {{/ enterStore}}
114 114
115 <div id="productDesc"> </div> 115 <div id="productDesc"> </div>
  116 + <!-- {{> product/product-description}} -->
116 {{> product/recommend-for-you}} 117 {{> product/recommend-for-you}}
117 118
118 {{#cartInfo}} 119 {{#cartInfo}}
@@ -130,10 +131,10 @@ @@ -130,10 +131,10 @@
130 </div> 131 </div>
131 {{/cartInfo}} 132 {{/cartInfo}}
132 {{#if introUrl}} 133 {{#if introUrl}}
133 - <input id="introUrl" type="hidden" value={{introUrl}}> 134 + <input id="introUrl" type="hidden" value='{{introUrl}}'>
134 {{/if}} 135 {{/if}}
135 {{#if id}} 136 {{#if id}}
136 - <input id="productId" type="hidden" value={{id}}> 137 + <input id="productId" type="hidden" value='{{id}}'>
137 {{/if}} 138 {{/if}}
138 139
139 </div> 140 </div>
1 {{> layout/header}} 1 {{> layout/header}}
2 <div class="discount-page yoho-page"> 2 <div class="discount-page yoho-page">
3 {{# headerBanner}} 3 {{# headerBanner}}
4 - {{> product/banner_swipe_and_single}} 4 + {{> product/banner-swipe-and-single}}
5 {{/ headerBanner}} 5 {{/ headerBanner}}
6 6
7 <ul id="list-nav" class="list-nav clearfix"> 7 <ul id="list-nav" class="list-nav clearfix">
1 <script> 1 <script>
2 seajs.use('js/common'); 2 seajs.use('js/common');
3 </script> 3 </script>
4 -{{!-- 逛(PLUS+STAR) --}} 4 + {{!-- 逛(PLUS+STAR) --}}
5 {{#if psList}} 5 {{#if psList}}
6 <script> 6 <script>
7 seajs.use('js/guang/plus-star/list'); 7 seajs.use('js/guang/plus-star/list');
@@ -175,6 +175,12 @@ @@ -175,6 +175,12 @@
175 seajs.use('js/product/detail/loadmore'); 175 seajs.use('js/product/detail/loadmore');
176 </script> 176 </script>
177 {{/if}} 177 {{/if}}
  178 + {{!-- 商品详情我要咨询 --}}
  179 + {{#if consultformPage}}
  180 +<script>
  181 + seajs.use('js/product/detail/consultform');
  182 +</script>
  183 + {{/if}}
178 {{!-- 品类 --}} 184 {{!-- 品类 --}}
179 {{#if categoryPage}} 185 {{#if categoryPage}}
180 <script> 186 <script>
@@ -59,7 +59,7 @@ @@ -59,7 +59,7 @@
59 <span class="iconfont">&#xe63d;</span>暂无咨询 59 <span class="iconfont">&#xe63d;</span>暂无咨询
60 </div> 60 </div>
61 <div class="consult-content-footer"> 61 <div class="consult-content-footer">
62 - <a href="/product/detail/consultform"> 62 + <a href="{{link}}">
63 我要咨询 63 我要咨询
64 <span class="iconfont">&#xe604;</span></a> 64 <span class="iconfont">&#xe604;</span></a>
65 </div> 65 </div>
@@ -72,7 +72,9 @@ @@ -72,7 +72,9 @@
72 {{#params}} 72 {{#params}}
73 {{#if @first}} 73 {{#if @first}}
74 {{else}} 74 {{else}}
75 - <img class="avatar lazy" data-original="{{param}}" alt=""> 75 + <div>
  76 + <img class="avatar lazy" data-original="{{param}}" alt="">
  77 + </div>
76 {{/if}} 78 {{/if}}
77 {{/params}} 79 {{/params}}
78 </div> 80 </div>