Authored by 毕凯

Merge branch 'feature/wap/postcss' into develop/wap

Showing 100 changed files with 645 additions and 53 deletions

Too many changes to show.

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

@@ -248,16 +248,23 @@ class CartData @@ -248,16 +248,23 @@ class CartData
248 * 248 *
249 * @param int $uid 用户ID 249 * @param int $uid 用户ID
250 * @param string $cartType 购物车类型,ordinary表示普通购物车 250 * @param string $cartType 购物车类型,ordinary表示普通购物车
251 - * @param int $isUseYohoCoin 是否使用有货币,默认0不使用, 1使用 251 + * @param int $isUseYohoCoin 是否使用有货币,0不使用, 1使用
  252 + * @param string $skuList 购买限购商品时需要传递的参数
252 * @return array 接口返回的数据 253 * @return array 接口返回的数据
253 */ 254 */
254 - public static function cartPay($uid, $cartType, $isUseYohoCoin = 0) 255 + public static function cartPay($uid, $cartType, $isUseYohoCoin, $skuList)
255 { 256 {
256 $param = Yohobuy::param(); 257 $param = Yohobuy::param();
257 $param['method'] = 'app.Shopping.payment'; 258 $param['method'] = 'app.Shopping.payment';
258 $param['cart_type'] = $cartType; 259 $param['cart_type'] = $cartType;
259 $param['yoho_coin_mode'] = $isUseYohoCoin; 260 $param['yoho_coin_mode'] = $isUseYohoCoin;
260 $param['uid'] = $uid; 261 $param['uid'] = $uid;
  262 +
  263 + // 购买限购商品时需要传递product_sku_list参数
  264 + if (!empty($skuList)) {
  265 + $param['product_sku_list'] = $skuList;
  266 + }
  267 +
261 $param['client_secret'] = Sign::getSign($param); 268 $param['client_secret'] = Sign::getSign($param);
262 269
263 return Yohobuy::get(Yohobuy::API_URL, $param); 270 return Yohobuy::get(Yohobuy::API_URL, $param);
@@ -272,9 +279,10 @@ class CartData @@ -272,9 +279,10 @@ class CartData
272 * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款 279 * @param int $paymentType 支付方式,1表示在线支付,2表示货到付款
273 * @param string $couponCode 优惠券码 280 * @param string $couponCode 优惠券码
274 * @param mixed $yohoCoin 使用的YOHO币数量 281 * @param mixed $yohoCoin 使用的YOHO币数量
  282 + * @param string $skuList 购买限购商品时需要传递的参数
275 * @return array 接口返回的数据 283 * @return array 接口返回的数据
276 */ 284 */
277 - public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin) 285 + public static function orderCompute($uid, $cartType, $deliveryWay, $paymentType, $couponCode, $yohoCoin, $skuList)
278 { 286 {
279 $param = Yohobuy::param(); 287 $param = Yohobuy::param();
280 $param['method'] = 'app.Shopping.compute'; 288 $param['method'] = 'app.Shopping.compute';
@@ -288,6 +296,11 @@ class CartData @@ -288,6 +296,11 @@ class CartData
288 $param['use_yoho_coin'] = $yohoCoin; 296 $param['use_yoho_coin'] = $yohoCoin;
289 } 297 }
290 298
  299 + // 购买限购商品时需要传递product_sku_list参数
  300 + if (!empty($skuList)) {
  301 + $param['product_sku_list'] = $skuList;
  302 + }
  303 +
291 $param['uid'] = $uid; 304 $param['uid'] = $uid;
292 $param['client_secret'] = Sign::getSign($param); 305 $param['client_secret'] = Sign::getSign($param);
293 306
@@ -346,9 +359,10 @@ class CartData @@ -346,9 +359,10 @@ class CartData
346 * @param string $remark 留言 359 * @param string $remark 留言
347 * @param string $couponCode 优惠券码 360 * @param string $couponCode 优惠券码
348 * @param mixed $yohoCoin 使用的YOHO币数量或为空 361 * @param mixed $yohoCoin 使用的YOHO币数量或为空
  362 + * @param string $skuList 购买限购商品时需要传递的参数
349 * @return array 接口返回的数据 363 * @return array 接口返回的数据
350 */ 364 */
351 - public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin) 365 + public static function orderSub($uid, $addressId, $cartType, $deliveryTime, $deliveryWay, $invoiceTitle, $invoiceId, $paymentId, $paymentType, $remark, $couponCode, $yohoCoin, $skuList)
352 { 366 {
353 $param = Yohobuy::param(); 367 $param = Yohobuy::param();
354 $param['debug'] = 'Y'; 368 $param['debug'] = 'Y';
@@ -375,6 +389,12 @@ class CartData @@ -375,6 +389,12 @@ class CartData
375 if (!empty($yohoCoin)) { 389 if (!empty($yohoCoin)) {
376 $param['use_yoho_coin'] = $yohoCoin; 390 $param['use_yoho_coin'] = $yohoCoin;
377 } 391 }
  392 +
  393 + // 购买限购商品时需要传递product_sku_list参数
  394 + if (!empty($skuList)) {
  395 + $param['product_sku_list'] = $skuList;
  396 + }
  397 +
378 $param['uid'] = $uid; 398 $param['uid'] = $uid;
379 $param['client_secret'] = Sign::getSign($param); 399 $param['client_secret'] = Sign::getSign($param);
380 400
@@ -35,6 +35,20 @@ class UserData @@ -35,6 +35,20 @@ class UserData
35 } 35 }
36 36
37 /** 37 /**
  38 + * 获取个人中心公告有关数据
  39 + *
  40 + * @return mixed
  41 + */
  42 + public static function noticeData()
  43 + {
  44 + $param = Yohobuy::param();
  45 + $param['method'] = 'app.resources.getNotices';
  46 + $param['client_secret'] = Sign::getSign($param);
  47 +
  48 + return Yohobuy::get(Yohobuy::API_URL, $param);
  49 + }
  50 +
  51 + /**
38 * 个人中心页面优惠券,收藏的商品等的数目数据 52 * 个人中心页面优惠券,收藏的商品等的数目数据
39 * 53 *
40 * @param int $uid 用户ID 54 * @param int $uid 用户ID
  1 +/**
  2 + * GULP-FILE
  3 + * author: xuqi(qi.xu@yoho.cn)
  4 + * date: 2015/9/30
  5 + */
  6 +
  7 +var gulp = require('gulp'),
  8 + compass = require('gulp-compass'),
  9 + cp = require('child_process');
  10 +
  11 +var fs = require('fs'),
  12 + ftp = require('gulp-ftp'),
  13 + gutil = require('gulp-util'),
  14 + uglify = require('gulp-uglify'),
  15 + Package = require('father').SpmPackage,
  16 + transport = require('gulp-spm'),
  17 + concat = require('gulp-concat');
  18 +
  19 +var config = JSON.parse(fs.readFileSync('./package.json').toString());
  20 +
  21 +var rootDist = 'dist/myohobuy/',
  22 + ftpConfig = {
  23 + host: '218.94.75.58',
  24 + user: 'php',
  25 + pass: 'yoho9646'
  26 + };
  27 +
  28 +var distDir = {
  29 + js: rootDist + config.version,
  30 + css: rootDist + config.version,
  31 + img: rootDist + 'assets/img',
  32 + font: rootDist + 'assets/font'
  33 +};
  34 +
  35 +gulp.task('default', ['compass', 'compass-watch', 'spm-doc']);
  36 +
  37 +// compass
  38 +gulp.task('compass', function() {
  39 + gulp.src('sass/**/*.scss')
  40 + .pipe(
  41 + compass({
  42 + config_file: 'config.rb',
  43 + css: 'css',
  44 + sass: 'sass'
  45 + })
  46 + ).on('error', function(error) {
  47 + console.log(error);
  48 + this.emit('end');
  49 + });
  50 +});
  51 +
  52 +// compass watch
  53 +gulp.task('compass-watch', function() {
  54 + gulp.watch('sass/**/*.scss', ['compass']);
  55 +});
  56 +
  57 +// start spm server
  58 +gulp.task('spm-doc', function() {
  59 + var sd = cp.exec('spm doc');
  60 +
  61 + // sd.stdout.on('data', function(data) {
  62 + // console.log(data);
  63 + // });
  64 +
  65 + sd.stderr.on('data', function(data) {
  66 + console.log(data);
  67 + });
  68 +
  69 + sd.on('exit', function(code) {
  70 + console.log('process spm doc exit with code ' + code);
  71 + });
  72 +});
  73 +
  74 +//生成发布目录,可用于上传测试机
  75 +gulp.task('ge', ['assets', 'compass-production', 'build']);
  76 +
  77 +//发布
  78 +gulp.task('dist', ['assets', 'compass-production', 'build'], function() {
  79 + var ftpstream = ftp(ftpConfig);
  80 +
  81 + return gulp.src('dist/**/')
  82 + .pipe(ftpstream)
  83 + .pipe(gutil.noop());
  84 +});
  85 +
  86 +//font+img->dist/assets
  87 +gulp.task('assets', function() {
  88 + gulp.src('img/**')
  89 + .pipe(gulp.dest(distDir.img));
  90 + gulp.src('font/*')
  91 + .pipe(gulp.dest(distDir.font));
  92 +});
  93 +
  94 +//compass
  95 +gulp.task('compass-production', ['assets'], function() {
  96 + gulp.src('sass/index.scss')
  97 + .pipe(
  98 + compass({
  99 + css: distDir.css,
  100 + sass: 'sass',
  101 + image: distDir.img,
  102 + font: distDir.font,
  103 + http_path: '/',
  104 + style: 'compressed'
  105 + })
  106 + )
  107 + .on('error', function(error) {
  108 + console.log(error);
  109 + this.emit('end');
  110 + });
  111 +});
  112 +
  113 +//spm build
  114 +gulp.task('build', ['libs', 'business']);
  115 +
  116 +//libs
  117 +gulp.task('libs', ['pre-libs', 'concat-min-libs', 'clear-libs']);
  118 +
  119 +gulp.task('pre-libs', function() {
  120 + var obj = {
  121 + name: '',
  122 + version: config.version,
  123 + spm: config.spm
  124 + };
  125 + var packages = [],
  126 + libsjs = '';
  127 +
  128 + var libCon, key, i;
  129 +
  130 + var pkg;
  131 +
  132 + obj.spm.main = 'libs.js';
  133 + obj.spm.buildArgs = '--idleading {{}} --include all';
  134 +
  135 + libCon = JSON.stringify(obj);
  136 +
  137 + fs.renameSync('package.json', 'package.bak.json');
  138 + fs.writeFileSync('package.json', libCon);
  139 +
  140 + for (key in obj.spm.dependencies) {
  141 + if (obj.spm.inside && obj.spm.inside[key]) {
  142 + packages.push(obj.spm.inside[key]);
  143 + } else {
  144 + packages.push(key);
  145 + }
  146 + }
  147 +
  148 + for (i = 0; i < packages.length; i++) {
  149 + libsjs += 'require("' + packages[i] + '");';
  150 + }
  151 +
  152 + fs.writeFileSync('libs.js', libsjs); //重写入口文件
  153 +
  154 + pkg = new Package(__dirname);
  155 +
  156 + return gulp.src(pkg.main)
  157 + .pipe(transport({
  158 + pkg: pkg
  159 + }))
  160 + .pipe(gulp.dest(distDir.js));
  161 +});
  162 +
  163 +gulp.task('concat-min-libs', ['pre-libs'], function() {
  164 + var path = distDir.js + '/libs.js';
  165 + var jsStr = fs.readFileSync(path).toString();
  166 +
  167 + fs.writeFileSync(path, jsStr.substr(jsStr.indexOf('});') + 4));
  168 +
  169 + return gulp.src(['js/sea.js', distDir.js + '/libs.js'])
  170 + .pipe(concat('lib.js'))
  171 + .pipe(uglify())
  172 + .pipe(gulp.dest(distDir.js));
  173 +});
  174 +
  175 +gulp.task('clear-libs', ['concat-min-libs'], function() {
  176 + fs.renameSync('package.bak.json', 'package.json');
  177 + fs.unlinkSync('./libs.js');
  178 + fs.unlinkSync(distDir.js + '/libs.js');
  179 +});
  180 +
  181 +gulp.task('business', ['libs'], function() {
  182 + var pkg = new Package(__dirname);
  183 +
  184 + return gulp.src(pkg.main)
  185 + .pipe(transport({
  186 + pkg: pkg
  187 + }))
  188 + .pipe(concat('index-debug.js'))
  189 + .pipe(gulp.dest(distDir.js))
  190 + .pipe(uglify())
  191 + .pipe(concat('index.js'))
  192 + .pipe(gulp.dest(distDir.js));
  193 +});
