Authored by 郭成尧

Merge branch 'feature/featureTemplate2' into 'master'

Feature/feature template2



See merge request !448
... ... @@ -9,7 +9,7 @@ exports.index = function(req, res, next) {
if (!result) {
return next();
}
res.render('feature', {
res.render('feature/index', {
module: 'activity',
page: 'feature',
title: result.name || 'Yoho!Buy有货',
... ... @@ -18,3 +18,17 @@ exports.index = function(req, res, next) {
});
}).catch(next);
};
exports.sidebar = function(req, res, next) {
model.index({
code: req.params.code
}).then((result) => {
if (!result) {
return next();
}
res.render('feature/sidebar', {
content: result,
layout: false
});
}).catch(next);
}
\ No newline at end of file
... ...
... ... @@ -16,6 +16,7 @@ const _getProductBySkns = function(productObj) {
producturl: `//m.yohobuy.com/product/pro_${val.product_id}_${goods_id}/${val.cn_alphabet}.html?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":${val.product_skn}}}`, // eslint-disable-line
productimg: helpers.image(val.default_images, 213, 284, 2, 60).replace('quality/80', 'quality/60'),
productname: val.product_name,
vipprice: val.vip_price,
saleprice: val.sales_price,
marketprice: val.sales_price === val.market_price ? '' : val.market_price,
brandname: val.brand_name
... ...
... ... @@ -15,6 +15,7 @@ let _getProduct = function(o) {
product_id: o.product_id,
product_name: o.product_name,
product_skn: o.product_skn,
vip_price: o.vip_price,
market_price: o.market_price,
sales_price: o.sales_price,
cn_alphabet: o.cn_alphabet,
... ...
... ... @@ -229,6 +229,7 @@ router.get('/individuation', individuation.productLst);
// 活动页模版
router.get('/feature/:code.html', feature.index);
router.get('/featuresidebar/:code.html', feature.sidebar);
// 2016 年度账单
router.get('/annual-account', annualAccount.index);
... ...
<div class="feature-page yoho-page">
{{#content.webShare}}
<input id="shareLink" type="hidden" value="{{url}}">
<input id="shareDesc" type="hidden" value="{{content}}">
<input id="shareImg" type="hidden" value="{{pic}}">
<input id="shareTitle" type="hidden" value="{{title}}">
{{/content.webShare}}
{{#content.floors}}
{{#isEqualOr type 'sidebar'}}
{{! 侧悬浮}}
<div class="cexuanfu" id="load_cxf"></div>
{{/isEqualOr}}
{{#isEqualOr type '' 'common_floor' 'fix'}}
{{! 普通楼层 顶悬浮}}
<div {{#if param.anchorname}}id="{{param.anchorname}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} class="floor {{type}}"
style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
<img src="{{image2 param.bgimg q=60}}">
{{/if}}
{{#component}}
{{#isEqualOr type 'link'}}
{{! 普通组件}}
<a class="anchor" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{/isEqualOr}}
{{#unless content.visiable}}
<div class="over">
<p>此活动已结束</p>
<p>稍后自动跳转更多其他精彩活动...</p>
</div>
{{else}}
{{#content.webShare}}
<input id="shareLink" type="hidden" value="{{url}}">
<input id="shareDesc" type="hidden" value="{{content}}">
<input id="shareImg" type="hidden" value="{{pic}}">
<input id="shareTitle" type="hidden" value="{{title}}">
{{/content.webShare}}
{{#content.floors}}
{{#isEqualOr type 'sidebar'}}
{{! 侧悬浮}}
<div id="sidebar" pageid="{{param.sidebarPageId}}"></div>
{{/isEqualOr}}
{{#isEqualOr type '' 'common_floor' 'fix'}}
{{! 普通楼层 顶悬浮}}
<div {{#if param.anchorname}}id="{{param.anchorname}}"{{/if}} {{#if param.tabname}}tabname="{{param.tabname}}"{{/if}} {{#if id}}data-id="{{id}}"{{/if}} class="floor {{type}}"
style="{{#if param.bgcolor}}background-color:{{param.bgcolor}}{{/if}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=60}}">
{{else}}
<img src="{{image2 param.bgimg q=60}}">
{{/isLazyLoad}}
{{/if}}
{{#component}}
{{#isEqualOr type 'link'}}
{{! 普通组件}}
<a class="anchor {{#if modalImg}}modalimg{{/if}}" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{#if modalImg}}
<div class="modal">
<span class="modal-close"></span>
<img class="modal-img lazy" data-original="{{image2 modalImg q=60}}">
</div>
{{/if}}
{{/isEqualOr}}
{{#isEqualOr type 'coupon'}}
{{! 优惠券}}
<a class="anchor yoho-conpon" style="{{styleFormat this percent=1}}" data-token="{{token}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{/isEqualOr}}
{{#isEqualOr type 'coupon'}}
{{! 优惠券}}
<a class="anchor yoho-conpon" style="{{styleFormat this percent=1}}" data-token="{{token}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{/isEqualOr}}
{{#isEqualOr type 'yohoCoin'}}
{{! 有货币}}
<a class="anchor yoho-coin" style="{{styleFormat this percent=1}}" data-token="{{token}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{/isEqualOr}}
{{#isEqualOr type 'yohoCoin'}}
{{! 有货币}}
<a class="anchor yoho-coin" style="{{styleFormat this percent=1}}" data-token="{{token}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
{{/isEqualOr}}
{{#isEqualOr type 'video'}}
{{! 视频}}
<a class="anchor video-bg" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
<div class="video-android-close hide"></div>
<div class="video-android-bg hide"></div>
<video class="video" controls loop preload="meta" name="media">
<source src="{{videoSrc}}">
</video>
{{/isEqualOr}}
{{#isEqualOr type 'video'}}
{{! 视频}}
<a class="anchor video-bg" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../this @index}}"></a>
<div class="video-android-close hide"></div>
<div class="video-android-bg hide"></div>
<video class="video" controls loop preload="meta" name="media">
<source src="{{videoSrc}}">
</video>
{{/isEqualOr}}
{{#isEqualOr type 'marquee' 'swiper'}}
{{! 轮播/滑动}}
<div class="swiper-container {{type}}" data-loop="{{loop}}" {{#if spaceBetween}}data-spacebetween="{{spaceBetween}}"{{/if}} {{#if autoplay}}data-autoplay="{{autoplay}}"{{/if}}>
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=60}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
</div>
{{#isEqualOr type 'marquee'}}
<div class="swiper-pagination"></div>
{{/isEqualOr}}
</div>
{{/isEqualOr}}
{{#isEqualOr type 'marquee' 'swiper'}}
{{! 轮播/滑动}}
<div class="swiper-container {{type}}" data-loop="{{loop}}" {{#if spaceBetween}}data-spacebetween="{{spaceBetween}}"{{/if}} {{#if autoplay}}data-autoplay="{{autoplay}}"{{/if}}>
<div class="swiper-wrapper">
{{#list}}
<div class="swiper-slide" style="{{styleFormat this percent=1}}">
<img src="{{image2 src q=60}}">
<a class="anchor" href="{{#if link}}{{link}}{{else}}javascript:void(0);{{/if}}" fp="{{getAnalysis ../../this @index}}"></a>
</div>
{{/list}}
</div>
{{#isEqualOr type 'marquee'}}
<div class="swiper-pagination"></div>
{{/isEqualOr}}
</div>
{{/isEqualOr}}
{{#isEqualOr type 'tab'}}
{{! tab}}
<div class="tab-container">
{{#repeat count}}
<a class="anchor {{#if @first}}active{{/if}}" style="{{tabStyle @index ../count}}"></a>
{{/repeat}}
</div>
{{/isEqualOr}}
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=60}})repeat;"{{/if}}>
<div class="product-source" {{#unless defaultPros.length}} {{#if searchCondition }}cloneitem="{{searchCondition.limit}}"{{/if}}{{/unless}} condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}">
<input class="imgwh" type="hidden" value="193x257">
{{#if defaultPros.length}}
{{#defaultPros}}
<div class="feature-product-info {{#if ../condition}}novisible{{/if}}">
<a class="first-part product-detail" href='{{producturl}}'>
<div class="product-detail-imgbox">
{{#if ../lefTopImg}}<img class="leftopimg" src="{{image2 ../lefTopImg q=60}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg" src="{{image2 ../rigTopImg q=60}}">{{/if}}
<img class="product-detail-img" src="{{image2 productimg q=60}}">
</div>
{{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
<div class="product-detail-text">
<div class="price">
<span class="sale-price"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>¥{{saleprice}}</span>
{{#if marketprice}}<span class="market-price">¥{{marketprice}}</span>{{/if}}
</div>
</div>
</a>
{{#if ../brandImg}}
<a class="second-part {{#isEqualOr ../showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href='{{brandurl}}'>
<div class="brand-div">
<span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
</div>
<img class="brand-img" src="{{image2 ../brandImg q=60}}">
</a>
{{/if}}
</div>
{{/defaultPros}}
{{else}}
<div class="feature-product-info novisible">
<a class="first-part product-detail" href=''>
<div class="product-detail-imgbox">
{{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=60}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=60}}">{{/if}}
<img class="product-detail-img" src="">
</div>
{{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
<div class="product-detail-text">
<div class="price">
<span class="sale-price"{{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
<span class="market-price"></span>
</div>
</div>
</a>
{{#if brandImg}}
<a class="second-part {{#isEqualOr showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href=''>
<div class="brand-div">
<span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
</div>
<img class="brand-img" src="{{image2 brandImg q=60}}">
</a>
{{/if}}
</div>
{{/if}}
</div>
</div>
{{/isEqualOr}}
{{/component}}
</div>
{{/isEqualOr}}
{{/content.floors}}
{{#isEqualOr type 'tab'}}
{{! tab}}
<div class="tab-container">
{{#repeat count}}
<a class="anchor {{#if @first}}active{{/if}}" tab={{tabName @index ../tabnames}} style="{{tabStyle @index ../count}}"></a>
{{/repeat}}
</div>
{{/isEqualOr}}
{{#isEqualOr type 'productGroup'}}
{{! 商品池}}
<div class="product-container item{{numOfOneRow}}" {{#if proBgImg}}style="background:url({{image2 proBgImg q=60}})repeat;"{{/if}}>
<div class="product-source" condition='{{stringify searchCondition}}' fp="{{getAnalysis ../this @index}}"
{{#unless defaultPros.length}}
{{#if searchCondition.item}}
cloneitem="{{searchCondition.item}}"
{{else}}
cloneitem="{{searchCondition.limit}}"
{{/if}}
{{/unless}}>
<input class="imgwh" type="hidden" value="193x257">
{{#if defaultPros.length}}
{{#defaultPros}}
<div class="feature-product-info {{#if ../searchCondition}}novisible{{/if}}">
<a class="first-part product-detail" href='{{producturl}}'>
<div class="product-detail-imgbox">
{{#if ../lefTopImg}}<img class="leftopimg lazy" data-original="{{image2 ../lefTopImg q=60}}">{{/if}}
{{#if ../rigTopImg}}<img class="rigtopimg lazy" data-original="{{image2 ../rigTopImg q=60}}">{{/if}}
<img class="product-detail-img lazy" data-original="{{image2 productimg q=60}}">
</div>
{{#isEqualOr ../showPrdName '1'}}<p class="product-name">{{productname}}</p>{{/isEqualOr}}
<div class="product-detail-text">
{{#isEqualOr ../showSalePrice '1'}}
<div class="price" style="{{#if ../salePriceBgColor}}background:{{../salePriceBgColor}};{{/if}}">
<span class="sale-price"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>¥{{saleprice}}</span>
{{#if marketprice}}<span class="market-price">¥{{marketprice}}</span>{{/if}}
</div>
{{/isEqualOr}}
{{#isEqualOr ../showVipPrice '1'}}
<div class="vipprice"style="{{#if ../vipFontColor}}color:{{../vipFontColor}};{{/if}}{{#if ../vipBgColor}}background:{{../vipBgColor}};{{/if}}">
<span class="vip-price-text">VIP价</span>
<span class="vip-price-val">¥{{vipprice}}</span>
</div>
{{/isEqualOr}}
</div>
</a>
{{#if ../brandImg}}
<a class="second-part {{#isEqualOr ../showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href='{{brandurl}}'>
<div class="brand-div">
<span class="brand-name"{{#if ../fontColor}}style="color:{{../fontColor}};"{{/if}}>{{brandname}}</span>
</div>
<img class="brand-img lazy" data-original="{{image2 ../brandImg q=60}}">
</a>
{{/if}}
</div>
{{/defaultPros}}
{{else}}
<div class="feature-product-info novisible">
<a class="first-part product-detail" href=''>
<div class="product-detail-imgbox">
{{#if lefTopImg}}<img class="leftopimg" src="{{image2 lefTopImg q=60}}">{{/if}}
{{#if rigTopImg}}<img class="rigtopimg" src="{{image2 rigTopImg q=60}}">{{/if}}
<img class="product-detail-img" src="">
</div>
{{#isEqualOr showPrdName '1'}}<p class="product-name"></p>{{/isEqualOr}}
<div class="product-detail-text">
{{#isEqualOr showSalePrice '1'}}
<div class="price" style="{{#if salePriceBgColor}}background:{{salePriceBgColor}};{{/if}}">
<span class="sale-price"{{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
<span class="market-price"></span>
</div>
{{/isEqualOr}}
{{#isEqualOr showVipPrice '1'}}
<div class="vipprice" style="{{#if vipFontColor}}color:{{vipFontColor}};{{/if}}{{#if vipBgColor}}background:{{vipBgColor}};{{/if}}">
<span class="vip-price-text">VIP价</span><span class="vip-price-val"></span>
</div>
{{/isEqualOr}}
</div>
</a>
{{#if brandImg}}
<a class="second-part {{#isEqualOr showBrandUrl '1'}}product-brand{{else}}product-detail{{/isEqualOr}}" href=''>
<div class="brand-div">
<span class="brand-name" {{#if fontColor}}style="color:{{fontColor}};"{{/if}}></span>
</div>
<img class="brand-img" src="{{image2 brandImg q=60}}">
</a>
{{/if}}
</div>
{{/if}}
</div>
</div>
{{/isEqualOr}}
{{/component}}
</div>
{{/isEqualOr}}
{{/content.floors}}
{{/unless}}
</div>
\ No newline at end of file
... ...
{{#if content.thumbnail}}
<img class="sidebar-img" src="{{image2 content.thumbnail q=60}}">
{{/if}}
<div class="sidebar">
<div class="sidebar-content">
{{#content.floors}}
{{#isEqualOr type '' 'common_floor'}}
<div class="sidebar-item">
{{#if param.bgimg}}<img src="{{image2 param.bgimg q=60}}">{{/if}}
{{#component}}
{{#isEqualOr type 'link'}}
{{#isEqualOr url 'closesidebar'}}
<a class="anchor closesidebar" style="{{styleFormat this percent=1}}" href="javascript:void(0);"></a>
{{else}}
<a class="anchor" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}"></a>
{{/isEqualOr}}
{{/isEqualOr}}
{{/component}}
</div>
{{/isEqualOr}}
{{/content.floors}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -8,9 +8,9 @@ const qpsLimiter = require('./rules/qps-limit');
const captchaPolicy = require('./policies/captcha');
const IP_WHITE_LIST = [
// '106.38.38.146',
// '218.94.75.58'
'106.38.38.146',
'218.94.75.58',
'218.94.75.50'
];
const limiter = (rule, policy, context) => {
... ... @@ -18,14 +18,18 @@ const limiter = (rule, policy, context) => {
};
module.exports = (req, res, next) => {
let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress;
logger.debug('request remote ip: ', remoteIp);
let remoteIp = req.get('X-Forwarded-For') || req.get('X-Real-IP') || '';
if (remoteIp.indexOf(',') > 0) {
let arr = remoteIp.split(',');
remoteIp = arr[0];
remoteIp = arr[arr.length - 1];
}
remoteIp = _.trim(remoteIp);
if (_.startsWith(remoteIp, '10.66.')) {
remoteIp = req.get('X-Real-IP');
}
const excluded = _.includes(IP_WHITE_LIST, remoteIp);
... ...
... ... @@ -22,6 +22,10 @@ module.exports = (req, res, next) => {
return next();
}
if (res.statusCode == 403) {
return res.end();
}
if (req.xhr) {
return res.json({
code: 400,
... ...
... ... @@ -101,7 +101,7 @@
<script type="text/javascript" src="{{src}}"></script>
{{/loadJs}}
{{#isFeature}}
<script type="text/javascript" src="//cdn.yoho.cn/js-sdk/1.2.0/jssdk.js"></script>
<script type="text/javascript" src="//cdn.yoho.cn/js-sdk/1.2.2/jssdk.js"></script>
{{/isFeature}}
{{#unless devEnv}}
{{> analysis}}
... ...
... ... @@ -12,7 +12,7 @@
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.3.7/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.3.8/yas.js', '_yas'));
var _hmt = _hmt || [];
... ... @@ -56,7 +56,7 @@
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.3.7', 'yohobuy_m', uid, '', '');
window._yas(1 * new Date(), '2.3.8', 'yohobuy_m', uid, '', '');
}
setTimeout(function() {
... ...
{
"name": "m-yohobuy-node",
"version": "5.5.10",
"version": "5.5.11",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
let $ = require('yoho-jquery');
let Swiper = require('yoho-swiper');
var $ = require('yoho-jquery');
var lazyLoad = require('yoho-jquery-lazyload');
var Swiper = require('yoho-swiper');
var yoho = require('../yoho-app');
global.jQuery = $;
let isAndroid = /(Android)/i.test(navigator.userAgent);
let isWechat = /micromessenger/i.test(navigator.userAgent);
lazyLoad($('img.lazy'));
function swiperInit() {
$('.swiper-container').each(function() {
let opt = {
... ... @@ -52,19 +56,27 @@ function topNavInit() {
}
function ceXuanFuInit() {
$('#load_cxf').load('http://feature.yoho.cn/public/cexuanfu/cexuanfu.html', function() {
$('#cxf').click(function() {
if ($(this).hasClass('isclick')) {
$('.cxfall').hide();
$(this).removeClass('iscxf');
} else {
$('.cxfall').show();
$(this).addClass('iscxf');
var cxf = $('#sidebar');
var pageid = cxf.attr('pageid');
if (!pageid) {
return;
}
$('#sidebar').load('//activity.yoho.cn/featuresidebar/' + pageid + '.html', function() {
$('.sidebar-img').click(function() {
$('.sidebar').show();
});
$('.sidebar').click(function(e) {
var $cur = $(e.target);
if (!$cur.closest('.sidebar-content').length) {
$(this).hide();
}
});
$('.cxfallbg').click(function() {
$(this).parent().hide();
$('#cxf').removeClass('iscxf');
$('.closesidebar').click(function() {
$('.sidebar').hide();
});
});
}
... ... @@ -99,31 +111,65 @@ function videoInit() {
}
function tabInit() {
let tabContainer = $('.tab-container');
let nextDom = tabContainer.parent().nextAll();
let tab = tabContainer.find('a.anchor');
$('.tab-container').each(function() {
var tab = $(this).find('a.anchor');
var tabname = (tab.attr('tab') || '').split('_')[0] + '_';
tab.on('click', function() {
tab.removeClass('active');
$(this).addClass('active');
let index = $(this).index() + 1;
for (let i = 1; i <= tab.length; i++) {
if (index === i) {
$('div[tabname="' + tabname + i + '"]').show();
} else {
$('div[tabname="' + tabname + i + '"]').hide();
}
}
});
tab.on('click', function() {
tab.removeClass('active');
$(this).addClass('active');
for (let i = 2; i <= tab.length; i++) {
$('div[tabname="' + tabname + i + '"]').hide();
}
});
}
let index = $(this).index();
function modalInit() {
$('a.modalimg').on('click', function() {
$($(this).next('.modal')[0]).show();
});
for (let i = 0; i < tab.length; i++) {
if (index === i) {
$(nextDom[i]).show();
} else {
$(nextDom[i]).hide();
}
}
$('.modal-close').on('click', function() {
$($(this).parent().get(0)).hide();
return false;
});
for (let i = 1; i < tab.length; i++) {
$(nextDom[i]).hide();
}
$('.modal').on('click', function(e) {
if (e.target.tagName === 'IMG') {
return false;
} else {
$(this).hide();
return false;
}
});
}
$(function() {
if ($('.over').length) {
// 过期/删除 状态的 活动
setTimeout(function() {
yoho.goHome();
}, 3000);
return false;
}
// tab
tabInit();
// 微信中点击之后,返回跳到指定位置
let totalH, scH;
let top = localStorage.changtu1;
... ... @@ -149,6 +195,6 @@ $(function() {
// 视频相关
videoInit();
// tab
tabInit();
// 模态框
modalInit();
});
... ...
... ... @@ -102,12 +102,11 @@ yoho = {
i;
url = (url || '').split('?');
hashs = url[1].split('&');
hashs = (url[1] || '').split('&');
if (hashs && hashs.length) {
for (i = 0; i < hashs.length; i++) {
hash = hashs[i].split('=');
console.log(hashs[i]);
query[hash[0]] = hash[1];
}
}
... ... @@ -174,6 +173,19 @@ yoho = {
$appLink.attr('href', url);
$appLink[0].click();
return false;
},
goHome: function() {
var url = '//m.yohobuy.com/';
if (yoho.isApp) {
url = url + '?openby:yohobuy=' + JSON.stringify({
action: 'go.home'
});
}
$appLink.attr('href', url);
$appLink[0].click();
return false;
}
};
... ...
... ... @@ -150,3 +150,157 @@ body {
height: 100%;
}
}
.video {
position: fixed;
top: -100%;
width: 100%;
height: 360px;
z-index: 3;
&.android {
top: 30%;
z-index: 1002;
}
}
.video-android-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: 1001;
background: #000;
opacity: 0.7;
}
.video-android-close {
position: fixed;
top: 26.2%;
right: 10px;
width: 35px;
height: 35px;
z-index: 1003;
background-image: resolve("activity/close.png");
background-size: cover;
}
.feature-page .modal {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
margin: 0 auto;
z-index: 1001;
background: rgba(0, 0, 0, 0.5);
display: none;
}
.feature-page .modal .modal-close {
position: absolute;
display: inline-block;
top: 20%;
right: 5%;
width: 45px;
height: 45px;
overflow: hidden;
border-radius: 50px;
background: black;
opacity: 0.5;
z-index: 100;
}
.feature-page .modal .modal-close:before,
.feature-page .modal .modal-close:after {
content: "";
position: absolute;
width: 80%;
top: 50%;
left: 10%;
height: 6px;
margin-top: -3px;
border-radius: 5px;
background: #fff;
}
.feature-page .modal .modal-close:before {
transform: rotate(45deg);
}
.feature-page .modal .modal-close:after {
transform: rotate(-45deg);
}
.feature-page .modal .modal-img {
position: absolute;
height: auto;
top: 20%;
left: 50%;
width: 90%;
transform: translateX(-50%);
}
.feature-page .sidebar {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
margin: 0 auto;
display: none;
background: rgba(0, 0, 0, 0.5);
z-index: 1000;
}
.feature-page .sidebar-content {
position: fixed;
display: block;
top: 50%;
right: 0;
width: 242px;
margin-top: -407px;
z-index: 1001;
}
.feature-page .sidebar-item {
position: relative;
img {
display: block;
width: 100%;
}
a {
position: absolute;
}
}
.feature-page .sidebar-img {
position: fixed;
display: block;
top: 50%;
right: 0;
width: 140px;
height: 150px;
margin-top: -75px;
z-index: 999;
}
.feature-page .over {
position: fixed;
top: 50%;
left: 50%;
width: 100%;
transform: translate(-50%, -50%);
text-align: center;
font-size: 28px;
color: #000;
p {
margin-bottom: 20px;
}
}
... ...
.video {
position: fixed;
top: -100%;
width: 100%;
height: 360px;
z-index: 3;
&.android {
top: 30%;
z-index: 1002;
}
}
.video-android-bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: 1001;
background: #000;
opacity: 0.7;
}
.video-android-close {
position: fixed;
top: 26.2%;
right: 10px;
width: 35px;
height: 35px;
z-index: 1003;
background-image: resolve("activity/close.png");
background-size: cover;
}
.product-container {
overflow: hidden;
... ... @@ -56,12 +21,14 @@
height: 257px;
}
.price {
.price,
.vipprice {
line-height: 34px;
height: 34px;
}
.sale-price {
.sale-price,
.vipprice {
font-size: 26px;
}
}
... ... @@ -132,7 +99,7 @@
position: absolute;
left: 0;
top: 0;
width: 40%;
width: 100%;
height: auto;
z-index: 1;
}
... ... @@ -141,11 +108,25 @@
position: absolute;
right: 0;
top: 0;
width: 40%;
width: 100%;
height: auto;
z-index: 1;
}
.vipprice {
line-height: 40px;
height: 40px;
white-space: nowrap;
text-align: center;
font-size: 26px;
color: #000;
}
.vip-price-text {
margin-right: 10px;
font-weight: 500;
}
.price {
font-size: 18px;
line-height: 40px;
... ...
... ... @@ -35,6 +35,13 @@ module.exports = {
}
return JSON.stringify(fp);
},
isLazyLoad: function(type, index, opt) {
if (type !== 'fix' && index > 8) { // 活动页中 不是浮动层及8张图后面的采用懒加载
return opt.fn(this); // eslint-disable-line
} else {
return opt.inverse(this); // eslint-disable-line
}
},
styleFormat: function(styleObj, opts) {
let style = '';
... ... @@ -50,6 +57,11 @@ module.exports = {
}
return style;
},
tabName: function(index, tabnames) {
var names = tabnames.split(',');
return names[index];
},
tabStyle: function(index, count) {
let width = (100 / Number(count)).toFixed(2);
let style = 'height:100%;width:' + width + '%;';
... ...