Merge branch 'develop' into test
Showing
8 changed files
with
54 additions
and
35 deletions
@@ -182,17 +182,19 @@ class NewsaleData | @@ -182,17 +182,19 @@ class NewsaleData | ||
182 | * 获取热销排行榜商品数据 | 182 | * 获取热销排行榜商品数据 |
183 | * | 183 | * |
184 | * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | 184 | * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 |
185 | + * $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活 | ||
185 | * @param string|null $sort 品类ID查询参数 | 186 | * @param string|null $sort 品类ID查询参数 |
186 | * @param integer|null $tab_id Tab的ID | 187 | * @param integer|null $tab_id Tab的ID |
187 | * @param integer $limit 查询返回的最大限制数, 默认为50 | 188 | * @param integer $limit 查询返回的最大限制数, 默认为50 |
188 | * @param integer $page 分页第几页, 默认第1页 | 189 | * @param integer $page 分页第几页, 默认第1页 |
189 | * @return array 新品到着商品数据 | 190 | * @return array 新品到着商品数据 |
190 | */ | 191 | */ |
191 | - public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1) | 192 | + public static function getTopProducts($gender, $channel, $sort = null, $tab_id = null, $limit = 50, $page = 1) |
192 | { | 193 | { |
193 | $param = Yohobuy::param(); | 194 | $param = Yohobuy::param(); |
194 | $param['method'] = 'app.search.top'; | 195 | $param['method'] = 'app.search.top'; |
195 | $param['gender'] = $gender; | 196 | $param['gender'] = $gender; |
197 | + $param['yh_channel'] = $gender; | ||
196 | !empty($sort) && $param['sort'] = $sort; | 198 | !empty($sort) && $param['sort'] = $sort; |
197 | !empty($tab_id) && $param['tab_id'] = $tab_id; | 199 | !empty($tab_id) && $param['tab_id'] = $tab_id; |
198 | $param['page'] = $page; | 200 | $param['page'] = $page; |
@@ -109,18 +109,13 @@ $page.on('touchstart', '.del-icon', function() { | @@ -109,18 +109,13 @@ $page.on('touchstart', '.del-icon', function() { | ||
109 | if (data.code === 200) { | 109 | if (data.code === 200) { |
110 | dialog.showDialog({ | 110 | dialog.showDialog({ |
111 | dialogText: '删除浏览记录成功', | 111 | dialogText: '删除浏览记录成功', |
112 | - autoHide: true, | 112 | + autoHide: 2000, |
113 | fast: true | 113 | fast: true |
114 | }); | 114 | }); |
115 | setTimeout(function() { | 115 | setTimeout(function() { |
116 | window.history.go(0); | 116 | window.history.go(0); |
117 | }, 1200); | 117 | }, 1200); |
118 | } | 118 | } |
119 | - }, | ||
120 | - complete: function() { | ||
121 | - setTimeout(function() { | ||
122 | - dialog.hideDialog(); | ||
123 | - }, 1500); | ||
124 | } | 119 | } |
125 | }); | 120 | }); |
126 | }); | 121 | }); |
@@ -37,6 +37,7 @@ exports.showDialog = function(data, callback) { | @@ -37,6 +37,7 @@ exports.showDialog = function(data, callback) { | ||
37 | 37 | ||
38 | var dialogStr = dialogTemplate(data), | 38 | var dialogStr = dialogTemplate(data), |
39 | $dialogBox, | 39 | $dialogBox, |
40 | + defaultHideDuraton, | ||
40 | dialogWrapperHammer; | 41 | dialogWrapperHammer; |
41 | 42 | ||
42 | $('.dialog-wrapper').remove(); | 43 | $('.dialog-wrapper').remove(); |
@@ -63,9 +64,13 @@ exports.showDialog = function(data, callback) { | @@ -63,9 +64,13 @@ exports.showDialog = function(data, callback) { | ||
63 | 64 | ||
64 | //隐藏 | 65 | //隐藏 |
65 | if (data.autoHide) { | 66 | if (data.autoHide) { |
67 | + defaultHideDuraton = 1000; | ||
68 | + if (data.autoHide > 1) { | ||
69 | + defaultHideDuraton = data.autoHide; | ||
70 | + } | ||
66 | setTimeout(function() { | 71 | setTimeout(function() { |
67 | $dialogWrapper.fadeOut(); | 72 | $dialogWrapper.fadeOut(); |
68 | - }, 1000); | 73 | + }, defaultHideDuraton); |
69 | } | 74 | } |
70 | 75 | ||
71 | dialogWrapperHammer.on('tap', function(event) { | 76 | dialogWrapperHammer.on('tap', function(event) { |
@@ -76,9 +81,5 @@ exports.showDialog = function(data, callback) { | @@ -76,9 +81,5 @@ exports.showDialog = function(data, callback) { | ||
76 | callback(); | 81 | callback(); |
77 | } | 82 | } |
78 | }); | 83 | }); |
79 | - | ||
80 | }; | 84 | }; |
81 | 85 | ||
82 | -exports.hideDialog = function() { | ||
83 | - $dialogWrapper.fadeOut(); | ||
84 | -}; |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | var $ = require('jquery'); | 6 | var $ = require('jquery'); |
7 | 7 | ||
8 | var loading = require('../plugin/loading'), | 8 | var loading = require('../plugin/loading'), |
9 | + tip = require('../plugin/tip'), | ||
9 | Hammer = require('yoho.hammer'); | 10 | Hammer = require('yoho.hammer'); |
10 | 11 | ||
11 | var theOrderCode = document.getElementById('ordercode').value; | 12 | var theOrderCode = document.getElementById('ordercode').value; |
@@ -17,7 +18,7 @@ var appIconPosition = { | @@ -17,7 +18,7 @@ var appIconPosition = { | ||
17 | baidu: '-2.7rem', | 18 | baidu: '-2.7rem', |
18 | weixin: '-1.2rem', | 19 | weixin: '-1.2rem', |
19 | QQ: '-5.4rem', | 20 | QQ: '-5.4rem', |
20 | - bank: '-4' | 21 | + bank: '-4rem' |
21 | }; | 22 | }; |
22 | 23 | ||
23 | //隐藏微信分享选项 | 24 | //隐藏微信分享选项 |
@@ -77,11 +78,11 @@ function callpay(orderCode) { | @@ -77,11 +78,11 @@ function callpay(orderCode) { | ||
77 | jsApiParameters = res.data.jsApiParameters; | 78 | jsApiParameters = res.data.jsApiParameters; |
78 | jsApiCall(orderCode, jsApiParameters); | 79 | jsApiCall(orderCode, jsApiParameters); |
79 | } else { | 80 | } else { |
80 | - alert('微信支付调取失败'); | 81 | + tip.show('微信支付调取失败'); |
81 | } | 82 | } |
82 | }, | 83 | }, |
83 | error: function() { | 84 | error: function() { |
84 | - alert('请刷新本页面,完成微信支付'); | 85 | + tip.show('请刷新本页面,完成微信支付'); |
85 | } | 86 | } |
86 | }); | 87 | }); |
87 | } | 88 | } |
@@ -99,11 +100,11 @@ function isWXOpen() { | @@ -99,11 +100,11 @@ function isWXOpen() { | ||
99 | } | 100 | } |
100 | 101 | ||
101 | function hideWeChatPay() { | 102 | function hideWeChatPay() { |
102 | - var payApps = document.getElementsByClassName('app'); | 103 | + var $payApps = $('.app'); |
103 | 104 | ||
104 | - [].forEach.call(payApps, function(app, index) { | ||
105 | - if (app.innerHTML.indexOf('微信') !== -1) { | ||
106 | - app.parentNode.style.display = 'none'; | 105 | + $payApps.each(function(idx, app) { |
106 | + if ($(app).attr('id') === 'weixin') { | ||
107 | + $(app).parent().css('display', 'none'); | ||
107 | return false; | 108 | return false; |
108 | } | 109 | } |
109 | }); | 110 | }); |
@@ -117,29 +118,29 @@ function handleForWX() { | @@ -117,29 +118,29 @@ function handleForWX() { | ||
117 | 118 | ||
118 | 119 | ||
119 | function setAppIcon(el, position) { | 120 | function setAppIcon(el, position) { |
120 | - el.style.backgroundPositionY = position; | 121 | + $(el).css('background-position-y', position); |
121 | } | 122 | } |
122 | 123 | ||
123 | function loadIcon() { | 124 | function loadIcon() { |
124 | - var boxs = document.getElementsByClassName('box'); | ||
125 | - var div = null; | 125 | + var $boxs = $('.box'); |
126 | + var $div = null; | ||
126 | var appid = null; | 127 | var appid = null; |
127 | 128 | ||
128 | - [].forEach.call(boxs, function(box, index) { | ||
129 | - div = box.getElementsByClassName('icon')[0].getElementsByTagName('div')[0]; | ||
130 | - if (div) { | ||
131 | - appid = box.getAttribute('id'); | 129 | + $boxs.each(function(idx, box) { |
130 | + $div = $(box).find('.icon').find('div'); | ||
131 | + if ($div.length > 0) { | ||
132 | + appid = $(box).attr('id'); | ||
132 | if (appid !== 'alipay') { | 133 | if (appid !== 'alipay') { |
133 | - setAppIcon(div, appIconPosition[appid]); | 134 | + setAppIcon($div, appIconPosition[appid]); |
134 | } | 135 | } |
135 | } | 136 | } |
136 | }); | 137 | }); |
137 | } | 138 | } |
138 | 139 | ||
139 | function showPage() { | 140 | function showPage() { |
140 | - var pageList = document.getElementsByClassName('payapp-list')[0]; | 141 | + var $pageList = $('.payapp-list'); |
141 | 142 | ||
142 | - pageList.style.visibility = 'visible'; | 143 | + $pageList.css('visibility', 'visible'); |
143 | } | 144 | } |
144 | 145 | ||
145 | if (wxHammer) { | 146 | if (wxHammer) { |
@@ -64,11 +64,21 @@ lazyLoad(); | @@ -64,11 +64,21 @@ lazyLoad(); | ||
64 | headerNavHammer = new Hammer(document.getElementById('yoho-header')); | 64 | headerNavHammer = new Hammer(document.getElementById('yoho-header')); |
65 | 65 | ||
66 | headerNavHammer.on('tap', function(e) { | 66 | headerNavHammer.on('tap', function(e) { |
67 | - var suggestText = $('#suggest-textarea').val(); | 67 | + var suggestText = $('#suggest-textarea').val(), |
68 | + textReg = /\S+/; | ||
68 | 69 | ||
69 | 70 | ||
70 | if ($(e.target).hasClass('nav-btn')) { | 71 | if ($(e.target).hasClass('nav-btn')) { |
71 | 72 | ||
73 | + if (!textReg.test(suggestText)) { | ||
74 | + diaLog.showDialog({ | ||
75 | + autoHide: true, | ||
76 | + dialogText: '意见不能为空' | ||
77 | + }); | ||
78 | + | ||
79 | + return; | ||
80 | + } | ||
81 | + | ||
72 | $.ajax({ | 82 | $.ajax({ |
73 | method: 'post', | 83 | method: 'post', |
74 | url: '/home/savesuggest', | 84 | url: '/home/savesuggest', |
@@ -85,10 +95,18 @@ headerNavHammer.on('tap', function(e) { | @@ -85,10 +95,18 @@ headerNavHammer.on('tap', function(e) { | ||
85 | setTimeout(function() { | 95 | setTimeout(function() { |
86 | location.pathname = 'home/suggest'; | 96 | location.pathname = 'home/suggest'; |
87 | }, 2000); | 97 | }, 2000); |
98 | + } else { | ||
99 | + diaLog.showDialog({ | ||
100 | + autoHide: true, | ||
101 | + dialogText: '提交失败~' | ||
102 | + }); | ||
88 | } | 103 | } |
89 | }).fail(function() { | 104 | }).fail(function() { |
90 | 105 | ||
91 | - //TODO | 106 | + diaLog.showDialog({ |
107 | + autoHide: true, | ||
108 | + dialogText: '网络错误~' | ||
109 | + }); | ||
92 | }); | 110 | }); |
93 | } | 111 | } |
94 | }); | 112 | }); |
@@ -807,7 +807,7 @@ class HomeController extends AbstractAction | @@ -807,7 +807,7 @@ class HomeController extends AbstractAction | ||
807 | ), | 807 | ), |
808 | ), | 808 | ), |
809 | 'orderCode' => $orderCode, | 809 | 'orderCode' => $orderCode, |
810 | - 'hasWxShare' => strpos($this->_request->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false | 810 | + 'hasWxShare' => strpos($this->server('HTTP_USER_AGENT', ''), 'MicroMessenger') !== false |
811 | )); | 811 | )); |
812 | } | 812 | } |
813 | 813 |
@@ -230,6 +230,7 @@ class NewsaleModel | @@ -230,6 +230,7 @@ class NewsaleModel | ||
230 | * 筛选出来的热销排行榜商品数据处理 | 230 | * 筛选出来的热销排行榜商品数据处理 |
231 | * | 231 | * |
232 | * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 | 232 | * @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部 |
233 | + * $param integer $channel 1表示男,2表示女,3表示潮童,4表示创意生活 | ||
233 | * @param string|null $sort 品类ID查询参数 | 234 | * @param string|null $sort 品类ID查询参数 |
234 | * @param integer|null $tab_id Tab的ID | 235 | * @param integer|null $tab_id Tab的ID |
235 | * @param boolean $notab 时候返回顶部tab的数据,默认返回 | 236 | * @param boolean $notab 时候返回顶部tab的数据,默认返回 |
@@ -237,11 +238,11 @@ class NewsaleModel | @@ -237,11 +238,11 @@ class NewsaleModel | ||
237 | * @param integer $page 分页第几页 | 238 | * @param integer $page 分页第几页 |
238 | * @return array 处理之后的数据 | 239 | * @return array 处理之后的数据 |
239 | */ | 240 | */ |
240 | - public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page) | 241 | + public static function selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page) |
241 | { | 242 | { |
242 | $result = array(); | 243 | $result = array(); |
243 | 244 | ||
244 | - $data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page); | 245 | + $data = NewsaleData::getTopProducts($gender, $channel, $sort, $tab_id, $limit, $page); |
245 | 246 | ||
246 | if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { | 247 | if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) { |
247 | $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page); | 248 | $result = NewSaleProcess::topData($data['data'], $notab, $limit, $page); |
@@ -110,7 +110,8 @@ class NewsaleController extends AbstractAction | @@ -110,7 +110,8 @@ class NewsaleController extends AbstractAction | ||
110 | 110 | ||
111 | // 获取性别 | 111 | // 获取性别 |
112 | $gender = Helpers::getGenderByCookie(); | 112 | $gender = Helpers::getGenderByCookie(); |
113 | - $result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page); | 113 | + $channel = Helpers::getChannelByCookie(); |
114 | + $result = \Product\NewsaleModel::selectTopData($gender, $channel, $sort, $tab_id, $notab, $limit, $page); | ||
114 | } | 115 | } |
115 | if (empty($result)) { | 116 | if (empty($result)) { |
116 | echo ' '; | 117 | echo ' '; |
-
Please register or login to post a comment