@@ -2,10 +2,10 @@ @@ -2,10 +2,10 @@
2 * GULP-FILE 2 * GULP-FILE
3 * author: xuqi(qi.xu@yoho.cn) 3 * author: xuqi(qi.xu@yoho.cn)
4 * date: 2015/9/30 4 * date: 2015/9/30
  5 + * 根据 PC 版修改为 H5 版, 毕凯
5 */ 6 */
6 7
7 var gulp = require('gulp'), 8 var gulp = require('gulp'),
8 - compass = require('gulp-compass'),  
9 cp = require('child_process'); 9 cp = require('child_process');
10 10
11 var fs = require('fs'), 11 var fs = require('fs'),
@@ -16,7 +16,11 @@ var fs = require('fs'), @@ -16,7 +16,11 @@ var fs = require('fs'),
16 transport = require('gulp-spm'), 16 transport = require('gulp-spm'),
17 concat = require('gulp-concat'); 17 concat = require('gulp-concat');
18 18
19 -var config = JSON.parse(fs.readFileSync('./package.json').toString()); 19 +var postcss = require('gulp-postcss');
  20 +var sourcemaps = require('gulp-sourcemaps');
  21 +var cssnano = require('gulp-cssnano');
  22 +
  23 +var config = require('./package');
20 24
21 var rootDist = 'dist/myohobuy/', 25 var rootDist = 'dist/myohobuy/',
22 ftpConfig = { 26 ftpConfig = {
@@ -32,31 +36,112 @@ var distDir = { @@ -32,31 +36,112 @@ var distDir = {
32 font: rootDist + 'assets/font' 36 font: rootDist + 'assets/font'
33 }; 37 };
34 38
35 -gulp.task('default', ['compass', 'compass-watch', 'spm-doc']);  
36 -  
37 -// compass  
38 -gulp.task('compass', function() {  
39 - gulp.src('sass/**/*.scss')  
40 - .pipe(  
41 - compass({  
42 - config_file: 'config.rb',  
43 - css: 'css',  
44 - sass: 'sass'  
45 - })  
46 - ).on('error', function(error) {  
47 - console.log(error);  
48 - this.emit('end'); 39 +gulp.task('default', ['postcss-dev', 'postcss-watch', 'spm-doc']);
  40 +
  41 +
  42 +//根据环境变量生成postcss插件配置
  43 +function postcssEnvPlugin(env) {
  44 + var sprites = {
  45 + spritesmith: {
  46 + padding: 4
  47 + },
  48 + groupBy: function(file) {
  49 +
  50 + // 根据目录分组,防止合并后的图片太大
  51 + var group = file.url.split('/')[1];
  52 +
  53 + file.retina = true; // H5 强制所有图片都是用二倍图
  54 + return group ? Promise.resolve(group) : Promise.reject();
  55 + },
  56 + filterBy: function(file) {
  57 +
  58 + //使用resolve转化后静态资源生成../img或者../assets/img/的路径
  59 + if (/\/img/.test(file.url) || /data:image/.test(file.url)) {
  60 + return Promise.reject();
  61 + }
  62 + return Promise.resolve();
  63 + }
  64 + },
  65 + assets;
  66 +
  67 + if (env === 'DEV') {
  68 + assets = {
  69 + loadPaths: ['font/', 'img/'],
  70 + relativeTo: 'css/'
  71 + };
  72 +
  73 + Object.assign(sprites, {
  74 + basePath: './img',
  75 + stylesheetPath: './css',
  76 + spritePath: './img'
  77 + });
  78 + } else if (env === 'PRO') {
  79 + assets = {
  80 + loadPaths: [distDir.img, distDir.font],
  81 + relativeTo: distDir.css,
  82 + cachebuster: function(filePath, urlPathname) {
  83 +
  84 + //只给字体加no-cache
  85 + if (/font\//.test(urlPathname)) {
  86 + return fs.statSync(filePath).mtime.getTime().toString(16);
  87 + }
  88 + }
  89 + };
  90 +
  91 + Object.assign(sprites, {
  92 + basePath: distDir.img,
  93 + stylesheetPath: distDir.css,
  94 + spritePath: distDir.img
49 }); 95 });
  96 + }
  97 +
  98 + return [
  99 + require('precss'),
  100 + require('postcss-assets')(assets),
  101 + require('postcss-sprites').default(sprites),
  102 + require('postcss-calc'),
  103 + require('postcss-pxtorem')({
  104 + rootValue: 40,
  105 + unitPrecision: 5, // 保留5位小数字
  106 + minPixelValue: 2, // 小于 2px 时,不转换, 单位为 PX 大写的时候不转换
  107 + selectorBlackList: [], // 选择器黑名单,可以使用正则
  108 + propWhiteList: [] // 属性名称为空,表示替换所有属性的值
  109 + }),
  110 + require('autoprefixer')({
  111 + browsers: ['> 1%']
  112 + }),
  113 +
  114 + //可选
  115 + require('postcss-use')({
  116 + modules: ['postcss-clearfix', 'postcss-crip', 'postcss-short', 'postcss-center', 'postcss-position']
  117 + })
  118 + ];
  119 +}
  120 +
  121 +//Postcss开发环境
  122 +gulp.task('postcss-dev', function() {
  123 + return gulp.src('sass/index.css')
  124 + .pipe(sourcemaps.init())
  125 + .pipe(postcss(postcssEnvPlugin('DEV')))
  126 + .pipe(sourcemaps.write('.'))
  127 + .pipe(gulp.dest('css/'))
  128 +});
  129 +
  130 +gulp.task('postcss-watch', function() {
  131 + gulp.watch('sass/**/*.css', ['postcss-dev']);
50 }); 132 });
51 133
52 -// compass watch  
53 -gulp.task('compass-watch', function() {  
54 - gulp.watch('sass/**/*.scss', ['compass']); 134 +//Postcss正式环境生成
  135 +gulp.task('postcss-pro', ['assets'], function() {
  136 + return gulp.src('sass/index.css')
  137 + .pipe(postcss(postcssEnvPlugin('PRO')))
  138 + .pipe(cssnano())
  139 + .pipe(gulp.dest(distDir.css))
55 }); 140 });
56 141
57 // start spm server 142 // start spm server
58 gulp.task('spm-doc', function() { 143 gulp.task('spm-doc', function() {
59 - var sd = cp.exec('spm doc'); 144 + var sd = cp.exec('spm doc watch --port 8000'); // PC 用8001,H5 用8000, 跑两个服务器,不冲突
60 145
61 // sd.stdout.on('data', function(data) { 146 // sd.stdout.on('data', function(data) {
62 // console.log(data); 147 // console.log(data);
@@ -72,10 +157,10 @@ gulp.task('spm-doc', function() { @@ -72,10 +157,10 @@ gulp.task('spm-doc', function() {
72 }); 157 });
73 158
74 //生成发布目录,可用于上传测试机 159 //生成发布目录,可用于上传测试机
75 -gulp.task('ge', ['assets', 'compass-production', 'build']); 160 +gulp.task('ge', ['assets', 'postcss-pro', 'build']);
76 161
77 //发布 162 //发布
78 -gulp.task('dist', ['assets', 'compass-production', 'build'], function() { 163 +gulp.task('dist', ['assets', 'postcss-pro', 'build'], function() {
79 var ftpstream = ftp(ftpConfig); 164 var ftpstream = ftp(ftpConfig);
80 165
81 return gulp.src('dist/**/') 166 return gulp.src('dist/**/')
@@ -84,30 +169,16 @@ gulp.task('dist', ['assets', 'compass-production', 'build'], function() { @@ -84,30 +169,16 @@ gulp.task('dist', ['assets', 'compass-production', 'build'], function() {
84 }); 169 });
85 170
86 //font+img->dist/assets 171 //font+img->dist/assets
87 -gulp.task('assets', function() {  
88 - gulp.src('img/**') 172 +gulp.task('assets', ['img', 'font']);
  173 +
  174 +gulp.task('img', function() {
  175 + return gulp.src('img/**/*')
89 .pipe(gulp.dest(distDir.img)); 176 .pipe(gulp.dest(distDir.img));
90 - gulp.src('font/*')  
91 - .pipe(gulp.dest(distDir.font));  
92 }); 177 });
93 178
94 -//compass  
95 -gulp.task('compass-production', ['assets'], function() {  
96 - gulp.src('sass/index.scss')  
97 - .pipe(  
98 - compass({  
99 - css: distDir.css,  
100 - sass: 'sass',  
101 - image: distDir.img,  
102 - font: distDir.font,  
103 - http_path: '/',  
104 - style: 'compressed'  
105 - })  
106 - )  
107 - .on('error', function(error) {  
108 - console.log(error);  
109 - this.emit('end');  
110 - }); 179 +gulp.task('font', function() {
  180 + return gulp.src('font/*')
  181 + .pipe(gulp.dest(distDir.font))
111 }); 182 });
112 183
113 //spm build 184 //spm build
@@ -166,7 +237,7 @@ gulp.task('concat-min-libs', ['pre-libs'], function() { @@ -166,7 +237,7 @@ gulp.task('concat-min-libs', ['pre-libs'], function() {
166 237
167 fs.writeFileSync(path, jsStr.substr(jsStr.indexOf('});') + 4)); 238 fs.writeFileSync(path, jsStr.substr(jsStr.indexOf('});') + 4));
168 239
169 - return gulp.src(['js/sea.js', distDir.js + '/libs.js']) 240 + return gulp.src(['plugin/sea.js', distDir.js + '/libs.js'])
170 .pipe(concat('lib.js')) 241 .pipe(concat('lib.js'))
171 .pipe(uglify()) 242 .pipe(uglify())
172 .pipe(gulp.dest(distDir.js)); 243 .pipe(gulp.dest(distDir.js));
@@ -190,4 +261,4 @@ gulp.task('business', ['libs'], function() { @@ -190,4 +261,4 @@ gulp.task('business', ['libs'], function() {
190 .pipe(uglify()) 261 .pipe(uglify())
191 .pipe(concat('index.js')) 262 .pipe(concat('index.js'))
192 .pipe(gulp.dest(distDir.js)); 263 .pipe(gulp.dest(distDir.js));
193 -});  
  264 +});
@@ -37,7 +37,8 @@ function getInstance() { @@ -37,7 +37,8 @@ function getInstance() {
37 return dialogTemplate; 37 return dialogTemplate;
38 } 38 }
39 39
40 -exports.showDialog = function(data, callback, callbackForLeft) { 40 +// fullWithBtn是供详情页获取限购码使用的特殊参数
  41 +exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
41 42
42 var dialogTemplate = getInstance(), 43 var dialogTemplate = getInstance(),
43 dialogStr = dialogTemplate(data), 44 dialogStr = dialogTemplate(data),
@@ -51,6 +52,8 @@ exports.showDialog = function(data, callback, callbackForLeft) { @@ -51,6 +52,8 @@ exports.showDialog = function(data, callback, callbackForLeft) {
51 52
52 $dialogBox = $('.dialog-box'); 53 $dialogBox = $('.dialog-box');
53 $dialogWrapper = $('.dialog-wrapper'); 54 $dialogWrapper = $('.dialog-wrapper');
  55 +
  56 +
54 dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper')); 57 dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper'));
55 58
56 // 显示 59 // 显示
@@ -62,6 +65,15 @@ exports.showDialog = function(data, callback, callbackForLeft) { @@ -62,6 +65,15 @@ exports.showDialog = function(data, callback, callbackForLeft) {
62 $dialogWrapper.fadeIn(); 65 $dialogWrapper.fadeIn();
63 } 66 }
64 67
  68 + if (fullWithBtn) {
  69 + $('.dialog-wrapper .dialog-footer > span').css('width', '100%');
  70 + $('.dialog-wrapper .dialog-content').css({
  71 + 'padding-left': '1.85rem',
  72 + 'padding-right': '1.85rem'
  73 + });
  74 + $dialogWrapper.css('z-index', '10');
  75 + }
  76 +
65 $dialogBox.css({ 77 $dialogBox.css({
66 top: '50%', 78 top: '50%',
67 marginTop: -($dialogBox.height() / 2) 79 marginTop: -($dialogBox.height() / 2)
@@ -18,6 +18,11 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'), @@ -18,6 +18,11 @@ var goodsDiscountEl = document.getElementById('goodsDiscount'),
18 18
19 var $cart = $('.cart-bar'); 19 var $cart = $('.cart-bar');
20 20
  21 +var limitSaleBtn = document.getElementById('limit-sale'),
  22 + limitSaleHammer = limitSaleBtn && new Hammer(limitSaleBtn);
  23 +
  24 +var dialog = require('../../me/dialog');
  25 +
21 //add extra marign-bottom for footer to show the yoho copyright 26 //add extra marign-bottom for footer to show the yoho copyright
22 function showFooter() { 27 function showFooter() {
23 var $cartBar = $('.cart-bar'); 28 var $cartBar = $('.cart-bar');
@@ -75,6 +80,25 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) { @@ -75,6 +80,25 @@ if (goodsDiscountHammer && $discountFolder.children().length > 0) {
75 }); 80 });
76 } 81 }
77 82
  83 +limitSaleHammer ? limitSaleHammer.on('tap', function(e) {
  84 + e.srcEvent.stopPropagation();
  85 + dialog.showDialog({
  86 + dialogText: '进入有货APP尖货频道分享\n以获取限购码',
  87 + hasFooter: {
  88 + rightBtnText: '打开Yoho!Buy有货APP'
  89 + }
  90 + }, function() {
  91 + console.log('111');
  92 + }, undefined, true);
  93 +
  94 + $('.dialog-wrapper').off('touchstart').on('touchstart', function(e) {
  95 + e.stopPropagation();
  96 + if ($(e.target).hasClass('dialog-wrapper')) {
  97 + dialog.hideDialog();
  98 + }
  99 + });
  100 +}) : null;
  101 +
78 require('./desc'); 102 require('./desc');
79 require('./comments-consults'); 103 require('./comments-consults');
80 require('../recommend-for-you-product-desc'); 104 require('../recommend-for-you-product-desc');
@@ -34,18 +34,33 @@ @@ -34,18 +34,33 @@
34 } 34 }
35 }, 35 },
36 "devDependencies": { 36 "devDependencies": {
  37 + "autoprefixer": "^6.3.3",
37 "father": "^1.0.0", 38 "father": "^1.0.0",
38 "gulp": "^3.9.0", 39 "gulp": "^3.9.0",
39 "gulp-compass": "^2.1.0", 40 "gulp-compass": "^2.1.0",
40 "gulp-concat": "^2.6.0", 41 "gulp-concat": "^2.6.0",
  42 + "gulp-cssnano": "^2.1.1",
41 "gulp-ftp": "^1.0.4", 43 "gulp-ftp": "^1.0.4",
  44 + "gulp-postcss": "^6.1.0",
  45 + "gulp-sourcemaps": "^1.6.0",
42 "gulp-spm": "^0.11.3", 46 "gulp-spm": "^0.11.3",
43 "gulp-uglify": "^1.4.2", 47 "gulp-uglify": "^1.4.2",
44 "gulp-util": "^3.0.6", 48 "gulp-util": "^3.0.6",
45 - "spm": "3" 49 + "postcss-assets": "^4.0.1",
  50 + "postcss-calc": "^5.2.0",
  51 + "postcss-center": "^1.0.0",
  52 + "postcss-clearfix": "^0.2.1",
  53 + "postcss-crip": "^2.0.0",
  54 + "postcss-position": "^0.4.0",
  55 + "postcss-pxtorem": "^3.3.1",
  56 + "postcss-short": "^1.4.0",
  57 + "postcss-sprites": "^3.1.0",
  58 + "postcss-use": "^2.0.2",
  59 + "precss": "^1.4.0",
  60 + "spm": "3.4"
46 }, 61 },
47 "scripts": { 62 "scripts": {
48 "test": "spm test", 63 "test": "spm test",
49 "build": "spm build" 64 "build": "spm build"
50 } 65 }
51 -}  
  66 +}
@@ -276,6 +276,7 @@ $basicBtnC:#eb0313; @@ -276,6 +276,7 @@ $basicBtnC:#eb0313;
276 } 276 }
277 } 277 }
278 .price-date { 278 .price-date {
  279 + position: relative;
279 width: 100%; 280 width: 100%;
280 color: $subFontC; 281 color: $subFontC;
281 height: pxToRem(88px); 282 height: pxToRem(88px);
@@ -284,6 +285,30 @@ $basicBtnC:#eb0313; @@ -284,6 +285,30 @@ $basicBtnC:#eb0313;
284 background-color: #fff; 285 background-color: #fff;
285 border-bottom: 1px solid $borderC; 286 border-bottom: 1px solid $borderC;
286 } 287 }
  288 +
  289 + .limit-sale {
  290 + position: absolute;
  291 + right: pxToRem(84px);
  292 + top: pxToRem(24px);
  293 + color: #d0021b;
  294 + border: 2px solid #d0021b;
  295 + background-color: #fff;
  296 + border-radius: pxToRem(40px);
  297 + padding: pxToRem(4px) pxToRem(20px);
  298 + font-size: pxToRem(24px);
  299 + font-weight: bold;
  300 + }
  301 +
  302 + .limit-sale:active {
  303 + background-color: #f0f0f0;
  304 + }
  305 +
  306 + .got-limit-sale {
  307 + @extend .limit-sale;
  308 + color: #ccc;
  309 + border-color: #ccc;
  310 + }
  311 +
287 .goodsPrice { 312 .goodsPrice {
288 float: left; 313 float: left;
289 font-size: pxToRem(34.59px); 314 font-size: pxToRem(34.59px);
@@ -367,7 +392,7 @@ $basicBtnC:#eb0313; @@ -367,7 +392,7 @@ $basicBtnC:#eb0313;
367 } 392 }
368 .goodsDiscount { 393 .goodsDiscount {
369 display: block; 394 display: block;
370 - width: 100%; 395 + width: 100%;
371 height:auto; 396 height:auto;
372 font-size: pxToRem(28px); 397 font-size: pxToRem(28px);
373 color: $mainFontC; 398 color: $mainFontC;
  1 +.limit-good-page {
  2 + background-color: #f4f4f4;
  3 + color: #444;
  4 +
  5 + .top {
  6 + font-size: 0.6rem;
  7 + height: 2rem;
  8 + line-height: 2.2rem;
  9 + margin-bottom: 0.1rem;
  10 + background-color: #fff;
  11 + padding: 0.2rem 0;
  12 +
  13 +
  14 + div {
  15 + width: 20%;
  16 + display: inline-block;
  17 + float: left;
  18 + img {
  19 + width: 1.5rem;
  20 + border: 1px solid #ccc;
  21 + border-radius: 100%;
  22 + position: relative;
  23 + top: 0.25rem;
  24 + }
  25 + }
  26 +
  27 + p {
  28 + display: inline-block;
  29 + float: left;
  30 + width: 80%;
  31 + }
  32 + }
  33 +
  34 + .detail {
  35 + background-color: #fff;
  36 + padding: 0.6rem 0.8rem;
  37 + border-bottom: 1px solid #e6e6e6;
  38 +
  39 + .name {
  40 + font-size: 0.9rem;
  41 + margin-bottom: 0.5rem;
  42 + }
  43 + .sale-info {
  44 + height: 1rem;
  45 + line-height: 1rem;
  46 + }
  47 + .price {
  48 + font-size: 0.8rem;
  49 + color: #d0021b;
  50 + float: left;
  51 + }
  52 +
  53 + .date {
  54 + font-size: 0.6rem;
  55 + float: right;
  56 +
  57 + .text {
  58 + position: relative;
  59 + top: 0.08rem;
  60 + }
  61 + }
  62 + }
  63 +
  64 + .goodDesc {
  65 + margin-top: 1rem;
  66 + }
  67 +
  68 + .bottom {
  69 + background-color: #fff;
  70 + border-top: 1px solid #e6e6e6;
  71 + padding: 0.5rem 2rem 2rem 2rem;
  72 + height: 3rem;
  73 + position: absolute;
  74 + bottom: 0;
  75 + width: 12rem;
  76 + margin: 0 auto;
  77 +
  78 + .logo {
  79 + width: 100;
  80 + height: 2.5rem;
  81 +
  82 + background-image: image-url('logo-bottom.png');
  83 + background-size: 100%;
  84 + background-repeat: no-repeat;
  85 + background-position: center;
  86 + }
  87 +
  88 + .btn {
  89 + font-size: 0.8rem;
  90 + background-color: #fff;
  91 + border: 1px solid #444;
  92 + border-radius: 0.2rem;
  93 + padding: 0.3rem 0.6rem;
  94 + }
  95 +
  96 + .btn:active {
  97 + background-color: #ccc;
  98 + }
  99 +
  100 + .left, .right {
  101 + display: inline-block;
  102 + float: left;
  103 + }
  104 +
  105 + .left {
  106 + width: 39%;
  107 + }
  108 +
  109 + .right {
  110 + width: 60%;
  111 + font-size: 0.65rem;
  112 +
  113 + span {
  114 + display: block;
  115 + width: 95%;
  116 + margin: 0 auto;
  117 + }
  118 + }
  119 + }
  120 +}
  1 +.filter-mask, .filter-body {
  2 + position: absolute;
  3 + left: 0;
  4 + right: 0;
  5 + top: 0;
  6 +}
  7 +
  8 +.filter-mask {
  9 + height: 100%;
  10 + background: rgba(0,0,0,0.1);
  11 +}
  12 +
  13 +.filter-body {
  14 + background: #fff;
  15 + color: #000;
  16 + cursor: pointer;
  17 + font-size: 14px;
  18 + height: 440px;
  19 +
  20 + .classify {
  21 + width: 50%;
  22 + height: 100%;
  23 + background: #f8f8f8;
  24 +
  25 + > li {
  26 + height: 60px;
  27 + line-height: 60px;
  28 +
  29 + > * {
  30 + box-sizing: border-box;
  31 + }
  32 +
  33 + &.active {
  34 + background: #fff;
  35 + }
  36 +
  37 + .shower {
  38 + padding-left: 20px;
  39 + width: 100%;
  40 + overflow: hidden;
  41 + white-space: nowrap;
  42 + text-overflow: ellipsis;
  43 + color: #333;
  44 +
  45 + &.highlight {
  46 + background: #eee;
  47 + }
  48 + }
  49 +
  50 + .default {
  51 + color: #999;
  52 + }
  53 +
  54 + .title {
  55 + float: left;
  56 + color: #000;
  57 + }
  58 +
  59 + }
  60 + }
  61 +
  62 + .sub-classify {
  63 + position: absolute;
  64 + display: none;
  65 + width: 50%;
  66 + height: 440px;
  67 + left: 50%;
  68 + top: 0;
  69 + overflow: auto;
  70 + -webkit-overflow-scrolling: touch;
  71 +
  72 + > li {
  73 + height: 60px;
  74 + line-height: 60px;
  75 + padding-left: 15px;
  76 + border-bottom: 1px solid #e6e6e6;
  77 + overflow: hidden;
  78 + white-space: nowrap;
  79 + text-overflow: ellipsis;
  80 +
  81 + &.highlight {
  82 + background: #eee;
  83 + }
  84 + }
  85 +
  86 + .chosed-icon {
  87 + display: none;
  88 + }
  89 +
  90 + .chosed .chosed-icon {
  91 + display: inline;
  92 + }
  93 + }
  94 +
  95 + .active > .sub-classify {
  96 + display: block;
  97 + }
  98 +}