Authored by htoooth

Merge remote-tracking branch 'origin/release/1.0' into release/1.0

... ... @@ -13,7 +13,7 @@ const brand = require('../models/brand');
* @param res
*/
const index = (req, res, next) => {
let channel = req.cookies._Channel || 'men';
let channel = req.yoho.channel || 'men';
let contentCode = '';
let name = '';
... ...
... ... @@ -8,13 +8,13 @@
<img class="lazy-img" data-original="{{#if smallImg}}{{image src 218 490}}{{^}}{{image src 327 490}}{{/if}}" alt="{{alt}}">
</a>
<div class="brand-name">
<a href="{{url}}">
<a href="{{url}}" target="_blank">
<span class="bottom">{{title}}</span>
</a>
</div>
{{^}}
<div class="brand-name">
<a href="{{url}}">
<a href="{{url}}" target="_blank">
<span class="top">{{title}}</span>
</a>
</div>
... ...
... ... @@ -19,11 +19,22 @@ const index = (req, res, next) => {
let pageNum = req.query.page || 1;
let limit = req.query.limit || 20;
let appType = 1;
let udid = md5(req.ip);
let channel = req.cookies._Channel || 'men';
let gender = '';
if (channel === 'men') {
gender = '1,3';
} else if (channel === 'women') {
gender = '2,3';
} else {
gender = '3,3';
}
// let gender = req.query.brand || 1;
console.log(gender);
editorialModel.getIndexData(pageNum, limit, appType, udid, gender).then((result) => {
editorialModel.getIndexData(pageNum, limit, appType).then((result) => {
// console.log(result.msg)
res.display('index', {
module: 'editorial',
page: 'index',
... ... @@ -67,8 +78,9 @@ const list = (req, res) => {
let limit = req.query.limit || 20;
let tag = req.query.query;
let authorId = req.query.authorId;
let udid = md5(req.ip);
editorialModel.getListData(pageNum, limit, tag, authorId).then((result) => {
editorialModel.getListData(pageNum, limit, tag, authorId, udid).then((result) => {
res.display('list', {
module: 'editorial',
... ... @@ -116,10 +128,11 @@ const list = (req, res) => {
*/
const detail = (req, res, next) => {
let id = req.params.id;
let appType = 1;
// let clientType = 'pc';
editorialModel.getDetailData(id).then((result) => {
editorialModel.getDetailData(id, appType).then((result) => {
res.display('detail', {
module: 'editorial',
page: 'detail',
... ...
... ... @@ -35,8 +35,6 @@ const _processListData = (list) => {
total: list.total
});
// console.log(list)
_.forEach(list.list.artList, (data) => {
if (data.author) {
... ... @@ -49,10 +47,11 @@ const _processListData = (list) => {
data.publishTime = data.publishTime.replace(/日/g, '');
data.isPraise = data.isPraise === 'Y';
});
listData.tabs = list.list.artList;
// console.log(listData)
return listData;
};
... ... @@ -65,13 +64,16 @@ const _processListData = (list) => {
* @param limit
* @returns {*}
*/
const getIndexData = (pageNum, limit, appType) => {
const getIndexData = (pageNum, limit, appType, udid, gender) => {
return serviceAPI.get('guang/api/*/article/getList', {
page: pageNum,
limit: limit,
app_type: appType
app_type: appType,
udid: udid,
gender: gender
}).then((result) => {
if (result && result.code === 200) {
// console.log(result)
return _processListData(result.data);
} else {
logger.error('Information page list data return code is not 200');
... ... @@ -88,10 +90,11 @@ const getIndexData = (pageNum, limit, appType) => {
* @param authorId
* @returns {*}
*/
const getListData = (pageNum, limit, tag, authorId) => {
const getListData = (pageNum, limit, tag, authorId, udid) => {
let param = {
page: pageNum,
limit: limit
limit: limit,
udid: udid
};
if (tag) {
... ... @@ -188,8 +191,8 @@ const _processHeadData = (list) => {
}
});
newData.headData.time = newData.headData.time.replace(/-/g, '/');
newData.headData.time = newData.headData.time.replace(':00', '', 2);
// newData.headData.time = newData.headData.time.replace(/-/g, '/');
// newData.headData.time = newData.headData.time.replace(':00', '', 2);
let id = newData.headData.authorId;
... ... @@ -341,9 +344,10 @@ const _processContentData = (list) => {
* @param id
* @returns {*}
*/
const _getHeadData = (id) => {
const _getHeadData = (id, appType) => {
return serviceAPI.get('/guang/api/*/article/getArticleBaseInfo', {
id: id
id: id,
app_type: appType
}).then((result) => {
if (result && result.code === 200) {
return result.data;
... ... @@ -400,6 +404,10 @@ const _getCommentsData = (id) => {
article_id: id
}).then((result) => {
if (result && result.code === 200) {
_.forEach(result.data.list, function(data) {
data.create_time = data.create_time.replace(/月/g, '/');
data.create_time = data.create_time.replace(/日/g, '');
});
return camelCase(result.data);
} else {
logger.error('Review data return code is not 200');
... ... @@ -433,12 +441,15 @@ const _getRelateBrand = (id) => {
});
};
const _getArticlePre = (id) => {
const _getArticlePre = (id, appType) => {
return serviceAPI.get('guang/api/*/article/getArticlePre', {
id: id
id: id,
app_type: appType
}).then((result) => {
if (result && result.code === 200) {
// console.log(result);
// console.log(1)
// let id = result.data.articleIdPre;
// _getHeadData(id, appType);
return result;
} else {
logger.error('上一篇不是200');
... ... @@ -554,13 +565,13 @@ const shareData = () => {
* @param id
* @returns {*}
*/
const getDetailData = (id) => {
const getDetailData = (id, appType) => {
return co(function *() {
let result = yield Promise.all([_getHeadData(id),
let result = yield Promise.all([_getHeadData(id, appType),
_getArticleData(id),
_getContentData(id),
_getCommentsData(id),
_getArticlePre(id),
_getArticlePre(id, appType),
_getRelateBrand(id)]);
let res = yield _processHeadData([result[0], result[1], result[3]]);
... ...
... ... @@ -8,7 +8,7 @@
<div class="content">{{intro}}</div>
<div class="msg-app">
<span class="like-comment">
<i class="iconfont like-icon{{#if isPraise}}liked{{/if}}">&#xe60e;</i>
<i class="iconfont like-icon {{#if isPraise}}liked{{/if}}">&#xe60e;</i>
<b class="like-num">{{praiseNum}}</b>
</span>
</div>
... ...
... ... @@ -94,12 +94,12 @@ const index = (req, res, next) => {
}
});
_.forEach(result.date.selectMonth, function(x) {
if (x.value === a[1]) {
if (parseInt(x.value, 10) === parseInt(a[1], 10)) {
x.isSelected = 'selected';
}
});
_.forEach(result.date.selectDay, function(x) {
if (x.value === a[2]) {
if (parseInt(x.value, 10) === parseInt(a[2], 10)) {
x.isSelected = 'selected';
}
});
... ...
... ... @@ -247,6 +247,8 @@ const _getUserOrder = (uid, type, page) => {
type: type,
page: page,
limit: pageSize
}, {
cache: true
}).then(result => {
let orderList = [];
let total = false;
... ... @@ -457,7 +459,7 @@ const getOrderData = (uid, type, page) => {
type: type
};
const empty = emptyObject[type];
const empty = emptyObject[type || 1];
navBar.tabs[typeActiveIndexMap[type]].isActive = true;
... ... @@ -541,7 +543,7 @@ const getOrderDetail = (uid, code) => {
detail.paymentTypeStr = paymentTypeStr[detail.paymentType];
detail.address = detail.area + detail.address;
detail.allAddress = detail.area + detail.address;
detail.expressInfo = express;
detail.expressInfo.addressList = _convertAddress(express.expressDetail, detail.createTime);
... ...
<div class="user-info info-box" data-area="{{areaCode}}">
<h4 class="status-title">收货人信息</h4>
<p class="text user-name-sel" data-name="{{userName}}">收货人:{{userName}}</p>
<p class="text user-addr-sel" data-address="{{address}}">收货地址:{{address}}</p>
<p class="text user-addr-sel" data-address="{{address}}">收货地址:{{allAddress}}</p>
<p class="text user-mo-sel" data-mobile="{{mobile}}">联系电话:{{mobile}}</p>
<p class="text user-ph-sel hide" data-phone="{{phone}}">联系电话:{{phone}}</p>
</div>
... ...
... ... @@ -33,7 +33,7 @@
</div>
<div class="form-group">
<label class="label-name">手机:</label>
{{#if info.verify_mobile}}
{{#if info.mobile}}
<input id="mobile" class="input no-edit" value="{{info.mobile}}">
<a class="blue operation" href="{{stepUrl}}/modifyMobile">修改</a>
{{else}}
... ...
... ... @@ -17,6 +17,7 @@ const Query = {
index: (req, res, next) => {
let q = req.query;
let query = q.query || '';
let channel = req.cookies._Channel || req.query._Channel || 'men';
q.page = parseInt(q.page || 1, 10);
q.order = q.order || 's_n_desc';
... ... @@ -36,7 +37,7 @@ const Query = {
if (result && result.code === 200 && result.data) {
let data = camelCase(result.data);
let nav = [DataHelper.getChannelNav()];
let nav = [DataHelper.getChannelNav(channel)];
nav.push({
name: query ? `"${query}" ${data.total}个结果` : `共${data.total}个结果`
... ...
... ... @@ -150,7 +150,7 @@ const shop = {
};
res.display('shop-list', _.assign(data, {
products: DataHelper.handleProductList(ret.productList, q),
products: DataHelper.handleProductList(ret.productList, q, false),
order: q.order
}));
} else {
... ...
... ... @@ -407,7 +407,9 @@ const helpers = {
* @param list
* @returns {*}
*/
handleProductList(list, q) {
handleProductList(list, q, showBrand) {
showBrand = typeof showBrand === 'undefined' ? true : showBrand;
if (_.isArray(list)) {
list.forEach(g => {
let goodsList = g.goodsList;
... ... @@ -426,6 +428,7 @@ const helpers = {
}
g.salesPrice = g.salesPrice || g.marketPrice;
g.defaultImages = defaultImages;
g.showBrand = showBrand;
if (g.salesPrice === g.marketPrice) {
delete g.marketPrice;
}
... ...
... ... @@ -36,6 +36,19 @@ function _paramHanlde(obj) {
obj.standard_value_id = standards[1];
}
if (obj.channel) {
switch (obj.channel) {
case 'men':
obj.gender = '1,3';
break;
case 'women':
obj.gender = '2,3';
break;
default:
break;
}
}
return obj;
}
... ...
... ... @@ -135,7 +135,7 @@ const ShopService = {
info.shopId = shopId;
info.name = shopIntro.shopName;
info.info = shopIntro.shopIntro;
info.btnName = '店铺介绍';
info.btnName = '品牌介绍';
info.isFavorite = shopIntro.isFavorite === 'Y';
let shopData = yield Promise.all([ShopService.getShopDecorator(shopId),
... ...
... ... @@ -6,9 +6,11 @@
<img class="lazy" data-original="{{image defaultImages 263 344}}" width="263" height="344" alt="">
</a>
</div>
{{#if showBrand}}
<div class="goods-brand">
<a href="/product/shop/{{brandDomain}}" target="_self">{{brandName}}</a>
</div>
{{/if}}
<div class="goods-name">
<a href="{{url}}" target="_blank">{{productName}}</a>
</div>
... ...
... ... @@ -46,7 +46,7 @@ const addToCart = (options) => {
if (shoppingKey) {
_.merge(params, {
shoppingKey: shoppingKey
shopping_key: shoppingKey
});
}
... ...
... ... @@ -91,6 +91,10 @@ $('.yoho-group a').hover(function() {
$(this).text(data.en);
});
$('.tag-bag').hover(function() {
refreshBag();
});
$bagGoodsList.on('click', '.del-good-btn', function() {
var $this = $(this),
data = $this.data();
... ... @@ -172,7 +176,7 @@ $searchKey.keyup(function(e) {
});
// ie8输入框提示特殊处理
if ($.browser && $.browser.msie && parseInt($.browser.version, 10) === 8) {
if (!!window.ActiveXObject && !!document.documentMode) {
$searchKey.focus(function() {
var key = $searchKey.val();
... ... @@ -185,7 +189,7 @@ if ($.browser && $.browser.msie && parseInt($.browser.version, 10) === 8) {
if ($.trim(key) === '') {
$searchKey.val('search').css('color', '#aaa');
}
});
}).val('search').css('color', '#aaa');
}
$clearInput.click(function() {
... ...
... ... @@ -39,17 +39,18 @@ var Bll = {
var birthdayForm = $('#birthday');
var nickForm = $('#nick_name');
var realNameForm = $('#username');
var addressForm = $('.form-group-address');
// var addressForm = $('.form-group-address');
var flag = true;
!regBirth.test(info.birthday) ? birthdayForm.next().show() : birthdayForm.next().hide();
!regName.test(info.nick_name) ? nickForm.next().show() : nickForm.next().hide();
!regRealName.test(info.username) ? realNameForm.next().show() : realNameForm.next().hide();
typeof (info.area_code) === 'undefined' ?
addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) || !regRealName.test(info.username) ||
typeof (info.area_code) === 'undefined') {
// typeof (info.area_code) === 'undefined' ?
// addressForm.css('margin-bottom', '20px').find('.error-tips').show() :
// addressForm.css('margin-bottom', '70px').find('.error-tips').hide();
if (!regBirth.test(info.birthday) || !regName.test(info.nick_name) || !regRealName.test(info.username)) {
flag = false;
}
return flag;
... ...
... ... @@ -31,6 +31,8 @@ var disableSMSBtn = function() {
var validatePhoneNumLocal = function(phoneNum) {
var length = phoneNum.length;
phoneNum = parseInt(phoneNum, 10);
if (length === 0) {
new _alert('请输入手机号码!').show();
return false;
... ...
... ... @@ -253,14 +253,15 @@ $('#keep-shopping').click(function() {
$('#brand-fav').click(function() {
var $this = $(this),
info = $this.data(),
param = {};
param = {
brandId: $this.data('id'),
type: 'add'
};
if (!info.id) {
if (!param.brandId) {
return;
}
param.brandId = info.id;
if ($this.hasClass('coll')) {
param.type = 'cancel';
}
... ...
... ... @@ -366,6 +366,11 @@ Cart = {
var newProductSku;
var oldProductSku;
// 如果已经有选尺寸颜色的面板显示,则不重复加载
if (editTarget.find('.edit-color-size').length > 0) {
return;
}
$.ajax({
type: 'GET',
url: '/product/item/getProductInfo',
... ... @@ -403,13 +408,20 @@ Cart = {
defaultColor: defaultColor,
defaultSize: defaultSize,
defaultImg: defaultImg
})
);
}));
oldProductSku = editTarget.find('.current-sizes .current').attr('data-sku');
editTarget.delegate('#confirm', 'click', function(e) {
// rebind events(Tips依赖接口数据,so 不能delegate)
editTarget.find('#confirm').click(function(e) {
e.preventDefault();
// 没有重新选择颜色-尺码,则不用重新请求显示
if (!newProductSku || newProductSku === oldProductSku) {
editTarget.find('.edit-color-size').remove();
return false;
}
Util.ajax({
url: '/shopping/cart/updateProduct',
type: 'PUT',
... ... @@ -428,15 +440,21 @@ Cart = {
}
});
return false;
}).delegate('#cancel', 'click', function(e) {
});
editTarget.find('#cancel').click(function(e) {
e.preventDefault();
editTarget.find('.edit-color-size').remove();
setEditable();
return false;
}).delegate('.edit-color-size', 'click', function(e) {
});
editTarget.find('.edit-color-size').click(function(e) {
e.preventDefault();
return false;
}).delegate('.color-item', 'click', function(e) {
});
editTarget.find('.color-item').click(function(e) {
e.preventDefault();
selectColor = $(this);
if (!selectColor.hasClass('current-color')) {
... ... @@ -452,7 +470,15 @@ Cart = {
.find('.selected-color').text(selectColor.attr('data-title'));
}
return false;
}).delegate('.current-sizes .size-item', 'click', function() {
});
editTarget.find('.current-sizes .size-item').click(function() {
var $this = $(this);
if ($this.hasClass('current')) {
return;
}
$(this).addClass('current').siblings('.current').removeClass('current');
newProductSku = $(this).attr('data-sku');
});
... ...
... ... @@ -48,54 +48,7 @@ var Util = {
* @params { Function } callback 购物车刷新后回调
*/
refreshCart: function(data, callback) {
// var template;
if (!data.hasGoods) {
$('#cart_content').html(emptyCartTpl);
return;
}
// // helpers start
// hbs.registerHelper('multiple', function(num1, num2) {
// num1 = typeof num1 === 'number' ? num1 : parseFloat(num1, 10);
// num2 = typeof num2 === 'number' ? num2 : parseFloat(num2, 10);
// if (num1 && num2) {
// return num1 * num2;
// }
// });
// hbs.registerHelper('isEqual', function(v1, v2, options) {
// if (v1 === v2) {
// return options.fn(this);
// }
// return options.inverse(this);
// });
// hbs.registerHelper('round', function(num, fixedNum) {
// num = typeof num === 'number' ? num : parseFloat(num, 10);
// return num.toFixed(fixedNum);
// });
// hbs.registerHelper('showStorage', function(leftNumber) {
// leftNumber = typeof num1 === 'number' ? leftNumber : parseFloat(leftNumber, 10);
// if (leftNumber <= 3 && leftNumber >= 0) {
// return '仅剩' + leftNumber + '件';
// } else if (leftNumber < 0) {
// return '库存不足';
// }
// });
// hbs.registerHelper('image', function(url, width, height, mode) {
// mode = parseInt(mode, 10) ? mode : 2;
// url = url || '';
// return url.replace(/{width}/g, width).replace(/{height}/g, height).replace(/{mode}/g, mode);
// });
// helpers end
// template = hbs.compile($('#cart-content-tpl').html());
$('#cart_content').html(cartTpl(data));
$('#cart_content').html(data.hasGoods ? cartTpl(data) : emptyCartTpl);
if (callback) {
return callback();
... ...
... ... @@ -411,12 +411,12 @@
}
.word-count-tip {
display: inline-block;
display: block;
height: 48px;
line-height: 48px;
font-size: 12px;
color: #c8c8c8;
float: right;
.exceed-count {
color: #f00;
... ... @@ -425,7 +425,7 @@
.publish-btn {
margin-top: 10px;
float: right;
float: left;
width: 100px;
height: 30px;
line-height: 33px;
... ...
... ... @@ -29,7 +29,7 @@
}
.no-edit {
width: 80px;
width: 100px;
border: none;
}
... ...
... ... @@ -311,7 +311,7 @@
}
}
.goods-name {
padding: 5px;
padding: 10px;
width: 265px;
overflow: hidden;
text-overflow: ellipsis;
... ... @@ -319,7 +319,7 @@
}
.goods-price {
padding: 15px;
padding: 10px;
font-size: 16px;
font-weight: 700;
... ...
... ... @@ -120,6 +120,11 @@ $hoverColor: #379ed6;
}
}
.pro-name > a {
height: 100%;
display: block;
}
.price {
display: inline-block;
padding: 59px 0;
... ...
... ... @@ -15,7 +15,7 @@
<div class="input-row necessary">
<span class="asterisk">*</span>
<label for="user-address">详细地址:</label>
<input class="input validate" class="long" type="text" id="user-address" placeholder="街道名称或小区名称" value={{address}}>
<input class="input validate" class="long" type="text" id="user-address" placeholder="街道名称或小区名称" value="{{address}}">
</div>
<div class="input-row necessary">
<span class="asterisk">*</span>
... ...