Authored by 梁志锋

gulp ge提交

Showing 100 changed files with 559 additions and 81 deletions

Too many changes to show.

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

... ... @@ -248,16 +248,23 @@ class CartData
*
* @param int $uid 用户ID
* @param string $cartType 购物车类型,ordinary表示普通购物车
* @param int $isUseYohoCoin 是否使用有货币,默认0不使用, 1使用
* @param int $isUseYohoCoin 是否使用有货币,0不使用, 1使用
* @param string $skuList 购买限购商品时需要传递的参数
* @return array 接口返回的数据
*/
public static function cartPay($uid, $cartType, $isUseYohoCoin = 0)
public static function cartPay($uid, $cartType, $isUseYohoCoin, $skuList)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.payment';
$param['cart_type'] = $cartType;
$param['yoho_coin_mode'] = $isUseYohoCoin;
$param['uid'] = $uid;
// 购买限购商品时需要传递product_sku_list参数
if (!empty($skuList)) {
$param['product_sku_list'] = $skuList;
}
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
... ... @@ -272,9 +279,10 @@ class CartData
* @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量
* @param string $skuList 购买限购商品时需要传递的参数
* @return array 接口返回的数据
*/
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin)
public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList)
{
$param = Yohobuy::param();
$param['method'] = 'app.Shopping.compute';
... ... @@ -288,6 +296,11 @@ class CartData
$param['use_yoho_coin'] = $yohoCoin;
}
// 购买限购商品时需要传递product_sku_list参数
if (!empty($skuList)) {
$param['product_sku_list'] = $skuList;
}
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ... @@ -346,9 +359,10 @@ class CartData
* @param string $remark 留言
* @param string $couponCode 优惠券码
* @param mixed $yohoCoin 使用的YOHO币数量或为空
* @param string $skuList 购买限购商品时需要传递的参数
* @return array 接口返回的数据
*/
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin)
public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList)
{
$param = Yohobuy::param();
$param['debug'] = 'Y';
... ... @@ -375,6 +389,12 @@ class CartData
if (!empty($yohoCoin)) {
$param['use_yoho_coin'] = $yohoCoin;
}
// 购买限购商品时需要传递product_sku_list参数
if (!empty($skuList)) {
$param['product_sku_list'] = $skuList;
}
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
... ...
... ... @@ -35,6 +35,20 @@ class UserData
}
/**
* 获取个人中心公告有关数据
*
* @return mixed
*/
public static function noticeData()
{
$param = Yohobuy::param();
$param['method'] = 'app.resources.getNotices';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 个人中心页面优惠券,收藏的商品等的数目数据
*
* @param int $uid 用户ID
... ...
... ... @@ -1697,7 +1697,8 @@ var $ = require("jquery"),
recommendSwiper,
hotBrandsSwiper,
trendTopicSwiper,
goodsSwiper;
goodsSwiper,
freshSwiper;
var start = 0,
swiperClass,
... ... @@ -1733,12 +1734,12 @@ function hideSideBar() {
}
}
$('.overlay').on('touchstart', function(e) {
$overlay.on('touchstart', function() {
hideSideBar();
return false;
});
$sideNav.on('touchmove', function(e) {
$sideNav.on('touchmove scroll', function() {
return false;
});
... ... @@ -1758,13 +1759,14 @@ $sideNav.on('touchend', 'li', function(e) {
// 返回一级导航,收起二级导航
$subNav.each(function() {
$(this).find('li').eq(0).on('touchend', function() {
$(this).find('li').eq(0).on('touchstart', function() {
$sideNav.css('pointer-events', 'none');
setTimeout(function() {
$('.sub-nav').removeClass('show');
$sideNav.css('pointer-events', 'auto');
}, 400);
$('.sub-nav').removeClass('show');
});
}).on('touchstart', function(e) {
if (e.currentTarget !== e.target) {
... ... @@ -1827,6 +1829,17 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
});
}
// 新人专享轮播
if ($('.fresh-list-swiper').find('li').size() > 1) {
freshSwiper = new Swiper('.fresh-list-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li'
});
}
// 潮流上装/经典裤装等轮播
$('.category-swiper').each(function(i, index) {
swiperClass = 'category-swiper' + i;
... ... @@ -3582,7 +3595,8 @@ function getInstance() {
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
// fullWithBtn是供详情页获取限购码使用的特殊参数
exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
... ... @@ -3596,6 +3610,8 @@ exports.showDialog = function(data, callback, callbackForLeft) {
$dialogBox = $('.dialog-box');
$dialogWrapper = $('.dialog-wrapper');
dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));
// 显示
... ... @@ -3607,6 +3623,15 @@ exports.showDialog = function(data, callback, callbackForLeft) {
$dialogWrapper.fadeIn();
}
if (fullWithBtn) {
$('.dialog-wrapper .dialog-footer > span').css('width', '100%');
$('.dialog-wrapper .dialog-content').css({
'padding-left': '1.85rem',
'padding-right': '1.85rem'
});
$dialogWrapper.css('z-index', '10');
}
$dialogBox.css({
top: '50%',
marginTop: -($dialogBox.height() / 2)
... ... @@ -3738,7 +3763,7 @@ $btnSure.on('touchstart', function() {
});
});
define("js/product/entry", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){
define("js/product/entry", ["jquery","swiper","lazyload","hammer","handlebars","source-map","index"], function(require, exports, module){
/**
* 产品打包入口
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
... ... @@ -5236,7 +5261,7 @@ $listNav.on('touchstart', 'li', function() {
});
});
define("js/product/detail/detail", ["jquery","swiper","hammer","lazyload","index"], function(require, exports, module){
define("js/product/detail/detail", ["jquery","swiper","hammer","lazyload","handlebars","source-map","index"], function(require, exports, module){
/**
* 商品详情
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
... ... @@ -5257,6 +5282,11 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
var $cart = $('.cart-bar');
var limitSaleBtn = document.getElementById('limit-sale'),
limitSaleHammer = limitSaleBtn && new Hammer(limitSaleBtn);
var dialog = require("js/me/dialog");
//add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
... ... @@ -5314,6 +5344,25 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
});
}
limitSaleHammer ? limitSaleHammer.on('tap', function(e) {
e.srcEvent.stopPropagation();
dialog.showDialog({
dialogText: '进入有货APP尖货频道分享\n以获取限购码',
hasFooter: {
rightBtnText: '打开Yoho!Buy有货APP'
}
}, function() {
console.log('111');
}, undefined, true);
$('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {
e.stopPropagation();
if ($(e.target).hasClass('dialog-wrapper')) {
dialog.hideDialog();
}
});
}) : null;
require("js/product/detail/desc");
require("js/product/detail/comments-consults");
require("js/product/recommend-for-you-product-desc");
... ... @@ -7206,6 +7255,15 @@ $(document).on('touchend', '.swiper-header', function() {
}
});
$('.invalidGoods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('del-fav')) {
return;
}
tip.show('商品已下架');
return false;
});
});
define("js/me/suggest", ["jquery","hammer","lazyload","handlebars","source-map"], function(require, exports, module){
/**
... ... @@ -8509,8 +8567,9 @@ define("js/me/browse-record", ["jquery","lazyload","handlebars","source-map","ha
var $ = require("jquery");
var lazyLoad = require("lazyload");
var load = require("js/plugin/loading");
var lazyLoad = require("lazyload"),
load = require("js/plugin/loading"),
tip = require("js/plugin/tip");
var dialog = require("js/me/dialog");
... ... @@ -8630,6 +8689,15 @@ $('.deps').on('touchstart', 'span', function() {
$(this).css('background', 'transparent');
});
$('.invalidGoods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('del-icon')) {
return;
}
tip.show('商品已下架');
return false;
});
});
define("js/me/address-act", ["jquery","hammer"], function(require, exports, module){
/**
... ... @@ -9358,6 +9426,12 @@ $('.btn-balance').on('touchend', function() {
});
$('.off-shell-goods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('icon-del')) {
return;
}
tip.show('商品已下架');
return false;
});
... ... @@ -9556,11 +9630,6 @@ $('.icon-edit').on('touchstart', function(e) {
$('.icon-del').on('touchstart', function(e) {
var $this = $(this);
if ($this.parents('.off-shell-goods').length) {
tip.show('商品已下架');
return false;
}
e.stopPropagation();
dialog.showDialog({
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
/**
* GULP-FILE
* author: xuqi(qi.xu@yoho.cn)
* date: 2015/9/30
*/
var gulp = require('gulp'),
compass = require('gulp-compass'),
cp = require('child_process');
var fs = require('fs'),
ftp = require('gulp-ftp'),
gutil = require('gulp-util'),
uglify = require('gulp-uglify'),
Package = require('father').SpmPackage,
transport = require('gulp-spm'),
concat = require('gulp-concat');
var config = JSON.parse(fs.readFileSync('./package.json').toString());
var rootDist = 'dist/myohobuy/',
ftpConfig = {
host: '218.94.75.58',
user: 'php',
pass: 'yoho9646'
};
var distDir = {
js: rootDist + config.version,
css: rootDist + config.version,
img: rootDist + 'assets/img',
font: rootDist + 'assets/font'
};
gulp.task('default', ['compass', 'compass-watch', 'spm-doc']);
// compass
gulp.task('compass', function() {
gulp.src('sass/**/*.scss')
.pipe(
compass({
config_file: 'config.rb',
css: 'css',
sass: 'sass'
})
).on('error', function(error) {
console.log(error);
this.emit('end');
});
});
// compass watch
gulp.task('compass-watch', function() {
gulp.watch('sass/**/*.scss', ['compass']);
});
// start spm server
gulp.task('spm-doc', function() {
var sd = cp.exec('spm doc');
// sd.stdout.on('data', function(data) {
// console.log(data);
// });
sd.stderr.on('data', function(data) {
console.log(data);
});
sd.on('exit', function(code) {
console.log('process spm doc exit with code ' + code);
});
});
//生成发布目录,可用于上传测试机
gulp.task('ge', ['assets', 'compass-production', 'build']);
//发布
gulp.task('dist', ['assets', 'compass-production', 'build'], function() {
var ftpstream = ftp(ftpConfig);
return gulp.src('dist/**/')
.pipe(ftpstream)
.pipe(gutil.noop());
});
//font+img->dist/assets
gulp.task('assets', function() {
gulp.src('img/**')
.pipe(gulp.dest(distDir.img));
gulp.src('font/*')
.pipe(gulp.dest(distDir.font));
});
//compass
gulp.task('compass-production', ['assets'], function() {
gulp.src('sass/index.scss')
.pipe(
compass({
css: distDir.css,
sass: 'sass',
image: distDir.img,
font: distDir.font,
http_path: '/',
style: 'compressed'
})
)
.on('error', function(error) {
console.log(error);
this.emit('end');
});
});
//spm build
gulp.task('build', ['libs', 'business']);
//libs
gulp.task('libs', ['pre-libs', 'concat-min-libs', 'clear-libs']);
gulp.task('pre-libs', function() {
var obj = {
name: '',
version: config.version,
spm: config.spm
};
var packages = [],
libsjs = '';
var libCon, key, i;
var pkg;
obj.spm.main = 'libs.js';
obj.spm.buildArgs = '--idleading {{}} --include all';
libCon = JSON.stringify(obj);
fs.renameSync('package.json', 'package.bak.json');
fs.writeFileSync('package.json', libCon);
for (key in obj.spm.dependencies) {
if (obj.spm.inside && obj.spm.inside[key]) {
packages.push(obj.spm.inside[key]);
} else {
packages.push(key);
}
}
for (i = 0; i < packages.length; i++) {
libsjs += 'require("' + packages[i] + '");';
}
fs.writeFileSync('libs.js', libsjs); //重写入口文件
pkg = new Package(__dirname);
return gulp.src(pkg.main)
.pipe(transport({
pkg: pkg
}))
.pipe(gulp.dest(distDir.js));
});
gulp.task('concat-min-libs', ['pre-libs'], function() {
var path = distDir.js + '/libs.js';
var jsStr = fs.readFileSync(path).toString();
fs.writeFileSync(path, jsStr.substr(jsStr.indexOf('});') + 4));
return gulp.src(['js/sea.js', distDir.js + '/libs.js'])
.pipe(concat('lib.js'))
.pipe(uglify())
.pipe(gulp.dest(distDir.js));
});
gulp.task('clear-libs', ['concat-min-libs'], function() {
fs.renameSync('package.bak.json', 'package.json');
fs.unlinkSync('./libs.js');
fs.unlinkSync(distDir.js + '/libs.js');
});
gulp.task('business', ['libs'], function() {
var pkg = new Package(__dirname);
return gulp.src(pkg.main)
.pipe(transport({
pkg: pkg
}))
.pipe(concat('index-debug.js'))
.pipe(gulp.dest(distDir.js))
.pipe(uglify())
.pipe(concat('index.js'))
.pipe(gulp.dest(distDir.js));
});
\ No newline at end of file
... ...
... ... @@ -2,10 +2,10 @@
* GULP-FILE
* author: xuqi(qi.xu@yoho.cn)
* date: 2015/9/30
* 根据 PC 版修改为 H5 版, 毕凯
*/
var gulp = require('gulp'),
compass = require('gulp-compass'),
cp = require('child_process');
var fs = require('fs'),
... ... @@ -16,7 +16,11 @@ var fs = require('fs'),
transport = require('gulp-spm'),
concat = require('gulp-concat');
var config = JSON.parse(fs.readFileSync('./package.json').toString());
var postcss = require('gulp-postcss');
var sourcemaps = require('gulp-sourcemaps');
var cssnano = require('gulp-cssnano');
var config = require('./package');
var rootDist = 'dist/myohobuy/',
ftpConfig = {
... ... @@ -32,31 +36,112 @@ var distDir = {
font: rootDist + 'assets/font'
};
gulp.task('default', ['compass', 'compass-watch', 'spm-doc']);
// compass
gulp.task('compass', function() {
gulp.src('sass/**/*.scss')
.pipe(
compass({
config_file: 'config.rb',
css: 'css',
sass: 'sass'
})
).on('error', function(error) {
console.log(error);
this.emit('end');
gulp.task('default', ['postcss-dev', 'postcss-watch', 'spm-doc']);
//根据环境变量生成postcss插件配置
function postcssEnvPlugin(env) {
var sprites = {
spritesmith: {
padding: 4
},
groupBy: function(file) {
// 根据目录分组,防止合并后的图片太大
var group = file.url.split('/')[1];
file.retina = true; // H5 强制所有图片都是用二倍图
return group ? Promise.resolve(group) : Promise.reject();
},
filterBy: function(file) {
//使用resolve转化后静态资源生成../img或者../assets/img/的路径
if (/\/img/.test(file.url) || /data:image/.test(file.url)) {
return Promise.reject();
}
return Promise.resolve();
}
},
assets;
if (env === 'DEV') {
assets = {
loadPaths: ['font/', 'img/'],
relativeTo: 'css/'
};
Object.assign(sprites, {
basePath: './img',
stylesheetPath: './css',
spritePath: './img'
});
} else if (env === 'PRO') {
assets = {
loadPaths: [distDir.img, distDir.font],
relativeTo: distDir.css,
cachebuster: function(filePath, urlPathname) {
//只给字体加no-cache
if (/font\//.test(urlPathname)) {
return fs.statSync(filePath).mtime.getTime().toString(16);
}
}
};
Object.assign(sprites, {
basePath: distDir.img,
stylesheetPath: distDir.css,
spritePath: distDir.img
});
}
return [
require('precss'),
require('postcss-assets')(assets),
require('postcss-sprites').default(sprites),
require('postcss-calc'),
require('postcss-pxtorem')({
rootValue: 40,
unitPrecision: 5, // 保留5位小数字
minPixelValue: 2, // 小于 2px 时,不转换, 单位为 PX 大写的时候不转换
selectorBlackList: [], // 选择器黑名单,可以使用正则
propWhiteList: [] // 属性名称为空,表示替换所有属性的值
}),
require('autoprefixer')({
browsers: ['> 1%']
}),
//可选
require('postcss-use')({
modules: ['postcss-clearfix', 'postcss-crip', 'postcss-short', 'postcss-center', 'postcss-position']
})
];
}
//Postcss开发环境
gulp.task('postcss-dev', function() {
return gulp.src('sass/index.css')
.pipe(sourcemaps.init())
.pipe(postcss(postcssEnvPlugin('DEV')))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('css/'))
});
gulp.task('postcss-watch', function() {
gulp.watch('sass/**/*.css', ['postcss-dev']);
});
// compass watch
gulp.task('compass-watch', function() {
gulp.watch('sass/**/*.scss', ['compass']);
//Postcss正式环境生成
gulp.task('postcss-pro', ['assets'], function() {
return gulp.src('sass/index.css')
.pipe(postcss(postcssEnvPlugin('PRO')))
.pipe(cssnano())
.pipe(gulp.dest(distDir.css))
});
// start spm server
gulp.task('spm-doc', function() {
var sd = cp.exec('spm doc');
var sd = cp.exec('spm doc watch --port 8000'); // PC 用8001,H5 用8000, 跑两个服务器,不冲突
// sd.stdout.on('data', function(data) {
// console.log(data);
... ... @@ -72,10 +157,10 @@ gulp.task('spm-doc', function() {
});
//生成发布目录,可用于上传测试机
gulp.task('ge', ['assets', 'compass-production', 'build']);
gulp.task('ge', ['assets', 'postcss-pro', 'build']);
//发布
gulp.task('dist', ['assets', 'compass-production', 'build'], function() {
gulp.task('dist', ['assets', 'postcss-pro', 'build'], function() {
var ftpstream = ftp(ftpConfig);
return gulp.src('dist/**/')
... ... @@ -84,30 +169,16 @@ gulp.task('dist', ['assets', 'compass-production', 'build'], function() {
});
//font+img->dist/assets
gulp.task('assets', function() {
gulp.src('img/**')
gulp.task('assets', ['img', 'font']);
gulp.task('img', function() {
return gulp.src('img/**/*')
.pipe(gulp.dest(distDir.img));
gulp.src('font/*')
.pipe(gulp.dest(distDir.font));
});
//compass
gulp.task('compass-production', ['assets'], function() {
gulp.src('sass/index.scss')
.pipe(
compass({
css: distDir.css,
sass: 'sass',
image: distDir.img,
font: distDir.font,
http_path: '/',
style: 'compressed'
})
)
.on('error', function(error) {
console.log(error);
this.emit('end');
});
gulp.task('font', function() {
return gulp.src('font/*')
.pipe(gulp.dest(distDir.font))
});
//spm build
... ... @@ -166,7 +237,7 @@ gulp.task('concat-min-libs', ['pre-libs'], function() {
fs.writeFileSync(path, jsStr.substr(jsStr.indexOf('});') + 4));
return gulp.src(['js/sea.js', distDir.js + '/libs.js'])
return gulp.src(['plugin/sea.js', distDir.js + '/libs.js'])
.pipe(concat('lib.js'))
.pipe(uglify())
.pipe(gulp.dest(distDir.js));
... ... @@ -190,4 +261,4 @@ gulp.task('business', ['libs'], function() {
.pipe(uglify())
.pipe(concat('index.js'))
.pipe(gulp.dest(distDir.js));
});
\ No newline at end of file
});
... ...
... ... @@ -217,6 +217,12 @@ $('.btn-balance').on('touchend', function() {
});
$('.off-shell-goods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('icon-del')) {
return;
}
tip.show('商品已下架');
return false;
});
... ...
... ... @@ -178,11 +178,6 @@ $('.icon-edit').on('touchstart', function(e) {
$('.icon-del').on('touchstart', function(e) {
var $this = $(this);
if ($this.parents('.off-shell-goods').length) {
tip.show('商品已下架');
return false;
}
e.stopPropagation();
dialog.showDialog({
... ...
... ... @@ -14,7 +14,8 @@ var $ = require('jquery'),
recommendSwiper,
hotBrandsSwiper,
trendTopicSwiper,
goodsSwiper;
goodsSwiper,
freshSwiper;
var start = 0,
swiperClass,
... ... @@ -50,12 +51,12 @@ function hideSideBar() {
}
}
$('.overlay').on('touchstart', function(e) {
$overlay.on('touchstart', function() {
hideSideBar();
return false;
});
$sideNav.on('touchmove', function(e) {
$sideNav.on('touchmove scroll', function() {
return false;
});
... ... @@ -75,13 +76,14 @@ $sideNav.on('touchend', 'li', function(e) {
// 返回一级导航,收起二级导航
$subNav.each(function() {
$(this).find('li').eq(0).on('touchend', function() {
$(this).find('li').eq(0).on('touchstart', function() {
$sideNav.css('pointer-events', 'none');
setTimeout(function() {
$('.sub-nav').removeClass('show');
$sideNav.css('pointer-events', 'auto');
}, 400);
$('.sub-nav').removeClass('show');
});
}).on('touchstart', function(e) {
if (e.currentTarget !== e.target) {
... ... @@ -144,6 +146,17 @@ if ($('.trend-topic-swiper').find('li').size() > 1) {
});
}
// 新人专享轮播
if ($('.fresh-list-swiper').find('li').size() > 1) {
freshSwiper = new Swiper('.fresh-list-swiper', {
lazyLoading: true,
lazyLoadingInPrevNext: true,
grabCursor: true,
slidesPerView: 'auto',
slideElement: 'li'
});
}
// 潮流上装/经典裤装等轮播
$('.category-swiper').each(function(i, index) {
swiperClass = 'category-swiper' + i;
... ...
... ... @@ -6,8 +6,9 @@
var $ = require('jquery');
var lazyLoad = require('yoho.lazyload');
var load = require('../plugin/loading');
var lazyLoad = require('yoho.lazyload'),
load = require('../plugin/loading'),
tip = require('../plugin/tip');
var dialog = require('./dialog');
... ... @@ -126,3 +127,13 @@ $('.deps').on('touchstart', 'span', function() {
}).on('touchend touchcancel', 'span', function() {
$(this).css('background', 'transparent');
});
$('.invalidGoods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('del-icon')) {
return;
}
tip.show('商品已下架');
return false;
});
\ No newline at end of file
... ...
... ... @@ -37,7 +37,8 @@ function getInstance() {
return dialogTemplate;
}
exports.showDialog = function(data, callback, callbackForLeft) {
// fullWithBtn是供详情页获取限购码使用的特殊参数
exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
var dialogTemplate = getInstance(),
dialogStr = dialogTemplate(data),
... ... @@ -51,6 +52,8 @@ exports.showDialog = function(data, callback, callbackForLeft) {
$dialogBox = $('.dialog-box');
$dialogWrapper = $('.dialog-wrapper');
dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));
// 显示
... ... @@ -62,6 +65,15 @@ exports.showDialog = function(data, callback, callbackForLeft) {
$dialogWrapper.fadeIn();
}
if (fullWithBtn) {
$('.dialog-wrapper .dialog-footer > span').css('width', '100%');
$('.dialog-wrapper .dialog-content').css({
'padding-left': '1.85rem',
'padding-right': '1.85rem'
});
$dialogWrapper.css('z-index', '10');
}
$dialogBox.css({
top: '50%',
marginTop: -($dialogBox.height() / 2)
... ...
... ... @@ -256,3 +256,13 @@ $(document).on('touchend', '.swiper-header', function() {
window.location.href = url;
}
});
$('.invalidGoods').on('touchstart touchend', function() {
var $this = $(e.target).closest('span');
if ($this.hasClass('del-fav')) {
return;
}
tip.show('商品已下架');
return false;
});
\ No newline at end of file
... ...
... ... @@ -18,6 +18,11 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
var $cart = $('.cart-bar');
var limitSaleBtn = document.getElementById('limit-sale'),
limitSaleHammer = limitSaleBtn && new Hammer(limitSaleBtn);
var dialog = require('../../me/dialog');
//add extra marign-bottom for footer to show the yoho copyright
function showFooter() {
var $cartBar = $('.cart-bar');
... ... @@ -75,6 +80,25 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
});
}
limitSaleHammer ? limitSaleHammer.on('tap', function(e) {
e.srcEvent.stopPropagation();
dialog.showDialog({
dialogText: '进入有货APP尖货频道分享\n以获取限购码',
hasFooter: {
rightBtnText: '打开Yoho!Buy有货APP'
}
}, function() {
console.log('111');
}, undefined, true);
$('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {
e.stopPropagation();
if ($(e.target).hasClass('dialog-wrapper')) {
dialog.hideDialog();
}
});
}) : null;
require('./desc');
require('./comments-consults');
require('../recommend-for-you-product-desc');
... ...
... ... @@ -34,18 +34,33 @@
}
},
"devDependencies": {
"autoprefixer": "^6.3.3",
"father": "^1.0.0",
"gulp": "^3.9.0",
"gulp-compass": "^2.1.0",
"gulp-concat": "^2.6.0",
"gulp-cssnano": "^2.1.1",
"gulp-ftp": "^1.0.4",
"gulp-postcss": "^6.1.0",
"gulp-sourcemaps": "^1.6.0",
"gulp-spm": "^0.11.3",
"gulp-uglify": "^1.4.2",
"gulp-util": "^3.0.6",
"spm": "3"
"postcss-assets": "^4.0.1",
"postcss-calc": "^5.2.0",
"postcss-center": "^1.0.0",
"postcss-clearfix": "^0.2.1",
"postcss-crip": "^2.0.0",
"postcss-position": "^0.4.0",
"postcss-pxtorem": "^3.3.1",
"postcss-short": "^1.4.0",
"postcss-sprites": "^3.1.0",
"postcss-use": "^2.0.2",
"precss": "^1.4.0",
"spm": "3.4"
},
"scripts": {
"test": "spm test",
"build": "spm build"
}
}
\ No newline at end of file
}
... ...
@import "header-download", "banner-top","banner-center","banner-bottom", "side-nav", "floor-header", "hot-brands", "fine-brands", "creative-life", "plus-star", "maybe-like",
"icons-enter","trendsetter-collocation",
"trend-topics","goods-category","hot-brands", "hot-category", "home-header", "thumb-row";
"trend-topics","goods-category","hot-brands", "hot-category", "home-header", "thumb-row", "fresh-only";
.mobile-container{
width: 100%;
... ...
... ... @@ -276,6 +276,7 @@ $basicBtnC:#eb0313;
}
}
.price-date {
position: relative;
width: 100%;
color: $subFontC;
height: pxToRem(88px);
... ... @@ -284,6 +285,30 @@ $basicBtnC:#eb0313;
background-color: #fff;
border-bottom: 1px solid $borderC;
}
.limit-sale {
position: absolute;
right: pxToRem(84px);
top: pxToRem(24px);
color: #d0021b;
border: 2px solid #d0021b;
background-color: #fff;
border-radius: pxToRem(40px);
padding: pxToRem(4px) pxToRem(20px);
font-size: pxToRem(24px);
font-weight: bold;
}
.limit-sale:active {
background-color: #f0f0f0;
}
.got-limit-sale {
@extend .limit-sale;
color: #ccc;
border-color: #ccc;
}
.goodsPrice {
float: left;
font-size: pxToRem(34.59px);
... ... @@ -367,7 +392,7 @@ $basicBtnC:#eb0313;
}
.goodsDiscount {
display: block;
width: 100%;
width: 100%;
height:auto;
font-size: pxToRem(28px);
color: $mainFontC;
... ...