Showing
6 changed files
with
44 additions
and
68 deletions
@@ -71,7 +71,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -71,7 +71,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
71 | '/home/account/modifymobile' | 71 | '/home/account/modifymobile' |
72 | ]}, | 72 | ]}, |
73 | {name: '地址管理', href: '/home/address'}, | 73 | {name: '地址管理', href: '/home/address'}, |
74 | - {name: '兑换礼品卡', href: '/home/gift'} | 74 | + // {name: '兑换礼品卡', href: '/home/gift'} // @韩施超-产品让注释的 |
75 | ] | 75 | ] |
76 | } | 76 | } |
77 | ]; | 77 | ]; |
@@ -103,25 +103,12 @@ module.exports = class extends global.yoho.BaseModel { | @@ -103,25 +103,12 @@ module.exports = class extends global.yoho.BaseModel { | ||
103 | } | 103 | } |
104 | 104 | ||
105 | // 验证手机是否绑定 | 105 | // 验证手机是否绑定 |
106 | - verifyBinMobile(uid) { | 106 | + verifyBinMobile() { |
107 | let userInfo = { | 107 | let userInfo = { |
108 | isBinMobile: Number(!!_.get(this.ctx, 'req.user.mobile', false)) | 108 | isBinMobile: Number(!!_.get(this.ctx, 'req.user.mobile', false)) |
109 | }; | 109 | }; |
110 | 110 | ||
111 | - if (userInfo.isBinMobile) { | ||
112 | - return Promise.resolve(userInfo); | ||
113 | - } | ||
114 | - | ||
115 | - return this.meGiftAPi.getProfile(uid).then(lres => { | ||
116 | - lres = _.get(lres, 'data', {}); | ||
117 | - | ||
118 | - let isBinMobile = Number(!!lres.verify_mobile); | ||
119 | - | ||
120 | - return Object.assign({}, userInfo, { | ||
121 | - isBinMobile: isBinMobile, | ||
122 | - email: lres.verify_email | ||
123 | - }); | ||
124 | - }); | 111 | + return Promise.resolve(userInfo); |
125 | } | 112 | } |
126 | 113 | ||
127 | // 发送邮箱验证码 | 114 | // 发送邮箱验证码 |
@@ -275,12 +275,12 @@ router.get('/newuser', newUserController.check); | @@ -275,12 +275,12 @@ router.get('/newuser', newUserController.check); | ||
275 | 275 | ||
276 | // 我的礼品卡 | 276 | // 我的礼品卡 |
277 | router.get('/megift', tabsMiddleware.getCommonHeader, meGiftController.index); | 277 | router.get('/megift', tabsMiddleware.getCommonHeader, meGiftController.index); |
278 | -router.post('/megift/sendEmailCode', captcha.requiredAPI, meGiftController.sendEmailCode);// 发送邮箱验证码 | 278 | +router.post('/megift/sendEmailCode', meGiftController.sendEmailCode);// 发送邮箱验证码 |
279 | router.post('/megift/verifyEmail', meGiftController.verifyEmail);// 验证邮箱验证码 | 279 | router.post('/megift/verifyEmail', meGiftController.verifyEmail);// 验证邮箱验证码 |
280 | -// 图形验证码、检查是否绑定手机号、发验证码 | ||
281 | -router.post('/megift/smsBind', captcha.requiredAPI, meGiftController.smsBind); | 280 | +// 检查是否绑定手机号、发验证码 |
281 | +router.post('/megift/smsBind', meGiftController.smsBind); | ||
282 | router.post('/megift/changeMobile', meGiftController.changeMobile);// 修改绑定手机 | 282 | router.post('/megift/changeMobile', meGiftController.changeMobile);// 修改绑定手机 |
283 | -router.post('/megift/activateGift', captcha.requiredAPI, meGiftController.activateGift);// 激活礼品卡 | 283 | +router.post('/megift/activateGift', meGiftController.activateGift);// 激活礼品卡 |
284 | router.get('/megift/detail', meGiftController.detail);// 消费明细 | 284 | router.get('/megift/detail', meGiftController.detail);// 消费明细 |
285 | 285 | ||
286 | module.exports = router; | 286 | module.exports = router; |
@@ -51,9 +51,6 @@ | @@ -51,9 +51,6 @@ | ||
51 | <input type="text" placeholder="短信验证码" class="left email-code" /> | 51 | <input type="text" placeholder="短信验证码" class="left email-code" /> |
52 | <span class="left email-btn">获取短信验证码</span> | 52 | <span class="left email-btn">获取短信验证码</span> |
53 | </div> | 53 | </div> |
54 | - <div class="gift-group"> | ||
55 | - <div id="captcha" style="display: inline-block; position: relative;"></div> | ||
56 | - </div> | ||
57 | </script> | 54 | </script> |
58 | 55 | ||
59 | {{!-- 绑定手机模板 --}} | 56 | {{!-- 绑定手机模板 --}} |
@@ -81,12 +78,9 @@ | @@ -81,12 +78,9 @@ | ||
81 | </span> | 78 | </span> |
82 | <input type="text" placeholder="请输入手机号" class="right mobile" /> | 79 | <input type="text" placeholder="请输入手机号" class="right mobile" /> |
83 | </div> | 80 | </div> |
84 | - <div class="gift-group"> | 81 | + <div class="gift-group bind-mobile-input"> |
85 | <input type="text" placeholder="短信验证码" class="left mobile-code" /> | 82 | <input type="text" placeholder="短信验证码" class="left mobile-code" /> |
86 | - <span class="left mobile-btn">获取短信验证码</span> | ||
87 | - </div> | ||
88 | - <div class="gift-group"> | ||
89 | - <div id="captcha" style="display: inline-block; position: relative;"></div> | 83 | + <span class="right mobile-btn">获取短信验证码</span> |
90 | </div> | 84 | </div> |
91 | </div> | 85 | </div> |
92 | </script> | 86 | </script> |
@@ -94,12 +88,9 @@ | @@ -94,12 +88,9 @@ | ||
94 | {{!-- 激活礼品卡模板 --}} | 88 | {{!-- 激活礼品卡模板 --}} |
95 | <script id="activate-gift-tpl" type="text/html"> | 89 | <script id="activate-gift-tpl" type="text/html"> |
96 | <div class="title">激活礼品卡</div> | 90 | <div class="title">激活礼品卡</div> |
97 | - <div class="verify-input"> | 91 | + <div class="verify-input activate-center"> |
98 | <div class="gift-group"><input type="text" placeholder="请输入礼品卡号" class="card-code" /></div> | 92 | <div class="gift-group"><input type="text" placeholder="请输入礼品卡号" class="card-code" /></div> |
99 | - <div class="gift-group"><input type="text" placeholder="请输入礼品卡密" class="card-pwd" /></div> | ||
100 | - <div class="gift-group"> | ||
101 | - <div id="captcha" style="display: inline-block; position: relative;"></div> | ||
102 | - </div> | 93 | + <div class="gift-group activate-input-last"><input type="text" placeholder="请输入礼品卡密" class="card-pwd" /></div> |
103 | </div> | 94 | </div> |
104 | </script> | 95 | </script> |
105 | 96 |
1 | var $ = require('yoho-jquery'), | 1 | var $ = require('yoho-jquery'), |
2 | Hbs = require('yoho-handlebars'), | 2 | Hbs = require('yoho-handlebars'), |
3 | - dialog = require('../common/dialog'), | ||
4 | - Captcha = require('../plugins/captcha'); | 3 | + dialog = require('../common/dialog'); |
5 | var meGift; | 4 | var meGift; |
6 | 5 | ||
7 | require('yoho-jquery-placeholder'); | 6 | require('yoho-jquery-placeholder'); |
@@ -38,7 +37,7 @@ meGift = { | @@ -38,7 +37,7 @@ meGift = { | ||
38 | if (that.isBinMobile) { | 37 | if (that.isBinMobile) { |
39 | that.activateGift(); | 38 | that.activateGift(); |
40 | } else { | 39 | } else { |
41 | - that.verifyEmailCode(); | 40 | + that.getMobileCode(); |
42 | } | 41 | } |
43 | }); | 42 | }); |
44 | 43 | ||
@@ -89,13 +88,11 @@ meGift = { | @@ -89,13 +88,11 @@ meGift = { | ||
89 | }); | 88 | }); |
90 | }, | 89 | }, |
91 | 90 | ||
92 | - postAjax: function(url, data, verifyData, captcha) { | 91 | + postAjax: function(url, data, verifyData) { |
93 | var deferred = $.Deferred(); // eslint-disable-line | 92 | var deferred = $.Deferred(); // eslint-disable-line |
94 | var that = this; | 93 | var that = this; |
95 | var x; | 94 | var x; |
96 | 95 | ||
97 | - captcha && captcha.hideTip(); | ||
98 | - | ||
99 | if (that.isFlag) { | 96 | if (that.isFlag) { |
100 | return deferred.resolve({ | 97 | return deferred.resolve({ |
101 | code: 401, | 98 | code: 401, |
@@ -122,9 +119,7 @@ meGift = { | @@ -122,9 +119,7 @@ meGift = { | ||
122 | type: 'post', | 119 | type: 'post', |
123 | data: data | 120 | data: data |
124 | }).then(function(res) { | 121 | }).then(function(res) { |
125 | - if (res.code === 405) { | ||
126 | - captcha && captcha.showTip(res.message); | ||
127 | - } else if (res.code !== 200) { | 122 | + if (res.code !== 200) { |
128 | that.meAlert(res.message, false); | 123 | that.meAlert(res.message, false); |
129 | } | 124 | } |
130 | 125 | ||
@@ -153,13 +148,12 @@ meGift = { | @@ -153,13 +148,12 @@ meGift = { | ||
153 | }, | 148 | }, |
154 | 149 | ||
155 | // 获取邮箱验证码 | 150 | // 获取邮箱验证码 |
156 | - getEmailCode: function(captcha) { | 151 | + getEmailCode: function() { |
157 | var that = this; | 152 | var that = this; |
158 | 153 | ||
159 | this.postAjax('/home/megift/sendEmailCode', { | 154 | this.postAjax('/home/megift/sendEmailCode', { |
160 | - email: this.userEmail, | ||
161 | - verifyCode: captcha.getResults() | ||
162 | - }, {}, captcha).then(function(res) { | 155 | + email: this.userEmail |
156 | + }, {}).then(function(res) { | ||
163 | if (res.code === 200) { | 157 | if (res.code === 200) { |
164 | that.intTimer($('.email-btn')); | 158 | that.intTimer($('.email-btn')); |
165 | } | 159 | } |
@@ -169,7 +163,6 @@ meGift = { | @@ -169,7 +163,6 @@ meGift = { | ||
169 | // 效验邮箱验证码 | 163 | // 效验邮箱验证码 |
170 | verifyEmailCode: function() { | 164 | verifyEmailCode: function() { |
171 | var that = this; | 165 | var that = this; |
172 | - var captcha; | ||
173 | var dg = new dialog.Dialog({ | 166 | var dg = new dialog.Dialog({ |
174 | content: that.emailTpl({}), | 167 | content: that.emailTpl({}), |
175 | className: 'me-gift-confirm', | 168 | className: 'me-gift-confirm', |
@@ -197,12 +190,11 @@ meGift = { | @@ -197,12 +190,11 @@ meGift = { | ||
197 | setTimeout(function() { | 190 | setTimeout(function() { |
198 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder | 191 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder |
199 | }, 10); | 192 | }, 10); |
200 | - captcha = new Captcha('#captcha').init(); | ||
201 | 193 | ||
202 | // 发送邮箱验证码 | 194 | // 发送邮箱验证码 |
203 | $('.me-gift-confirm').find('.email-btn').unbind('click').bind('click', function() { | 195 | $('.me-gift-confirm').find('.email-btn').unbind('click').bind('click', function() { |
204 | if (!$(this).hasClass('int-timer')) { | 196 | if (!$(this).hasClass('int-timer')) { |
205 | - that.getEmailCode(captcha); | 197 | + that.getEmailCode(); |
206 | } | 198 | } |
207 | }); | 199 | }); |
208 | }, | 200 | }, |
@@ -210,7 +202,6 @@ meGift = { | @@ -210,7 +202,6 @@ meGift = { | ||
210 | // 获取手机验证码 | 202 | // 获取手机验证码 |
211 | getMobileCode: function() { | 203 | getMobileCode: function() { |
212 | var that = this; | 204 | var that = this; |
213 | - var captcha; | ||
214 | var dg = new dialog.Dialog({ | 205 | var dg = new dialog.Dialog({ |
215 | content: that.mobileTpl({}), | 206 | content: that.mobileTpl({}), |
216 | className: 'me-gift-confirm', | 207 | className: 'me-gift-confirm', |
@@ -236,7 +227,7 @@ meGift = { | @@ -236,7 +227,7 @@ meGift = { | ||
236 | area: ($('.mobile-area').find('em').text() || '').replace(/^\+/, ''), | 227 | area: ($('.mobile-area').find('em').text() || '').replace(/^\+/, ''), |
237 | mobile: $('input.mobile').val(), | 228 | mobile: $('input.mobile').val(), |
238 | code: $('input.mobile-code').val() | 229 | code: $('input.mobile-code').val() |
239 | - }, verifyData, captcha).then(function(res) { | 230 | + }, verifyData).then(function(res) { |
240 | if (res.code === 200) { | 231 | if (res.code === 200) { |
241 | that.isBinMobile = 1; | 232 | that.isBinMobile = 1; |
242 | dg.close(); | 233 | dg.close(); |
@@ -250,18 +241,17 @@ meGift = { | @@ -250,18 +241,17 @@ meGift = { | ||
250 | setTimeout(function() { | 241 | setTimeout(function() { |
251 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder | 242 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder |
252 | }, 10); | 243 | }, 10); |
253 | - captcha = new Captcha('#captcha').init(); | ||
254 | 244 | ||
255 | // 发送邮箱验证码 | 245 | // 发送邮箱验证码 |
256 | $('.me-gift-confirm').find('.mobile-btn').unbind('click').bind('click', function() { | 246 | $('.me-gift-confirm').find('.mobile-btn').unbind('click').bind('click', function() { |
257 | if (!$(this).hasClass('int-timer')) { | 247 | if (!$(this).hasClass('int-timer')) { |
258 | - that.smsBind(captcha); | 248 | + that.smsBind(); |
259 | } | 249 | } |
260 | }); | 250 | }); |
261 | }, | 251 | }, |
262 | 252 | ||
263 | // 发送手机验证码 | 253 | // 发送手机验证码 |
264 | - smsBind: function(captcha) { | 254 | + smsBind: function() { |
265 | var that = this; | 255 | var that = this; |
266 | var area = ($('.mobile-area').find('em').text() || '').replace(/^\+/, ''); | 256 | var area = ($('.mobile-area').find('em').text() || '').replace(/^\+/, ''); |
267 | var mobile = $('input.mobile').val(); | 257 | var mobile = $('input.mobile').val(); |
@@ -272,9 +262,8 @@ meGift = { | @@ -272,9 +262,8 @@ meGift = { | ||
272 | 262 | ||
273 | this.postAjax('/home/megift/smsBind', { | 263 | this.postAjax('/home/megift/smsBind', { |
274 | area: area, | 264 | area: area, |
275 | - mobile: mobile, | ||
276 | - verifyCode: captcha.getResults() | ||
277 | - }, verifyData, captcha).then(function(res) { | 265 | + mobile: mobile |
266 | + }, verifyData).then(function(res) { | ||
278 | if (res.code === 200) { | 267 | if (res.code === 200) { |
279 | that.intTimer($('.mobile-btn')); | 268 | that.intTimer($('.mobile-btn')); |
280 | } | 269 | } |
@@ -284,7 +273,6 @@ meGift = { | @@ -284,7 +273,6 @@ meGift = { | ||
284 | // 激活礼品卡 | 273 | // 激活礼品卡 |
285 | activateGift: function() { | 274 | activateGift: function() { |
286 | var that = this; | 275 | var that = this; |
287 | - var captcha; | ||
288 | var dg = new dialog.Dialog({ | 276 | var dg = new dialog.Dialog({ |
289 | content: that.giftTpl({}), | 277 | content: that.giftTpl({}), |
290 | className: 'me-gift-confirm', | 278 | className: 'me-gift-confirm', |
@@ -308,9 +296,8 @@ meGift = { | @@ -308,9 +296,8 @@ meGift = { | ||
308 | 296 | ||
309 | that.postAjax('/home/meGift/activateGift', { | 297 | that.postAjax('/home/meGift/activateGift', { |
310 | cardCode: $confirm.find('.card-code').val(), | 298 | cardCode: $confirm.find('.card-code').val(), |
311 | - cardPwd: $confirm.find('.card-pwd').val(), | ||
312 | - verifyCode: captcha.getResults() | ||
313 | - }, verifyData, captcha).then(function(res) { | 299 | + cardPwd: $confirm.find('.card-pwd').val() |
300 | + }, verifyData).then(function(res) { | ||
314 | if (res.code === 200) { | 301 | if (res.code === 200) { |
315 | dg.close(); | 302 | dg.close(); |
316 | that.meAlert('<p>您的礼品卡激活成功</p>', false, function() { | 303 | that.meAlert('<p>您的礼品卡激活成功</p>', false, function() { |
@@ -325,7 +312,6 @@ meGift = { | @@ -325,7 +312,6 @@ meGift = { | ||
325 | setTimeout(function() { | 312 | setTimeout(function() { |
326 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder | 313 | $('[placeholder]', dg.$el).placeholder(); // ie8 兼容 placeholder |
327 | }, 10); | 314 | }, 10); |
328 | - captcha = new Captcha('#captcha').init(); | ||
329 | }, | 315 | }, |
330 | 316 | ||
331 | // 消费明细 | 317 | // 消费明细 |
@@ -150,7 +150,7 @@ | @@ -150,7 +150,7 @@ | ||
150 | 150 | ||
151 | input { | 151 | input { |
152 | height: 30px; | 152 | height: 30px; |
153 | - line-height: 28px; | 153 | + line-height: 30px; |
154 | padding: 0 5px; | 154 | padding: 0 5px; |
155 | font-size: 14px; | 155 | font-size: 14px; |
156 | color: #444; | 156 | color: #444; |
@@ -161,11 +161,11 @@ | @@ -161,11 +161,11 @@ | ||
161 | 161 | ||
162 | .email-btn, | 162 | .email-btn, |
163 | .mobile-btn { | 163 | .mobile-btn { |
164 | + border: 1px solid #e6e6e6; | ||
164 | font-size: 13px; | 165 | font-size: 13px; |
165 | background-color: #444; | 166 | background-color: #444; |
166 | color: #fff; | 167 | color: #fff; |
167 | height: 30px; | 168 | height: 30px; |
168 | - border: none; | ||
169 | cursor: pointer; | 169 | cursor: pointer; |
170 | width: 110px; | 170 | width: 110px; |
171 | line-height: 30px; | 171 | line-height: 30px; |
@@ -191,7 +191,7 @@ | @@ -191,7 +191,7 @@ | ||
191 | 191 | ||
192 | .mobile-area { | 192 | .mobile-area { |
193 | width: 70px; | 193 | width: 70px; |
194 | - line-height: 30px; | 194 | + line-height: 26px; |
195 | height: 30px; | 195 | height: 30px; |
196 | text-align: center; | 196 | text-align: center; |
197 | border: 1px solid #e6e6e6; | 197 | border: 1px solid #e6e6e6; |
@@ -225,12 +225,12 @@ | @@ -225,12 +225,12 @@ | ||
225 | } | 225 | } |
226 | 226 | ||
227 | input.mobile-code { | 227 | input.mobile-code { |
228 | - width: 217px; | 228 | + width: 200px; |
229 | } | 229 | } |
230 | 230 | ||
231 | .card-code, | 231 | .card-code, |
232 | .card-pwd { | 232 | .card-pwd { |
233 | - width: 310px; | 233 | + width: 330px; |
234 | } | 234 | } |
235 | 235 | ||
236 | .border-top-info { | 236 | .border-top-info { |
@@ -307,12 +307,24 @@ | @@ -307,12 +307,24 @@ | ||
307 | } | 307 | } |
308 | 308 | ||
309 | .confirm-sure { | 309 | .confirm-sure { |
310 | - margin-left: 45px; | 310 | + margin-left: 65px; |
311 | } | 311 | } |
312 | 312 | ||
313 | .alert-sure { | 313 | .alert-sure { |
314 | width: 160px; | 314 | width: 160px; |
315 | } | 315 | } |
316 | + | ||
317 | + .activate-input-last { | ||
318 | + margin-top: 30px; | ||
319 | + } | ||
320 | + | ||
321 | + .activate-center { | ||
322 | + padding-bottom: 30px; | ||
323 | + } | ||
324 | + | ||
325 | + .bind-mobile-input { | ||
326 | + margin: 30px 0 50px; | ||
327 | + } | ||
316 | } | 328 | } |
317 | 329 | ||
318 | .me-gift-confirm.me-page { | 330 | .me-gift-confirm.me-page { |
-
Please register or login to post a comment