diff --git a/docs/data-structure.md b/docs/data-structure.md index 27de48f..e5b8530 100644 --- a/docs/data-structure.md +++ b/docs/data-structure.md @@ -943,7 +943,8 @@ { name: '', active: true, - typeId: 1 + typeId: 1, + url: '' }, ... ] diff --git a/library/Api/Yohobuy.php b/library/Api/Yohobuy.php index 497a627..29dbca2 100644 --- a/library/Api/Yohobuy.php +++ b/library/Api/Yohobuy.php @@ -18,17 +18,18 @@ class Yohobuy { // /* 正式环境 */ - const API_URL = 'http://api2.open.yohobuy.com/'; - const API_URL2 = 'http://api.open.yohobuy.com/'; - const SERVICE_URL = 'http://service.api.yohobuy.com/'; - const YOHOBUY_URL = 'http://www.yohobuy.com/'; + const API_URL = 'http://api2.open.yohobuy.com/'; + const API_URL2 = 'http://api.open.yohobuy.com/'; + const SERVICE_URL = 'http://service.api.yohobuy.com/'; + const YOHOBUY_URL = 'http://www.yohobuy.com/'; /* 测试环境 */ -// const API_URL = 'http://test2.open.yohobuy.com/'; -// const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; -// const YOHOBUY_URL = 'http://www.yohobuy.com/'; -// const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL -// const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL + // const API_URL = 'http://test2.open.yohobuy.com/'; + // const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; + // const YOHOBUY_URL = 'http://www.yohobuy.com/'; + // const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL + // const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL + /** * 私钥列表 diff --git a/static/js/guang/info.js b/static/js/guang/info.js index 5d66e33..8df0cda 100644 --- a/static/js/guang/info.js +++ b/static/js/guang/info.js @@ -5,16 +5,16 @@ */ var $ = require('jquery'), - Hammer = require('yoho.hammer'), - ellipsis = require('mlellipsis'), - lazyLoad = require('yoho.lazyload'); + Hammer = require('yoho.hammer'), + ellipsis = require('mlellipsis'), + lazyLoad = require('yoho.lazyload'); var tip = require('../plugin/tip'); var loading = require('../plugin/loading'); var $loadMoreInfo = $('#load-more-info'); var $loading = $(''), - $noMore = $(''); + $noMore = $(''); var searching = false; @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) { $infos.each(function() { var $this = $(this), - $title = $this.find('.info-title'), - $text = $this.find('.info-text'); + $title = $this.find('.info-title'), + $text = $this.find('.info-text'); $title[0].mlellipsis(2); $text[0].mlellipsis(2); @@ -57,10 +57,10 @@ function initInfosEvt($container) { cHammer.on('tap', function(e) { var $this = $(e.target), - opt = 'ok', - $likeBtn, - $collectBtn, - $info; + opt = 'ok', + $likeBtn, + $collectBtn, + $info; $likeBtn = $this.closest('.like-btn'); if ($likeBtn.length > 0) { diff --git a/static/js/me/my-guang.js b/static/js/me/my-guang.js new file mode 100644 index 0000000..259938d --- /dev/null +++ b/static/js/me/my-guang.js @@ -0,0 +1,11 @@ +/** + * 我的逛 + * @author xuqi<qi.xu@yoho.cn> + * @date: 2015/11/17 + */ + +var $ = require('jquery'); + +var info = require('../guang/info'); + +info.initInfoEvt($('#info-list')); \ No newline at end of file diff --git a/static/js/me/order.js b/static/js/me/order.js index facb29e..1003c72 100644 --- a/static/js/me/order.js +++ b/static/js/me/order.js @@ -17,27 +17,32 @@ var winH = $(window).height(); var activeType = $navLi.filter('.active').data('type'); //当前active的项的index -var orderPage = {}; +var order = { + page: 0, + end: false +}; var inAjax = false; var loading = require('../plugin/loading'); -var navHammer, orderHammer; +var orderHammer; //加载订单 -function getOrders() { +function getOrders(option) { var opt = { type: activeType, - page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1 + page: order.page + 1 }; + var show = option && option.showLoadingMask; + if (inAjax) { return; } inAjax = true; - loading.showLoadingMask(); + show && loading.showLoadingMask(); $.ajax({ type: 'GET', @@ -46,23 +51,27 @@ function getOrders() { success: function(data) { var num; - if (data.code === 200) { - orderPage[opt.type] = opt.page; + if (data !== ' ') { + order.page = opt.page; if (opt.page === 1) { - $curContainer.html(data.data); + $curContainer.html(data); lazyLoad($curContainer.find('.lazy')); } else { num = $curContainer.children('.order').length; - $curContainer.append(data.data); + $curContainer.append(data); //lazyload - lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy')); + lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy')); } + + window.rePosFooter(); //重新计算底部位置 + } else { + order.end = true; } inAjax = false; - loading.hideLoadingMask(); + show && loading.hideLoadingMask(); } }); } @@ -83,33 +92,6 @@ lazyLoad(); loading.init($('body')); //满屏loading -//导航切换 -navHammer = new Hammer(document.getElementById('order-nav')); -navHammer.on('tap', function(e) { - var $cur = $(e.target).closest('li'), - index; - - if ($cur.length === 0 || $cur.hasClass('active')) { - return; - } - - index = $cur.index(); - - $navLi.filter('.active').removeClass('active'); - $cur.addClass('active'); - - $curContainer.addClass('hide'); - $curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide'); - - activeType = $cur.data('type'); - - if (orderPage[activeType]) { - return; - } else { - getOrders(); - } -}); - //点击订单区域跳转订单详情页 orderHammer = new Hammer(document.getElementById('order-container')); orderHammer.on('tap', function(e) { @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) { }); $(window).scroll(function() { - if ($(window).scrollTop() + winH > + if (order.end === false && $(window).scrollTop() + winH > $(document).height() - 0.25 * $orderContainer.height()) { - getOrders(); + + //下拉请求时不显示mask + getOrders({ + noLoadingMask: true + }); } }); diff --git a/static/js/product/newsale/hot-rank.js b/static/js/product/newsale/hot-rank.js index dedcf82..a631e70 100644 --- a/static/js/product/newsale/hot-rank.js +++ b/static/js/product/newsale/hot-rank.js @@ -11,7 +11,8 @@ var page = 1, navSwiper, notab = 0, sort = '', - id = ''; + id = '', + noResult = '<p class="no-result">未找到相关搜索结果</p>'; function hotrank(page, sort, tabId, notab) { loading.showLoadingMask(); @@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) { if (page === 1) { $('.rank-main').remove(); } - $('#hotRank').append(data); + if (data === ' ') { + $('#hotRank').html(noResult); + } else { + $('#hotRank').append(data); + } lazyLoad($('img.lazy')); $('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top'); winH = $(window).height(); diff --git a/static/sass/me/_coupons.scss b/static/sass/me/_coupons.scss index 78ac735..58a94a1 100644 --- a/static/sass/me/_coupons.scss +++ b/static/sass/me/_coupons.scss @@ -45,9 +45,8 @@ p{ width: 55.517241%; height: auto; - padding: 0 5% 10em / $pxConvertRem;; + padding: 0 5% 18em / $pxConvertRem;; float: left; - font-size: 44em / $pxConvertRem; &:first-of-type{ padding-top:30em / $pxConvertRem; font-size: 60em / $pxConvertRem; diff --git a/static/sass/me/_order.scss b/static/sass/me/_order.scss index 2a72296..033933b 100644 --- a/static/sass/me/_order.scss +++ b/static/sass/me/_order.scss @@ -106,7 +106,14 @@ border-bottom: 1px solid #e0e0e0; background: #fff; - > li{ + a { + display: block; + height: 100%; + width: 100%; + color: #b0b0b0; + } + + > li { float: left; height: 90rem / $pxConvertRem; width: 25%; @@ -115,7 +122,7 @@ font-size: 26rem / $pxConvertRem; text-align: center; - &.active { + &.active a { color: #000; } } diff --git a/template/m.yohobuy.com/actions/index/home/coupons.phtml b/template/m.yohobuy.com/actions/index/home/coupons.phtml index 471d9e1..62478e6 100644 --- a/template/m.yohobuy.com/actions/index/home/coupons.phtml +++ b/template/m.yohobuy.com/actions/index/home/coupons.phtml @@ -3,18 +3,25 @@ <span class="active">未使用</span> <span>已使用</span> </div> +{{# couponsUrl}} <div class="employ-list"> + +{{# unused}} <div class="employ-main"> <span>50</span> <p>【summer sale】下装满¥399减¥50券</p> <p>有效期:2014.07.28 - 2014.09.15</p> </div> +{{/ unused}} </div> <div class="employ-list not none"> +{{# used}} <div class="employ-main"> - <span>60</span> - <p>【summer sale】下装满¥399减¥60券</p> - <p>有效期:2014.07.28 - 2014.09.15</p> + <span>{{ money }}</span> + <p>{{ coupon_name }}</p> + <p>{{ couponValidity }}</p> </div> +{{/ used}} </div> +{{/ couponsUrl}} {{> layout/footer}} \ No newline at end of file diff --git a/template/m.yohobuy.com/actions/index/home/order.phtml b/template/m.yohobuy.com/actions/index/home/order.phtml index 5da8b98..59ceb11 100644 --- a/template/m.yohobuy.com/actions/index/home/order.phtml +++ b/template/m.yohobuy.com/actions/index/home/order.phtml @@ -4,7 +4,7 @@ <ul id="order-nav" class="order-nav clearfix"> {{#each navs}} <li {{#if active}}class="active"{{/if}} data-type="{{typeId}}"> - {{name}} + <a href="{{url}}">{{name}}</a> </li> {{/each}} </ul> diff --git a/yohobuy/m.yohobuy.com/application/controllers/Home.php b/yohobuy/m.yohobuy.com/application/controllers/Home.php index c2820a4..b57fe12 100644 --- a/yohobuy/m.yohobuy.com/application/controllers/Home.php +++ b/yohobuy/m.yohobuy.com/application/controllers/Home.php @@ -212,8 +212,6 @@ class HomeController extends AbstractAction 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status), 'couponsPage' => true ); - print_r($coupons); - $this->_view->display('coupons', $coupons); } @@ -361,26 +359,31 @@ class HomeController extends AbstractAction } /** - * 意见反馈-提交表单 + * 意见反馈-提交表单页面 */ - public function suggest_subAction() { - $udid = $this->getUdid(); - $page = $this->get('page', 1); - $limit = $this->get('limit', 30); - - $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit); - - //print_r($suggest); - $this->_view->display('suggest_sub', array( - 'suggestPage' => true, //加载js - 'pageHeader' => array( - 'navBack' => true, - 'navTitle' => '反馈问题', - 'navBtn' => '提交' - ), - 'suggestSub' => true, - 'pageFooter' => true - )); + public function suggestSubAction() { + + // 设置网站标题 + $this->setTitle('反馈问题'); + + $param = \Api\Yohobuy::param(); + unset($param['private_key']); + $param['project'] = 'suggest'; + $param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a'; + $data = array( + 'suggestPage' => true, //加载js + 'pageHeader' => array( + 'navBack' => true, + 'navTitle' => '反馈问题', + 'navBtn' => '提交' + ), + 'param' => $param, + 'suggestSub' => true, + 'pageFooter' => true + ); + print_r($data); + + $this->_view->display('suggest_sub', $data); } /** @@ -456,7 +459,7 @@ class HomeController extends AbstractAction } //ajax请求订单页面 - public function getOrderAction() { + public function getOrdersAction() { //判断是不是ajax请求 if (!$this->isAjax()) { $this->error();