Authored by 王洪广

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

... ... @@ -29,67 +29,16 @@ const fav = {
const tab = req.query.tab;
const page = req.query.page;
const result = [];
let isend = true;
if (tab === 'brand') {
const gender = '1,2,3'; // todo 获取频道的性别
favModel.getFavBrandData(uid, gender, page, 10).then(data => {
if (data && page <= data.page_total) {
data.brand_list.forEach(function(d) {
result.push({
fav_id: d.brand_id,
link: '', // todo
imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '',
brandName: d.brand_name,
down: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return res.json({
isend: isend,
list: result
});
return res.json(data);
});
} else {
favModel.getFavProductData(uid, page, 10).then(data => {
if (data && page <= data.page_total) {
data.product_list.forEach(function(d) {
if (!d.product_skn) {
return;
}
let link = '';
if (d.goodsId && d.cnAlphabet) {
link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`);
}
result.push({
fav_id: d.product_id,
link: link,
imgUrl: d.image ? helpers.image(d.image) : '',
title: d.product_name,
price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2) : false,
sellOut: d.storage < 0,
invalidGoods: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return res.json({
isend: isend,
list: result
});
return res.json(data);
}).catch(next);
}
},
... ...
'use strict';
const api = global.yoho.API;
const helpers = global.yoho.helpers;
/**
* 处理用户收藏的商品数据
... ... @@ -16,7 +17,47 @@ exports.getFavProductData = (uid, page, limit) => {
page: page,
limit: limit
}).then(result => {
return result.data;
var isend = true,
list = [],
data = result.data;
if (data && page <= data.page_total) {
data.product_list.forEach(function(d) {
if (!d.product_skn) {
return;
}
let link = '';
let discountPrice = false;
if (d.goodsId && d.cnAlphabet) {
link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`);
}
if (Number(d.market_price) - Number(d.sales_price) > 0) {
discountPrice = '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2);
}
list.push({
fav_id: d.product_id,
link: link,
imgUrl: d.image ? helpers.image(d.image) : '',
title: d.product_name,
price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
discountPrice: discountPrice,
sellOut: d.storage < 0,
invalidGoods: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return {
isend: isend,
list: list
};
});
};
... ... @@ -37,7 +78,30 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
page: page,
limit: limit
}).then(result => {
return result.data;
var isend = true,
list = [],
data = result.data;
if (data && page <= data.page_total) {
data.brand_list.forEach(function(d) {
list.push({
fav_id: d.brand_id,
link: '', // todo
imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '',
brandName: d.brand_name,
down: d.status === 0
});
});
if (page < data.page_total) {
isend = false;
}
}
return {
isend: isend,
list: list
};
});
};
... ...
... ... @@ -15,8 +15,8 @@ module.exports = {
port: 6004,
siteUrl: '//m.yohoblk.com',
domains: {
api: 'http://192.168.102.202:8080/gateway/',
service: 'http://192.168.102.202:8080/gateway/'
api: 'http://devapi.yoho.cn:58078/',
service: 'http://devservice.yoho.cn:58077/'
},
subDomains: {
host: '.m.yohoblk.com',
... ...
... ... @@ -5,165 +5,3 @@
@import "about-us";
@import "coin";
@import "logistics";
.my-page {
color: #444;
background: #f0f0f0;
a {
color: #000;
}
.user-info {
display: block;
position: relative;
padding: 0 30px;
color: #000;
font-size: 34px;
line-height: 138px;
height: 469px;
background-size: cover;
background: resolve("home/header-bg.png");
text-align: center;
.user-avatar {
display: inline-block;
position: relative;
top: 90px;
width: 200px;
height: 200px;
border-radius: 50%;
border: 6px solid #a7a8a9;
background: resolve("home/user-icon.png");
background-size: 100%;
}
.username {
display: inline-block;
padding: 0 16px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 32px;
max-width: 260px;
}
}
.login-btn {
display: inline-block;
top: 40px;
left: 194px;
width: 244px;
height: 82px;
line-height: 82px;
color: #fff;
border: 4px solid #fff;
margin: 150px auto;
}
.my-order {
margin-bottom: 30px;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
background: #fff;
.order-title {
display: block;
padding: 0 29px;
font-size: 34px;
line-height: 88px;
span {
color: #e0e0e0;
float: right;
}
&.highlight {
background: #eee;
}
.read-order {
font-size: 30px;
}
}
.order-type {
padding: 20px 30px;
text-align: center;
border-top: 1px solid #e0e0e0;
.type-item {
position: relative;
float: left;
color: #444;
font-size: 24px;
line-height: 1.5;
width: 170px;
&.highlight {
background: #eee;
}
.num {
position: absolute;
top: -24px;
right: 36px;
width: 72px;
height: 72px;
font-size: 34px;
line-height: 72px;
color: #fff;
background: #f03d35;
text-align: center;
border-radius: 50%;
transform: scale(0.5);
}
}
}
}
.group-list {
margin-bottom: 30px;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
background: #fff;
.list-item {
display: block;
position: relative;
padding: 0 30px;
font-size: 34px;
line-height: 90px;
overflow: hidden;
&.highlight {
background: #eee;
}
&:after {
content: "";
position: absolute;
right: 0;
bottom: 0;
width: 100%;
height: 0;
border-top: 1px solid #f0f0f0;
}
&:last-child:after {
content: none;
}
}
.icon {
margin-right: 5px;
font-size: 34px;
vertical-align: top;
}
.num {
color: #b0b0b0;
float: right;
}
}
}
... ...
... ... @@ -41,9 +41,7 @@
productList: [],
// state:
inSearching: false,
brand: require('product/filter/brand-group-mock')
inSearching: false
};
},
watch: {
... ...
<template>
<div class="upload">
<form v-on:change="upload">
<form v-el:form v-on:change="upload">
<label class="label-input icon" for="{{inputId}}">
<input id="{{inputId}}" type="file" name="filename">
</label>
... ... @@ -18,7 +18,7 @@
},
methods: {
upload(e) {
const formData = new FormData(e.target.closest('form'));
const formData = new FormData(this.$els.form);
formData.append('bucket', this.bucket || '');
$.ajax({
... ...
... ... @@ -25,23 +25,11 @@ module.exports = {
},
data: function() {
return {
// mock data
params: {
color: [{
colorId: 11,
colorName: '红色',
colorCode: 'ee0000'
}],
gender: [{
genderName: 'BOYS',
genderId: '1,3'
}],
size: [{
sizeName: '100',
sizeId: 255
}]
// 选择的值
params: {},
}
// 确定的值
selected: {}
};
},
watch: {},
... ... @@ -66,7 +54,6 @@ module.exports = {
});
},
entrySub: function(key) {
console.log(this.config[key]);
bus.$emit('filter.sub.show', {
val: key,
ref: this._uid
... ...
module.exports = {
A: [{
id: 5,
type: '0',
hotKeyword: 'AAAA 葛民辉',
isShowNew: 'N',
domain: 'aaaa',
alif: 'A',
isHot: 'N',
ico: 'http://img10.static.yhbimg.com/logo/2012/04/12/13/013c4f832d97df25ce9f79a294d5e05d6b.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'AAAA',
keyword: '街头,嘻哈,创意,潮流,AAAA,TEE,扭蛋',
nameEn: 'AAAA',
nameCn: 'AAAA'
}, {
id: 862,
type: '0',
hotKeyword: '',
isShowNew: 'N',
domain: 'aape',
alif: 'A',
isHot: 'N',
ico: 'http://img13.static.yhbimg.com/logo/2015/12/03/15/02a0c256f3a75784fbcaa7d37715fcfa00.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'Aape',
keyword: '',
nameEn: 'Aape',
nameCn: 'Aape'
}, {
type: '0',
id: 1209,
alif: 'A',
ico: 'http://img13.static.yhbimg.com/logo/2016/01/04/10/02c340899abe71a7ee1cfeb7591b6b96c0.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'AAVA Lifestyle',
keyword: '香薰,首饰,手表,围巾',
nameEn: 'AAVA Lifestyle',
nameCn: '爱瓦生活',
hotKeyword: '创意 品质 居家',
shelvestime: 1451877790,
isShowNew: 'N',
domain: 'aavalifestyle',
isHot: 'N'
}, {
id: 536,
type: '0',
hotKeyword: '',
isShowNew: 'N',
domain: 'ablejeans',
alif: 'A',
isHot: 'Y',
ico: 'http://img13.static.yhbimg.com/logo/2014/05/08/12/0241b56aa9407b25d60b8d6c03ad6396c6.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'ABLE JEANS',
keyword: 'ABLE JEANS',
nameEn: 'ABLE JEANS',
nameCn: '欧帛牛仔'
}, {
id: 262,
type: '0',
hotKeyword: '',
isShowNew: 'N',
domain: 'absurdlogic',
alif: 'A',
isHot: 'Y',
ico: 'http://img12.static.yhbimg.com/logo/2015/11/02/16/026f093fae4c9e3c7788508be9d109fc39.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'ABSURD LOGIC',
keyword: '',
nameEn: 'ABSURD LOGIC',
nameCn: '荒诞逻辑'
}],
B: [{
id: 373,
type: '0',
hotKeyword: '',
isShowNew: 'N',
domain: 'babyghost',
alif: 'B',
isHot: 'Y',
ico: 'http://img12.static.yhbimg.com/logo/2015/12/09/14/020b4cfa2aa3fb66642259f2be63780cc3.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'BABYGHOST',
keyword: '',
nameEn: 'BABYGHOST',
nameCn: '北北高斯'
}, {
id: 1039,
type: '0',
hotKeyword: '',
isShowNew: 'N',
domain: 'backbone',
alif: 'B',
isHot: 'N',
ico: 'http://img11.static.yhbimg.com/logo/2015/12/03/16/01c06f7a1524a2a9052350a8c03c2475d7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'BACK BONE',
keyword: '',
nameEn: 'backbone',
nameCn: 'BACK BONE'
}, {
type: '0',
id: 980,
alif: 'B',
ico: 'http://img10.static.yhbimg.com/logo/2015/09/29/17/0173fd258619dc31c9a659b5be0507eeb1.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',
name: 'B+ by Beautyberry',
keyword: '原创,设计',
nameEn: 'B+ by Beautyberry',
nameCn: 'B+ by Beautyberry',
hotKeyword: '原创,设计',
shelvestime: 1448608361,
isShowNew: 'N',
domain: 'beautyberry',
isHot: 'N'
}]
};
... ... @@ -12,19 +12,40 @@
</div>
</template>
<script>
/**
* 数据结构:
* {
* index: [brandObj, brandObj],
* index: [{}....]
* }
*/
module.exports = {
props: ['data', 'val'],
methods: {
select: function(val) {
this.val = val;
/**
* 数据结构:
* {
* index: [brandObj, brandObj],
* index: [{}....]
* }
*/
const $ = require('yoho-jquery');
module.exports = {
props: {
val: Number,
data: {
coerce: (data) => {
// 以brand.alif 分组
const res = {};
$.each(data, brand => {
let groupName = brand.alif;
if (!res.hasOwnProperty(groupName)) {
res[groupName] = [];
}
res[groupName].push(brand);
});
}
}
},
methods: {
select: function(val) {
this.val = val;
}
}
}
};
};
</script>
... ...
<template>
<div>
<filter-sub :data="brand" :value="3" type="brand"></filter-sub>
<!--<filter-sub :data="brand" :value="3" type="brand"></filter-sub>-->
<Sort :config="sortConfig" :val="sort">
</Sort>
<List :data="productList"></List>
... ... @@ -44,9 +44,7 @@
productList: [],
// state
inSearching: false, // 请求中
brand: require('product/filter/brand-group-mock')
inSearching: false // 请求中
};
},
components: {
... ... @@ -90,8 +88,8 @@
});
},
openFilterSub: function() {
console.log('TODO: open filter sub');
openFilterSub: function(classify) {
console.log('TODO: open filter sub', classify);
},
/**
... ... @@ -147,9 +145,7 @@
* 1. 打开view
* 2. 监听 router.back ,重新设置 筛选值
*/
bus.$on('filter.sub.show', function({
val
}) {
bus.$on('filter.sub.show', function({val}) {
self.openFilterSub(val);
});
... ... @@ -159,6 +155,4 @@
</script>
<style>
</style>
... ...