From 3f11082e5c769ff20242b28a515e4114386cf310 Mon Sep 17 00:00:00 2001 From: 陈轩 <xuan.chen@yoho.cn> Date: Mon, 31 Oct 2016 16:54:41 +0800 Subject: [PATCH] 领券完成 --- apps/product/models/coupon.js | 2 +- apps/product/views/action/detail/detail.hbs | 2 +- doraemon/middleware/auth.js | 3 ++- public/font/iconfont.eot | Bin 19396 -> 0 bytes public/font/iconfont.svg | 2 +- public/font/iconfont.ttf | Bin 19228 -> 0 bytes public/font/iconfont.woff | Bin 19304 -> 0 bytes public/js/product/detail/brand-coupon.js | 11 +++++++++++ public/scss/layout/_common.css | 2 +- public/scss/product/detail/_detail.css | 7 ++++--- 10 files changed, 21 insertions(+), 8 deletions(-) diff --git a/apps/product/models/coupon.js b/apps/product/models/coupon.js index 4c52dc3..703b86c 100644 --- a/apps/product/models/coupon.js +++ b/apps/product/models/coupon.js @@ -21,7 +21,7 @@ exports.queryProdPageCoupons = (uid, skn, brandId) => { * [用户领券] * doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/促销/promotion.md */ -exports.getCoupons = (uid, couponId) => { +exports.getCoupon = (uid, couponId) => { const param = { method: 'app.promotion.getCoupon', uid, diff --git a/apps/product/views/action/detail/detail.hbs b/apps/product/views/action/detail/detail.hbs index d7af296..3373afd 100644 --- a/apps/product/views/action/detail/detail.hbs +++ b/apps/product/views/action/detail/detail.hbs @@ -83,7 +83,7 @@ </ul> {{! 品牌优惠券}} - <div class="brand-coupon"> + <div class="brand-coupon hide"> <i class="iconfont font-right pull-right"></i> <i class="iconfont font-quan"></i><span>领取优惠券</span> </div> diff --git a/doraemon/middleware/auth.js b/doraemon/middleware/auth.js index 2b54934..0398082 100644 --- a/doraemon/middleware/auth.js +++ b/doraemon/middleware/auth.js @@ -12,7 +12,8 @@ module.exports = (req, res, next) => { if (req.xhr) { return res.json({ code: 400, - message: '抱歉,您暂未登录!' + message: '抱歉,您暂未登录!', + redirect: '/passport/login' }); } diff --git a/public/font/iconfont.eot b/public/font/iconfont.eot index 906a4c6..a91c1ca 100755 Binary files a/public/font/iconfont.eot and b/public/font/iconfont.eot differ diff --git a/public/font/iconfont.svg b/public/font/iconfont.svg index af624be..c683ea3 100755 --- a/public/font/iconfont.svg +++ b/public/font/iconfont.svg @@ -86,6 +86,6 @@ <glyph unicode="" glyph-name="uniE64B" d="M379-128q-57 0-122 51.5t-97 132.5q-26 71-27 149.5t24 151.5q11 33 32.5 70.5t37 58.5 46.5 62q17 20 51 68l11 14 23 34q9 14 21 35t18.5 38.5 11.5 38 4 42.5-7 44q-6 11 7 24 7 7 20 7 149-50 216-284 27 50 58 69 12 6 23 0t11-21q-3-59 11.5-126.5t42.5-126.5q4-5 9-17t8-17q51-89 55-157 4-63-14.5-126.5t-65.5-120-115-80.5q-30-11-61-11-18 0-30.5 5t-18 12.5-7.5 13-2 10.5q0 7 2 13t4 10 7.5 9.5 7.5 7 9 6.5 8 6l3 3q36 26 54 75.5t7 95.5q-4 28-27 75-2 6-7.5 20t-8.5 22-6.5 20-4.5 23q0-2-2-5t-2-5q-15-42-20-75 0-45 7-58 7-5 7.5-14.5t-4.5-16.5q-5-8-14-10t-17 3v0q-67 44-85 120 7 34 7 78v45q0 68-10 92-14-53-28-72-22-39-37-58-6-6-15.5-20t-12.5-18q-13-22-24-46.5t-21.5-61.5-5.5-78 28-76q3-7 7.5-12.5t8-10 8.5-10 7.5-8 8-7 7.5-6.5 7.5-6.5 6.5-4.5q11-9 16.5-14.5t10-14.5 0.5-19q-5-18-21.5-29.5t-39.5-11.5z" /> <glyph unicode="" glyph-name="uniE64C" d="M911 725h-242v123q0 21-13.5 34.5t-34.5 13.5h-246q-20 0-33.5-13.5t-13.5-34.5v-123h-246q-21 0-34.5-13.5t-13.5-34 13.5-34 34.5-13.5h829q21 0 34.5 13.5t13.5 34-13.5 34-34.5 13.5zM423 725v72h147v-72h-147zM765 579q-21 0-34.5-14t-13.5-34v-560h-441v560q0 20-13.5 34t-34 14-34-14-13.5-34v-611q0-21 13.5-34.5t34.5-13.5h536q20 0 33.5 13.5t13.5 34.5v611q3 20-11.5 34t-35.5 14zM447 67v389q0 20-13.5 33.5t-34 13.5-34-13.5-13.5-33.5v-389q0-21 13.5-34.5t34-13.5 34 13.5 13.5 34.5zM645 67v389q0 20-13.5 33.5t-34.5 13.5q-20 0-35.5-13.5t-15.5-33.5v-389q0-21 13.5-34.5t34.5-13.5 36 13.5 15 34.5z" /> <glyph unicode="" glyph-name="uniE64D" d="M562 224h109v-111h-109v111zM889 224h109v-111h-109v111zM562 113h109v-110h-109v110zM438 458h-438v438h438v-438zM111 569h216v216h-216v-216zM1000 458h-438v438h438v-438zM673 569h216v216h-216v-216zM438-106h-438v438h438v-438zM111 5h216v216h-216v-216zM561 335h222v-111h-222v111zM889 334h109v-111h-109v111zM780 113h109v-111h-109v111zM562 2h218v-110h-218v110zM889 2h109v-110h-109v110z" /> -<glyph unicode="" glyph-name="coupon" d="M345.89 325.375h332.221c-47.787 28.191-90.13 67.276-127.025 117.25h-58.63c-32.569-45.596-81.426-84.683-146.566-117.25zM942.337 831.725h-860.676c-9.612 0-17.405-7.792-17.405-17.404v-860.641c0-9.612 7.793-17.404 17.405-17.404h860.676c9.612 0 17.405 7.792 17.405 17.404v860.641c0 9.612-7.793 17.404-17.405 17.404zM883.306 442.624h-214.968c47.737-58.625 119.392-103.155 214.968-133.535v-65.138c-26.060 6.511-60.818 17.352-104.226 32.568-13.029 4.326-22.799 7.583-29.315 9.772v-156.332c2.139-73.792-34.758-109.616-110.74-107.481h-97.712v68.398h55.368c34.71-2.139 50.993 11.908 48.857 42.341v123.762h-185.652c10.84-136.791-87.942-220.353-296.393-250.784v61.88c138.935 30.381 203.007 92.265 192.167 185.648v3.256h-91.198v29.311c-17.404-8.702-46.718-19.541-87.94-32.568-15.217-6.515-27.177-10.893-35.828-13.029v68.396c106.365 39.083 182.395 83.561 227.995 133.535h-227.996v65.14h273.595c8.651 19.541 16.284 42.339 22.798 68.395h-263.823v65.14h91.199c-8.703 19.542-18.475 50.991-29.314 94.451h97.712c6.516-34.758 15.166-66.258 26.056-94.451h91.198v120.507h110.741v-55.367c0-23.92-1.12-45.598-3.256-65.14h100.968c13.027 28.193 21.681 59.694 26.058 94.451h94.456c-6.516-39.083-16.288-70.585-29.315-94.451h100.97v-65.14h-299.65c-6.516-26.055-14.149-48.854-22.801-68.395h355.022v-65.141z" /> +<glyph unicode="" glyph-name="quan" d="M806.934 879.547h-604.98c-110.906 0-201.661-90.751-201.661-201.661v-604.982c0-110.91 90.755-201.66 201.661-201.66h604.98c110.918 0 201.663 90.75 201.663 201.66v604.982c-0.001 110.91-90.745 201.661-201.663 201.661zM850.766 187.323c-43.087 19.867-84.506 43.085-122.626 68.751-4.134-48.052-9.932-105.206-11.596-121.792-7.44-84.507-39.759-108.532-127.592-108.532h-121.793l-14.912 75.403h99.418c62.976 0 76.236 10.766 81.204 57.987 2.496 19.89 7.462 67.943 9.126 87.834h-179.802c-23.194-133.391-91.138-194.701-264.298-260.151l-43.086 80.349c147.483 43.085 198.019 87 217.898 179.802h-80.36v16.564c-38.939-28.993-83.687-57.156-134.222-84.508l-43.086 77.877c90.306 47.221 155.764 91.137 204.649 143.336h-183.106v73.74h238.62c12.429 19.89 23.194 40.601 33.14 63.796h-242.767v74.572h136.717l-75.405 96.937 66.291 44.737c28.162-34.791 67.111-84.507 95.273-120.962l-29.825-20.711h77.056c14.080 45.569 28.992 103.566 35.623 151.618l86.991-13.261c-9.934-49.704-20.7-95.273-32.309-138.358h111.849l-28.162 19.059c32.319 34.792 70.414 83.676 97.767 123.446l67.944-43.085c-22.387-29.826-52.213-68.764-78.71-99.42h138.356v-74.572h-333.071c-8.282-22.362-16.576-43.905-27.342-63.796h392.731v-73.74h-191.397c54.683-56.335 122.626-97.756 217.898-131.739l-43.086-81.182zM571.556 400.242h-141.673c-19.889-27.341-43.085-53.84-69.595-78.698h285.010c-26.521 24.026-51.379 50.525-73.742 78.698z" /> <glyph unicode="" glyph-name="notdef" horiz-adv-x="374" d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> </font></defs></svg> \ No newline at end of file diff --git a/public/font/iconfont.ttf b/public/font/iconfont.ttf index 5d28550..743410f 100755 Binary files a/public/font/iconfont.ttf and b/public/font/iconfont.ttf differ diff --git a/public/font/iconfont.woff b/public/font/iconfont.woff index ecec4d1..a34c76a 100755 Binary files a/public/font/iconfont.woff and b/public/font/iconfont.woff differ diff --git a/public/js/product/detail/brand-coupon.js b/public/js/product/detail/brand-coupon.js index fdbe5b9..7858d1c 100644 --- a/public/js/product/detail/brand-coupon.js +++ b/public/js/product/detail/brand-coupon.js @@ -31,6 +31,8 @@ var brandCoupon = { self.render(data); self.domInit(); self.bindEvents(); + + self.$entry.removeClass('hide'); } }) .fail(); @@ -77,7 +79,15 @@ var brandCoupon = { if (res.code === 200) { callback(); // eslint-disable-line + } else { + if (res.redirect) { + setTimeout(function() { + location.href = res.redirect; + }, 1000); + } } + }).fail(function(res) { + tip.show(res.message); }); }, @@ -88,6 +98,7 @@ var brandCoupon = { this.saveCoupon(couponId, function() { $btn.prop('disabled', true) + .removeClass('coupon-btn-valid') .text('已领取'); }); diff --git a/public/scss/layout/_common.css b/public/scss/layout/_common.css index 0ab103e..908fd6b 100644 --- a/public/scss/layout/_common.css +++ b/public/scss/layout/_common.css @@ -107,7 +107,7 @@ button { color: #fff; font-size: 18PX; border: none; - z-index: 4; + z-index: 100; border-radius: 10PX; } diff --git a/public/scss/product/detail/_detail.css b/public/scss/product/detail/_detail.css index 939e050..c7f169d 100644 --- a/public/scss/product/detail/_detail.css +++ b/public/scss/product/detail/_detail.css @@ -285,8 +285,8 @@ $basicBtnC: #eb0313; .price-date, .brand-coupon { position: relative; - padding-right: 28px; - padding-left: 28px; + padding-right: 30px; + padding-left: 30px; width: 100%; height: 88px; border-bottom: 1px solid $borderC; @@ -304,6 +304,7 @@ $basicBtnC: #eb0313; .iconfont { font-size: inherit; + margin-right: 20px; } .font-right{ @@ -514,7 +515,7 @@ $basicBtnC: #eb0313; h1 { position: relative; - padding: 30px 60px 30px 28px; + padding: 30px 60px 30px 30px; line-height: 36px; } -- libgit2 0.24.0