Authored by 陈峰

50%完成

Showing 67 changed files with 857 additions and 896 deletions

Too many changes to show.

To preserve performance only 67 of 67+ files are displayed.

var $ = require('yoho-jquery'),
dbClass = 'data-bind',
let $ = require('yoho-jquery');
let dbClass = 'data-bind',
$chosePanel = $('.chose-panel');
module.exports = function(data, callback) {
render(data);
render(data); // eslint-disable-line
callback && callback();
};
function render(data) {
var htmlTemplate = '<div class="main">' +
let htmlTemplate = '<div class="main">' +
' <div class="close iconfont">&#xe626;</div>' +
' <div class="infos">' +
' <div class="basic-info" >' +
... ... @@ -66,18 +65,21 @@ function render(data) {
$('#promotionId').remove();
$('#single').remove();
$('.chose-panel').addClass('data-bind').html(htmlTemplate).append('<input id="promotionId" type="hidden" value="">').append('<input id="single" type="hidden" value="">');
$('.chose-panel').addClass('data-bind')
.html(htmlTemplate)
.append('<input id="promotionId" type="hidden" value="">')
.append('<input id="single" type="hidden" value="">');
if (data.cartInfo.thumbs) {
$chosePanel.removeClass(dbClass);
var cartInfo = data.cartInfo;
var thumbClone = $chosePanel.find('.thumb').remove();
let cartInfo = data.cartInfo;
let thumbClone = $chosePanel.find('.thumb').remove();
for (var i = cartInfo.thumbs.length - 1; i >= 0; i--) {
var thumbEle = thumbClone.clone();
for (let i = cartInfo.thumbs.length - 1; i >= 0; i--) {
let thumbEle = thumbClone.clone();
thumbEle.attr('src', cartInfo.thumbs[i].img);
if (i != 0) {
if (i !== 0) {
thumbEle.addClass('hide');
}
$chosePanel.find('.thumb-img').prepend(thumbEle);
... ... @@ -93,20 +95,20 @@ function render(data) {
} else {
$chosePanel.find('.market-price').text(cartInfo.price).removeClass(dbClass);
}
var colorsClone = $chosePanel.find('.color-list>.size-row').remove();
var colorClone = colorsClone.find('li').remove();
let colorsClone = $chosePanel.find('.color-list>.size-row').remove();
let colorClone = colorsClone.find('li').remove();
for (var i = 0; i < cartInfo.colors.length; i++) {
var colors = cartInfo.colors[i];
var colorsEle = colorsClone.clone();
for (let i = 0; i < cartInfo.colors.length; i++) {
let colors = cartInfo.colors[i];
let colorsEle = colorsClone.clone();
colorsEle.attr('id', colors.id).attr('data-index', i);
if (i != 0) {
if (i !== 0) {
colorsEle.addClass('hide');
}
for (var o = 0; o < colors.color.length; o++) {
var color = colors.color[o];
var colorEle = colorClone.clone();
for (let o = 0; o < colors.color.length; o++) {
let color = colors.color[o];
let colorEle = colorClone.clone();
colorEle.attr('data-num', color.colorNum).text(color.name);
if (color.chosed) {
... ... @@ -119,21 +121,25 @@ function render(data) {
}
$chosePanel.find('.color-list').append(colorsEle);
}
var sizesClone = $chosePanel.find('.size-list>.size-row').remove();
var sizeClone = sizesClone.find('li').remove();
let sizesClone = $chosePanel.find('.size-list>.size-row').remove();
let sizeClone = sizesClone.find('li').remove();
for (var i = 0; i < cartInfo.sizes.length; i++) {
var sizes = cartInfo.sizes[i];
var sizesEle = sizesClone.clone();
for (let i = 0; i < cartInfo.sizes.length; i++) {
let sizes = cartInfo.sizes[i];
let sizesEle = sizesClone.clone();
if (i != 0) {
if (i !== 0) {
sizesEle.addClass('hide');
}
for (var o = 0; o < sizes.size.length; o++) {
var size = sizes.size[o];
var sizeEle = sizeClone.clone();
sizeEle.attr('data-num', size.sizeNum).attr('data-id', size.id).attr('data-skuid', size.skuId).text(size.name).attr('data-info', size.sizeInfo);
for (let o = 0; o < sizes.size.length; o++) {
let size = sizes.size[o];
let sizeEle = sizeClone.clone();
sizeEle.attr('data-num', size.sizeNum)
.attr('data-id', size.id)
.attr('data-skuid', size.skuId)
.text(size.name)
.attr('data-info', size.sizeInfo);
if (size.chosed) {
sizeEle.addClass('chosed');
}
... ... @@ -161,7 +167,7 @@ function render(data) {
}
/* tar modified 161205 量贩商品数量限制 */
var $discountBuy = $('#discount-buy'),
let $discountBuy = $('#discount-buy'),
$promotionPhrase = $('#promotion-phrase');
if ($discountBuy.length > 0) {
... ...
... ... @@ -3,11 +3,11 @@
* @param string value
*/
module.exports = function() {
var args = Array.prototype.slice.call(arguments);
var opt = args[args.length - 1];
var isTrue = true;
let args = Array.prototype.slice.call(arguments);
let opt = args[args.length - 1];
let isTrue = true;
for (var i = 0; i < args.length - 1; i++) {
for (let i = 0; i < args.length - 1; i++) {
if (!args[i]) {
isTrue = false;
break;
... ...
... ... @@ -3,11 +3,11 @@
* @param string value
*/
module.exports = function() {
var args = Array.prototype.slice.call(arguments);
var opt = args[args.length - 1];
var isTrue = false;
let args = Array.prototype.slice.call(arguments);
let opt = args[args.length - 1];
let isTrue = false;
for (var i = 0; i < args.length - 1; i++) {
for (let i = 0; i < args.length - 1; i++) {
if (args[i]) {
isTrue = true;
break;
... ...
... ... @@ -10,7 +10,9 @@ module.exports = function(imageUrl, opts) {
}
if (query) {
query = query.replace(/{width}/g, params.w).replace(/{height}/g, params.h).replace(/{mode}/g, (params.mode || 2));
query = query.replace(/{width}/g, params.w)
.replace(/{height}/g, params.h)
.replace(/{mode}/g, (params.mode || 2));
if (query.indexOf('imageView2') === 0) {
if (params.q && query.indexOf('/q/') > 0) {
... ...
... ... @@ -4,9 +4,9 @@
* @date: 2015/11/1
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var $cart = $('#suspend-cart');
let $cart = $('#suspend-cart');
require('../common');
... ... @@ -15,7 +15,7 @@ if ($('#remove-cart-count').length) {
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
let count;
if (data.code === 200) {
count = data.data.cart_goods_count;
... ... @@ -32,6 +32,6 @@ if ($('#remove-cart-count').length) {
}
/* tar add 161121 app del suspend cart */
if (queryString.app_version || queryString.appVersion) {
if (window.queryString.app_version || window.queryString.appVersion) {
$('.suspend-cart').css('display', 'none');
}
... ...
... ... @@ -4,27 +4,27 @@
* @date: 2015/10/26
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer');
var floatLayerBtnHammer;
let floatLayerBtnHammer;
require('./common');
/**
* 获取url参数
*/
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return window.unescape(r[2]);
}
return null;
}
// /**
// * 获取url参数
// */
// function getQueryString(name) {
// let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
// let r = window.location.search.substr(1).match(reg);
// if (r != null) {
// return window.unescape(r[2]);
// }
// return null;
// }
$('#float-layer-close').on('touchend', function(e) {
$('#float-layer-close').on('touchend', function() {
$('#float-layer-app').hide();
window.setCookie('_float-layer-app', 'id490655927',
{
... ...
require('guang/brand-cate/brand-list.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper2');
var categoryHeight = $('.tab-box').height(),
let categoryHeight = $('.tab-box').height(),
gender;
var $listBox = $('.list-box'),
let $listBox = $('.list-box'),
$brandContent = $('.brand-content'),
$tabBox = $('.tab-box'),
$contentIndex = $('.content-index'),
... ... @@ -19,7 +19,7 @@ require('../common');
require('./brand-cate/cate-all');
function channels(key) {
var channel = {
let channel = {
men: 1,
women: 2,
lifestyle: 4
... ... @@ -31,7 +31,7 @@ function channels(key) {
// 点击字母,页面滚动到相关区域
function reference() {
$('.no-intercept').click(function() {
var name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],
let name = $(this).attr('href').split('#')[1] === '0_9' ? '0~9' : $(this).attr('href').split('#')[1],
targetTop = $('.brand-list-box').find('[name="' + name + '"]').offset().top - categoryHeight;
$('html,body').animate({
... ... @@ -43,7 +43,8 @@ function reference() {
function initialize() {
$('.banner-swiper').each(function() {
if (!$(this).parents('.content').hasClass('hide') && $(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
if (!$(this).parents('.content').hasClass('hide') &&
$(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
new Swiper(this, {
preloadImages: false,
lazyLoading: true,
... ... @@ -130,7 +131,7 @@ if ($listBox.find('li').length <= 0) {
}
$(window).scroll(function() {
var totalHeight = $('#yoho-header').height() + $('.tab-box').height();
let totalHeight = $('#yoho-header').height() + $('.tab-box').height();
if (!$brandContent.hasClass('hide')) {
if ($(this).scrollTop() >= $('#yoho-header').height()) {
... ... @@ -157,7 +158,8 @@ $(window).scroll(function() {
$(function() {
$('.banner-swiper').each(function() {
if (!$(this).parents('.content').hasClass('hide') && $(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
if (!$(this).parents('.content').hasClass('hide') &&
$(this).hasClass('swiper-container-horizontal') === false && $(this).find('li').length > 1) {
new Swiper(this, {
preloadImages: false,
lazyLoading: true,
... ...
var lazyLoad = require('yoho-jquery-lazyload');
/**
* 搭配区块
*
... ... @@ -28,31 +26,31 @@ function CollocationBlock() {
// 初始化箭头位置
this._updateCollocationArrowPos(this.thumbs.filter('.focus'));
var scrollFn = () => {
var pos = this.container.offset(),
posFixed = this.fixedContainer.offset();
var visible = false;
// let scrollFn = () => {
// let pos = this.container.offset(),
// posFixed = this.fixedContainer.offset();
// let visible = false;
if (posFixed.top >= pos.top) {
visible = false;
} else {
visible = true;
}
// if (posFixed.top >= pos.top) {
// visible = false;
// } else {
// visible = true;
// }
if (posFixed.top + this.fixedContainer.height() > $('ul.brand-list').offset().top) {
visible = false;
} else if (pos.top < $(window).scrollTop()) {
visible = true;
this.fixedContainer.removeClass('fixed-bottom').addClass('fixed-top');
} else {
this.fixedContainer.removeClass('fixed-top').addClass('fixed-bottom');
}
// if (posFixed.top + this.fixedContainer.height() > $('ul.brand-list').offset().top) {
// visible = false;
// } else if (pos.top < $(window).scrollTop()) {
// visible = true;
// this.fixedContainer.removeClass('fixed-bottom').addClass('fixed-top');
// } else {
// this.fixedContainer.removeClass('fixed-top').addClass('fixed-bottom');
// }
this.fixedContainer.css({
visibility: visible ? 'visible' : 'hidden'
});
};
// this.fixedContainer.css({
// visibility: visible ? 'visible' : 'hidden'
// });
// };
// $(document).on('scroll', scrollFn);
// $(document).on('touchmove', scrollFn);
... ... @@ -69,7 +67,7 @@ $.extend(CollocationBlock.prototype, {
* @param current 当前focus的搭配项
*/
_updateCollocationArrowPos: function(current) {
var left = current.offset().left,
let left = current.offset().left,
bgPos = -$(window).width() + left + (this.thumbs.width() / 2) + 'px';
this.container.css({
... ... @@ -90,7 +88,7 @@ $.extend(CollocationBlock.prototype, {
* @private
*/
_touchHandler: function(e) {
var current = $(e.currentTarget),
let current = $(e.currentTarget),
index = current.index();
if (current.hasClass('focus')) {
... ...
... ... @@ -4,13 +4,13 @@
* @date: 2016/4/12
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
lazyLoad = require('yoho-jquery-lazyload'),
ellipsis = require('yoho-mlellipsis');
var stopLoading = false,
let stopLoading = false,
page = 1;
require('./list-common');
... ... @@ -18,7 +18,7 @@ require('./list-common');
ellipsis.init();
function massageAJAX(pageData) {
var $this, $title, $cont;
let $this, $title, $cont;
loading.showLoadingMask();
$.ajax({
... ... @@ -53,7 +53,7 @@ function massageAJAX(pageData) {
lazyLoad($('img.lazy'));
if (pageData === 1) {
$('.buriedpoint').on('click', bpClickHdl);
$('.buriedpoint').on('click', bpClickHdl); // eslint-disable-line
}
},
error: function() {
... ... @@ -79,13 +79,13 @@ if ($('.collocation-list').find('li').length === 0) {
}
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
var bpClickHdl = function() {
let C_ID = window._ChannelVary[window.cookie('_Channel')];
let bpClickHdl = function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(this);
let $this = $(this);
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
... ...
... ... @@ -6,26 +6,26 @@
require('guang/index-editor.page.css');
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var info = require('./info-common');
let info = require('./info-common');
var loadMore = info.loadMore;
let loadMore = info.loadMore;
var winH = $(window).height();
let winH = $(window).height();
var $author = $('#author-infos');
var $tag = $('#tag');
var $gender = $('#gender');
var $isApp = $('#isApp');
let $author = $('#author-infos');
let $tag = $('#tag');
let $gender = $('#gender');
let $isApp = $('#isApp');
var setting = {
let setting = {
page: 2,
end: false
};
var $infos = $('#info-list');
var getDynamicData = require('./list-dynamic');
let $infos = $('#info-list');
let getDynamicData = require('./list-dynamic');
require('../common');
... ... @@ -60,14 +60,14 @@ $(window).scroll(function() {
});
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
let C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.info-list').on('click', function(e) {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(e.target),
let $this = $(e.target),
$btn = $this.closest('.like-btn'),
$info = $this.closest('.guang-info');
... ...
... ... @@ -7,26 +7,26 @@ require('guang/index.page.css');
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var info = require('./info');
var loadMore = info.loadMore;
let info = require('./info');
let loadMore = info.loadMore;
var $loadMoreInfo = $('#load-more-info');
var $loading = $(''),
let $loadMoreInfo = $('#load-more-info');
let $loading = $(''),
$noMore = $('');
var winH = $(window).height();
let winH = $(window).height();
var $infoList = $('#info-list'),
let $infoList = $('#info-list'),
$infos = $infoList.children('.info-list'),
$nav = $('#guang-nav'),
$curNav = $nav.children('.focus'),
curType = $curNav.data('type');
var getDynamicData = require('./list-dynamic');
let getDynamicData = require('./list-dynamic');
var state = {};
let state = {};
require('../common');
... ... @@ -41,10 +41,10 @@ info.initInfosEvt($infoList);
// 初始化各Nav下资讯加载的状态
(function() {
var gender = $('#gender').val();
let gender = $('#gender').val();
$nav.children('.guang-nav-item').each(function() {
var type = $(this).data('type'),
let type = $(this).data('type'),
focus = $(this).hasClass('focus');
state[type] = {
... ... @@ -62,7 +62,7 @@ $nav.bind('contextmenu', function() {
});
$nav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('.guang-nav-item'),
let $this = $(e.target).closest('.guang-nav-item'),
$content,
index;
... ... @@ -111,7 +111,7 @@ $nav.on('touchend touchcancel', function(e) {
});
function scrollHandler() {
var $c = $infos.not('.hide');
let $c = $infos.not('.hide');
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $c.height()) {
loadMore($c, state[curType]);
... ... @@ -124,7 +124,7 @@ $(document).scroll(function() {
});
$nav.on('touchstart', function(e) {
var target = e.target || e.srcElement;
let target = e.target || e.srcElement;
target.className = 'bytouch ' + target.className;
}).on('touchend touchcancel', function() {
... ...
... ... @@ -4,24 +4,24 @@
* @date: 2015/10/10
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('../common/toy-hammer'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper2');
var tip = require('../plugin/tip');
var loading = require('../plugin/loading');
let tip = require('../plugin/tip');
let loading = require('../plugin/loading');
var $loadMoreInfo = $('#load-more-info');
var $loading = $(''),
let $loadMoreInfo = $('#load-more-info');
let $loading = $(''),
$noMore = $(''),
$swiper = $('');
var searching = false;
var mySwiper = {};
let searching = false;
let mySwiper = {};
var isLoading = false;
let isLoading = false;
ellipsis.init();
... ... @@ -34,10 +34,10 @@ if ($loadMoreInfo.length > 0) {
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
// 匹配目标参数
var r = window.location.search.substr(1).match(reg);
let r = window.location.search.substr(1).match(reg);
// 返回参数值
if (r !== null) {
... ... @@ -72,7 +72,7 @@ function setLazyLoadAndMellipsis($infos) {
lazyLoad($infos.find('img.lazy'));
$infos.each(function() {
var $this = $(this),
let $this = $(this),
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
... ... @@ -86,7 +86,7 @@ function setLazyLoadAndMellipsis($infos) {
* @params $container 逛资讯列表容器
*/
function initInfosEvt($container) {
var cHammer;
let cHammer;
if (typeof $container === 'undefined') {
return;
... ... @@ -98,7 +98,7 @@ function initInfosEvt($container) {
// 点赞或者收藏事件
cHammer.on('tap', function(e) {
var $this = $(e.target),
let $this = $(e.target),
opt = 'ok',
$btn,
$info,
... ... @@ -126,7 +126,7 @@ function initInfosEvt($container) {
opt: opt
},
success: function(data) {
var code = data.code;
let code = data.code;
if (code === 200) {
... ... @@ -149,7 +149,7 @@ function initInfosEvt($container) {
// APP收藏
$btn = $this.closest('.collect-btn');
if ($btn.length > 0) {
var uid = getUrlParam('uid');
let uid = getUrlParam('uid');
if (uid) {
if ($btn.hasClass('collected')) {
... ... @@ -201,7 +201,7 @@ function initInfosEvt($container) {
* @param url[可选], 扩展请求的url而不使用默认值
*/
function loadMore($container, opt, url) {
var num;
let num;
if (searching) {
return;
... ... @@ -226,7 +226,7 @@ function loadMore($container, opt, url) {
url: url ? url : '/guang/index/page', // 对于指定url的使用指定url(存在不同的控制器)
data: opt,
success: function(data) {
var $newItems;
let $newItems;
if (data === '') {
opt.end = true;
... ...
... ... @@ -5,30 +5,29 @@
*/
require('guang/info-index.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload'),
Hammer = require('yoho-hammer');
lazyLoad = require('yoho-jquery-lazyload');
var $authorIntro = $('.author .intro');
let $authorIntro = $('.author .intro');
// collocation block variable
var $fixedThumbContainer = $(''),
let $fixedThumbContainer = $(''),
$coBlock,
$thumbContainer = $('.thumb-container');
var $sideNav = $('.side-nav'),
let $sideNav = $('.side-nav'),
$guangPage = $('.guang-detail-page'),
$overlay = $('.overlay'),
$subNav = $('.sub-nav');
var time = 0;
let time = 0;
require('../common');
require('../plugin/wx-share')();
require('./detail-dynamic');
var CollactionBlock = require('./collocation-block');
let CollactionBlock = require('./collocation-block');
$('#wrapper').css({
'overflow-y': 'scroll'
... ... @@ -36,8 +35,8 @@ $('#wrapper').css({
// 初始化iscroll
function initIscroll() {
var $yohoHeader = $('.yoho-header');
var hH = 0,
let $yohoHeader = $('.yoho-header');
let hH = 0,
winH, tcH, cbH, cbTop, fixedThumbDom;
if (CollactionBlock.exists()) {
... ... @@ -79,8 +78,8 @@ function initIscroll() {
}
$(window).on('scroll', function() {
var sTop = -this.y;
var classList = fixedThumbDom && fixedThumbDom.className;
let sTop = -this.y;
let classList = fixedThumbDom && fixedThumbDom.className;
if (sTop <= cbTop - winH + tcH) {
if (classList.indexOf('fixed-bottom') === -1) {
... ... @@ -157,7 +156,7 @@ $sideNav.on('touchend', 'li', function(e) {
}
if (e.target.pathname === location.pathname) {
hideSideBar();
hideSideBar(); // eslint-disable-line
return false;
}
});
... ... @@ -201,7 +200,7 @@ $overlay.on('touchstart', function() {
});
function setCookie(name, value, options) {
var expires = '',
let expires = '',
path,
domain,
secure,
... ... @@ -258,12 +257,13 @@ $('.wei-share').on('touchend', function(e) {
// 初始化页面,包括是否使用iscorll初始化页面
// 接口暴露在HTML中,使用压缩名
(function() {
var isweixin = navigator.userAgent.indexOf('MicroMessenger') ? true : false;
var $this, $title;
let isweixin = navigator.userAgent.indexOf('MicroMessenger') ? true : false;
let $this, $title;
// pagecache 前端判断是否显示头
var param = location.search;
var isHeader = navigator.userAgent.indexOf('MicroMessenger') > -1 || param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
let param = location.search;
let isHeader = navigator.userAgent.indexOf('MicroMessenger') > -1 ||
param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
isHeader && $('#yoho-header').remove();
... ... @@ -299,14 +299,14 @@ $('.wei-share').on('touchend', function(e) {
}
$('#float-layer-close').on('touchend', function() {
var appClose = window.cookie('_float-layer-app-close') || '0';
let appClose = window.cookie('_float-layer-app-close') || '0';
// window.setCookie('_float-layer-app-close', 1);
if (parseInt(appClose) === 0) {
if (parseInt(appClose, 10) === 0) {
setCookie('_float-layer-app-close', 1, {expires: -1});
} else if (parseInt(appClose) === 1) {
} else if (parseInt(appClose, 10) === 1) {
setCookie('_float-layer-app-close', 2, {expires: -1});
}
... ... @@ -333,7 +333,7 @@ $('.wei-share').on('touchend', function(e) {
e.srcEvent.stopPropagation();
});
if (typeof window.cookie === 'function' && parseInt(window.cookie('_float-layer-app-close')) != 2) {
if (typeof window.cookie === 'function' && parseInt(window.cookie('_float-layer-app-close'), 10) !== 2) {
// $('#float-layer-app').show();
$('.down-bottom').show();
} else {
... ...
... ... @@ -4,23 +4,23 @@
* @date: 2015/10/10
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper2');
var tip = require('../plugin/tip');
var loading = require('../plugin/loading');
let tip = require('../plugin/tip');
let loading = require('../plugin/loading');
var $loadMoreInfo = $('#load-more-info');
var $loading = $(''),
let $loadMoreInfo = $('#load-more-info');
let $loading = $(''),
$noMore = $(''),
$swiper = $('');
var searching = false;
var mySwiper = {};
let searching = false;
let mySwiper = {};
var getDynamicData = require('./list-dynamic');
let getDynamicData = require('./list-dynamic');
require('../common');
... ... @@ -35,10 +35,10 @@ if ($loadMoreInfo.length > 0) {
function getUrlParam(name) {
// 构造一个含有目标参数的正则表达式对象
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
// 匹配目标参数
var r = window.location.search.substr(1).match(reg);
let r = window.location.search.substr(1).match(reg);
// 返回参数值
if (r !== null) {
... ... @@ -72,7 +72,7 @@ function setLazyLoadAndMellipsis($infos) {
lazyLoad($infos.find('img.lazy'));
$infos.each(function() {
var $this = $(this),
let $this = $(this),
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
... ... @@ -94,15 +94,15 @@ function initInfosEvt($container) {
}
$container.on('touchend touchcancel', function(e) {
var $this = $(e.target);
let $this = $(e.target);
// 点赞
var $btn = $this.closest('.like-btn');
let $btn = $this.closest('.like-btn');
if ($btn.length > 0) {
e.preventDefault();
var opt = 'ok',
let opt = 'ok',
$info;
if ($btn.hasClass('like')) {
... ... @@ -117,7 +117,7 @@ function initInfosEvt($container) {
opt: opt
},
success: function(data) {
var code = data.code;
let code = data.code;
if (code === 200) {
$btn.next('.like-count').text(data.data);
... ... @@ -138,7 +138,7 @@ function initInfosEvt($container) {
if ($btn.length > 0) {
e.preventDefault();
var opt = 'ok',
let opt = 'ok',
$info,
yhChannel;
... ... @@ -186,7 +186,7 @@ function initInfosEvt($container) {
* @param url[可选], 扩展请求的url而不使用默认值
*/
function loadMore($container, opt, url) {
var num;
let num;
if (searching) {
return;
... ... @@ -209,7 +209,7 @@ function loadMore($container, opt, url) {
url: url ? url : '/guang/index/page', // 对于指定url的使用指定url(存在不同的控制器)
data: opt,
success: function(data) {
var $newItems;
let $newItems;
if (data === ' ') {
opt.end = true;
... ...
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
Swiper = require('yoho-swiper2'),
loading = require('../plugin/loading'),
debounce = require('lodash/debounce');
var plusstar = {};
let plusstar = {};
var windowHeight = $(window).height();
var scrollFn,
let windowHeight = $(window).height();
let scrollFn,
scrollTop,
RECPOSE,
isApp,
... ... @@ -29,7 +29,7 @@ plusstar = {
productSkns: []
},
init: function() {
var that = this,
let that = this,
$liDom,
$tabUlDom;
... ... @@ -100,7 +100,7 @@ plusstar = {
},
_yas: function() {
// http://redmine.yoho.cn/issues/12224
var that = this;
let that = this;
if (!window._yas || !window._yas.sendCustomInfo) {
return false;
... ... @@ -108,7 +108,7 @@ plusstar = {
RECPOSE = that.ParentLiDom.index() !== 0 ? 100015 : 100014;
$('.plusstar-resources').bind('click', function(event) {
var $dom, $domA, index;
let $dom, $domA, index;
if ($(event.target).closest('.good-info').length > 0) {
// 商品单击埋点
... ... @@ -171,8 +171,8 @@ plusstar = {
}, true);
},
tabNav: function(code) {
var that = this;
var tabId = that.ParentLiDom.index() + 1;
let that = this;
let tabId = that.ParentLiDom.index() + 1;
this.common.codeDefault = code;// 记住最后一次的tab code
this.common.page = 1;// 商品列表从第一页开始
... ... @@ -217,7 +217,7 @@ plusstar = {
// 页面中下拉曝光
setTimeout(function() {
if (window._yas && window._yas.sendAppLogs) {
var actionUrl = [],
let actionUrl = [],
aDom = $('.plusstar-resources').find('a');
aDom.each(function() {
... ... @@ -255,7 +255,7 @@ plusstar = {
}
},
resInit: function() {
var that = this,
let that = this,
productSkns = '',
tabId;
... ... @@ -307,7 +307,7 @@ plusstar = {
}, 300);
},
goodsList: function() {
var that = this,
let that = this,
skn = [];
if (searching) {
... ... @@ -320,7 +320,8 @@ plusstar = {
}
loading.showLoadingMask();
skn = that.common.productSkns.slice((that.common.page - 1) * that.common.pagesize, that.common.page * that.common.pagesize);
skn = that.common.productSkns.slice((that.common.page - 1) *
that.common.pagesize, that.common.page * that.common.pagesize);
$.ajax({
type: 'POST',
url: '/guang/plusstar/resources-goodsList',
... ...
var $ = require('yoho-jquery'),
dbClass = 'data-bind',
let $ = require('yoho-jquery');
let dbClass = 'data-bind',
isApp = $('input[name="isApp"]').val(),
uid = $('input[name="uid"]').val();
module.exports = function(callback) {
var brandId = $('#brandId').val();
var clientType = $('#clientType').val();
let brandId = $('#brandId').val();
let clientType = $('#clientType').val();
if (brandId && $('#related-infos-demote').length) {
$.ajax({
... ... @@ -19,7 +18,7 @@ module.exports = function(callback) {
uid: uid
},
success: function(data) {
render(data);
render(data); // eslint-disable-line
callback && callback(data);
}
});
... ... @@ -30,26 +29,26 @@ function render(data) {
$('.brand-islike').addClass('like');
}
if (data.infos && data.infos.length) {
var guangInfoEl = $('#related-infos-container>.guang-info').remove();
let guangInfoEl = $('#related-infos-container>.guang-info').remove();
for (var i = 0; i < data.infos.length; i++) {
var info = data.infos[i];
var item = guangInfoEl.clone().attr('data-id', info.id);
for (let i = 0; i < data.infos.length; i++) {
let info = data.infos[i];
let item = guangInfoEl.clone().attr('data-id', info.id);
item.find('.info-img-link')
.attr('href', info.url)
.find('img')
.attr('data-original', info.img)
.attr('alt', info.alt);
var depsEl = item.find('.info-deps');
let depsEl = item.find('.info-deps');
depsEl.find('.info-title-container').attr('href', info.url).find('.info-title').text(info.title);
depsEl.find('.info-text').text(info.text);
var timeEl = item.find('.time-view-like-share');
let timeEl = item.find('.time-view-like-share');
timeEl.find('.publish-time').text(info.publishTime);
timeEl.find('.page-view').text(info.pageView);
var likeEl = timeEl.find('.like-share-container');
let likeEl = timeEl.find('.like-share-container');
if (info.like) {
likeEl.find('.like-btn').removeClass(dbClass);
... ... @@ -77,7 +76,7 @@ function render(data) {
.text(info.author.name)
.removeClass(dbClass);
}
var infoImgEl = item.find('.info-img');
let infoImgEl = item.find('.info-img');
if (info.showTags) {
infoImgEl.find('.data-bind').removeClass(dbClass);
... ...
... ... @@ -4,28 +4,27 @@
* @date: 2015/10/10
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('../common/toy-hammer'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload');
var $intro = $('#intro'),
let $intro = $('#intro'),
$imt = $('#intro-more-txt'),
$infosContainer = $('#related-infos-container'),
uid = $('input[name="uid"]').val(),
isApp = $('input[name="isApp"]').val();
uid = $('input[name="uid"]').val();
var info = require('./info');
let info = require('./info');
var tip = require('../plugin/tip');
let tip = require('../plugin/tip');
var brandId = $('#brand-info').data('id');
let brandId = $('#brand-info').data('id');
var jumpToApp = $('#jump-to-app').val();
let jumpToApp = $('#jump-to-app').val();
var mIntro, aIntro, logoImg;
let mIntro, aIntro, logoImg;
var moreHammer, likeHammer, $goodName, $title;
let likeHammer, $goodName, $title;
require('guang/plustar-detail.page.css');
require('../plugin/wx-share');
... ... @@ -64,7 +63,7 @@ info.initInfosEvt($infosContainer);
// 文字介绍收起与展开
$('#more-intro-click-range').on('click', function(e) {
var $this = $imt.parent();
let $this = $imt.parent();
e.preventDefault(); // 防止收缩后误点到商品产生跳转
... ... @@ -90,7 +89,7 @@ if ($('#brand-like').length) {
// 品牌收藏
likeHammer = new Hammer(document.getElementById('brand-like'));
likeHammer.on('tap', function(e) {
var opt = 'ok',
let opt = 'ok',
$this = $(e.target);
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
... ... @@ -118,10 +117,11 @@ if ($('#brand-like').length) {
} else if (data.code === 400 || data.code === 412) {
if (jumpToApp === '1') {
var url = location.href + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":' +
window.queryString.id + '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' + $('#brand-info').data('id') + '"}},"priority":"Y"}}';
let url = location.href + '&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":' + // eslint-disable-line
window.queryString.id + '}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"' + $('#brand-info').data('id') + '"}},"priority":"Y"}}'; // eslint-disable-line
$('body').append('<a href=' + url + ' style="display:none;"><span class="jump-login">&nbsp;</span></a>');
$('body').append('<a href=' + url +
' style="display:none;"><span class="jump-login">&nbsp;</span></a>');
$('.jump-login').click();
} else {
... ...
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper');
var $navs = $('#nav-tab > li'),
let $navs = $('#nav-tab > li'),
$contents = $('#ps-content > .content');
require('guang/plustar-list.page.css');
... ... @@ -10,12 +10,12 @@ require('../common');
lazyLoad($('img.lazy'));
$('#nav-tab').bind('contextmenu', function(e) {
$('#nav-tab').bind('contextmenu', function() {
return false;
});
$('#nav-tab').on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li');
let $this = $(e.target).closest('li');
if ($this.hasClass('focus')) {
return;
... ... @@ -50,7 +50,7 @@ $('#nav-tab').on('touchend touchcancel', function(e) {
// }
$('#nav-tab').on('touchstart', function(e) {
var target = e.target || e.srcElement;
let target = e.target || e.srcElement;
target.className = 'bytouch ' + target.className;
}).on('touchend touchcancel', function() {
... ...
... ... @@ -4,7 +4,7 @@
* @date: 2016/6/7
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
require('../common');
... ... @@ -12,14 +12,14 @@ require('../common');
lazyLoad($('img.lazy'));
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
let C_ID = window._ChannelVary[window.cookie('_Channel')];
$('.buriedpoint').on('click', function() {
if (!window._yas || !window._yas.sendAppLogs) {
return;
}
var $this = $(this);
let $this = $(this);
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
... ...
... ... @@ -4,22 +4,26 @@
* @date: 2016/5/31
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
loading = require('../plugin/loading'),
PullRefresh = require('../plugin/pull-refresh');
var $window = $(window),
let $window = $(window),
stopLoading = false,
$mainContent = $('.main-content'),
$loadingTip = $('.loading-tip'),
u = navigator.userAgent,
isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
var avatarKey, bannerLen, res, avatarSwiper, getIndexHtml, bannerSwiper,
$avatarWrap, starIScroll;
let bannerLen,
res,
getIndexHtml,
bannerSwiper,
$avatarWrap,
starIScroll;
var swiperNum = $('.avatar-wrap .swiper-slide').width() / 2,
let swiperNum = $('.avatar-wrap .swiper-slide').width() / 2,
topBanner = $('.banner-top');
if ($('.star-main').css('height') === '0px') {
... ... @@ -40,7 +44,6 @@ $('#yoho-header, .head-tab').on('touchmove', function() {
// 明星头像点击居中显示或跳转
function bindAvatar(dom) {
avatarKey = dom.index();
if (!dom.hasClass('swiper-slide-active')) {
... ... @@ -51,7 +54,7 @@ function bindAvatar(dom) {
function setIndexAction() {
// 明星头像 swiper 初始化
if (bannerLen > 1) {
avatarSwiper = new Swiper($avatarWrap.find('.avatar-swiper')[0], {
new Swiper($avatarWrap.find('.avatar-swiper')[0], {
lazyLoading: true,
lazyLoadingInPrevNextAmount: 3,
... ... @@ -151,7 +154,7 @@ starIScroll.iScroll.on('scrollEnd', function() {
window.setCookie('guangStarUid', window.queryString.uid);
// app埋点
var C_ID = window._ChannelVary[window.cookie('_Channel')];
let C_ID = window._ChannelVary[window.cookie('_Channel')];
// 点击星潮教室页面中的banner
$('.banner-top').find('li').on('click', function() {
... ... @@ -192,11 +195,11 @@ $('.star-info').on('click', function(e) {
return;
}
var $this = $(e.target),
let $this = $(e.target),
$a = $this.closest('.star-article');
if ($a.length > 0) {
var $li = $this.parents('li');
let $li = $this.parents('li');
window._yas.sendAppLogs({
appop: 'YB_H5_STROLL_STAR_FLR_C',
... ...
var $ = require('yoho-jquery');
var bp = require('./burying-point');
let $ = require('yoho-jquery');
let bp = require('./burying-point');
$(window).load(function() {
// 统计:分期首页点击账户管理进入账户管理页面时
bp.setContYas({
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
op: 'YB_INST_REPAYMENT',
appop: 'YB_H5_INST_REPAYMENT_C'
}, {
POS_ID: $('.account-page').data('posId')
}, true);
... ...
... ... @@ -3,12 +3,12 @@
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/30
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
security = require('../plugin/security'),
loading = require('../plugin/loading');
var $addressForm = $('.edit-address'),
let $addressForm = $('.edit-address'),
$submit = $('.submit'),
$editAddressPage = $('.my-edit-address-page'),
$addressListPage = $('.my-address-list-page'),
... ... @@ -20,10 +20,10 @@ var $addressForm = $('.edit-address'),
isSubmiting,
currentPage = 'edit';
var Vue = require('vue');
var vueAddressAct = require('home/address/address-act.vue');
let Vue = require('vue');
let vueAddressAct = require('home/address/address-act.vue');
var addressVact = new Vue({
let addressVact = new Vue({
el: '#vAddressAct',
components: {
vueAddressAct: vueAddressAct
... ... @@ -37,7 +37,7 @@ $($editAddressPage, $addressListPage).css('min-height', function() {
});
// 清除返回按钮原有链接
$backBtn.attr('href', 'javascript:void(0);');
$backBtn.attr('href', 'javascript:void(0);'); // eslint-disable-line
// 自定义返回按钮事件
$backBtn.on('touchend', function(e) {
... ...
... ... @@ -3,33 +3,33 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/28
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var lazyLoad = require('yoho-jquery-lazyload'),
let lazyLoad = require('yoho-jquery-lazyload'),
load = require('../plugin/loading'),
tip = require('../plugin/tip');
var dialog = require('../plugin/dialog');
let dialog = require('../plugin/dialog');
var $page = $('.records');
let $page = $('.records');
var $loadMore = $('.load-more'),
let $loadMore = $('.load-more'),
$more = $loadMore.children('.more'),
$noMore = $loadMore.children('.no-more');
var page = 1;
let page = 1;
var end = false,
let end = false,
loading = false;
var winH = $(window).height();
let winH = $(window).height();
require('home/record.page.css');
require('../common');
load.init();
function moreRecord(cb) {
var count = $page.children('.browse-record-good').length;
let count = $page.children('.browse-record-good').length;
if (count === 0) {
return;
... ... @@ -70,7 +70,7 @@ function moreRecord(cb) {
page++;
if (cb) {
cb();
return cb();
}
}
},
... ... @@ -94,7 +94,7 @@ $(window).scroll(function() {
});
$page.on('touchstart', '.del-icon', function() {
var $good = $(this).closest('.browse-record-good'),
let $good = $(this).closest('.browse-record-good'),
skn = $good.data('skn');
dialog.showDialog({
... ... @@ -134,7 +134,7 @@ $('.deps').on('touchstart', 'span', function() {
});
$('.invalidGoods').on('touchstart touchend', function(e) {
var $this = $(e.target).closest('span');
let $this = $(e.target).closest('span');
if ($this.hasClass('del-icon')) {
return;
... ...
... ... @@ -6,7 +6,7 @@ function setContYas(operid, params, flag) {
}, params);
if (window._yas && window._yas.sendCustomInfo) {
var op,
let op,
appop;
if (typeof operid === 'object') {
... ... @@ -25,7 +25,7 @@ function setContYas(operid, params, flag) {
}
function countGoodsId() {
var idStr = '';
let idStr = '';
$('.installment-only .good-info').each(function(key, item) {
if (key !== 0) {
... ...
... ... @@ -4,13 +4,13 @@
* @date: 2016/10/25
*/
var $ = require('yoho-jquery');
var tip = require('../plugin/tip');
var dialog = require('../plugin/dialog');
var yohoApp = require('../yoho-app');
var cardDetail = {
let $ = require('yoho-jquery');
let tip = require('../plugin/tip');
let dialog = require('../plugin/dialog');
let yohoApp = require('../yoho-app');
let cardDetail = {
init: function() {
var self = this,
let self = this,
$relieveBtn = $('.relieve-btn'),
$changeBtn = $('.change-btn'),
asyncMode = yohoApp.isiOS;
... ... @@ -49,7 +49,8 @@ var cardDetail = {
if (asyncMode) {
yohoApp.invokeMethod('go.instalmentMyCardList');
} else {
window.location.href = location.href + '&openby:yohobuy={"action":"go.instalmentMyCardList"}';
window.location.href = location.href +
'&openby:yohobuy={"action":"go.instalmentMyCardList"}';
}
}, 1000);
}
... ... @@ -57,7 +58,7 @@ var cardDetail = {
});
},
dialogAction: function(params) {
var self = this;
let self = this;
dialog.showDialog({
dialogText: params.text,
... ...
require('home/coin/yoho-coin-detail.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
loading = require('../plugin/loading'),
currencyDetailHbs = require('home/ajax-currency-detail.hbs');
var page = 1,
let page = 1,
flag = true;
require('../common');
... ...
... ... @@ -4,15 +4,15 @@
* @date: 2016/8/16
*/
require('home/favorite.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
Swiper = require('yoho-swiper');
var diaLog = require('../plugin/dialog');
let diaLog = require('../plugin/dialog');
var tip = require('../plugin/tip');
let tip = require('../plugin/tip');
var $navLi = $('#fav-tab > li'),
let $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content > .fav-type'),
swiperObj = {},
favTabHammer,
... ... @@ -41,7 +41,7 @@ function showFavTab(index) {
// 初始化swiper
function initSwiper(data) {
var i,
let i,
idStrReg = /container-(\d+)['"]{1}/gi,
idReg = /\d+/,
idArr = data.match(idStrReg),
... ... @@ -84,7 +84,7 @@ function loadData($parent, url, page) {
page: page
},
success: function(data) {
var $loadingMask = $parent.closest('.fav-type').find('.fav-content-loading');
let $loadingMask = $parent.closest('.fav-type').find('.fav-content-loading');
if (url === 'favBrand') {
$brandLoadMore.addClass('hide');
... ... @@ -148,7 +148,7 @@ if ($('#fav-tab').hasClass('brand-tab')) {
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
let $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
... ... @@ -179,7 +179,7 @@ favTabHammer.on('tap', function(e) {
favContentHammer = new Hammer(document.getElementById('fav-content'));
favContentHammer.on('tap', function(e) {
var id = '';
let id = '';
if (!$(e.target).hasClass('del-fav')) {
return;
... ... @@ -262,7 +262,7 @@ function scrollHandler() {
$(window).scroll(scrollHandler);
$(document).on('touchend', '.swiper-header', function() {
var url = $(this).find('.fav-more').attr('href');
let url = $(this).find('.fav-more').attr('href');
if (url) {
window.location.href = url;
... ... @@ -270,7 +270,7 @@ $(document).on('touchend', '.swiper-header', function() {
});
$('.invalidGoods').on('touchstart touchend', function(e) {
var $this = $(e.target).closest('span');
let $this = $(e.target).closest('span');
if ($this.hasClass('del-fav')) {
return;
... ...
... ... @@ -3,7 +3,7 @@
*/
require('home/currency-index.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
require('../common');
... ...
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
require('../common');
// 生成二维码
setTimeout(function() {
var text = $('.myqrcode_qr').attr('qr-data'),
let text = $('.myqrcode_qr').attr('qr-data'),
width = $('.myqrcode_qr').css('width');
require('yoho-jquery-qrcode');
$('.myqrcode_qr').qrcode({
render: 'canvas', // 显示方式,canvas,image和div
text: text, // 二维码的内容
size: parseInt(width), // 大小
size: parseInt(width, 10), // 大小
ecLevel: 'H', // 纠错级别
});
}, 0);
... ...
var bp = require('./burying-point');
var $notice = $('.installment-overdue-notice');
let bp = require('./burying-point');
let $notice = $('.installment-overdue-notice');
$('.repay-list .notice').on('click', function() {
$notice.show();
// 统计:点击逾期说明时
bp.setContYas({
op: 'YB_INST_OVERDUE_INFO_CLICK',
appop: 'YB_H5_INST_OVERDUE_INFO_C'
op: 'YB_INST_OVERDUE_INFO_CLICK',
appop: 'YB_H5_INST_OVERDUE_INFO_C'
}, {}, true);
return false;
});
... ...
... ... @@ -5,14 +5,14 @@
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var $recommendForYou = $('.recommend-for-you');
let $recommendForYou = $('.recommend-for-you');
setTimeout(function() {
$.get('/product/recommend-for-you/userCenter').then(function(html) {
var PRDID = [];
let PRDID = [];
$recommendForYou.html(html);
... ... @@ -24,7 +24,7 @@ setTimeout(function() {
PRDID.push($(this).data('id'));
});
var $recommendSonLen = $recommendForYou.find('.good-info').length;
let $recommendSonLen = $recommendForYou.find('.good-info').length;
if ($recommendSonLen === 0) {
$recommendForYou.hide();
... ... @@ -41,7 +41,7 @@ setTimeout(function() {
});
$recommendForYou.find('.good-info').on('click', 'a', function() {
var index = $(this).closest('.good-info').index() + 1;
let index = $(this).closest('.good-info').index() + 1;
window.givePoint({
REC_POSE: 110004,
... ...
var domainList = {
let domainList = {
'01': [
'img10.static.yhbimg.com',
'img11.static.yhbimg.com'
... ... @@ -10,18 +10,18 @@ var domainList = {
'yhb-head': 'head.static.yhbimg.com'
};
var table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D';
let table = '00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D'; // eslint-disable-line
/* Number */
var crc32 = function(str, crc) {
if (crc == window.undefined) {
let crc32 = function(str, crc) {
if (crc === window.undefined) {
crc = 0;
}
var n = 0; // a number between 0 and 255
var x = 0; // an hex number
let n = 0; // a number between 0 and 255
let x = 0; // an hex number
crc = crc ^ (-1);
for (var i = 0, iTop = str.length; i < iTop; i++) {
for (let i = 0, iTop = str.length; i < iTop; i++) {
n = (crc ^ str.charCodeAt(i)) & 0xFF;
x = '0x' + table.substr(n * 9, 8);
crc = (crc >>> 8) ^ x;
... ... @@ -30,9 +30,9 @@ var crc32 = function(str, crc) {
};
function getDomain(bucket, filename) {
var domain = '';
var node = '';
var domainL, nodeNum;
let domain = '';
let node = '';
let domainL, nodeNum;
if (domainList[bucket]) {
domain = domainList[bucket];
... ... @@ -49,7 +49,7 @@ function getDomain(bucket, filename) {
}
function getSourceUrl(fileName, bucket) {
var domain = '';
let domain = '';
bucket = bucket || 'yhfair';
... ... @@ -61,13 +61,13 @@ function getSourceUrl(fileName, bucket) {
}
function saveImage(data) {
var imgExtra = '?imageMogr2/thumbnail/130x130/extent/130x130/background/d2hpdGU=/position/center/quality/90';
var imgList = [];
let imgExtra = '?imageMogr2/thumbnail/130x130/extent/130x130/background/d2hpdGU=/position/center/quality/90';
let imgList = [];
data = JSON.parse(data).data;
if (data && data.imagesList) {
for (var i = 0; i < data.imagesList.length; i++) {
for (let i = 0; i < data.imagesList.length; i++) {
imgList.push({
imgUrl: getSourceUrl(data.imagesList[i], 'suggest') + imgExtra,
imgRelUrl: data.imagesList[i]
... ...
... ... @@ -2,22 +2,20 @@
* 个人中心--意见反馈
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
lazyLoad = require('yoho-jquery-lazyload');
var diaLog = require('../plugin/dialog');
var saveImage = require('./save-image');
var $uploadImgList = $('.upload-img-list'),
let diaLog = require('../plugin/dialog');
let saveImage = require('./save-image');
let imgTemplate = require('home/suggest.hbs');
let $uploadImgList = $('.upload-img-list'),
headerNavHammer,
formHammer,
imgTemplate = require('home/suggest.hbs'),
$likeBtn = $('.suggest-item .like-btn'),
$disLikeBtn = $('.suggest-item .dislike-btn'),
$imgAdd = $('.img-add'),
imgStr = '',
uploadImgNum = 0;
imgStr = '';
require('./jquery.upload');
require('../common');
... ... @@ -34,7 +32,7 @@ $('#upload-img').upload({
formData: {
bucket: 'suggest'
},
onAddQueueItem: function(files) {
onAddQueueItem: function() {
// TODO
$uploadImgList.html(imgTemplate({
... ... @@ -48,7 +46,6 @@ $('#upload-img').upload({
imgStr = data.imgList[0].imgRelUrl;
$uploadImgList.html(imgTemplate(data));
$imgAdd.hide();
uploadImgNum++;
}
});
... ... @@ -57,7 +54,7 @@ lazyLoad();
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function(e) {
var suggestText = $('#suggest-textarea').val(),
let suggestText = $('#suggest-textarea').val(),
textReg = /\S+/;
... ... @@ -111,7 +108,6 @@ if (document.getElementById('img-form') !== null) {
if ($(e.target).hasClass('upload-img-remove')) {
$uploadImgList.html('');
imgStr = '';
uploadImgNum--;
setTimeout(function() {
$imgAdd.show();
}, 50);
... ... @@ -123,7 +119,7 @@ if (document.getElementById('img-form') !== null) {
// 点赞与取消点赞
$likeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
let id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
... ... @@ -138,7 +134,7 @@ $likeBtn.bind('click', function() {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-good').addClass('show');
}
}).fail(function(data) {
}).fail(function() {
// TODO
... ... @@ -151,7 +147,7 @@ $likeBtn.bind('click', function() {
$disLikeBtn.bind('click', function() {
var id = $(this).closest('.suggest-item').attr('data-id'),
let id = $(this).closest('.suggest-item').attr('data-id'),
$that = $(this);
$.ajax({
... ... @@ -166,7 +162,7 @@ $disLikeBtn.bind('click', function() {
$that.closest('.suggest-type').removeClass('show');
$that.closest('.suggest-item').find('.suggest-bad').addClass('show');
}
}).fail(function(data) {
}).fail(function() {
// TODO
... ...
... ... @@ -3,9 +3,9 @@
* @author: zxr
* @date: 2016/10/27
*/
var $ = require('yoho-jquery');
var appVersion = $('input[name="app_version"]').val();
var yoho;
let $ = require('yoho-jquery');
let appVersion = $('input[name="app_version"]').val();
let yoho;
require('../common');
yoho = require('../yoho-app');
... ... @@ -23,7 +23,7 @@ $('.pitch').on('click', function() {
$('.submit-btn').on('click', function() {
if ($('.pitch').hasClass('select')) {
if (appVersion === '1') {
var params = {
let params = {
action: 'go.serviceClause',
params: {selected: 'Y'}
};
... ... @@ -35,7 +35,7 @@ $('.submit-btn').on('click', function() {
}
} else {
if (appVersion === '1') {
var params = {
let params = {
action: 'go.serviceClause',
params: {selected: 'N'}
};
... ...
... ... @@ -3,9 +3,9 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var $phoneNum = $('#phone-num'),
let $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$areaCode = $('#area-code'),
$openId = $('#openId'),
... ... @@ -13,20 +13,20 @@ var $phoneNum = $('#phone-num'),
$sourceType = $('#sourceType'),
$btnNext = $('#btn-next');
var api = require('../api'),
let api = require('../api'),
tip = require('plugin/tip'),
dialog = require('plugin/dialog');
var trim = $.trim;
var showErrTip = tip.show;
let trim = $.trim;
let showErrTip = tip.show;
var requested = false;
let requested = false;
require('common');
var ImgCheck = require('plugin/img-check');
let ImgCheck = require('plugin/img-check');
var imgCheck = new ImgCheck('#js-img-check', {
let imgCheck = new ImgCheck('#js-img-check', {
useREM: {
rootFontSize: 40,
picWidth: 150
... ... @@ -91,7 +91,7 @@ $countrySelect.change(function() {
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
let pn = trim($phoneNum.val()),
openId = trim($openId.val()),
nickname = trim($nickname.val()),
sourceType = trim($sourceType.val()),
... ...
... ... @@ -3,12 +3,12 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
require('js/common');
module.exports = function(useInRegister, useForBind, useForRelate) {
var $captcha = $('#captcha'),
let $captcha = $('#captcha'),
$btnNext = $('#btn-next'),
$captchaTip = $('#captcha-tip'),
nickname = $('#nickname').val(),
... ... @@ -17,15 +17,15 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
var api = require('./api');
var tip = require('../plugin/tip');
let api = require('./api');
let tip = require('../plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
let trim = $.trim;
let showErrTip = tip.show;
var urlMid = useInRegister ? 'reg' : 'back';
let urlMid = useInRegister ? 'reg' : 'back';
var isReg = parseInt($('#isReg').val(), 10);
let isReg = parseInt($('#isReg').val(), 10);
function startBind() {
$.ajax({
... ... @@ -82,7 +82,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
}
function countDown(during) {
var count = during || 59,
let count = during || 59,
itime;
itime = setInterval(function() {
... ... @@ -93,7 +93,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
$captchaTip.text('重新发送 (' + count-- + '秒)');
window.setCookie('count', count);
if (during && parseInt(during) !== 0) {
if (during && parseInt(during, 10) !== 0) {
$captchaTip.addClass('disable');
}
}
... ... @@ -156,7 +156,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
}
});
if (window.cookie('count') && parseInt(window.cookie('count')) > 0) {
if (window.cookie('count') && parseInt(window.cookie('count'), 10) > 0) {
countDown(window.cookie('count'));
} else {
countDown();
... ...
... ... @@ -3,10 +3,10 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho-jquery');
var Validate = require('plugin/validata');
let $ = require('yoho-jquery');
let Validate = require('plugin/validata');
var $phoneNum = $('#phone-num'),
let $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$areaCode = $('#area-code'),
$pwd = $('#pwd'),
... ... @@ -17,13 +17,13 @@ var $phoneNum = $('#phone-num'),
pnPass = false,
pwdPass = false;
var api = require('../api');
var tip = require('plugin/tip');
let api = require('../api');
let tip = require('plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
let trim = $.trim;
let showErrTip = tip.show;
var validate = new Validate($captcha, {
let validate = new Validate($captcha, {
useREM: {
rootFontSize: 40,
picWidth: 150
... ... @@ -37,7 +37,7 @@ if ($captcha.data('init') != null) { //eslint-disable-line
// 登录按钮状态切换
function switchLoginBtnStatus() {
var bool = !(pnPass && pwdPass);
let bool = !(pnPass && pwdPass);
$loginBtn.toggleClass('disable', bool);
}
... ... @@ -67,7 +67,7 @@ $phoneNum.bind('input', function() {
});
$pwd.bind('input', function() {
var pwd = trim($pwd.val());
let pwd = trim($pwd.val());
if (pwd === '') {
pwdPass = false;
... ... @@ -83,7 +83,7 @@ $countrySelect.change(function() {
});
$loginBtn.on('touchstart', function() {
var pn = trim($phoneNum.val()),
let pn = trim($phoneNum.val()),
areaCode = $countrySelect.val(),
pwd = trim($pwd.val());
... ... @@ -117,12 +117,12 @@ $loginBtn.on('touchstart', function() {
type: 'POST',
url: '/passport/login/auth',
data,
success: function(data) {
var res;
success: function(result) {
let res;
validate.type === 2 && validate.refresh();
if (data.code === 200) {
res = data.data;
res = result.data;
showErrTip('登录成功');
// 3秒后强制跳转
... ... @@ -133,11 +133,12 @@ $loginBtn.on('touchstart', function() {
$loginBtn.text('登录成功');
showErrTip('登录成功');
} else {
if (data.captchaShow) {
validate.atWorking ? ((data.changeCaptcha || validate.type !== 2) && validate.refresh()) : validate.init();
if (result.captchaShow) {
validate.atWorking ? ((result.changeCaptcha || validate.type !== 2) &&
validate.refresh()) : validate.init();
}
showErrTip(data.message);
showErrTip(result.message);
resetForm();
}
},
... ...
... ... @@ -3,10 +3,10 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/9/30
*/
var $ = require('yoho-jquery');
var Validate = require('plugin/validata');
let $ = require('yoho-jquery');
let Validate = require('plugin/validata');
var $account = $('#account'),
let $account = $('#account'),
$pwd = $('#pwd'),
$loginBtn = $('#btn-login'),
... ... @@ -18,14 +18,14 @@ var $account = $('#account'),
accPass = false,
pwdPass = false;
var api = require('../api');
var tip = require('plugin/tip');
let api = require('../api');
let tip = require('plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
let trim = $.trim;
let showErrTip = tip.show;
var validate = new Validate($captcha, {
let validate = new Validate($captcha, {
useREM: {
rootFontSize: 40,
picWidth: 150
... ... @@ -38,7 +38,7 @@ if ($captcha.data('init') != null) { //eslint-disable-line
// 登录按钮状态切换
function switchLoginBtnStatus() {
var bool = true;
let bool = true;
bool = !(accPass && pwdPass);
... ... @@ -123,7 +123,7 @@ $loginBtn.on('touchstart', function() {
url: '/passport/login/auth',
data,
success: function(data) { //eslint-disable-line
var res,
let res,
LOGI_TYPE;
if (acc.indexOf('@') > 0) {
... ... @@ -150,7 +150,8 @@ $loginBtn.on('touchstart', function() {
$loginBtn.text('登录成功');
} else {
if (data.captchaShow) {
validate.atWorking ? ((data.changeCaptcha || validate.type !== 2) && validate.refresh()) : validate.init();
validate.atWorking ? ((data.changeCaptcha || validate.type !== 2) &&
validate.refresh()) : validate.init();
}
showErrTip(data.message);
... ... @@ -203,7 +204,7 @@ function getTypeName(name) {
}
$('.tp-link a').on('touchstart', function() {
var logType = getTypeName($(this).prop('className'));
let logType = getTypeName($(this).prop('className'));
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
... ...
... ... @@ -3,22 +3,20 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var $phoneNum = $('#phone-num'),
let $phoneNum = $('#phone-num'),
$countrySelect = $('#country-select'),
$areaCode = $('#area-code'),
$captcha = $('#js-captcha'),
$captchaPNG = $('.passport-captcha-png'),
$btnNext = $('#btn-next');
var api = require('../api');
var tip = require('plugin/tip');
let api = require('../api');
let tip = require('plugin/tip');
var trim = $.trim;
var showErrTip = tip.show;
let trim = $.trim;
let showErrTip = tip.show;
var requested = false;
let requested = false;
api.selectCssHack($('#country-select'));
... ... @@ -41,10 +39,10 @@ imgCheck.init();
* 必填校验
*/
function checkEnableNext() {
var phone = trim($phoneNum.val());
var area = trim($countrySelect.val());
let phone = trim($phoneNum.val());
let area = trim($countrySelect.val());
var ret = true;
let ret = true;
$.each([phone, area], function(i, val) {
if (!val) {
... ... @@ -69,7 +67,7 @@ $countrySelect.change(function() {
});
$btnNext.on('touchstart', function() {
var pn = trim($phoneNum.val()),
let pn = trim($phoneNum.val()),
areaCode = $countrySelect.val(),
captcha = imgCheck.getResults();
... ...
'use strict';
var tip, api, checkPoint;
let tip, api, checkPoint;
var $countrySelect,
let $countrySelect,
$areaCode,
$nextBtn,
$resetBtn,
$captcha,
$captchaPNG,
$phoneNum,
$mask = $('#retrive-pwd-mask'),
$ways = $('#retrive-pwd-ways');
var page;
let page;
require('js/common');
tip = require('plugin/tip');
... ... @@ -49,7 +47,7 @@ page = {
$resetBtn = $('.clear-input');
},
bindEvent: function() {
var self = this;
let self = this;
$countrySelect.on('change', function() {
$areaCode.text(this.value);
... ... @@ -93,7 +91,7 @@ page = {
// 切换$nextBtn disable状态
toggleNextBtn: function() {
var bool = Boolean($.trim($phoneNum.val()));
let bool = Boolean($.trim($phoneNum.val()));
$nextBtn
.toggleClass('disable', !bool)
... ... @@ -104,9 +102,9 @@ page = {
// 提交按钮
goNext: function() {
var areaCode = $countrySelect.val();
var phone = $.trim($phoneNum.val());
var captcha = $.trim(imgCheck.getResults());
let areaCode = $countrySelect.val();
let phone = $.trim($phoneNum.val());
let captcha = $.trim(imgCheck.getResults());
if ($nextBtn.prop('disabled')) {
return;
... ...
... ... @@ -4,14 +4,13 @@
* @author: chenglong.wang
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
var dialogHbs = require('plugin/dialog.hbs');
let dialogHbs = require('plugin/dialog.hbs');
// fullWithBtn是供详情页获取限购码使用的特殊参数
exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
var dialogStr,
$dialogBox,
let $dialogBox,
defaultHideDuraton,
$dialogWrapper;
... ...
... ... @@ -5,14 +5,12 @@
* @date: 2015/10/19
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer');
var $filter;
let $filter;
var fCbFn, hCbFn; // 筛选和关闭的回调
var missStatus; // 是否忽略选中状态
let fCbFn, hCbFn; // 筛选和关闭的回调
// 隐藏筛选界面
function hideFilter() {
... ... @@ -28,10 +26,10 @@ function showFilter() {
// 一级菜单点击时背景高亮
function highlightMainItem() {
var $mainItem = $('.filter-body .classify');
let $mainItem = $('.filter-body .classify');
$mainItem.on('touchstart', '.shower', function() {
var bpIdData = $(this).attr('data-bp-id') || '';
let bpIdData = $(this).attr('data-bp-id') || '';
$mainItem.removeClass('highlight');
$(this).addClass('highlight');
... ... @@ -44,7 +42,7 @@ function highlightMainItem() {
// 子菜单点击时背景高亮
function highlightSubItem() {
var $subItem = $('.filter-body .sub-item');
let $subItem = $('.filter-body .sub-item');
$subItem.on('touchstart', function() {
$subItem.removeClass('highlight');
... ... @@ -68,11 +66,11 @@ function classifyTapEvt($this) {
// 子筛选项选中处理
function setSubClassify($this) {
var $sub = $this.closest('.sub-classify');
let $sub = $this.closest('.sub-classify');
var $shower = $sub.siblings('.shower');
let $shower = $sub.siblings('.shower');
var html, shower;
let html, shower;
if ($this.hasClass('chosed')) {
return $sub;
... ... @@ -105,9 +103,9 @@ function setSubClassify($this) {
// 子筛选项Tap句柄
function subClassifyTapEvt($this) {
var id = $this.data('id');
let id = $this.data('id');
var $sub;
let $sub;
$sub = setSubClassify($this);
... ... @@ -129,14 +127,12 @@ function subClassifyTapEvt($this) {
// 初始化筛选
function initFilter(opt) {
var filterHammer;
let filterHammer;
// 注册回调
fCbFn = opt.fCbFn;
hCbFn = opt.hCbFn;
missStatus = opt.missStatus;
highlightMainItem();
highlightSubItem();
... ... @@ -144,7 +140,7 @@ function initFilter(opt) {
filterHammer = new Hammer($filter[0]);
filterHammer.on('tap', function(e) {
var $this = $(e.target),
let $this = $(e.target),
$cur;
// 这行不能注释,iphone下会出现穿透
... ... @@ -176,8 +172,8 @@ function initFilter(opt) {
});
if (opt.isScroll) {
$('ul.sub-classify').each(function() {
var lastY = 0, y = 0;
var $slider = $(this);
let lastY = 0, y = 0;
let $slider = $(this);
$(this).wrap('<div class=\'sub-classify-farther\' data-type=\'' + $(this).data('type') + '\'></div>');
... ... @@ -187,11 +183,11 @@ function initFilter(opt) {
lastY = e.originalEvent.touches[0].pageY;
});
$slider.on('touchmove', function(e) {
var curY = e.originalEvent.touches[0].pageY;
var deltaY = curY - lastY;
var height = $(this)[0].scrollHeight;
var limit = height - $(this).parent().height();
var translate;
let curY = e.originalEvent.touches[0].pageY;
let deltaY = curY - lastY;
let height = $(this)[0].scrollHeight;
let limit = height - $(this).parent().height();
let translate;
y = y + deltaY;
... ...
... ... @@ -2,8 +2,8 @@
* Plugin: 图片旋转验证;
* @example
* pc:
* var ImgCheck = require('path/to/img-check')
* var imgCheck = new ImgCheck('#js-img-check', {
* let ImgCheck = require('path/to/img-check')
* let imgCheck = new ImgCheck('#js-img-check', {
* template: require('path/to/hbs'),
* refreshURI: 'path/to/refresh/src'
* })
... ... @@ -14,7 +14,7 @@
*- ----------------------------------------
* @example
* wap:
* var imgCheck = new ImgCheck('#js-img-check', {
* let imgCheck = new ImgCheck('#js-img-check', {
* useREM: {
* rootFontSize: 40,
* picWidth: 150
... ... @@ -78,7 +78,7 @@ ImgCheck.prototype = {
return;
}
var self = this;
let self = this;
if (this.useREM) {
this.picWidth = this.useREM.picWidth / this.useREM.rootFontSize;
... ... @@ -106,7 +106,7 @@ ImgCheck.prototype = {
* }
*/
render: function(data) {
var self = this;
let self = this;
this.$container.html(this.template(data));
this.$imgPics = this.$container.find('.img-check-pic');
... ... @@ -116,8 +116,8 @@ ImgCheck.prototype = {
}
this.$imgPics.each(function(index, elem) {
var $elem = $(elem);
var position = self.calcPosition($elem);
let $elem = $(elem);
let position = self.calcPosition($elem);
$elem.css('backgroundPosition', position);
});
... ... @@ -129,10 +129,10 @@ ImgCheck.prototype = {
* @param num count img-check-pic
*/
calcPosition: function($elem) {
var positionX, positionY;
var index = $elem.index();
var count = parseInt($elem.attr('data-val'), 10);
var unit = this.useREM ? 'rem' : 'px';
let positionX, positionY;
let index = $elem.index();
let count = parseInt($elem.attr('data-val'), 10);
let unit = this.useREM ? 'rem' : 'px';
count = count % 4;
... ... @@ -157,8 +157,8 @@ ImgCheck.prototype = {
* Handler method: 旋转图片
*/
rotateImg: function(event) {
var $pic = $(event.target);
var prevRotateCount = parseInt($pic.attr('data-val'), 10);
let $pic = $(event.target);
let prevRotateCount = parseInt($pic.attr('data-val'), 10);
$pic.attr('data-val', prevRotateCount + 1);
... ... @@ -172,12 +172,12 @@ ImgCheck.prototype = {
* @return string '0123'
*/
getResults: function() {
var result = [];
let result = [];
this.$container.find('.img-check-pic')
.each(function() {
var $elem = $(this);
var val = $elem.attr('data-val');
let $elem = $(this);
let val = $elem.attr('data-val');
val = parseInt(val, 10);
... ...
... ... @@ -5,7 +5,7 @@
* @date: 2016/02/22
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
function preventDefault(e) {
e = e || window.event;
... ... @@ -20,7 +20,7 @@ function stopPropagation(e) {
}
function innerScroll(e) {
var delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
let delta = e.wheelDelta || e.originalEvent.wheelDelta || e.detail || 0,
box = $(this).get(0);
// 阻止冒泡到document
... ... @@ -53,7 +53,7 @@ function enableScroll($choseArea) {
}
function disableScroll($choseArea) {
enableScroll($choseArea);
var startX, startY;
let startX, startY;
// 内部可滚
$choseArea.on('mousewheel', innerScroll);
... ... @@ -66,10 +66,10 @@ function disableScroll($choseArea) {
// 仿innerScroll方法
$choseArea.on('touchmove', function(e) {
var deltaX = e.originalEvent.changedTouches[0].pageX - startX,
let deltaX = e.originalEvent.changedTouches[0].pageX - startX,
deltaY = e.originalEvent.changedTouches[0].pageY - startY;
var box = $(this).get(0);
let box = $(this).get(0);
e.stopPropagation();
... ...
... ... @@ -5,16 +5,16 @@
'use strict';
/* config */
var NAME = 'yModal';
var DATA_KEY = 'yoho.modal';
var Selector = {
let NAME = 'yModal';
let DATA_KEY = 'yoho.modal';
let Selector = {
DATA_TOGGLE: '[data-toggle="ymodal"]',
DATA_DISMISS: '[data-dismiss="ymodal"]'
};
var ClassName = {
let ClassName = {
BACKDROP: 'ymodal-backdrop'
};
var Modal = function(elem, config) {
let Modal = function(elem, config) {
this.$element = $(elem);
this.$body = $(document.body);
this._backdrop = null;
... ... @@ -69,8 +69,8 @@ Modal.prototype.toggle = function(relatedTarget) {
return this;
};
Modal.prototype.backdrop = function(callback) {
var self = this;
Modal.prototype.backdrop = function() {
let self = this;
if (this._isShown && this._config.backdrop) {
this._backdrop = document.createElement('div');
... ... @@ -96,9 +96,9 @@ Modal.prototype.backdrop = function(callback) {
/* ------------------------static method ------------------*/
Modal._jqueryBridge = function(config, relatedTarget) {
return this.each(function() {
var $this = $(this);
var data = $this.data(DATA_KEY);
var configs = $this.data(DATA_KEY) ? 'toggle' : $.extend(
let $this = $(this);
let data = $this.data(DATA_KEY);
let configs = $this.data(DATA_KEY) ? 'toggle' : $.extend(
{},
Modal.DEFAULT,
$this.data(),
... ... @@ -120,10 +120,10 @@ Modal._jqueryBridge = function(config, relatedTarget) {
/* ----------------------- DATA-API ----------------------*/
$(document).on('click.yoho.modal.data-api', Selector.DATA_TOGGLE, function(event) {
var $this = $(this);
var selector = this.getAttribute('data-target');
var $target = $(selector);
var config = $target.data(DATA_KEY) ? 'toggle' : $.extend($target.data(), $this.data());
let $this = $(this);
let selector = this.getAttribute('data-target');
let $target = $(selector);
let config = $target.data(DATA_KEY) ? 'toggle' : $.extend($target.data(), $this.data());
if ($target[0].tagName.toUpperCase() === 'A') {
event.preventDefault();
... ...
... ... @@ -19,14 +19,14 @@
*/
var Tab = function(elem) {
let Tab = function(elem) {
this.$elem = $(elem);
};
Tab.prototype.show = function() {
var $nav = this.$elem;
var targetSelector = (function(elem) {
var selector = elem.dataset.target;
let $nav = this.$elem;
let targetSelector = (function(elem) {
let selector = elem.dataset.target;
if (!selector) {
selector = elem.getAttribute('href') || '';
... ... @@ -36,7 +36,7 @@ Tab.prototype.show = function() {
return selector;
}($nav[0]));
var $target = $(targetSelector);
let $target = $(targetSelector);
if ($nav.hasClass('active')) {
return;
... ... @@ -56,9 +56,9 @@ Tab.prototype.show = function() {
function Plugin(option) {
this.each(function() {
var $this = $(this);
var data = $this.data('yoho.tab');
var options = typeof option === 'object' && option;
let $this = $(this);
let data = $this.data('yoho.tab');
let options = typeof option === 'object' && option;
if (!data) {
$this.data('yoho.tab', (data = new Tab(this, options)));
... ... @@ -78,7 +78,7 @@ $(document).on('click', '[data-trigger=tab]', function(event) {
event.preventDefault();
event.stopPropagation();
var $nav = $(event.target);
let $nav = $(event.target);
Plugin.call($nav, 'show');
});
... ...
... ... @@ -7,19 +7,19 @@
module.exports = function() {
var $ = require('yoho-jquery');
var _weChatInterface = '//m.yohobuy.com/activity/wechat/share';
let $ = require('yoho-jquery');
let _weChatInterface = '//m.yohobuy.com/activity/wechat/share';
$.getJSON(_weChatInterface + '?url=' +
encodeURIComponent(location.href.split('#')[0]) + '&callback=?', function(json) {
var _appId, _timestamp, _nonceStr, _signature;
let _appId, _timestamp, _nonceStr, _signature;
if (!wx) {
return;
}
if (json !== undefined && json !== '') {
if (typeof json !== 'undefined' && json !== '') {
_appId = json.appId.toString();
_timestamp = json.timestamp;
_nonceStr = json.nonceStr.toString();
... ... @@ -72,11 +72,11 @@ module.exports = function() {
});
wx.ready(function() {
var shareTitle = $('#shareTitle').val();
var shareImg = $('#shareImg').val();
var shareDesc = $('#shareDesc').val();
var shareLink = $('#shareLink').val();
var shareData = {
let shareTitle = $('#shareTitle').val();
let shareImg = $('#shareImg').val();
let shareDesc = $('#shareDesc').val();
let shareLink = $('#shareLink').val();
let shareData = {
title: shareTitle,
desc: shareDesc,
imgUrl: shareImg,
... ...
... ... @@ -158,6 +158,7 @@ $buyNowBtn.on('touchstart', function() {
activity_id: bundleId
}), actCkOpthn);
window.location.href = '/cart/index/new/orderEnsure?cartType=bundle&activityType=bundle&productId=' + window.queryString.productId;
window.location.href = '/cart/index/new/orderEnsure?cartType=bundle&activityType=bundle&productId=' +
window.queryString.productId;
}
});
... ...
... ... @@ -4,32 +4,32 @@
* @date: 2015/10/20
*/
require('product/detail/detail.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
Hammer = require('yoho-hammer'),
lazyLoad = require('yoho-jquery-lazyload');
require('./detail/page-render')(function() {
var $discountFolder = $('.goods-discount .discount-folder'),
let $discountFolder = $('.goods-discount .discount-folder'),
$discountArrow = $('.goods-discount .first-item span');
var goodsDiscountEl = document.getElementById('goodsDiscount'),
let goodsDiscountEl = document.getElementById('goodsDiscount'),
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl),
$discountFirstItem = $(goodsDiscountEl).find('.first-item');
var $cart = $('.cart-bar');
let $cart = $('.cart-bar');
var appUrl = $('input[name="limitCodeUrl"]').val();
let appUrl = $('input[name="limitCodeUrl"]').val();
var dialog = require('../plugin/dialog');
let dialog = require('../plugin/dialog');
require('../common');
// add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
let $cartBar = $('.cart-bar');
var timer = setInterval(function() {
let timer = setInterval(function() {
if ($cartBar) {
window.reMarginFooter('.cart-bar');
clearInterval(timer);
... ... @@ -48,7 +48,7 @@ require('./detail/page-render')(function() {
}
// 顶部swiper
var swiper = new Swiper('.banner-swiper', {
let swiper = new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
paginationClickable: true,
... ... @@ -59,7 +59,7 @@ require('./detail/page-render')(function() {
});
if ($('.banner-swiper').length) {
var bannerSwiperHammer = new Hammer($('.banner-swiper')[0]);
let bannerSwiperHammer = new Hammer($('.banner-swiper')[0]);
bannerSwiperHammer.on('tap', function() {
$('.banner-top').toggleClass('hover');
... ... @@ -90,7 +90,7 @@ require('./detail/page-render')(function() {
}
$('#limit-sale').on('touchend', function(e) {
var loginUrl = $('#loginUrl').val(),
let loginUrl = $('#loginUrl').val(),
time,
ifr;
... ... @@ -143,7 +143,7 @@ require('./detail/page-render')(function() {
type: 'GET',
url: '/cart/index/count',
success: function(data) {
var count;
let count;
if (data.code === 200) {
count = data.data.cart_goods_count || 0;
... ... @@ -168,8 +168,10 @@ require('./detail/page-render')(function() {
$(document).scroll(function() {
if ($(document).scrollTop() >= $(document).height() - $(window).height() - 20) {
if (!$('.float-top').hasClass('animation')) {
var top = $('.back-to-top').offset().top - $('.float-top').offset().top + ($('.back-to-top').height() - $('.float-top').height()) / 2;
var left = $('.back-to-top').offset().left - $('.float-top').offset().left;
let top = $('.back-to-top').offset().top -
$('.float-top').offset().top +
($('.back-to-top').height() - $('.float-top').height()) / 2;
let left = $('.back-to-top').offset().left - $('.float-top').offset().left;
$('.float-top').addClass('animation').css({
transform: 'translate(' + left + 'px, ' + top + 'px) scale(0, 0)',
... ...
... ... @@ -3,11 +3,11 @@
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/12/01
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('plugin/tip'),
loading = require('plugin/loading');
var $consultForm = $('.consult-form'),
let $consultForm = $('.consult-form'),
$submit = $('#submit'),
$content = $('#content'),
productId = $('#product_id').val(),
... ... @@ -32,16 +32,16 @@ $content.on('focus', function() {
$content.val('请输入咨询内容');
}
});
var getUrlParam = function(paramName) {
var reg = '[\\?|\\&]+' + paramName + '=([^&]*)[^&]?';
var exp = (window.location.href + '').match(reg);
let getUrlParam = function(paramName) {
let reg = '[\\?|\\&]+' + paramName + '=([^&]*)[^&]?';
let exp = (window.location.href + '').match(reg);
return exp ? exp[1] : '';
};
// 提交表单请求
$consultForm.on('submit', function() {
var content;
let content;
if (isSubmiting) {
return false;
... ... @@ -74,7 +74,7 @@ $consultForm.on('submit', function() {
} else {
tip.show('提交成功~');
setTimeout(function() {
var from = getUrlParam('from');
let from = getUrlParam('from');
if (from) {
window.location = decodeURIComponent(from);
... ...
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
chosePanel = require('common/chose-panel'),
tip = require('plugin/tip'),
dbClass = 'data-bind';
tip = require('plugin/tip');
let dbClass = 'data-bind';
module.exports = function(callback) {
var productId = $('#productId').val();
var goodsId = $('#goodsId').val();
var productSkn = $('#productSkn').val();
let productId = $('#productId').val();
let goodsId = $('#goodsId').val();
let productSkn = $('#productSkn').val();
if (productId && (goodsId || productSkn)) {
$.ajax({
... ... @@ -21,13 +21,13 @@ module.exports = function(callback) {
success: function(data) {
// 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
var reg = /\/product\/show_([\d]+)/;
var regPro = /\/product\/pro_([\d]+)_([\d]+)/;
var regSeckill = /\/product\/seckill/;
let reg = /\/product\/show_([\d]+)/;
let regPro = /\/product\/pro_([\d]+)_([\d]+)/;
let regSeckill = /\/product\/seckill/;
// var regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
var thisHref = window.location.href;
var thisRefer = document.referrer;
// let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
let thisHref = window.location.href;
let thisRefer = document.referrer;
// 如果秒杀商品没有吊牌价,显示原销售价
if (data.isSecKill === 'Y' && !data.cartInfo.price) {
... ... @@ -40,12 +40,12 @@ module.exports = function(callback) {
}
}
render(data);
render(data); // eslint-disable-line
callback(data);
}
});
} else {
callback();
callback(); // eslint-disable-line
}
};
function render(data) {
... ... @@ -69,11 +69,11 @@ function render(data) {
$('.price-date').removeClass(dbClass);
$('.student-value').text(data.studentPrice);
} else if (data.vipLevel) {
var li = $('.vip-level>li').first().remove();
let li = $('.vip-level>li').first().remove();
for (var i = 0; i < data.vipLevel.list.length; i++) {
var item = data.vipLevel.list[i];
var itemLi = li.clone();
for (let i = 0; i < data.vipLevel.list.length; i++) {
let item = data.vipLevel.list[i];
let itemLi = li.clone();
if (item.currentLevel) {
itemLi.addClass('current-level');
... ... @@ -85,16 +85,18 @@ function render(data) {
}
if (data.goodsDiscount && data.goodsDiscount.list && data.goodsDiscount.list.length) {
var shortText = $('#goodsDiscount>.short-text').remove();
var liText = $('#goodsDiscount>.discount-folder>.folder-item').remove();
let shortText = $('#goodsDiscount>.short-text').remove();
let liText = $('#goodsDiscount>.discount-folder>.folder-item').remove();
for (var i = 0; i < data.goodsDiscount.list.length; i++) {
var discount = data.goodsDiscount.list[i];
var itemText = i === 0 ? shortText.clone() : liText.clone();
for (let i = 0; i < data.goodsDiscount.list.length; i++) {
let discount = data.goodsDiscount.list[i];
let itemText = i === 0 ? shortText.clone() : liText.clone();
if (discount.text) {
if (i === 0) {
itemText.text(discount.text).append('<span class="icon-down iconfont dropdown">&#xe609;</span>').prependTo('#goodsDiscount');
itemText.text(discount.text)
.append('<span class="icon-down iconfont dropdown">&#xe609;</span>')
.prependTo('#goodsDiscount');
} else {
itemText.text(discount.text).appendTo('#goodsDiscount>.discount-folder');
}
... ...
... ... @@ -6,11 +6,11 @@
require('product/sale/discount-detail-index.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('../plugin/tip'),
lazyLoad = require('yoho-jquery-lazyload');
var countDown = require('../plugin/countdown'),
let countDown = require('../plugin/countdown'),
search = require('./sale/search');
search.start();
... ...
... ... @@ -6,7 +6,7 @@
require('product/sale/discount-index.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
// 底部注册按钮和top事件
... ...
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
lazyLoad = require('yoho-jquery-lazyload'),
loading = require('../plugin/loading');
var page = 1,
let page = 1,
winH,
listTop,
navSwiper,
notab = 0,
sort = '',
id = '',
... ... @@ -16,7 +15,7 @@ var page = 1,
require('../common/suspend-cart');
require('../common');
var share = require('../common/share');
let share = require('../common/share');
share({
title: '有货【会员日】开启啦!9月28日潮集狂欢趴等你来HI!限时6大福利,快参与起来喽~',
... ... @@ -26,23 +25,23 @@ share({
});
function hotrank(page, sort, tabId, notab) {
function hotrank(pageIndex, sortIndex, tabId, noTab) {
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '/product/newsale/selectHotrank?' + sort,
url: '/product/newsale/selectHotrank?' + sortIndex,
dataType: 'html',
data: {
page: page,
page: pageIndex,
tab_id: tabId,
notab: notab
notab: noTab
},
success: function(data) {
if (data === ' ') {
if ($('.rank-main').length < 1 && $('.goods-nav').length < 1) {
$('#hotRank').html(noResult);
} else {
if (page === 1) {
if (pageIndex === 1) {
hotrankNav = $('.goods-nav').prop('outerHTML');
$('#hotRank').html(hotrankNav + noResult);
... ... @@ -50,7 +49,7 @@ function hotrank(page, sort, tabId, notab) {
}
} else {
$('.no-result').remove();
if (page === 1) {
if (pageIndex === 1) {
$('.rank-main').remove();
}
$('#hotRank').append(data);
... ... @@ -68,7 +67,7 @@ function hotrank(page, sort, tabId, notab) {
width: '100%'
});
}
navSwiper = new Swiper('.s-goods-nav', {
new Swiper('.s-goods-nav', {
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li'
... ... @@ -97,9 +96,9 @@ $(window).scroll(function() {
});
hotrank(page, sort, id, notab);
$('#hotRank').on('touchend touchcancel', function(e) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
$('#hotRank').on('touchend touchcancel', function() {
let ev = window.event;
let target = ev.target || ev.srcElement;
if (target.nodeName.toLowerCase() === 'span') {
$('.s-goods-nav .nav-item').removeClass('active');
... ... @@ -111,12 +110,12 @@ $('#hotRank').on('touchend touchcancel', function(e) {
hotrank(page, sort, id, notab);
}
});
$('#hotRank').bind('contextmenu', function(e) {
$('#hotRank').bind('contextmenu', function() {
return false;
});
$('#hotRank').on('touchstart', function(e) {
var ev = ev || window.event;
var target = ev.target || ev.srcElement;
$('#hotRank').on('touchstart', function() {
let ev = window.event;
let target = ev.target || ev.srcElement;
if (target.nodeName.toLowerCase() === 'span') {
target.parentNode.className = 'bgActive ' + target.parentNode.className;
... ...
... ... @@ -54,9 +54,8 @@ setTimeout(() => {
if (!data) {
return;
}
let dbClass = 'data-bind',
infoDataHbs = require('product/detail/infodata.hbs'),
let dbClass = 'data-bind';
let infoDataHbs = require('product/detail/infodata.hbs'),
priceDataHbs = require('product/detail/pricedata.hbs');
// 商品价格
... ... @@ -110,10 +109,10 @@ setTimeout(() => {
},
success: (data) => {
// 如果当前是秒杀商品,且不在秒杀路径下,跳到该商品的秒杀详情页
var reg = /\/product\/show_([\d]+)/;
var reg2 = /\/product\/([\d]+)/;
var regPro = /\/product\/pro_([\d]+)_([\d]+)/;
var regSeckill = /\/product\/seckill/;
let reg = /\/product\/show_([\d]+)/;
let reg2 = /\/product\/([\d]+)/;
let regPro = /\/product\/pro_([\d]+)_([\d]+)/;
let regSeckill = /\/product\/seckill/;
// let regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
let thisHref = window.location.href;
... ... @@ -248,13 +247,13 @@ setTimeout(() => {
*/
+ (function(skn, productId, brandId) { // eslint-disable-line
// 模版: 促销, feedback, 店铺
var promotionT = require('product/detail/promotion.hbs');
var feedbackT = require('product/detail/feedbacks.hbs');
var enterStoreT = require('product/detail/enterStore.hbs');
let promotionT = require('product/detail/promotion.hbs');
let feedbackT = require('product/detail/feedbacks.hbs');
let enterStoreT = require('product/detail/enterStore.hbs');
// placeholder
var $feedbackStore = $('#placeholder-feedback-store');
var $promotion = $('#placeholder-promotion');
let $feedbackStore = $('#placeholder-feedback-store');
let $promotion = $('#placeholder-promotion');
/**
* 渲染 feedback, 店铺, 替换placeholder
... ...
... ... @@ -4,40 +4,38 @@
* @date: 2015/10/24
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload');
var swiper;
var tip = require('plugin/tip'),
let tip = require('plugin/tip'),
filter = require('plugin/filter'),
loading = require('plugin/loading');
var $goodsContainer = $('#goods-container'),
let $goodsContainer = $('#goods-container'),
$goodsChildren = $goodsContainer.children(),
$ngc = $($goodsChildren.get(0)),
$pgc = $($goodsChildren.get(1)).addClass('hide'),
$dgc = $($goodsChildren.get(2)).addClass('hide');
var winH = $(window).height(),
let winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
// 默认筛选条件
var defaultOpt = require('common/query-param');
let defaultOpt = require('common/query-param');
var storeOpt = $.extend({}, defaultOpt); // 存储默认筛选条件以便重置
let storeOpt = $.extend({}, defaultOpt); // 存储默认筛选条件以便重置
var now = new Date(),
let now = new Date(),
month = now.getMonth() + 1,
date = now.getDate();
var C_ID, argument, flval = {};
let C_ID, argument, flval = {};
require('common/footer');
var $listNav = $('#list-nav'),
let $listNav = $('#list-nav'),
// 导航数据信息
navInfo = {
... ... @@ -68,7 +66,7 @@ ellipsis.init();
$('#today a').text(month + '月' + date + '号');
if ($('.swiper-container .swiper-slide').length > 1) {
swiper = new Swiper('.swiper-container', {
new Swiper('.swiper-container', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
... ... @@ -87,7 +85,7 @@ C_ID = window._ChannelVary[window.cookie('_Channel')];
* @param opt {type, id}
*/
function search(opt) {
var setting = {},
let setting = {},
ext,
att,
nav, navType,
... ... @@ -212,7 +210,7 @@ function search(opt) {
url: '/product/new/selectNewSale',
data: setting,
success: function(data) {
var $container,
let $container,
num,
yasparm,
goodid,
... ... @@ -318,7 +316,7 @@ function search(opt) {
window.rePosFooter();
$('.good-detail-text .name').each(function() {
var $this = $(this),
let $this = $(this),
$title = $this.find('a');
$title[0].mlellipsis(2);
... ... @@ -366,7 +364,7 @@ $listNav.bind('contextmenu', function() {
// 5.当前active为筛选并且点击其他项时,隐藏筛选面板
// navHammer = new Hammer($listNav[0]);
$listNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
let $this = $(e.target).closest('li'),
nav,
navType,
$active;
... ... @@ -452,7 +450,7 @@ function scrollHandler() {
// 当scroll到1/4$goodsContainer高度后继续请求下一页数据
if ($(window).scrollTop() + winH >
$(document).height() - 0.25 * $goodsContainer.height() - 50) {
if ($pre !== undefined) {
if (typeof $pre !== 'undefined') {
search();
}
}
... ... @@ -473,7 +471,7 @@ $listNav.on('touchstart', 'li', function() {
});
$('#goods-container').on('click', '.good-info', function() {
var PRD_ID = $(this).data('good-id'),
let PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index(),
FILTER_VALUE = flval ? JSON.stringify(flval).replace(/\{|\}|\"/g, '') : '';
... ...
require('product/outlet/activity.page.css');
var ajaxActivityTime = require('./outlet/ajaxActivityTime');
var search = require('./sale/search');
let ajaxActivityTime = require('./outlet/ajaxActivityTime');
let search = require('./sale/search');
search.start({}, {_noLazy: true});
... ...
... ... @@ -5,19 +5,19 @@
* license: MIT
*/
var $ = require('yoho-jquery');
let $ = require('yoho-jquery');
(function() {
$.fn.fixNav = function(options) {
var defaults = {
let defaults = {
autoRollTop: false, // make the content below the fixed el roll to top when the el is clicked
zIndex: 999 // the z-index when the element is fixed
};
var settings = $.extend({}, defaults, options || {});
let settings = $.extend({}, defaults, options || {});
var scrollDirection = {
let scrollDirection = {
direction: '',
preScrollTop: 0,
curScrollTop: 0,
... ... @@ -38,7 +38,7 @@ var $ = require('yoho-jquery');
}
};
var utils = {
let utils = {
lock: false,
rollTo: function(el, toWhere) {
$(el).click(function() {
... ... @@ -55,7 +55,7 @@ var $ = require('yoho-jquery');
}
};
var styleCtrl = {
let styleCtrl = {
isSet: false,
preStyle: '',
preTop: null,
... ... @@ -84,7 +84,7 @@ var $ = require('yoho-jquery');
}
},
clearFix: function() {
var windowTop;
let windowTop;
if (this.$el) {
windowTop = $(window).scrollTop();
... ... @@ -102,13 +102,13 @@ var $ = require('yoho-jquery');
};
return this.each(function(index, el) {
var originPoistion = $(el).offset().top;
let originPoistion = $(el).offset().top;
$(window).scroll(function() {
if (utils.lock) {
return;
}
var elementTop = originPoistion - $(window).scrollTop();
let elementTop = originPoistion - $(window).scrollTop();
if (scrollDirection.isDown() && elementTop <= 0) {
styleCtrl.setFix(el, originPoistion);
... ...
... ... @@ -4,23 +4,23 @@
* @date: 2015/10/20
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload');
// 品牌页参数
var $brandHeader = $('#brand-header'),
let $brandHeader = $('#brand-header'),
$introBox = $('#intro-box');
var filter = require('plugin/filter');
let filter = require('plugin/filter');
var writeSearch = require('./write-search');
let writeSearch = require('./write-search');
var tip = require('plugin/tip');
var loading = require('plugin/loading');
let tip = require('plugin/tip');
let loading = require('plugin/loading');
var $goodsContainer = $('#goods-container'),
let $goodsContainer = $('#goods-container'),
$fsgc = $goodsContainer.children('.firstscreen-goods'),
$defaultgc = $goodsContainer.children('.default-goods'),
$ngc = $goodsContainer.children('.new-goods'),
... ... @@ -28,27 +28,27 @@ var $goodsContainer = $('#goods-container'),
$pgc = $goodsContainer.children('.price-goods'),
$dgc = $goodsContainer.children('.discount-goods');
var winH = $(window).height();
let winH = $(window).height();
window.$ = $;
var $input = $('#search-input').find('input[name="query"]'),
let $input = $('#search-input').find('input[name="query"]'),
$clear = $('#search-input .clear-input'),
$buriedpoint = $('.buriedpoint'),
$search = $('#search');
var shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students, couponId, searchFrom;
var size, color, style, standard, gender, price, p_d, oldquery, query, limited, specialoffer, specialsale_id, promotion;
let shopId, sort, brand, outlets, app_type, age_level, msort, misort, coin, app_version, students, couponId, searchFrom;
let size, color, style, standard, gender, price, p_d, oldquery, query, limited, specialoffer, specialsale_id, promotion;
// 默认筛选条件
var defaultOpt = require('common/query-param');
let defaultOpt = require('common/query-param');
require('common');
// 首屏加载标志
var firstScreen = $('.firstscreen-goods').children().size() > 0;
var isRecYas = window.queryString.needSuggestion === 'Y' || $('.word-content').length ? 'Y' : 'N'; // 是否是关键词
let firstScreen = $('.firstscreen-goods').children().size() > 0;
let isRecYas = window.queryString.needSuggestion === 'Y' || $('.word-content').length ? 'Y' : 'N'; // 是否是关键词
var $listNav = $('#list-nav'),
let $listNav = $('#list-nav'),
// 导航数据信息
navInfo = {
... ... @@ -89,11 +89,11 @@ var $listNav = $('#list-nav'),
introHammer,
brandColHammer;
var C_ID, RES_QTY, argument, optype, filext = {};
let C_ID, RES_QTY, argument, optype, filext = {};
var category = $('#category-point').val();
let category = $('#category-point').val();
var noResultHbs = require('product/search/no-result-new.hbs');
let noResultHbs = require('product/search/no-result-new.hbs');
C_ID = window._ChannelVary[window.cookie('_Channel')];
... ... @@ -144,9 +144,9 @@ ellipsis.init();
// 搜索输入联动
function inputAction() {
var $searchAssociate = $('.search-associate');
var $icon = $('.search-icon');
var $searchItems = $('.search-items');
let $searchAssociate = $('.search-associate');
let $icon = $('.search-icon');
let $searchItems = $('.search-items');
$input.on('input', function() {
if ($input.val() === '') {
... ... @@ -169,8 +169,8 @@ function inputAction() {
},
dataType: 'json',
success: function(data) {
var ajaxHtml = '';
var i;
let ajaxHtml = '';
let i;
if (data.length > 0) {
for (i = 0; i < data.length; i++) {
... ... @@ -214,8 +214,8 @@ $search.on('touchend', function() {
* 获取url参数
*/
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = decodeURI(window.location.search).substr(1).match(reg);
let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
let r = decodeURI(window.location.search).substr(1).match(reg);
if (r !== null) {
return decodeURIComponent(r[2]);
... ... @@ -251,12 +251,12 @@ couponId = getQueryString('coupon_id');
searchFrom = getQueryString('from');
if ($fsgc.children().length > 0) {
var fsgcgoods = [],
let fsgcgoods = [],
firstop,
firstyasparm = {};
$fsgc.find('.good-info').each(function() {
var fsgcgood = $(this).data('good-id');
let fsgcgood = $(this).data('good-id');
if (fsgcgood) {
fsgcgoods.push(fsgcgood);
... ... @@ -301,7 +301,7 @@ if ($fsgc.children().length > 0) {
* @param opt {type, id}
*/
function search(opt) {
var setting = {},
let setting = {},
ext,
att,
nav,
... ... @@ -553,7 +553,7 @@ function search(opt) {
withCredentials: true
},
success: function(data) {
var num,
let num,
$container,
goodIds = [],
yasparm,
... ... @@ -634,7 +634,7 @@ function search(opt) {
RES_QTY = $container.find('.total').data('id');
$container.find('.good-info').each(function() {
var goodid = $(this).data('good-id');
let goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
... ... @@ -672,7 +672,7 @@ function search(opt) {
RES_QTY = $container.find('.total').data('id');
$container.find('.good-info:gt(' + (num - 1) + ')').each(function() {
var goodid = $(this).data('good-id');
let goodid = $(this).data('good-id');
if (goodid) {
goodIds.push(goodid);
... ... @@ -746,7 +746,7 @@ function search(opt) {
},
error: function() {
var $divide = $('.search-divide');
let $divide = $('.search-divide');
$divide.html('加载失败,点击重试');
$divide.one('click', function() {
... ... @@ -770,7 +770,7 @@ if ($brandHeader.data('isbaseshop') === true) {
}
(function() {
var pars = {};
let pars = {};
if (age_level) {
pars.age_level = age_level;
... ... @@ -895,11 +895,11 @@ $listNav.bind('contextmenu', function() {
});
$listNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
let $this = $(e.target).closest('li'),
nav,
navType,
$active;
var bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
let bpIdData = $(this).find('.buriedpoint').attr('data-bp-id') || '';
if ($this.hasClass('filter')) {
... ... @@ -1027,7 +1027,7 @@ if ($brandHeader.length > 0) {
// 关闭品牌介绍
introHammer = new Hammer(document.getElementById('intro-box'));
introHammer.on('tap', function(e) {
var $this = $(e.target);
let $this = $(e.target);
e.srcEvent.preventDefault();
... ... @@ -1041,9 +1041,9 @@ if ($brandHeader.length > 0) {
// 品牌收藏
brandColHammer = new Hammer($brandHeader.children('.btn-col')[0]);
brandColHammer.on('tap', function(e) {
var $this = $(e.target).closest('.btn-col');
let $this = $(e.target).closest('.btn-col');
var id = $brandHeader.data('id'),
let id = $brandHeader.data('id'),
opt;
if ($this.hasClass('coled')) {
... ... @@ -1086,7 +1086,7 @@ if ($brandHeader.length > 0) {
});
}
var initialData = false;
let initialData = false;
$(window).one('scroll', function() {
// 初始请求最新第一页数据
... ... @@ -1104,7 +1104,7 @@ $listNav.on('touchstart', 'li', function() {
});
$('#goods-container').on('click', '.good-info', function() {
var PRD_ID = $(this).data('good-id'),
let PRD_ID = $(this).data('good-id'),
PRD_NUM = $(this).index(),
FILTER_VALUE = filext ? JSON.stringify(filext).replace(/\{|\}|\"/g, '') : '',
yasparms,
... ... @@ -1147,7 +1147,7 @@ $('#goods-container').on('click', '.good-info', function() {
}
});
var fuckNum = $('.good-info').length;
let fuckNum = $('.good-info').length;
fuckNum < 12 && $('.search-divide').remove();
... ...
... ... @@ -7,34 +7,29 @@ $(window).on('seckill', function(event, detailData) {
* date: 2016/09/08
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
tip = require('../plugin/tip');
var seckillObj = {};
let seckillObj = {};
var offsetTime = 0;
let offsetTime = 0;
var nowTime = 0;
let nowTime = 0;
var startTime = 0;
let startTime = 0;
var endTime = 0,
let endTime = 0,
diffTime = 0; // 误差时间
var dateText = 0,
let dateText = 0,
newDate = 0,
newMonth = 0,
newDay = 0,
newHour = 0,
newMinus = 0;
var skuFlag,
hideNum,
hideIndex;
var oneIndex = 0,
twoIndex = 0,
secKillPrice = 0;
let secKillPrice = 0;
require('../common');
... ... @@ -44,35 +39,44 @@ $(window).on('seckill', function(event, detailData) {
currentTick: null
},
startTick: function(status, offsetTime) {
var that = this,
startTick: function(status, offTime) {
let that = this,
$el = this.el,
day = parseInt(offsetTime / (60 * 60 * 24), 10),
hour = parseInt(offsetTime % (60 * 60 * 24) / (60 * 60), 10),
minute = parseInt(offsetTime % (60 * 60) / 60, 10),
second = offsetTime % 60;
day = parseInt(offTime / (60 * 60 * 24), 10),
hour = parseInt(offTime % (60 * 60 * 24) / (60 * 60), 10),
minute = parseInt(offTime % (60 * 60) / 60, 10),
second = offTime % 60;
var $elem = status === 0 ? $('.seckill-count-num') : $('.end-time');
let $elem = status === 0 ? $('.seckill-count-num') : $('.end-time');
if (offsetTime >= -1) {
if (offTime >= -1) {
if (day <= 0) {
$('.day-c').addClass('hide');
}
$elem.find('.tick.day').text(day < 0 ? '00' : (day < 10 ? ('0' + day) : day));
$elem.find('.tick.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
$elem.find('.tick.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));
$elem.find('.tick.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
$elem.find('.tick.day').text(that.formatNumber(day));
$elem.find('.tick.hour').text(that.formatNumber(hour));
$elem.find('.tick.minute').text(that.formatNumber(minute));
$elem.find('.tick.second').text(that.formatNumber(second));
if (offsetTime <= -1) { // 结束倒计时刷新状态
if (offTime <= -1) { // 结束倒计时刷新状态
window.location.reload();
} else {
$el.currentTick = setTimeout(function() {
that.startTick(status, --offsetTime);
that.startTick(status, --offTime);
}, 1000);
}
}
}
},
formatNumber: (number) => {
if (number < 0) {
return '00';
} else if (number < 10) {
return '0' + number;
} else {
return number;
}
},
};
$(
... ... @@ -80,8 +84,8 @@ $(window).on('seckill', function(event, detailData) {
$('#goodsDiscount').hide(); // 隐藏折扣楼层
$('.cart-bar').hide();
$('.current-price').hide();
var ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val();
var timestamp = Date.parse(new Date());
let ajaxUrl = '/product/seckillDetail/seckillData/' + $('#productSkn').val();
let timestamp = Date.parse(new Date());
$.ajax({
type: 'GET',
... ... @@ -89,7 +93,7 @@ $(window).on('seckill', function(event, detailData) {
success: function(data) {
// 秒杀是否结束
if (data == '' || data.status === 0 || data.status === 3) {
if (data === '' || data.status === 0 || data.status === 3) {
window.location.replace('/product/' + $('#productSkn').val() + '.html'); // 商品url改版
// $('.sold-out').hide();
... ... @@ -124,14 +128,14 @@ $(window).on('seckill', function(event, detailData) {
$('.addto-cart').hide();
$('.cart-bar').show();
$('.current-price').show();
timeInit(data);
timeInit(data); // eslint-disable-line
}
// 秒杀进行中
if (data.status === 2) {
$('#addtoCart').off('touchstart');
var chosePanel = require('common/chose-panel-new');
var seckillData = data.secKillSku;
let chosePanel = require('common/chose-panel-new');
let seckillData = data.secKillSku;
detailData.cartInfo.skus.forEach(
function(val) {
... ... @@ -153,7 +157,8 @@ $(window).on('seckill', function(event, detailData) {
}).then(result => {
$('.cart-bar').show();
if (result && result.sku) {
window.location.href = '/cart/index/seckill?skn=' + $('#productSkn').val() + '&sku=' + result.sku.skuId;
window.location.href = '/cart/index/seckill?skn=' +
$('#productSkn').val() + '&sku=' + result.sku.skuId;
}
}, () => {
$('.cart-bar').show();
... ... @@ -166,49 +171,18 @@ $(window).on('seckill', function(event, detailData) {
return false;
});
// $('.chose-panel .size-list').find('li[data-skuid != \'\']').each(
// function() {
// skuFlag = 0;
// for (var i = 0; i < data.secKillSku.length; i++) {
// if (data.secKillSku[i].productSku === Number($(this).attr('data-skuid'))) {
// skuFlag++;
// // 如果秒杀库存为0
// if (data.secKillSku[i].storageNum === 0) {
// $(this).addClass('zero-stock');
// oneIndex = $(this).index() + 1;
// twoIndex = $(this).parent('ul').index() - 2;
// $('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock');
// }
// } else {
// // alert("没有匹配");
// }
// }
// if (skuFlag === 0) {
// $(this).addClass('zero-stock').attr('data-num', '0').addClass('hide');
// oneIndex = $(this).index() + 1;
// twoIndex = $(this).parent('ul').index() - 2;
// $('.chose-panel .color-list ul:eq(' + oneIndex + ') li:eq(' + twoIndex + ')').addClass('zero-stock').addClass('hide');
// }
// }
// );
// seckHide(); // 非秒杀库存置灰
// 插入倒计时
addTimeout($('.price-date').eq(0));
secKillPrice = toDecimal2(data.secKillPrice);
addTimeout($('.price-date').eq(0)); // eslint-disable-line
secKillPrice = toDecimal2(data.secKillPrice); // eslint-disable-line
$('.current-price').text('¥' + secKillPrice).show();
$('.left-num').hide();
$('.btn-plus').removeClass('btn-plus');
$('.addto-cart').text('立即购买');
$('#chose-btn-sure').text('立即购买').addClass('isSecKill');
$('.cart-bar').show();
var seckillNum = 0;
let seckillNum = 0;
for (var i = 0; i < data.secKillSku.length; i++) {
for (let i = 0; i < data.secKillSku.length; i++) {
seckillNum = seckillNum + data.secKillSku[i].storageNum;
}
if (seckillNum === 0) {
... ... @@ -217,7 +191,7 @@ $(window).on('seckill', function(event, detailData) {
$('.addto-cart').hide();
}
$('.current-price').show();
timeInit(data);
timeInit(data); // eslint-disable-line
}
}
... ... @@ -290,14 +264,14 @@ $(window).on('seckill', function(event, detailData) {
// 强制保留2位小数点
function toDecimal2(num) {
var f = parseFloat(num);
let f = parseFloat(num);
if (isNaN(f)) {
return false;
}
var f = Math.round(num * 100) / 100;
var s = f.toString();
var rs = s.indexOf('.');
f = Math.round(num * 100) / 100;
let s = f.toString();
let rs = s.indexOf('.');
if (rs < 0) {
rs = s.length;
... ... @@ -310,7 +284,7 @@ $(window).on('seckill', function(event, detailData) {
}
function timeInit(data) {
var status = 0;
let status = 0;
startTime = data.startTime;
endTime = data.endTime;
... ...
... ... @@ -5,8 +5,8 @@
*/
require('common.js');
require('common/share');
var yoho = require('../yoho-app');
var $ = require('yoho-jquery'),
let yoho = require('../yoho-app');
let $ = require('yoho-jquery'),
IScroll = require('yoho-iscroll'),
loading = require('plugin/loading'),
lazyload = require('yoho-jquery-lazyload'),
... ... @@ -16,7 +16,7 @@ loading.init($(document.body), {
className: 'loading-mask-opactiy'
});
var seckillObj = {};
let seckillObj = {};
lazyload('img.lazy');
seckillObj = {
... ... @@ -33,14 +33,14 @@ seckillObj = {
* [初始化界面]
*/
init: function() {
var self = this;
let self = this;
this.$container = $('.seckill-list');
this.pageLoad(function() {
self.domInit();
var $el = self.el;
var focus = $el.$navUl.find('>li.focus');
let $el = self.el;
let focus = $el.$navUl.find('>li.focus');
self.$productList = $('.product-list');
$el.$navUl.find('>li').click(function(event) {
... ... @@ -80,7 +80,7 @@ seckillObj = {
* [初始化时间段]
*/
initNav: function() {
var $el = this.el, that = this;
let $el = this.el, that = this;
$el.timeWidth = ($el.$navUl.find('>li:not(.focus)').width() + 1);
$el.focusTimeWidth = ($el.$navUl.find('>li.focus').width() + 1);
... ... @@ -113,14 +113,14 @@ seckillObj = {
* [注册iscroll事件,滑动停止时判断位置自动选中居中时间段]
*/
registerScrollEvents: function(iScroll) {
var $el = this.el, that = this;
let $el = this.el, that = this;
iScroll.on('scrollStart', function() {
$el.$navList.addClass('srolling');
});
iScroll.on('scrollEnd', function() {
var offsetLeft = 0;
var i = 0;
let offsetLeft = 0;
let i = 0;
// 避免死循环
if ($el.$navList.hasClass('srolling')) {
... ... @@ -142,8 +142,8 @@ seckillObj = {
* [选中时间段]
*/
selectTime: function(elem) {
var $el = this.el, that = this;
var index = 0;
let $el = this.el, that = this;
let index = 0;
$el.$navUl.find('>li').removeClass('focus');
index = $(elem).index();
... ... @@ -163,7 +163,7 @@ seckillObj = {
if ($el.currentTick) {
clearTimeout($el.currentTick);
$el.currentTick = undefined;
delete $el.currentTick;
}
if ($(elem).hasClass('now') || $(elem).hasClass('wait')) {
... ... @@ -181,8 +181,8 @@ seckillObj = {
/**
* [刷新状态]
*/
refreshList: function(elem) {
var $el = this.el, that = this, time, nowTime, nextTime;
refreshList: function() {
let $el = this.el, that = this, time, nowTime, nextTime;
// 刷新时间段状态
$el.$navUl.find('>li').each(function() {
... ... @@ -210,7 +210,7 @@ seckillObj = {
});
// 刷新商品列表
var focusElem = $el.$navUl.find('>li.focus');
let focusElem = $el.$navUl.find('>li.focus');
if (focusElem.length) {
that.refreshProductList(
... ... @@ -224,8 +224,8 @@ seckillObj = {
* [异步加载商品列表]
*/
refreshProductList: function(activityId, startTime) {
var self = this;
var url = yoho.isApp ?
let self = this;
let url = yoho.isApp ?
'/product/seckill/get-product-list?app_version=1' :
'/product/seckill/get-product-list';
... ... @@ -245,7 +245,7 @@ seckillObj = {
window.scrollTo(0, 0);
window.rePosFooter();
},
error: function(data) {
error: function() {
tip.show('网络断开连接了~');
}
})
... ... @@ -258,7 +258,7 @@ seckillObj = {
* [初始化倒计时]
*/
initTick: function(elem) {
var $el = this.el, that = this,
let that = this,
time,
nowTime = Date.parse(new Date()) / 1000 + that.diff,
offsetTime;
... ... @@ -276,7 +276,7 @@ seckillObj = {
* [开始倒计时]
*/
startTick: function(elem, offsetTime, nowTime) {
var that = this,
let that = this,
$el = this.el,
hour = parseInt(offsetTime / (60 * 60), 10),
minute = parseInt(offsetTime % (60 * 60) / 60, 10),
... ... @@ -285,12 +285,12 @@ seckillObj = {
if (offsetTime <= 0) { // 结束倒计时刷新状态
that.refreshList(elem);
} else {
$(elem).find('.tick.hour').text(hour < 0 ? '00' : (hour < 10 ? ('0' + hour) : hour));
$(elem).find('.tick.minute').text(minute < 0 ? '00' : (minute < 10 ? ('0' + minute) : minute));
$(elem).find('.tick.second').text(second < 0 ? '00' : (second < 10 ? ('0' + second) : second));
$(elem).find('.tick.hour').text(that.formatNumber(hour));
$(elem).find('.tick.minute').text(that.formatNumber(minute));
$(elem).find('.tick.second').text(that.formatNumber(second));
$el.currentTick = setTimeout(function() {
var curSec = Math.floor(Date.now() / 1000) + that.diff;
let curSec = Math.floor(Date.now() / 1000) + that.diff;
offsetTime = offsetTime - (curSec - nowTime);
that.startTick(elem, offsetTime, curSec);
... ... @@ -298,11 +298,21 @@ seckillObj = {
}
},
formatNumber: (number) => {
if (number < 0) {
return '00';
} else if (number < 10) {
return '0' + number;
} else {
return number;
}
},
bindEvents: function() {
var self = this;
var $nav = self.el.$navList;
var h = $nav.height();
var top = $nav.position().top;
let self = this;
let $nav = self.el.$navList;
let h = $nav.height();
let top = $nav.position().top;
$nav.wrap('<div style="height:' + h + 'px;"></div>');
... ... @@ -320,15 +330,15 @@ seckillObj = {
添加/删除提醒
*/
toggleRemind: function(event) {
var $remindBtn,
let $remindBtn,
$product;
var actionName,
let actionName,
action,
params,
on_off;
var okTip,
let okTip,
failTip,
onsuccess;
... ... @@ -393,8 +403,8 @@ seckillObj = {
},
pageLoad: function(callback) {
var self = this;
var $xhr;
let self = this;
let $xhr;
loading.show();
$xhr = $.ajax({
... ... @@ -409,7 +419,7 @@ seckillObj = {
if (result && result.activitys && result.activitys.length) {
window.diff = self.diff = Math.round((result.currentTime - Date.now()) / 1000);
callback();
return callback();
}
lazyload('img.lazy');
... ...
... ... @@ -4,29 +4,20 @@
require('./shop/coupon');
require('product/shop/shop.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper');
var bannerSwiper,
multiSwiper,
myScroll,
imgH,
let myScroll,
nav1H,
main1H,
main1oH,
nav2H,
main2oH,
scH,
$nav1 = $('#pos-nav'),
$nav2 = $('#pos-list'),
sTop;
$nav2 = $('#pos-list');
var tip = require('../plugin/tip'),
let tip = require('../plugin/tip'),
filter = require('../plugin/filter'),
loading = require('../plugin/loading');
var $subNav = $('.home-sub-nav'),
let $subNav = $('.home-sub-nav'),
$collect = $('#collect'),
$goodsContainer = $('#goods-container'),
$goodsChildren = $goodsContainer.children(),
... ... @@ -42,18 +33,18 @@ var $subNav = $('.home-sub-nav'),
favId = $('input[name="favId"]').val(),
uid = window.queryString.uid;
var winH = $(window).height(),
let winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
require('../common');
// 默认筛选条件
var defaultOpt = require('../common/query-param');
let defaultOpt = require('../common/query-param');
// pagecache判断app设置cookie,判断是否收藏
(function() {
var param = location.search;
var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
let param = location.search;
let isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
// 不阻塞字体文件加载
setTimeout(function() {
... ... @@ -120,17 +111,18 @@ var defaultOpt = require('../common/query-param');
// 初始化filter&注册filter回调
filter.initFilter({
fCbFn: search,
fCbFn: search, // eslint-disable-line
hCbFn: function() {
$('.filter ').removeClass('active');
// 切换active状态到$pre上
$pre.addClass('active');
// $pre.addClass('active');
$('#pos-list').addClass('hide');
$pre.siblings('.filter').removeClass('active');
scrollHandler();
subNavScrollTo();
// $pre.siblings('.filter').removeClass('active');
scrollHandler(); // eslint-disable-line
subNavScrollTo(); // eslint-disable-line
}
});
}
... ... @@ -140,7 +132,7 @@ var defaultOpt = require('../common/query-param');
}());
var $listNav = $('#list-nav'),
let $listNav = $('#list-nav'),
// 导航数据信息
navInfo = {
... ... @@ -184,14 +176,14 @@ var $listNav = $('#list-nav'),
$pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项
searching;
var viewType = 1, // 1-首页,2-上新,3-人气
let viewType = 1, // 1-首页,2-上新,3-人气
listCount = $('.category-list li').length,
listModValue = 4 - listCount % 4,
listIndex;
// 焦点效果
if ($('.banner-swiper').find('li').size() > 1) {
bannerSwiper = new Swiper('.banner-swiper', {
new Swiper('.banner-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
loop: true,
... ... @@ -204,7 +196,7 @@ if ($('.banner-swiper').find('li').size() > 1) {
}
if ($('.multi-browse').find('li').size() > 1) {
multiSwiper = new Swiper('.multi-browse', {
new Swiper('.multi-browse', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
lazyLoadingOnTransitionStart: true,
... ... @@ -231,7 +223,7 @@ if ($('.category-list li').length < 4) {
}
function getPageGoods(info) {
var nav, navType;
let nav, navType;
if (searching) {
return;
... ... @@ -278,7 +270,7 @@ function getParam(req) {
}
function newData(callback) {
var req = {};
let req = {};
req.url = '/product/search/search';
req.data = {
... ... @@ -295,19 +287,18 @@ function newData(callback) {
$('#new-arrival').append(data);
navInfo.new.page++;
lazyLoad($('#new-arrival .lazy'));
scH = $('#scroller').outerHeight();
searching = false;
callback && $.isFunction(callback) && callback();
};
var result = getPageGoods(req);
let result = getPageGoods(req);
if (!result) {
callback && callback();
return callback && callback();
}
}
function hotData(callback) {
var req = {};
let req = {};
req.url = '/product/search/search';
req.data = {
... ... @@ -324,19 +315,18 @@ function hotData(callback) {
$('#popularity').append(data);
navInfo.hot.page++;
lazyLoad($('#popularity .lazy'));
scH = $('#scroller').outerHeight();
searching = false;
callback && $.isFunction(callback) && callback();
};
var result = getPageGoods(req);
let result = getPageGoods(req);
if (!result) {
callback && callback();
return callback && callback();
}
}
function tabChange(dom, index) {
var li = dom.eq(index);
let li = dom.eq(index);
dom.removeClass('active color');
li.addClass('active color');
... ... @@ -345,15 +335,15 @@ function tabChange(dom, index) {
// 首页导航
(function(nav, posNav, main) {
var scrollToNav1 = function() {
let scrollToNav1 = function() {
setTimeout(function() {
window.scrollTo(0, $('#nav').offset().top + 5);
}, 100);
};
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
var isPos = $(this).parent().attr('id') === 'pos-nav';
var index = $(this).index(),
let isPos = $(this).parent().attr('id') === 'pos-nav';
let index = $(this).index(),
activeTab = $(this).attr('tab');
if ($('.filter-mask').length && !$('.filter-mask').hasClass('hide')) {
... ... @@ -377,29 +367,25 @@ function tabChange(dom, index) {
viewType = 1;
isPos && scrollToNav1();
}
scH = $('#scroller').outerHeight();
});
}('#nav', '#pos-nav', '.main'));
function scrollHandler(e) {
function scrollHandler() {
if (!$('.filter-mask').hasClass('hide')) {
return;
}
var scrollCall,
sTop = $(document).scrollTop(),
let sTop = $(document).scrollTop(),
scH = $('#scroller').outerHeight(),
nav1OffsetTop = $('#nav').length ? $('#nav').offset().top : 0,
nav2OffsetTop = $('#list-nav').length ? $('#list-nav').offset().top : 0;
var tra;
// 分页加载店铺商品列表
if (sTop > scH - winH * 2 && viewType === 1) {
if ($pre !== undefined) {
search({
if (typeof $pre !== 'undefined') {
search({ // eslint-disable-line
type: 'shop_id',
id: shopId,
brand: brand,
... ... @@ -418,6 +404,8 @@ function scrollHandler(e) {
case 3:
hotData();
break;
default:
break;
}
}
... ... @@ -445,16 +433,8 @@ function scrollHandler(e) {
// window ready 后重新refresh iscroll
$(window).ready(function() {
// myScroll && myScroll.refresh();
imgH = $('#nav-top').outerHeight();
nav1H = $('#nav').outerHeight();
main1H = $('#nav-main').height();
main1oH = $('#nav-main').outerHeight(true);
nav2H = $('#list-nav').outerHeight(true);
main2oH = $('#goods-container').outerHeight(true);
setTimeout(function() {
scH = $('#scroller').outerHeight();
}, 500);
$(document).scroll(scrollHandler);
lazyLoad($('img.lazy'));
... ... @@ -465,7 +445,7 @@ function bindGoodThumbClick() {
}
function search(opt, callback) {
var setting = {},
let setting = {},
ext,
att,
nav, navType,
... ... @@ -596,7 +576,7 @@ function search(opt, callback) {
url: opt.url ? opt.url : '',
data: setting,
success: function(data) {
var $container,
let $container,
num;
switch (navType) {
... ... @@ -633,8 +613,6 @@ function search(opt, callback) {
}
}
scH = $('#scroller').outerHeight();
nav.reload = false;
nav.page = page;
... ... @@ -661,12 +639,12 @@ function search(opt, callback) {
}
$listNav.bind('contextmenu', function(e) {
$listNav.bind('contextmenu', function() {
return false;
});
$newList.on('touchstart', 'li', function(e) {
var navType, bpIdData = $(this).attr('data-bp-id') || '';
let navType, bpIdData = $(this).attr('data-bp-id') || '';
e.preventDefault();
if ($(this).hasClass('new')) {
... ... @@ -697,11 +675,13 @@ $newList.on('touchstart', 'li', function(e) {
case 'default':
$defaultgc.removeClass('hide');
break;
default:
break;
}
var nav = navInfo[navType];
let nav = navInfo[navType];
if (nav.reload) {
search({
... ... @@ -714,7 +694,7 @@ $newList.on('touchstart', 'li', function(e) {
}, function() {
});
}
subNavScrollTo();
subNavScrollTo(); // eslint-disable-line
e.stopPropagation();
});
... ... @@ -725,12 +705,12 @@ function subNavScrollTo() {
}, 100);
}
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
let $this = $(e.target).closest('li'),
cname,
nav,
navType,
$active;
var bpIdData = $this.attr('data-bp-id') || '';
let bpIdData = $this.attr('data-bp-id') || '';
e.preventDefault();
$(document).trigger('shouldSendBpData', [bpIdData]);
... ... @@ -784,7 +764,7 @@ $subNav.on('touchend touchcancel', function(e) {
}
nav = navInfo[navType];
var reloadCb = function() {
let reloadCb = function() {
$goodsContainer.children('.container:not(.hide)').addClass('hide');
switch (navType) {
case 'newest':
... ... @@ -858,20 +838,20 @@ $subNav.on('touchend touchcancel', function(e) {
});
$listNav.on('touchstart', 'li', function(e) {
$listNav.on('touchstart', 'li', function() {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$listNav.find('li').removeClass('bytouch');
});
$nav2.on('touchstart', 'li', function(e) {
$nav2.on('touchstart', 'li', function() {
$(this).addClass('bytouch');
}).on('touchend touchcancel', function() {
$nav2.find('li').removeClass('bytouch');
});
$('.shop-foot-wrapper .buriedpoint').click(function() {
var subGroup = $(this).find('.sub-group');
let subGroup = $(this).find('.sub-group');
if (subGroup.hasClass('hide')) {
subGroup.removeClass('hide');
... ... @@ -882,7 +862,7 @@ $('.shop-foot-wrapper .buriedpoint').click(function() {
// 店铺收藏 || 取消收藏
$collect.on('touchstart', function() {
var opt;
let opt;
if (searching) {
return;
... ... @@ -909,7 +889,7 @@ $collect.on('touchstart', function() {
withCredentials: true
},
success: function(data) {
var url = '';
let url = '';
if (data.code === 200) {
if ($collect.hasClass('already-collect')) {
... ... @@ -931,7 +911,6 @@ $collect.on('touchstart', function() {
setTimeout(function() {
myScroll && myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 500);
searching = false;
},
... ...
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
tip = require('plugin/tip');
require('common');
var shopCoupon = {};
let shopCoupon = {};
shopCoupon = {
common: {
... ... @@ -26,7 +26,7 @@ shopCoupon = {
}.bind(shopCoupon), 400);
},
getShopCouponsList: function() {
var that = this,
let that = this,
_url = location.protocol + '//m.yohobuy.com';
if ($('.coupon-group').length <= 0) {
... ... @@ -64,10 +64,10 @@ shopCoupon = {
});
},
userCoupon: function() {
var $self = this;
let $self = this;
$('.coupon-content .receive-btn').closest('.swiper-slide').on('click', function() {
var that = this,
let that = this,
code = $(this).data('id') || '';
if (that.isCouponClick === false) {
... ... @@ -118,7 +118,7 @@ shopCoupon = {
// 登录状态下,领取优惠券
loginCoupon: function() {
var $self = this,
let $self = this,
code = window.cookie('shopBrandCoupon') || false;
window.setCookie('shopBrandCoupon', null);
... ...
... ... @@ -6,46 +6,45 @@
*/
require('product/shop/shop.page.css');
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
Hammer = require('yoho-hammer'),
ellipsis = require('yoho-mlellipsis'),
lazyLoad = require('yoho-jquery-lazyload');
// 品牌页参数
var $brandHeader = $('#brand-header'),
let $brandHeader = $('#brand-header'),
$introBox = $('#intro-box');
var filter = require('plugin/filter');
let filter = require('plugin/filter');
var writeSearch = require('../search/write-search');
var noResultHbs = require('product/search/no-result-new.hbs');
var tip = require('plugin/tip');
var loading = require('plugin/loading');
let writeSearch = require('../search/write-search');
let noResultHbs = require('product/search/no-result-new.hbs');
let tip = require('plugin/tip');
let loading = require('plugin/loading');
var $goodsContainer = $('#goods-container'),
let $goodsContainer = $('#goods-container'),
$defaultgc = $goodsContainer.children('.default-goods'),
$sgc = $goodsContainer.children('.sale-goods'),
$ngc = $goodsContainer.children('.new-goods'),
$pgc = $goodsContainer.children('.price-goods'),
$dgc = $goodsContainer.children('.discount-goods');
var winH = $(window).height();
let winH = $(window).height();
var $input = $('#search-input').find('input[name="query"]'),
let $input = $('#search-input').find('input[name="query"]'),
$clear = $('#search-input .clear-input'),
$buriedpoint = $('.buriedpoint'),
$search = $('#search');
var C_ID, filext = {}, total, argument;
let C_ID, filext = {}, total, argument;
var shopId, sort, brand, outlets, app_type, age_level, msort, misort,
coin, app_version, first_load = true, searchFrom, oldquery, query;
let shopId, sort, brand, outlets, app_type, age_level, msort, misort,
coin, app_version, first_load = true, searchFrom, oldquery;
// 默认筛选条件
var defaultOpt = require('common/query-param');
let defaultOpt = require('common/query-param');
var $listNav = $('#list-nav'),
let $listNav = $('#list-nav'),
// 导航数据信息
navInfo = {
... ... @@ -217,7 +216,6 @@ coin = getQueryString('coin');
app_version = getQueryString('app_version') || getQueryString('appVersion');
searchFrom = getQueryString('from');
oldquery = getQueryString('query');
query = $('.query-param[data-attr="query"]').val() || oldquery;
/**
* 筛选注册的回调,筛选子项点击后逻辑
... ... @@ -457,7 +455,7 @@ function search(opt) {
if (nav.reload) {
var goodList = [], wordContents = [];
let goodList = [], wordContents = [];
$(data).each(function(i, goodInfo) {
if ($(goodInfo).hasClass('good-info')) {
... ...
... ... @@ -2,29 +2,26 @@
* 品牌店铺首页
*/
var $ = require('yoho-jquery'),
let $ = require('yoho-jquery'),
IScroll = require('yoho-iscroll/build/iscroll-probe'),
lazyLoad = require('yoho-jquery-lazyload'),
Swiper = require('yoho-swiper');
var bannerSwiper,
let bannerSwiper,
multiSwiper,
myScroll,
imgH,
nav1H,
main1H,
main1oH,
nav2H,
main2oH,
scH,
$nav1 = $('#pos-nav'),
$nav2 = $('#pos-list'),
sTop;
$nav2 = $('#pos-list');
var tip = require('plugin/tip'),
let tip = require('plugin/tip'),
filter = require('plugin/filter'),
loading = require('plugin/loading');
var $subNav = $('.home-sub-nav'),
let $subNav = $('.home-sub-nav'),
$collect = $('#collect'),
$goodsContainer = $('#goods-container'),
$ngc = $goodsContainer.children('.newest-goods'),
... ... @@ -40,15 +37,15 @@ var $subNav = $('.home-sub-nav'),
uid = $('input[name="uid"]').val(),
$newList = $('.new-list');
var winH = $(window).height(),
let winH = $(window).height(),
noResult = '<p class="no-result">未找到相关搜索结果</p>';
require('common');
// pagecache判断app设置cookie,判断是否收藏
(function() {
var param = location.search;
var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
let param = location.search;
let isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
if (isApp) {
$.ajax({
... ... @@ -84,9 +81,9 @@ require('common');
}());
// 默认筛选条件
var defaultOpt = require('common/query-param');
let defaultOpt = require('common/query-param');
var $listNav = $('#list-nav'),
let $listNav = $('#list-nav'),
// 导航数据信息
navInfo = {
... ... @@ -136,7 +133,7 @@ var $listNav = $('#list-nav'),
$pre = $listNav.find('.active'), // 纪录进入筛选前的active项,初始为选中项
searching;
var viewType = 1, // 1-首页,2-上新,3-人气
let viewType = 1, // 1-首页,2-上新,3-人气
listCount = $('.category-list li').length,
listModValue = 4 - listCount % 4,
listIndex;
... ... @@ -188,7 +185,7 @@ if ($('.category-list li').length < 4) {
}
function getPageGoods(info) {
var nav, navType;
let nav, navType;
if (searching) {
return;
... ... @@ -239,7 +236,7 @@ function getParam(req) {
}
function newData(callback) {
var req = {};
let req = {};
req.url = location.protocol + '//m.yohobuy.com/product/search/search';
req.data = {
... ... @@ -265,7 +262,7 @@ function newData(callback) {
}
function hotData(callback) {
var req = {};
let req = {};
req.url = location.protocol + '//m.yohobuy.com/product/search/search';
req.data = {
... ... @@ -291,7 +288,7 @@ function hotData(callback) {
}
function tabChange(dom, index) {
var li = dom.eq(index);
let li = dom.eq(index);
dom.removeClass('active color');
li.addClass('active color');
... ... @@ -303,7 +300,7 @@ function tabChange(dom, index) {
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
var index = $(this).index(),
let index = $(this).index(),
activeTab = $(this).attr('tab');
if (!$('.filter-mask').hasClass('hide')) {
... ... @@ -334,13 +331,13 @@ function tabChange(dom, index) {
});
}('#nav', '#pos-nav', '.main'));
var theY;
let theY;
/**
* 筛选后内容变化,导致nav1位置错掉,重新计算确保位置正确显示
*/
function reNav1Pos() {
var sTop = theY ? theY : 0, tra;
let sTop = theY ? theY : 0, tra;
if (sTop < imgH + main1oH + nav1H) {
if ($nav1.hasClass('hide')) {
... ... @@ -380,16 +377,16 @@ function reNav1Pos() {
function scrollHandler() {
var scrollCall,
let scrollCall,
sTop = -this.y;
var tra;
let tra;
theY = sTop;
if (sTop + winH > scH - 0.25 * $goodsContainer.height() - 50) {
if ($pre !== undefined) {
search({
if (typeof $pre !== 'undefined') {
search({ // eslint-disable-line
type: 'shop_id',
id: shopId,
brand: brand,
... ... @@ -401,7 +398,7 @@ function scrollHandler() {
if (sTop + winH * 2 > scH) {
scrollCall = function() {
var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
let translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
$nav1.css({
transform: translate,
... ... @@ -417,6 +414,8 @@ function scrollHandler() {
case 3:
hotData(scrollCall);
break;
default:
break;
}
}
... ... @@ -510,8 +509,6 @@ $(window).ready(function() {
nav1H = $('#nav').outerHeight();
main1H = $('#nav-main').height();
main1oH = $('#nav-main').outerHeight(true);
nav2H = $('#list-nav').outerHeight(true);
main2oH = $('#goods-container').outerHeight(true);
myScroll = new IScroll('#wrapper', {
... ... @@ -553,7 +550,7 @@ function bindGoodThumbClick() {
}
function search(opt) {
var setting = {},
let setting = {},
ext,
att,
nav, navType,
... ... @@ -691,7 +688,7 @@ function search(opt) {
url: opt.url ? opt.url : '',
data: setting,
success: function(data) {
var $container,
let $container,
num;
switch (navType) {
... ... @@ -760,7 +757,7 @@ $listNav.bind('contextmenu', function() {
});
function newListHide() {
var $firstLi = $('ul.pos-list').find('li.first-li-more');
let $firstLi = $('ul.pos-list').find('li.first-li-more');
if ($newList.hasClass('hide')) {
$firstLi.find('span.up').addClass('hide');
... ... @@ -772,7 +769,7 @@ function newListHide() {
}
$newList.on('touchstart', 'li', function(e) {
var navType, bpIdData = $(this).attr('data-bp-id') || '',
let navType, bpIdData = $(this).attr('data-bp-id') || '',
$firstLiDom = $('ul.pos-list').find('li.first-li-more');
e.preventDefault();
... ... @@ -838,12 +835,12 @@ $(document).on('touchstart', function(e) {
});
$subNav.on('touchend touchcancel', function(e) {
var $this = $(e.target).closest('li'),
let $this = $(e.target).closest('li'),
cname,
nav,
navType,
$active;
var bpIdData = $this.attr('data-bp-id') || '';
let bpIdData = $this.attr('data-bp-id') || '';
e.preventDefault();
... ... @@ -1079,7 +1076,7 @@ $nav2.on('touchstart', 'li', function() {
// });
$('.shop-foot-wrapper .buriedpoint').click(function() {
var subGroup = $(this).find('.sub-group');
let subGroup = $(this).find('.sub-group');
if (subGroup.hasClass('hide')) {
subGroup.removeClass('hide');
... ... @@ -1090,7 +1087,7 @@ $('.shop-foot-wrapper .buriedpoint').click(function() {
// 店铺收藏 || 取消收藏
$collect.on('touchstart', function() {
var opt;
let opt;
if (searching) {
return;
... ... @@ -1117,7 +1114,7 @@ $collect.on('touchstart', function() {
withCredentials: true
},
success: function(data) {
var url = '';
let url = '';
if (data.code === 200) {
if ($collect.hasClass('already-collect')) {
... ...
require('product/sale/vip-index.page.css');
var Swiper = require('yoho-swiper2');
var search = require('./sale/search');
let Swiper = require('yoho-swiper2');
let search = require('./sale/search');
// 获取频道页
var getChannel = function() {
var name = window.cookie('_Channel');
let getChannel = function() {
let name = window.cookie('_Channel');
return {
boys: 1,
... ... @@ -19,7 +19,7 @@ var getChannel = function() {
search.start();
$('.goods-container').on('click', '.good-info', function() {
var C_ID = getChannel(),
let C_ID = getChannel(),
UDID = window.queryString.anbiudid || window.queryString.udid || '',
SID = window.queryString.session_id || '',
skn = $(this).attr('data-id');
... ...
... ... @@ -39,7 +39,7 @@ $('.get-qa').on('keyup focus',
function() {
var searchText = $(this).val();
if (searchText == '') {
if (searchText === '') {
$hotGroup.show();
$searchGroup.hide();
$noResult.hide();
... ... @@ -53,20 +53,21 @@ $('.get-qa').on('keyup focus',
$searchGroup.show();
$noResult.hide();
$hotGroup.hide();
var keyList = result.data.helper_list;
let keyList = result.data.helper_list;
if (keyList == '') {
if (keyList === '') {
$searchGroup.empty();
$noResult.show();
$noResult.find('.noKey').html(searchText);
} else {
var keyItem = '';
let keyItem = '';
for (var i = 0; i < keyList.length; i++) {
var redText = keyList[i].caption.replace(searchText, '<span>$&</span>');
var id = keyList[i].id;
for (let i = 0; i < keyList.length; i++) {
let redText = keyList[i].caption.replace(searchText, '<span>$&</span>');
let id = keyList[i].id;
keyItem += '<a class="common-item" href="./qaDetail?keyword=' + searchText + '&sonId=' + id + '">' +
keyItem += '<a class="common-item" href="./qaDetail?keyword=' + searchText +
'&sonId=' + id + '">' +
'<p>' + redText + '</p>' +
'<i class="arr-ico iconfont">&#xe604;</i>' +
'</a>';
... ...