Authored by 郭成尧

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

@@ -6,12 +6,12 @@ Name | Path | Note @@ -6,12 +6,12 @@ Name | Path | Note
6 品牌列表 | /brand | 6 品牌列表 | /brand |
7 品类 | /cate | 7 品类 | /cate |
8 全部分类 | /cate-all | 8 全部分类 | /cate-all |
9 -商品列表 | /list?sort=1 |  
10 -品牌店铺 | /brand/{domain} | 9 +商品列表 | /product/list?sort=1 |
  10 +品牌店铺 | /product/shop/{domain} |
11 品牌店铺分享页面 | /brand/share/{domain} | 11 品牌店铺分享页面 | /brand/share/{domain} |
12 商品详情 | /product/{productId} | 12 商品详情 | /product/{productId} |
13 -新品抢先看 | /new |  
14 -搜索页 | /search?query=xxx | 13 +新品抢先看 | /product/new |
  14 +搜索页 | /product/search?query=xxx |
15 资讯列表 | /editorial/list | 15 资讯列表 | /editorial/list |
16 资讯详情 | /editorial/{newsId} | 16 资讯详情 | /editorial/{newsId} |
17 个人中心 | /me | 17 个人中心 | /me |
@@ -17,13 +17,16 @@ const model = require('../models/detail'); @@ -17,13 +17,16 @@ const model = require('../models/detail');
17 */ 17 */
18 const component = { 18 const component = {
19 index(req, res) { 19 index(req, res) {
20 - const pid = req.params[0], goodsId = req.params[1]; 20 + const pid = req.params[0],
  21 + goodsId = req.params[1],
  22 + cnAlphabet = req.params[2];
21 23
22 res.render('detail', { 24 res.render('detail', {
23 module: 'product', 25 module: 'product',
24 page: 'detail', 26 page: 'detail',
25 pid: pid, 27 pid: pid,
26 - goodsId: goodsId 28 + goodsId: goodsId,
  29 + cnAlphabet: cnAlphabet
27 }); 30 });
28 }, 31 },
29 product(req, res, next) { 32 product(req, res, next) {
@@ -14,38 +14,57 @@ const router = expressRouter(); @@ -14,38 +14,57 @@ const router = expressRouter();
14 // 产品 搜索 页面 14 // 产品 搜索 页面
15 const search = require(`${cRoot}/search`); 15 const search = require(`${cRoot}/search`);
16 16
17 -router.get('/search', search.index);  
18 -router.get('/search.json', search.fetchProducts); // ajax 17 +router.get('/product/search', search.index);
  18 +router.get('/product/search.json', search.fetchProducts); // ajax
19 19
20 // 新品页 20 // 新品页
21 const newProduct = require(`${cRoot}/new`); 21 const newProduct = require(`${cRoot}/new`);
22 22
23 -router.get('/new', newProduct.index);  
24 -router.get('/new.json', newProduct.fetchProducts); 23 +router.get('/product/new', newProduct.index);
  24 +router.get('/product/new.json', newProduct.fetchProducts);
25 25
26 // 产品 列表页 26 // 产品 列表页
27 const productList = require(`${cRoot}/product-list`); 27 const productList = require(`${cRoot}/product-list`);
28 28
29 -router.get('/list', productList.index);  
30 -router.get('/list.json', productList.fetchProducts); 29 +router.get('/product/list', productList.index);
  30 +router.get('/product/list.json', productList.fetchProducts);
31 31
32 // 品牌店铺页面 32 // 品牌店铺页面
33 const shop = require(`${cRoot}/shop`); 33 const shop = require(`${cRoot}/shop`);
34 34
  35 +router.get('/brand', shop.index); // 品牌 集合页
35 router.get(/\/brand\/share\/(.*)/, shop.shopShare); // 品牌店铺分享页面 36 router.get(/\/brand\/share\/(.*)/, shop.shopShare); // 品牌店铺分享页面
36 -router.get(/\/brand\/(.*)/, shop.index); // 店铺首页  
37 router.get('/product/shop/info.json', shop.getShopInfo); // 店铺介绍 37 router.get('/product/shop/info.json', shop.getShopInfo); // 店铺介绍
38 router.get('/product/shop/goods.json', shop.getBrandShopGoods); // 店铺商品列表 38 router.get('/product/shop/goods.json', shop.getBrandShopGoods); // 店铺商品列表
39 router.post('/product/shop/collect.json', shop.collectShop); // 收藏品牌店铺 39 router.post('/product/shop/collect.json', shop.collectShop); // 收藏品牌店铺
  40 +router.get('/product/shop/(.*)/', shop.index); // 品牌店铺页
40 41
41 // 商品详情controller 42 // 商品详情controller
42 const detail = require(`${cRoot}/detail`); 43 const detail = require(`${cRoot}/detail`);
43 44
44 -router.get(/\/item\/([\d]+)(.*)\.html/, detail.index); // 商品详情routers 45 +router.get(/\/product\/pro_([\d]+)_([\d]+)\/(.*).html/, detail.index); // 商品详情routers
45 router.get(/\/product\/product_([\d]+)\.json/, detail.product); 46 router.get(/\/product\/product_([\d]+)\.json/, detail.product);
46 router.get(/\/product\/intro_([\d]+)\.json/, detail.intro); 47 router.get(/\/product\/intro_([\d]+)\.json/, detail.intro);
47 router.post(/\product\/cart.json/, detail.addToCart); 48 router.post(/\product\/cart.json/, detail.addToCart);
48 router.post(/\product\/favorite.json/, detail.favorite); 49 router.post(/\product\/favorite.json/, detail.favorite);
49 router.get(/\/product\/cart-count.json/, detail.getCartCount); 50 router.get(/\/product\/cart-count.json/, detail.getCartCount);
50 router.get(/\/product\/search_product\.json/, detail.search); 51 router.get(/\/product\/search_product\.json/, detail.search);
  52 +
  53 +// alias: TODO: 测试完成 删除一下router,并更新资源位
  54 +router.get(/\/item\/([\d]+)(.*)\.html/, detail.index); // 商品详情routers
  55 +router.get(/\/brand\/(.*)/, shop.index); // 店铺首页
  56 +
  57 +router.get('/new', newProduct.index);
  58 +router.get('/new.json', newProduct.fetchProducts);
  59 +
  60 +router.get('/list', productList.index);
  61 +router.get('/list.json', productList.fetchProducts);
  62 +
  63 +router.get('/search', search.index);
  64 +router.get('/search.json', search.fetchProducts); // ajax
  65 +
  66 +
  67 +
  68 +
  69 +
51 module.exports = router; 70 module.exports = router;
@@ -56,11 +56,22 @@ Vue.filter('brandUrl', (value) => { @@ -56,11 +56,22 @@ Vue.filter('brandUrl', (value) => {
56 /** 56 /**
57 * 产品 URL 57 * 产品 URL
58 */ 58 */
59 -Vue.filter('goodsUrl', productId => {  
60 - if (!productId) {  
61 - return ''; 59 +Vue.filter('goodsUrl', (product, kind)=> {
  60 + let productId, goodsId, cnAlphabet;
  61 +
  62 + switch (kind) {
  63 + case 'collection':
  64 + productId = product.productId;
  65 + goodsId = product.goodsId;
  66 + cnAlphabet = product.cnAlphabet;
  67 + break;
  68 + default:
  69 + productId = product.productId;
  70 + goodsId = product.goodsList[0].goodsId;
  71 + cnAlphabet = product.cnAlphabet;
62 } 72 }
63 - return `/item/${productId}.html`; 73 +
  74 + return `/product/pro_${productId}_${goodsId}/${cnAlphabet}.html`;
64 }); 75 });
65 76
66 /** 77 /**
@@ -21,6 +21,11 @@ const util = require('common/util'); @@ -21,6 +21,11 @@ const util = require('common/util');
21 const interceptClick = require('common/intercept-click'); 21 const interceptClick = require('common/intercept-click');
22 const bus = require('common/vue-bus'); 22 const bus = require('common/vue-bus');
23 23
  24 +/**
  25 + * iOS 7 不支持 Promise, vue-lazyload 有用到,所以全局申明
  26 + */
  27 +global.Promise = Promise;
  28 +
24 // 隐藏 App 默认显示的 loading 29 // 隐藏 App 默认显示的 loading
25 Vue.mixin({ 30 Vue.mixin({
26 ready() { 31 ready() {
@@ -91,7 +91,7 @@ ul { @@ -91,7 +91,7 @@ ul {
91 } 91 }
92 92
93 @for $i from 1 to 3 { 93 @for $i from 1 to 3 {
94 - .line-clamp-$i { 94 + .line-clamp-$i { /* stylelint-disable-line */
95 -webkit-line-clamp: $(i); 95 -webkit-line-clamp: $(i);
96 96
97 @mixin line-clamp ; 97 @mixin line-clamp ;
@@ -34,6 +34,7 @@ @@ -34,6 +34,7 @@
34 } 34 }
35 $init: calc(($i + 1) * 0.12); 35 $init: calc(($i + 1) * 0.12);
36 } 36 }
  37 +
37 display: inline-block; 38 display: inline-block;
38 margin: 4px; 39 margin: 4px;
39 width: 30px; 40 width: 30px;
@@ -16,6 +16,7 @@ @@ -16,6 +16,7 @@
16 height: 130px; 16 height: 130px;
17 line-height: 130px; 17 line-height: 130px;
18 } 18 }
  19 +
19 height: 90px; 20 height: 90px;
20 border-bottom: 1px solid #e0e0e0; 21 border-bottom: 1px solid #e0e0e0;
21 22
@@ -10,13 +10,13 @@ @@ -10,13 +10,13 @@
10 <div class="sub-level-container"> 10 <div class="sub-level-container">
11 <ul class="sub-level"> 11 <ul class="sub-level">
12 <li > 12 <li >
13 - <a v-if="jump" href="/list?sort={{rightAll.sortId}}&sort_name=全部{{rightAll.categoryName}}&gender={{gender}}">全部{{rightAll.categoryName}}</a> 13 + <a v-if="jump" href="/product/list?sort={{rightAll.sortId}}&sort_name=全部{{rightAll.categoryName}}&gender={{gender}}">全部{{rightAll.categoryName}}</a>
14 <a v-else @click="noJumpReturn(rightAll.sortId, '全部' + rightAll.categoryName)">全部{{rightAll.categoryName}}</a> 14 <a v-else @click="noJumpReturn(rightAll.sortId, '全部' + rightAll.categoryName)">全部{{rightAll.categoryName}}</a>
15 </li> 15 </li>
16 </ul> 16 </ul>
17 <ul class="sub-level"> 17 <ul class="sub-level">
18 <li v-for="sub in cateNavRightData"> 18 <li v-for="sub in cateNavRightData">
19 - <a v-if="jump" href="/list?sort={{sub.relationParameter.sort}}&sort_name={{sub.categoryName}}&gender={{gender}}">{{sub.categoryName}}</a> 19 + <a v-if="jump" href="/product/list?sort={{sub.relationParameter.sort}}&sort_name={{sub.categoryName}}&gender={{gender}}">{{sub.categoryName}}</a>
20 <a v-else @click="noJumpReturn(sub.relationParameter.sort, sub.categoryName)">{{sub.categoryName}}</a> 20 <a v-else @click="noJumpReturn(sub.relationParameter.sort, sub.categoryName)">{{sub.categoryName}}</a>
21 </li> 21 </li>
22 </ul> 22 </ul>
@@ -253,8 +253,10 @@ @@ -253,8 +253,10 @@
253 this.$set('cateNavLeftData', this.category); 253 this.$set('cateNavLeftData', this.category);
254 this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []); 254 this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
255 255
  256 + let allSorts = this.cateNavLeftData[0].sub ? this.cateNavLeftData[0].sub.map(sort=>sort.relationParameter.sort).join(',') : '';
  257 +
256 this.$set('rightAll', this.cateNavLeftData ? { 258 this.$set('rightAll', this.cateNavLeftData ? {
257 - sortId: this.cateNavLeftData[0].sub.map(sort=>sort.relationParameter.sort).join(','), 259 + sortId: allSorts,
258 categoryName: this.cateNavLeftData[0].categoryName 260 categoryName: this.cateNavLeftData[0].categoryName
259 } : {}); 261 } : {});
260 } 262 }
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 right: 0; 36 right: 0;
37 left: 0; 37 left: 0;
38 z-index: 210; 38 z-index: 210;
39 - padding: 10px 30px; 39 + padding: 20px 30px;
40 height: 70px; 40 height: 70px;
41 max-width: 750px; 41 max-width: 750px;
42 margin-left: auto; 42 margin-left: auto;
@@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
44 line-height: 70px; 44 line-height: 70px;
45 font-size: 48px; 45 font-size: 48px;
46 background-color: #fff; 46 background-color: #fff;
  47 +
47 .icon, 48 .icon,
48 .header-title { 49 .header-title {
49 vertical-align: middle; 50 vertical-align: middle;
@@ -66,22 +67,24 @@ @@ -66,22 +67,24 @@
66 67
67 .header-right { 68 .header-right {
68 float: right; 69 float: right;
  70 +
69 .icon { 71 .icon {
70 margin-left: 30px; 72 margin-left: 30px;
71 } 73 }
72 } 74 }
73 75
74 .header-gap { 76 .header-gap {
75 - height: 90px; 77 + height: 100px;
76 background-color: transparent; 78 background-color: transparent;
77 } 79 }
78 80
79 .app.ios { 81 .app.ios {
80 .header { 82 .header {
81 - padding-top: 50px; 83 + padding-top: 60px;
82 } 84 }
  85 +
83 .header-gap { 86 .header-gap {
84 - height: calc(70 + 50 + 10)px; 87 + height: calc(70 + 60 + 10)px;
85 } 88 }
86 } 89 }
87 </style> 90 </style>
@@ -145,7 +145,7 @@ @@ -145,7 +145,7 @@
145 top: 0; 145 top: 0;
146 right: 0; 146 right: 0;
147 bottom: 0; 147 bottom: 0;
148 - left: 20%; 148 + left: 150px;
149 background-color: #fff; 149 background-color: #fff;
150 transform: translate3d(100%, 0, 0); 150 transform: translate3d(100%, 0, 0);
151 transition: all 0.3s 0.2s; 151 transition: all 0.3s 0.2s;
@@ -3,13 +3,13 @@ @@ -3,13 +3,13 @@
3 <ul class="cardlist card-large clearfix"> 3 <ul class="cardlist card-large clearfix">
4 <li class="card" v-for="item in data"> 4 <li class="card" v-for="item in data">
5 <div class="card-pic"> 5 <div class="card-pic">
6 - <a href="{{item.productId | goodsUrl}}"> 6 + <a href="{{item | goodsUrl}}">
7 <img v-lazy="item.defaultImages | resize 372 499" alt="{{item.productName}}"> 7 <img v-lazy="item.defaultImages | resize 372 499" alt="{{item.productName}}">
8 </a> 8 </a>
9 </div> 9 </div>
10 <div class="card-bd"> 10 <div class="card-bd">
11 <h2 class="card-label"> 11 <h2 class="card-label">
12 - <a href="{{item.productId | goodsUrl}}" class="line-clamp-2">{{item.productName}}</a> 12 + <a href="{{item | goodsUrl}}" class="line-clamp-2">{{item.productName}}</a>
13 </h2> 13 </h2>
14 <span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice | toFixed}}</span> 14 <span class="good-price" :class="{'old-price': item.marketPrice}" v-if="item.marketPrice">¥ {{item.marketPrice | toFixed}}</span>
15 <span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice | toFixed}}</span> 15 <span class="good-price" :class="{'sale-price': item.marketPrice}">¥ {{item.salesPrice | toFixed}}</span>
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 29
30 <div class="fav-null-box {{ nullbox }}"> 30 <div class="fav-null-box {{ nullbox }}">
31 <span class="fav-null">您暂无收藏任何品牌</span> 31 <span class="fav-null">您暂无收藏任何品牌</span>
32 - <a slot="go-shopping" class="go-shopping" href="/new">随便逛逛</a> 32 + <a slot="go-shopping" class="go-shopping" href="/product/new">随便逛逛</a>
33 </div> 33 </div>
34 </div> 34 </div>
35 </template> 35 </template>
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> 8 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
9 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span> 9 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
10 </div> 10 </div>
11 - <a :href="item.link | goodsUrl"> 11 + <a :href="item | goodsUrl 'collection'">
12 <div class="fav-img-box"> 12 <div class="fav-img-box">
13 <img :src="item.imgUrl | resize 152 203" alt=""/> 13 <img :src="item.imgUrl | resize 152 203" alt=""/>
14 </div> 14 </div>
@@ -34,7 +34,7 @@ @@ -34,7 +34,7 @@
34 </ul> 34 </ul>
35 <div class="fav-null-box {{ nullbox }}"> 35 <div class="fav-null-box {{ nullbox }}">
36 <span class="fav-null">您暂无收藏任何商品</span> 36 <span class="fav-null">您暂无收藏任何商品</span>
37 - <a slot="go-shopping" class="go-shopping" href='/new'>随便逛逛</a> 37 + <a slot="go-shopping" class="go-shopping" href='/product/new'>随便逛逛</a>
38 </div> 38 </div>
39 </div> 39 </div>
40 </template> 40 </template>
@@ -51,7 +51,7 @@ @@ -51,7 +51,7 @@
51 <div class="order-empty {{emptybox}}"> 51 <div class="order-empty {{emptybox}}">
52 <p>您暂时还没有订单</p> 52 <p>您暂时还没有订单</p>
53 <p>Your do not have an order <br>for the time being</p> 53 <p>Your do not have an order <br>for the time being</p>
54 - <a href="/new">随便逛逛</a> 54 + <a href="/product/new">随便逛逛</a>
55 </div> 55 </div>
56 <select id="cancel-reason" class="cancel-reason" v-on:blur="reasonChange" v-model="selected"> 56 <select id="cancel-reason" class="cancel-reason" v-on:blur="reasonChange" v-model="selected">
57 <option v-for="option in options" v-bind:value="{id:option.id,reason:option.reason}">{{option.reason}}</option> 57 <option v-for="option in options" v-bind:value="{id:option.id,reason:option.reason}">{{option.reason}}</option>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <div class="order-empty {{emptybox}}"> 45 <div class="order-empty {{emptybox}}">
46 <p>您暂时还没有订单</p> 46 <p>您暂时还没有订单</p>
47 <p>Your do not have an order <br>for the time being</p> 47 <p>Your do not have an order <br>for the time being</p>
48 - <a href="/new">随便逛逛</a> 48 + <a href="/product/new">随便逛逛</a>
49 </div> 49 </div>
50 </template> 50 </template>
51 <script> 51 <script>
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 filterConfig: null, 36 filterConfig: null,
37 37
38 // query 38 // query
39 - url: '/list.json', 39 + url: '/product/list.json',
40 order: '', 40 order: '',
41 filter: {}, 41 filter: {},
42 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0 42 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 filterConfig: null, 36 filterConfig: null,
37 37
38 // query 38 // query
39 - url: '/new.json', 39 + url: '/product/new.json',
40 order: '', 40 order: '',
41 filter: {}, 41 filter: {},
42 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0 42 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0
@@ -30,7 +30,7 @@ @@ -30,7 +30,7 @@
30 orderConfig: [], 30 orderConfig: [],
31 31
32 // query 32 // query
33 - url: '/search.json', 33 + url: '/product/search.json',
34 order: '', 34 order: '',
35 query: decodeURIComponent(qs.query), 35 query: decodeURIComponent(qs.query),
36 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0 36 page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 11
12 <style> 12 <style>
13 .top-box { 13 .top-box {
14 - .header { 14 + &.header-wrap {
15 background-color: transparent; 15 background-color: transparent;
16 color: #fff; 16 color: #fff;
17 } 17 }
@@ -22,7 +22,7 @@ @@ -22,7 +22,7 @@
22 } 22 }
23 23
24 .top-change { 24 .top-change {
25 - .header { 25 + &.header-wrap {
26 background-color: #fff; 26 background-color: #fff;
27 color: #000; 27 color: #000;
28 } 28 }