Authored by zhangxiaoru

冲突

... ... @@ -99,6 +99,7 @@ app.use((req, res, next) => {
// dispatcher
try {
const user = require('./doraemon/middleware/user');
const reqParamsFilter = require('./doraemon/middleware/req-params-filter');
const subDomain = require('./doraemon/middleware/sub-domain');
const itemNameHandler = require('./doraemon/middleware/item-name-handler');
const setYohoData = require('./doraemon/middleware/set-yoho-data');
... ... @@ -110,6 +111,7 @@ try {
const pageCache = require('./doraemon/middleware/page-cache');
// YOHO 前置中间件
app.use(reqParamsFilter());
app.use(subDomain());
app.use(itemNameHandler);
app.use(setYohoData());
... ...
... ... @@ -30,6 +30,10 @@
{{# is_soon_sold_out}}
<p class="few-tag">即将售罄</p>
{{/ is_soon_sold_out}}
{{# is_solded}}
<p class="out-tag">已售罄</p>
{{/ is_solded}}
</div>
<div class="good-detail-text">
<div class="name">
... ...
... ... @@ -28,6 +28,9 @@ const list = (req, res, next) => {
if (params.shop_id) {
params.shopId = params.shop_id;
}
params.isApp = req.yoho.isApp;
return searchModel.searchKeyActivity(params.query || '').then(activityResult => {
let activity = _.get(activityResult, 'urlobj.appUrl', '');
... ... @@ -117,7 +120,8 @@ const list = (req, res, next) => {
title: title,
goodList: params,
firstPageGoodsList: result[2].list || [],
pageFooter: true
pageFooter: true,
shopId: params.shop_id || ''
});
}).catch(next);
}
... ... @@ -182,7 +186,8 @@ const search = (req, res, next) => {
params.limit = 24;
searchModel.getSearchData(params).then((result) => {
if (result && result.list && parseInt(params.page) === 1 && parseInt(params.start) > 0) {
if (result && result.list && result.list.length > params.start &&
parseInt(params.page) === 1 && parseInt(params.start) > 0) {
// 首屏渲染时,使用 'start' 参数裁减已渲染数据
result.list = result.list.slice(params.start || 0);
}
... ...
... ... @@ -73,7 +73,7 @@ const getSearchData = (params) => {
if (result && result.code === 200) {
let newList = {};
newList.list = productProcess.processProductList(result.data.product_list || [], {showTags: false});
newList.list = productProcess.processProductList(result.data.product_list || [], {showTags: true});
if (parseInt(params.page) === 1) {
newList.total = result.data.total;
... ...
... ... @@ -53,8 +53,15 @@ const getPreferenceData = (data) => {
_.forEach(value.tags, tag => {
tags[tag] = true;
});
// tags.is_solded = true;
goods.tags = tags;
if (tags.is_solded === true) {
goods.is_solded = true;
}
dest.goods.push(goods);
});
... ...
... ... @@ -5,6 +5,7 @@
<i class="search-icon iconfont">&#xe60f;</i>
<input type="text" value="{{default}}" name="query" class="buriedpoint" data-bp-id="shop-search_input_1" autocomplete="off">
<input type="hidden" value="search" name="from">
<input type="hidden" name="shop_id" value="{{@root.shopId}}">
<i class="clear-input iconfont hide">&#xe626;</i>
<span id="search" class="search buriedpoint" type="submit" data-bp-id="shop-search_btn_0">搜索</span>
</form>
... ...
const _ = require('lodash');
// 黑名单参数
const BLACK_LIST = [
'client_secret',
'method'
];
module.exports = () => {
return (req, res, next) => {
if (req.query) {
_.forEach(BLACK_LIST, (key) => {
if (req.query[key]) {
delete req.query[key];
}
});
}
next();
};
};
... ...
... ... @@ -28,6 +28,14 @@
(function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
</script>
{{/if}}
{{#if isWechat}}
{{!--Android机器页面不再受到用户字体缩放强制改变大小 http://m.blog.csdn.net/article/details?id=51275080 --}}
<script type="text/javascript">
(function(){if(typeof(WeixinJSBridge)=="undefined"){document.addEventListener("WeixinJSBridgeReady",function(a){setTimeout(function(){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(b){})},0)})}else{setTimeout(function(){WeixinJSBridge.invoke("setFontSizeCallback",{fontSize:0},function(a){})},0)}})();
</script>
{{/if}}
{{#if devEnv}}
{{#if localCss}}
<link rel="stylesheet" media="all" href="//{{devHost}}:5001/bundle/common.css">
... ...
... ... @@ -38,11 +38,15 @@
<p class="few-tag">即将售罄</p>
{{/ is_soon_sold_out}}
{{# noStorage}}
{{# is_solded}}
<p class="out-tag">已售罄</p>
{{/ is_solded}}
{{!-- {{# noStorage}}
<div class="no-storage">
<div class="no-storage-img"></div>
</div>
{{/ noStorage}}
{{/ noStorage}} --}}
</div>
<div class="good-detail-text">
<div class="name">
... ...
{
"name": "m-yohobuy-node",
"version": "5.2.13",
"version": "5.2.14",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -77,6 +77,10 @@ $categoryContainer.on('touchend', function(e) {
if ($this[0] && $this[0].tagName === 'LI' && $this.find('a').attr('href')) {
location.href = $this.find('a').attr('href');
}
if ($this[0] && $this[0].tagName === 'A' && $this.attr('href')) {
location.href = $this.attr('href');
}
});
$categoryContainer.find('.primary-level').on('touchstart touchend touchcancel', 'li', function() {
... ...
... ... @@ -168,11 +168,11 @@ var installment = {
});
},
setCookies: function() {
window.setCookie('installmentUid', window.queryString.uid);
window.setCookie('yhChannel', window.queryString.yh_channel);
window.setCookie('udid', window.queryString.udid);
window.setCookie('clientType', window.queryString.client_type);
window.setCookie('appVersion', window.queryString.app_version);
// window.setCookie('installmentUid', window.queryString.uid);
// window.setCookie('yhChannel', window.queryString.yh_channel);
// window.setCookie('udid', window.queryString.udid);
// window.setCookie('clientType', window.queryString.client_type);
// window.setCookie('appVersion', window.queryString.app_version);
}
};
... ...
... ... @@ -35,6 +35,8 @@ var brandCoupon = {
self.$entry.removeClass('hide');
}
window.rePosFooter && window.rePosFooter();
})
.fail();
}, 200);
... ...
... ... @@ -131,6 +131,8 @@ function search() {
}),
}, true);
});
window.rePosFooter && window.rePosFooter();
},
error: function() {
tip.show('网络断开连接了~');
... ...
... ... @@ -77,6 +77,8 @@ function request() {
// return false;
});
window.rePosFooter && window.rePosFooter();
}).fail(function() {
$recommendForYou.hide();
});
... ...
... ... @@ -16,6 +16,8 @@ require('./detail/desc');
// 喂你优选
require('./detail/recommend-for-you-product-desc');
window.rePosFooter && window.rePosFooter();
setTimeout(() => {
var Swiper = require('yoho-swiper');
... ... @@ -175,6 +177,8 @@ setTimeout(() => {
});
}
});
window.rePosFooter && window.rePosFooter();
}
});
}, 150);
... ... @@ -274,6 +278,7 @@ setTimeout(() => {
require('./detail/comments-consults');
require('./detail/consultform'); // TODO
promotionInit();
window.rePosFooter && window.rePosFooter();
});
}, 200);
}(productSkn, productId, brandId));
... ...
... ... @@ -92,6 +92,13 @@ var C_ID, RES_QTY, argument, optype, filext = {};
var category = $('#category-point').val();
var noResult = '<p class="no-result">未找到相关搜索结果</p>';
// 首屏无数据
if ($fsgc.children().length === 0) {
$goodsContainer.html(noResult);
}
require('../../common');
ellipsis.init();
... ... @@ -467,6 +474,9 @@ function search(opt, filtering) {
if (filtering) {
$fsgc.addClass('hide');
if (params.start) {
delete setting.start;
}
}
$.ajax({
... ... @@ -474,8 +484,7 @@ function search(opt, filtering) {
url: location.protocol + '//m.yohobuy.com/product/search/search',
data: setting,
success: function(data) {
var noResult = '<p class="no-result">未找到相关搜索结果</p>',
num,
var num,
$container,
goodIds = [],
yasparm,
... ... @@ -810,6 +819,8 @@ $newList.on('touchstart', 'li', function(e) {
$firstLiDom = $listNav.find('li.first-li-more');
e.preventDefault();
if ($(this).hasClass('new')) {
navType = 'new';
} else if ($(this).hasClass('default')) {
... ... @@ -826,6 +837,14 @@ $newList.on('touchstart', 'li', function(e) {
$(document).trigger('shouldSendBpData', [bpIdData]);
newListHide();
if (navType !== 'default') {
$fsgc.addClass('hide');
}
if ($(this).hasClass('active')) {
return;
}
// 切换container显示
$goodsContainer.children('.container:not(.hide)').addClass('hide');
... ...
... ... @@ -12,7 +12,7 @@
width: 100%;
height: 90px;
line-height: 90px;
z-index: 2;
z-index: 99;
background: rgba(0, 0, 0, 0.6);
}
... ...
.mobile-container {
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 640px;
overflow: hidden;
}
.mobile-wrap {
position: relative;
z-index: 2;
background: #f0f0f0;
transition: transform 0.3s;
.creative-life .classify-name {
display: none;
}
.banner-top .banner-swiper:first-child {
height: 312px;
}
}
.mobile-wrap.menu-open {
transform: translateX(540px);
}
.overlay {
display: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #000;
z-index: 4;
transition: opacity 1s;
}
.overlay.show {
display: block;
opacity: 0.3;
}
... ...
... ... @@ -33,47 +33,5 @@
@import "shop-recommand";
@import "sale-floor";
@import "divide-image";
@import "home-main";
.mobile-container {
margin-left: auto;
margin-right: auto;
width: 100%;
max-width: 640px;
overflow: hidden;
}
.mobile-wrap {
position: relative;
z-index: 2;
background: #f0f0f0;
transition: transform 0.3s;
.creative-life .classify-name {
display: none;
}
.banner-top .banner-swiper:first-child {
height: 312px;
}
}
.mobile-wrap.menu-open {
transform: translateX(540px);
}
.overlay {
display: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #000;
z-index: 4;
transition: opacity 1s;
}
.overlay.show {
display: block;
opacity: 0.3;
}
... ...
.index-page {
overflow: hidden;
margin: 0 auto;
width: 100%;
#double11 {
display: block;
width: 432px;
height: 100px;
margin: 0 auto;
background-color: transparent;
background-image: resolve("channel/11.11.png");
background-size: 100%;
&:active {
background-image: resolve("channel/11.11-touch.png");
}
}
#yohood {
border: none;
border-bottom: 8px solid #fff;
background-color: transparent;
background-image: resolve("channel/yohood.png");
background-position-x: 26%;
background-position-y: 36%;
background-size: 40%;
background-repeat: no-repeat;
}
#yohood:active {
border-bottom-color: #000;
background-color: rgba(255, 255, 255, 0.4);
background-image: resolve("channel/yohood-tapped.png");
.right-icon {
color: #000;
}
}
.index-header {
box-sizing: border-box;
padding: 0 20px;
width: 100%;
height: 96px;
line-height: 96px;
.index-logo {
float: left;
width: 288px;
height: 96px;
background: resolve("channel/yohologo.png") left center no-repeat;
background-size: 280px 60px;
opacity: 1;
transition: all 400ms;
img {
width: 207px;
height: 49px;
vertical-align: middle;
}
&.action {
width: 0;
opacity: 0;
}
}
.box {
position: relative;
z-index: 1;
overflow: hidden;
&.action {
.no-search,
.clear-text {
display: block;
}
}
}
.index-search {
overflow: hidden;
height: 96px;
background: #fff;
transition: width 0.4s;
.search-box {
position: relative;
top: 20px;
overflow: hidden;
box-sizing: border-box;
padding-right: 80px;
height: 56px;
border: 1px solid #ccc;
transition: width 400ms;
transition: margin-left 0.4s;
}
input {
float: left;
overflow: hidden;
padding: 10px;
width: 96%;
border: none;
color: #999;
font-size: 28px;
-webkit-appearance: none;
}
.iconfont {
position: absolute;
top: 8px;
z-index: 1;
width: 40px;
font-size: 28px;
line-height: 40px;
}
.clear-text {
right: 50px;
display: none;
color: #ccc;
}
.search-icon {
right: 10px;
color: #666;
&.empty {
color: #e6e6e6;
}
}
}
.no-search {
display: none;
float: left;
margin-right: 10px;
color: #999;
font-size: 28px;
}
}
.index-container {
position: relative;
background-color: white;
transition: transform 0.5s;
.index-channel {
position: relative;
min-height: 800px;
background-color: #000;
color: #fff;
text-align: center;
img {
width: 100%;
}
.index-channel-list {
position: absolute;
top: 50%;
margin-top: -300px;
width: 100%;
.list-item {
position: relative;
display: block;
margin: 0 auto 40px;
width: 432px;
height: 100px;
border: 8px solid #fff;
background-color: #000;
color: #fff;
text-align: center;
font-weight: bold;
font-size: 32px;
line-height: 82px;
}
.list-item:last-child {
margin-bottom: 0;
}
.lighter {
font-weight: lighter;
}
.right-icon {
position: absolute;
top: 0;
right: 10px;
font-weight: bold;
}
.homestyle {
margin-bottom: 50px;
width: 287.3px;
}
}
}
}
}
\ No newline at end of file
... ...
.index-page {
overflow: hidden;
margin: 0 auto;
width: 100%;
#double11 {
display: block;
width: 432px;
height: 100px;
margin: 0 auto;
background-color: transparent;
background-image: resolve("channel/11.11.png");
background-size: 100%;
&:active {
background-image: resolve("channel/11.11-touch.png");
}
}
#yohood {
border: none;
border-bottom: 8px solid #fff;
background-color: transparent;
background-image: resolve("channel/yohood.png");
background-position-x: 26%;
background-position-y: 36%;
background-size: 40%;
background-repeat: no-repeat;
}
#yohood:active {
border-bottom-color: #000;
background-color: rgba(255, 255, 255, 0.4);
background-image: resolve("channel/yohood-tapped.png");
.right-icon {
color: #000;
}
}
.index-header {
box-sizing: border-box;
padding: 0 20px;
width: 100%;
height: 96px;
line-height: 96px;
.index-logo {
float: left;
width: 288px;
height: 96px;
background: resolve("channel/yohologo.png") left center no-repeat;
background-size: 280px 60px;
opacity: 1;
transition: all 400ms;
img {
width: 207px;
height: 49px;
vertical-align: middle;
}
&.action {
width: 0;
opacity: 0;
}
}
.box {
position: relative;
z-index: 1;
overflow: hidden;
&.action {
.no-search,
.clear-text {
display: block;
}
}
}
.index-search {
overflow: hidden;
height: 96px;
background: #fff;
transition: width 0.4s;
.search-box {
position: relative;
top: 20px;
overflow: hidden;
box-sizing: border-box;
padding-right: 80px;
height: 56px;
border: 1px solid #ccc;
transition: width 400ms;
transition: margin-left 0.4s;
}
input {
float: left;
overflow: hidden;
padding: 10px;
width: 96%;
border: none;
color: #999;
font-size: 28px;
-webkit-appearance: none;
}
.iconfont {
position: absolute;
top: 8px;
z-index: 1;
width: 40px;
font-size: 28px;
line-height: 40px;
}
.clear-text {
right: 50px;
display: none;
color: #ccc;
}
.search-icon {
right: 10px;
color: #666;
&.empty {
color: #e6e6e6;
}
}
}
.no-search {
display: none;
float: left;
margin-right: 10px;
color: #999;
font-size: 28px;
}
}
.index-container {
position: relative;
background-color: white;
transition: transform 0.5s;
.index-channel {
position: relative;
min-height: 800px;
background-color: #000;
color: #fff;
text-align: center;
img {
width: 100%;
}
.index-channel-list {
position: absolute;
top: 50%;
margin-top: -300px;
width: 100%;
.list-item {
position: relative;
display: block;
margin: 0 auto 40px;
width: 432px;
height: 100px;
border: 8px solid #fff;
background-color: #000;
color: #fff;
text-align: center;
font-weight: bold;
font-size: 32px;
line-height: 82px;
}
.list-item:last-child {
margin-bottom: 0;
}
.lighter {
font-weight: lighter;
}
.right-icon {
position: absolute;
top: 0;
right: 10px;
font-weight: bold;
}
.homestyle {
margin-bottom: 50px;
width: 287.3px;
}
}
}
}
}
@import "index-main";
@import "brand";
@import "home";
... ...
@import "../layout/_loading.css";
@import "../layout/_swiper.css";
@import "../layout/_loading.css";
@import "../layout/_swiper.css";
@import "../common/_filter.css";
@import "../common/_good.css";
@import "../common/_loading.css";
@import "../common/_suspend-home.css";
@import "../common/_filter.css";
@import "../common/_good.css";
@import "../common/_loading.css";
@import "../common/_suspend-home.css";
@import "_banner-bottom.css";
@import "_banner-center.css";
@import "_banner-top.css";
@import "_brand.css";
@import "_cate.css";
@import "_creative-life.css";
@import "_divide-image.css";
@import "_fine-brands.css";
@import "_floor-header.css";
@import "_footer-tab.css";
@import "_fresh-only.css";
@import "_goods-category.css";
@import "_home-header.css";
@import "_home.css";
@import "_hot-brands.css";
@import "_hot-category.css";
@import "_hot-single.css";
@import "_icons-enter.css";
@import "_index.css";
@import "_left-right.css";
@import "_maybe-like.css";
@import "_new-first.css";
@import "_new-user-floor.css";
@import "_notice.css";
@import "_plus-star.css";
@import "_sale-floor.css";
@import "_search-input.css";
@import "_search.css";
@import "_seckill.css";
@import "_shop-recommand.css";
@import "_side-nav.css";
@import "_six-lines-floor.css";
@import "_three-picture.css";
@import "_thumb-row.css";
@import "_trend-topics.css";
@import "_trend-tops.css";
@import "_trendsetter-collocation.css";
@import "_two-column-goods.css";
@import "_vip-only.css";
@import "_index-main.css";
@import "_brand.css";
@import "_banner-bottom.css";
@import "_banner-center.css";
@import "_banner-top.css";
@import "_cate.css";
@import "_creative-life.css";
@import "_divide-image.css";
@import "_fine-brands.css";
@import "_floor-header.css";
@import "_footer-tab.css";
@import "_fresh-only.css";
@import "_goods-category.css";
@import "_hot-brands.css";
@import "_hot-category.css";
@import "_home-header.css";
@import "_hot-single.css";
@import "_icons-enter.css";
@import "_left-right.css";
@import "_maybe-like.css";
@import "_new-first.css";
@import "_new-user-floor.css";
@import "_notice.css";
@import "_plus-star.css";
@import "_sale-floor.css";
@import "_search.css";
@import "_seckill.css";
@import "_shop-recommand.css";
@import "_side-nav.css";
@import "_six-lines-floor.css";
@import "_three-picture.css";
@import "_thumb-row.css";
@import "_trend-topics.css";
@import "_trend-tops.css";
@import "_trendsetter-collocation.css";
@import "_two-column-goods.css";
@import "_vip-only.css";
@import "_home-main.css";
... ...
... ... @@ -111,6 +111,19 @@
line-height: 28px;
}
.out-tag {
position: absolute;
bottom: 0;
width: 100%;
height: 32px;
background: #b0b0b0;
color: #fff;
text-align: center;
font-size: 18px;
line-height: 32px;
z-index: 1;
}
.no-storage {
width: 100%;
height: 100%;
... ...
... ... @@ -317,8 +317,9 @@
font-size: 26px;
margin: 13px 30px 0 0;
border: none;
float: right;
border-radius: 8px;
position: absolute;
right: 0;
}
.repayment-btn:active {
... ...
... ... @@ -141,3 +141,8 @@ section,
summary {
display: block;
}
body {
-webkit-text-size-adjust: 100% !important;
text-size-adjust: 100% !important;
}
... ...
... ... @@ -7,4 +7,5 @@
@import "../../channel/banner-top";
@import "../../common/good";
@import "../../cart/chose-panel";
@import "../../common/_suspend-home.css";
... ...
@import "../../channel/banner-top";
@import "../../common/good";
@import "../../common/filter";
@import "../../common/_suspend-home.css";
@import "search";
@import "list";
@import "search-index";
... ...
... ... @@ -83,9 +83,9 @@ exports.processProductList = (list, options) => {
}
// 如果库存为0,显示已抢完
if (product.storage_num === 0) {
product.noStorage = true;
}
// if (product.storage_num === 0) {
// product.noStorage = true;
// }
// 市场价和售价一样,则不显示市场价
if (product.market_price === product.sales_price) {
... ... @@ -107,7 +107,18 @@ exports.processProductList = (list, options) => {
_.forEach(product.tags, tag => {
tags[tag] = true;
});
//tags.is_solded = true;
// product.tags = tags;
product.tags = tags;
if (tags.is_solded === true) {
product.is_solded = true;
}
}
pruductList.push(product);
... ...