Authored by 沈志敏

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

... ... @@ -3,17 +3,17 @@ Name | Path | Note
-------- | ------------------------------------ | ---------
首页 | / |
侧边栏 | /sidebar | 只有 app 使用
品牌列表 | /brands |
品牌列表 | /brand |
品类 | /cate |
全部分类 | /cate-all |
商品列表 | /list?sort=1 |
品牌店铺 | /product/shop?domain=sctest1 |
品牌店铺分享页面 | /product/shop-share?domain=colormad |
品牌店铺 | /brand/{domain} |
品牌店铺分享页面 | /brand/share/{domain} |
商品详情 | /product/{productId} |
新品抢先看 | /new |
搜索页 | /search?query=xxx |
资讯列表 | /news |
资讯详情 | /news/{newsId} |
资讯列表 | /editorial/list |
资讯详情 | /editorial/{newsId} |
个人中心 | /me |
个人信息 | /me/mydetails |
全部订单 | /me/order?type=1 |
... ...
... ... @@ -10,11 +10,7 @@ const api = global.yoho.API;
const brandApi = require('./brand-api');
const logger = global.yoho.logger;
const _ = require('lodash');
const querystring = require('querystring');
const urlFormat = (path, qs) => {
return path + '?' + querystring.stringify(qs);
};
const camelCase = global.yoho.camelCase;
/**
* 处理品牌一览品牌列表数据
... ... @@ -33,8 +29,6 @@ const handleBrandList = origin => {
_.forEach(value, (subValue) => {
brands.push({
name: subValue.brand_name,
// link: helpers.urlFormat('/brand', {domain: subValue.brand_domain}),
link: '/product/shop?domain=' + subValue.brand_domain,
logo: subValue.brand_ico
});
... ... @@ -78,77 +72,12 @@ const getBrandListData = params => {
* @returns {*|Promise.<TResult>}
*/
const getCateListData = params => {
let finalResult = [];
let item = {};
let oneClass = [];
let subitem = {};
let genderArr = {
MEN男士: '1,3',
WOMEN女士: '2,3',
LIFESTYLE生活: '1,2,3'
};
return brandApi.getCateListData(params).then(result => {
if (result.code !== 200) {
return [];
if (result.code === 200) {
return camelCase(result.data);
} else {
logger.error('getCateListData api code no 200 or data is null');
}
_.forEach(result.data, (category, categorykey) => {
oneClass = {name: categorykey, ca: []};
_.forEach(category, (cate) => {
item = {
id: cate.category_id,
name: cate.category_name,
sort: cate.relation_parameter.sort,
sub: []
};
if (_.isEmpty(cate.sub)) {
item.url = urlFormat('/list', {
sort: item.sort,
sort_name: item.name,
gender: genderArr[categorykey]
});
oneClass.ca.push(item);
return true;// equal continue;
}
// 有子分类的,首先添加一级分类
item.sub.push({
id: item.id,
name: '全部' + item.name,
sort: item.sort,
url: urlFormat('/list', {
sort: item.sort,
sort_name: item.name,
gender: genderArr[categorykey]
}),
sub: []
});
_.forEach(cate.sub, (sub) => {
subitem = {
id: sub.category_id,
name: sub.category_name,
sort: sub.relation_parameter.sort,
url: ''
};
subitem.url = urlFormat('/list', {
sort: subitem.sort,
sort_name: subitem.name,
gender: genderArr[categorykey]
});
item.sub.push(subitem);
});
oneClass.ca.push(item);
});
finalResult.push(oneClass);
});
return finalResult;
});
};
... ...
... ... @@ -15,7 +15,8 @@ module.exports = {
index: (req, res) => {
res.render('shop/index', {
module: 'product',
page: 'shop'
page: 'shop',
domain: req.params[0]
});
},
... ... @@ -77,7 +78,8 @@ module.exports = {
shopShare: (req, res) => {
res.render('shop/share', {
module: 'product',
page: 'shop-share'
page: 'shop-share',
domain: req.params[0]
});
}
};
... ...
... ... @@ -32,11 +32,11 @@ router.get('/list.json', productList.fetchProducts);
// 品牌店铺页面
const shop = require(`${cRoot}/shop`);
router.get('/product/shop', shop.index); // 店铺首页
router.get(/\/brand\/share\/(.*)/, shop.shopShare); // 品牌店铺分享页面
router.get(/\/brand\/(.*)/, shop.index); // 店铺首页
router.get('/product/shop/info.json', shop.getShopInfo); // 店铺介绍
router.post('/product/shop/goods.json', shop.getBrandShopGoods); // 店铺商品列表
router.post('/product/shop/collect.json', shop.collectShop); // 收藏品牌店铺
router.get('/product/shop/share', shop.shopShare); // 品牌店铺分享页面
// 商品详情controller
const detail = require(`${cRoot}/detail`);
... ...
<div id="shop">
<div id="shop" data-domain="{{domain}}">
<shop-box></shop-box>
</div>
... ...
<div id="share">
<div id="share" data-domain="{{domain}}">
<share-box></share-box>
</div>
... ...
/*
* @Author: Targaryen
* @Date: 2016-08-02 17:29:52
* @Last Modified by: Targaryen
* @Last Modified time: 2016-08-02 17:42:26
*/
let Vue = require('vue');
Vue.directive('lazy-html', function(html) {
html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">');
this.$el.innerHTML = html;
this.$vm.$compile(this.$el);
});
... ...
... ... @@ -50,7 +50,7 @@ Vue.filter('clothingGenderIdentity', (value) => {
* @param value brand domain
*/
Vue.filter('brandUrl', (value) => {
return `/product/shop?domain=${value}`;
return `/brand/${value}`;
});
/**
... ...
... ... @@ -24,11 +24,8 @@ const cate = {
lifestyle: '6f7b590ed3844e680d4052fc5c4d98ad'
};
/* TODO 资讯列表资源位 */
const editorial = {
all: 'd4fdfcad1ec877d466d9780efaf4d296',
men: 'e1f8dce8cb9de1a0977479c13c4d3dcc',
women: '5c0b9963d8b75e6fd788a2b49402be14'
all: '87e3b7ff41132fde5e061fb1c3899f84'
};
module.exports = {
... ...
... ... @@ -3,11 +3,14 @@ const lazyload = require('vue-lazyload');
const app = require('editorial/detail.vue');
require('common/vue-filter');
require('common/vue-directive');
Vue.use(lazyload);
new Vue({
el: '#app',
components: {
app
}
});
Vue.use(lazyload);
... ...
... ... @@ -3,7 +3,7 @@
<div class="cate-nav clearfix">
<ul>
<li v-for="(index, cate) in brandCate" v-on:click='cateNavTopFun(index)' v-bind:class="{focus: index === topcurrent}" v-bind:style="{width: widthli + '%'}">
<span>{{cate.name}}</span>
<span>{{index}}</span>
</li>
</ul>
</div>
... ... @@ -11,13 +11,14 @@
<div class="content" style="height: 522px;">
<ul class="primary-level">
<li v-for="(index, ca) in cateNavLeftData" v-bind:class="{focus: index === leftcurrent}" class="p-level-item" v-on:click='cateNavLeftFun(index)'>
<a href="{{ca.url}}">{{ca.name}}</a>
<a v-if="ca.sub" href="/list?sort={{ca.categoryId}}&sort_name={{ca.categoryName}}&gender={{gender}}">{{ca.categoryName}}</a>
<a v-else="ca.sub">{{ca.categoryName}}</a>
</li>
</ul>
<div class="sub-level-container">
<ul class="sub-level">
<li v-for="sub in cateNavRightData">
<a href="{{sub.url}}">{{sub.name}}</a>
<a href="/list?sort={{sub.categoryId}}&sort_name={{sub.categoryName}}&gender={{gender}}">{{sub.categoryName}}</a>
</li>
</ul>
</div>
... ... @@ -202,6 +203,12 @@
const contentCode = require('content-code');
const qs = require('yoho-qs');
const genderCode = {
MEN男士: '1,3',
WOMEN女士: '2,3',
LIFESTYLE生活: '1,2,3'
};
module.exports = {
props: [],
data() {
... ... @@ -210,9 +217,10 @@
cateNavLeftData: [],
cateNavRightData: [],
topcurrent: 0,
widthli: 25,
widthli: 33.33,
leftcurrent: 0,
page: 'cate',
gender: '1,2,3',
contentCode: contentCode.brand[qs.channel || 'men']
};
},
... ... @@ -226,11 +234,10 @@
url: '/cate/list.json',
data: data
}).then(result => {
if (result.length > 0) {
if (result) {
this.brandCate = result;
this.widthli = 100 / result.length;
this.cateNavLeftData = this.brandCate[0].ca;
this.cateNavRightData = this.cateNavLeftData[0].sub;
this.cateNavLeftData = result['MEN男士'];
this.cateNavRightData = result['MEN男士'][0].sub;
}
}).fail(() => {
tip('网络错误');
... ... @@ -238,7 +245,8 @@
},
cateNavTopFun(index) {
this.topcurrent = index;
this.cateNavLeftData = this.brandCate[index].ca;
this.gender = genderCode[index];
this.cateNavLeftData = this.brandCate[index];
this.cateNavRightData = this.cateNavLeftData[0].sub;
},
cateNavLeftFun(index) {
... ...
... ... @@ -14,7 +14,7 @@
</div>
</div>
</div>
<index-list v-bind:index-list="indexList"></index-list>
<index-list class="index-list" v-bind:index-list="indexList"></index-list>
</template>
<style>
.brand-list-box {
... ... @@ -53,6 +53,10 @@
}
}
}
.index-list {
top: 40px;
}
</style>
<script>
const $ = require('jquery');
... ...
<template>
<div v-if="block.text" class="text-block">
{{{block.text.data.text}}}
<div v-if="block.text" class="text-block a" v-lazy-html="block.text.data.text">
</div>
<div v-if="block.singleImage">
... ... @@ -8,7 +7,7 @@
<a :href="item.url">
<img :title="item.title"
:alt="item.alt"
:src="item.src | resize 750 469" width="375"/>
v-lazy="item.src | resize 750 469" width="375"/>
</a>
</div>
</div>
... ...
... ... @@ -182,8 +182,6 @@
const $ = require('jquery');
const yoho = require('yoho');
require('common/vue-filter');
module.exports = {
components: {
'content-block': require('./content-block.vue'),
... ...
... ... @@ -40,6 +40,11 @@
font-size: 32px;
font-weight: 700;
padding: 10px 20px;
text-overflow: ellipsis;
overflow-y: hidden;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.editorial-des {
... ... @@ -77,7 +82,7 @@
module.exports = {
data() {
return {
contentCode: contentCode.editorial[qs.channel || 'all'],
contentCode: contentCode.editorial.all,
editorialList: [],
page: 0,
scrollDisabled: false
... ...
... ... @@ -49,11 +49,13 @@
}
</style>
<script>
const $ = require('jquery');
const shareBottom = require('component/tool/share-bottom.vue');
const qs = require('yoho-qs');
const tip = require('common/tip');
const share = require('common/share');
const $share = $('#share');
module.exports = {
data() {
... ... @@ -77,7 +79,7 @@
getShopInfo() {
$.get({
url: '/product/shop/info.json',
data: { domain: qs.domain }
data: { domain: $share.data('domain') }
}).done(result => {
this.shopInfo = result;
}).fail(() => {
... ...
... ... @@ -22,6 +22,8 @@
const goodsList = require('component/product/list.vue');
const filter = require('component/product/filter.vue');
const $shop = $('#shop');
const shareSubTitle = '我在BLK发现了一个不错的品牌,赶快来看看吧!';
let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
... ... @@ -39,7 +41,9 @@
// query
url: '/product/shop/goods.json',
sort: '',
filter: {},
filter: {
domain: $shop.data('domain')
},
page: 0, // page= 0 未搜索, 1 并且productList.length =0 没有数据, page = page_total 全部加载完
totalPage: 3,
... ... @@ -67,7 +71,7 @@
$.get({
url: '/product/shop/info.json',
data: {
domain: locationQuery.domain
domain: $shop.data('domain')
}
}).done(result => {
if (result) {
... ... @@ -76,7 +80,7 @@
this.shareData = {
title: result.shopName,
des: shareSubTitle,
url: '/product/shop/share?domain=' + locationQuery.domain,
url: '/brand/share/' + $shop.data('domain'),
img: result.shopBg,
isBlkShop: result.isBlkShop,
domain: locationQuery.domain,
... ... @@ -148,7 +152,6 @@
bus.$on('sort.change', ({
val
}) => {
console.log(val);
this.sort = val;
});
... ...
... ... @@ -17,7 +17,7 @@
height: 80px;
padding: 10px 20px;
position: fixed;
top: 40px;
top: 0;
left: 0;
z-index: 99;
color: #fff;
... ... @@ -55,6 +55,12 @@
top: 0;
padding: 55px 20px 10px;
}
.ios {
.top-box {
top: 40px;
}
}
</style>
<script>
... ...