Authored by 沈志敏

Merge branch 'feature/home' into develop

... ... @@ -24,6 +24,7 @@ const fav = {
},
favpaging: (req, res, next) => {
let uid = req.user.uid;
uid = 20000134; // 测试uid
const tab = req.query.tab;
... ... @@ -33,6 +34,7 @@ const fav = {
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) {
... ... @@ -41,7 +43,7 @@ const fav = {
link: '', // todo
imgUrl: d.brand_ico ? helpers.image(d.brand_ico, 160, 125) : '',
brandName: d.brand_name,
down: d.status == 0
down: d.status === 0
});
});
... ... @@ -63,6 +65,7 @@ const fav = {
}
let link = '';
if (d.goodsId && d.cnAlphabet) {
link = helpers.urlFormat(`/product/pro_${d.product_id}_${d.goodsId}/${d.cnAlphabet}.html`);
}
... ... @@ -75,7 +78,7 @@ const fav = {
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
invalidGoods: d.status === 0
});
});
... ... @@ -92,14 +95,16 @@ const fav = {
},
deletefav: (req, res, next) => {
let uid = req.user.uid;
uid = 20000134; // 测试uid
const favId = req.body.favId;
const type = req.body.type;
favModel.favoriteDelete(uid, favId, type).then(data => {
return res.json(data);
}).catch(next);
}
}
};
module.exports = fav;
... ...
... ... @@ -16,6 +16,7 @@ const helpers = global.yoho.helpers;
const component = {
index: (req, res, next) => {
let uid = req.user.uid;
uid = 8050378; // 测试uid
if (!uid && req.xhr) {
... ... @@ -27,7 +28,7 @@ const component = {
homeModel.getUserHomeData(uid).then(data => {
const proData = data[0];
let result = {
const result = {
module: 'home',
page: 'index',
head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
... ... @@ -36,6 +37,7 @@ const component = {
refer: req.originalUrl
}),
};
res.render('index', _.merge(result, data[1]));
}).catch(next);
},
... ... @@ -104,6 +106,7 @@ const component = {
}
}).catch(next);
},
// 关于我们
aboutUs: (req, res) => {
res.render('about-us', {
... ...
... ... @@ -39,12 +39,11 @@ const refund = {
res.json(result);
}).catch(next);
},
saveLogistics(req, res, next) {
const company_id = req.body.company_id;
const company_name = req.body.company_name;
const num = req.body.num;
saveLogistics(req, res) {
// todo 调用保存物流信息接口
// const companyId = req.body.company_id;
// const companyName = req.body.company_name;
// const num = req.body.num;
res.json({
code: 200
});
... ...
... ... @@ -38,8 +38,8 @@ exports.getFavBrandData = (uid, gender, page, limit) => {
limit: limit
}).then(result => {
return result.data;
})
}
});
};
/**
* 取消收藏的商品/品牌数据
... ... @@ -56,4 +56,4 @@ exports.favoriteDelete = (uid, favId, type) => {
type: type,
fav_id: favId
});
}
\ No newline at end of file
};
\ No newline at end of file
... ...
const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const BrandList = require('home/fav-brand-list.vue');
const favBrandList = require('home/fav-brand-list.vue');
Vue.use(infiniteScroll);
new Vue({
el: '#fav-content',
components: {
'favBrandList': BrandList
favBrandList
}
});
... ...
const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const ProductList = require('home/fav-product-list.vue');
const favProductList = require('home/fav-product-list.vue');
Vue.use(infiniteScroll);
new Vue({
el: '#fav-content',
components: {
'favProductList': ProductList
favProductList
}
});
... ...
... ... @@ -71,6 +71,7 @@
.fav-price {
margin-top: 20px;
}
.new-price {
color: #d1021c;
... ... @@ -83,7 +84,6 @@
color: #b0b0b0;
font-size: 24px;
}
}
.save-price {
position: absolute;
... ... @@ -91,9 +91,9 @@
left: 0;
width: 100%;
min-height: 24px;
}
span {
&.sell-out {
.sell-out {
float: right;
padding: 5px 18px;
color: #b0b0b0;
... ... @@ -102,8 +102,6 @@
}
}
}
}
}
.fav-null {
font-size: 22px;
... ... @@ -113,13 +111,13 @@
text-align: center;
&:before {
content: '';
content: "";
display: block;
width: 188px;
height: 171px;
background: resolve("home/fav/fav-null.png");
background-size: 100% 100%;
margin: 0 auto 45px auto;
margin: 0 auto 45px;
}
}
... ... @@ -127,13 +125,13 @@
width: 472px;
height: 88px;
line-height: 88px;
margin: 80px auto 0 auto;
margin: 80px auto 0;
background: #444;
text-align: center;
color: #fff;
display: block;
font-size: 26px;
border-radius:.2rem;
border-radius: 0.2rem;
}
}
}
... ... @@ -232,13 +230,13 @@
text-align: center;
&:before {
content: '';
content: "";
display: block;
width: 188px;
height: 171px;
background: resolve("home/fav/fav-null.png");
background-size: 100% 100%;
margin: 0 auto 45px auto;
margin: 0 auto 45px;
}
}
... ... @@ -246,13 +244,13 @@
width: 472px;
height: 88px;
line-height: 88px;
margin: 80px auto 0 auto;
margin: 80px auto 0;
background: #444;
text-align: center;
color: #fff;
display: block;
font-size: 26px;
border-radius:.2rem;
border-radius: 0.2rem;
}
}
}
... ...
... ... @@ -14,9 +14,9 @@
font-size: 34px;
line-height: 138px;
height: 469px;
background-size: cover;
background: resolve("home/header-bg.png");
text-align: center;
background: resolve("home/header-bg.png");
background-size: cover;
.user-avatar {
display: inline-block;
... ...
... ... @@ -6,6 +6,4 @@
@import "order";
@import "coin";
@import "logistics";
/*@import "order-detail";*/
/* @import "order-detail"; */
... ...
... ... @@ -29,6 +29,7 @@
direction: rtl;
margin-right: 10px;
}
.icon {
margin-top: 27px;
margin-right: 10px;
... ... @@ -41,14 +42,13 @@
top: 0;
right: 40px;
width: 360px;
height: 88px;
height: 86px;
color: #444;
padding: 0;
border: none;
-webkit-appearance: none;
}
.num {
width: 440px;
text-align: right;
... ... @@ -80,15 +80,15 @@
.search-input {
position: relative;
text-align: center;
padding: 16px 16px;
padding: 16px;
border-bottom: 1px solid #e6e6e6;
input {
height: 56px;
width: 100%;
padding-left: 15px;
padding-left: 25px;
border-radius: 20px;
font-size: 36px;
font-size: 22px;
color: #b0b0b0;
background: #eee;
border: none;
... ... @@ -97,6 +97,7 @@
input::-webkit-input-placeholder { /* WebKit browsers */
text-align: center;
}
input:-ms-input-placeholder { /* Internet Explorer 10+ */
text-align: center;
}
... ... @@ -107,7 +108,6 @@
margin-left: 30px;
.company-item {
h2 {
height: 50px;
line-height: 50px;
... ...
... ... @@ -14,7 +14,7 @@
<br/>
<div class="fav-price">
<span class="new-price" v-if="item.discountPrice">{{item.discountPrice}}</span>
<span class="fav-price {{ item.discountPrice ? 'price-underline' : ''}}">{{item.price}}</span>
<span class="{{ item.discountPrice ? 'price-underline' : ''}}">{{item.price}}</span>
</div>
<br/>
<div class="save-price">
... ...