Authored by 郭成尧

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

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