Merge branch 'refs/heads/develop'
Showing
10 changed files
with
46 additions
and
18 deletions
@@ -85,7 +85,7 @@ exports.couponSend = (req, res, next) => { | @@ -85,7 +85,7 @@ exports.couponSend = (req, res, next) => { | ||
85 | 85 | ||
86 | // 接口要加 session 校验,跨域异步请求未添加相关参数 | 86 | // 接口要加 session 校验,跨域异步请求未添加相关参数 |
87 | if (req.yoho.isApp || app.client_type === 'miniapp') { | 87 | if (req.yoho.isApp || app.client_type === 'miniapp') { |
88 | - if (app.app_version && app.client_type && app.session_key && app.uid) { | 88 | + if (app.app_version && app.client_type && app.session_key && app.uid && !req.query.webSession) { |
89 | // 小程序调接口获取 session 的方式不同,H5 嵌小程序,client_type 标记为 h5 | 89 | // 小程序调接口获取 session 的方式不同,H5 嵌小程序,client_type 标记为 h5 |
90 | let isMiniApp = app.client_type === 'miniapp'; | 90 | let isMiniApp = app.client_type === 'miniapp'; |
91 | 91 |
@@ -6,9 +6,9 @@ | @@ -6,9 +6,9 @@ | ||
6 | <div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@index}}" data-item-idx="{{@index}}" class="guess-tab first" data-query="{{queryString}}" data-code="{{resources_code}}"> | 6 | <div id="tab-{{@index}}" data-template-name="{{../template_name}}" data-tab-name="{{tab_name}}" data-template-id="{{../template_id}}" data-index="{{@index}}" data-index-idx="{{@index}}" data-item-idx="{{@index}}" class="guess-tab first" data-query="{{queryString}}" data-code="{{resources_code}}"> |
7 | {{#if src}} | 7 | {{#if src}} |
8 | <img class="guess-img" src="{{image2 src w=200 h=160 q=60 mode=3}}" /> | 8 | <img class="guess-img" src="{{image2 src w=200 h=160 q=60 mode=3}}" /> |
9 | - <div class=""></div> | 9 | + <div class="guess-tab-active"></div> |
10 | {{else}} | 10 | {{else}} |
11 | - <span class="guess-like-tab">{{tab_name}}</span> | 11 | + <span class="guess-like-tab guess-like-tab-active">{{tab_name}}</span> |
12 | {{/if}} | 12 | {{/if}} |
13 | </div> | 13 | </div> |
14 | {{^}} | 14 | {{^}} |
@@ -24,4 +24,4 @@ | @@ -24,4 +24,4 @@ | ||
24 | {{/each}} | 24 | {{/each}} |
25 | </div> | 25 | </div> |
26 | </div> | 26 | </div> |
27 | -</div> | ||
27 | +</div> |
@@ -25,7 +25,11 @@ const geetest = { | @@ -25,7 +25,11 @@ const geetest = { | ||
25 | } else { | 25 | } else { |
26 | req.session.useYohoCaptcha = true; | 26 | req.session.useYohoCaptcha = true; |
27 | } | 27 | } |
28 | - res.send(data); | 28 | + if (req.query.callback) { |
29 | + res.jsonp(data); | ||
30 | + } else { | ||
31 | + res.send(data); | ||
32 | + } | ||
29 | }).catch(next); | 33 | }).catch(next); |
30 | }, | 34 | }, |
31 | validate(req, res, next) { | 35 | validate(req, res, next) { |
@@ -89,7 +89,11 @@ class SmsLogin { | @@ -89,7 +89,11 @@ class SmsLogin { | ||
89 | co(function* () { | 89 | co(function* () { |
90 | let sendSmsResult = yield req.ctx(PhoneServiceModel).sendSMS(params); | 90 | let sendSmsResult = yield req.ctx(PhoneServiceModel).sendSMS(params); |
91 | 91 | ||
92 | - res.json(sendSmsResult); | 92 | + if (req.query.callback) { |
93 | + res.jsonp(sendSmsResult); | ||
94 | + } else { | ||
95 | + res.json(sendSmsResult); | ||
96 | + } | ||
93 | })().catch(next); | 97 | })().catch(next); |
94 | } | 98 | } |
95 | 99 | ||
@@ -159,8 +163,14 @@ class SmsLogin { | @@ -159,8 +163,14 @@ class SmsLogin { | ||
159 | let shopping_key = cookie.getShoppingKey(req); // eslint-disable-line | 163 | let shopping_key = cookie.getShoppingKey(req); // eslint-disable-line |
160 | let from = req.cookies.from || 'yohobuy'; | 164 | let from = req.cookies.from || 'yohobuy'; |
161 | 165 | ||
166 | + if (req.query.callback) { | ||
167 | + res._sendFn = res.jsonp; | ||
168 | + } else { | ||
169 | + res._sendFn = res.json; | ||
170 | + } | ||
171 | + | ||
162 | if (!mobile || !area) { | 172 | if (!mobile || !area) { |
163 | - res.json({ | 173 | + res._sendFn({ |
164 | code: 401, | 174 | code: 401, |
165 | message: VERIFY_ERROR | 175 | message: VERIFY_ERROR |
166 | }); | 176 | }); |
@@ -171,13 +181,13 @@ class SmsLogin { | @@ -171,13 +181,13 @@ class SmsLogin { | ||
171 | 181 | ||
172 | // 验证码 校验异常 | 182 | // 验证码 校验异常 |
173 | if (r2.code !== 200) { | 183 | if (r2.code !== 200) { |
174 | - res.json(r2); | 184 | + res._sendFn(r2); |
175 | return; | 185 | return; |
176 | } | 186 | } |
177 | 187 | ||
178 | // 校验失败 | 188 | // 校验失败 |
179 | if (r2.data.is_pass !== 'Y') { | 189 | if (r2.data.is_pass !== 'Y') { |
180 | - res.json({ | 190 | + res._sendFn({ |
181 | code: 401, | 191 | code: 401, |
182 | message: '短信验证码错误' | 192 | message: '短信验证码错误' |
183 | }); | 193 | }); |
@@ -218,7 +228,7 @@ class SmsLogin { | @@ -218,7 +228,7 @@ class SmsLogin { | ||
218 | }); | 228 | }); |
219 | return req.ctx(AuthHelperModel).syncUserSession(info.data.uid, req, res, info.data.session_key); | 229 | return req.ctx(AuthHelperModel).syncUserSession(info.data.uid, req, res, info.data.session_key); |
220 | }).then((authData) => { | 230 | }).then((authData) => { |
221 | - res.json({ | 231 | + res._sendFn({ |
222 | code: 200, | 232 | code: 200, |
223 | message: LOGIN_SUCCSS, | 233 | message: LOGIN_SUCCSS, |
224 | redirect: _.get(authData, 'refer') || utils.refererLimit(req.cookies.refer), | 234 | redirect: _.get(authData, 'refer') || utils.refererLimit(req.cookies.refer), |
@@ -228,7 +238,7 @@ class SmsLogin { | @@ -228,7 +238,7 @@ class SmsLogin { | ||
228 | 238 | ||
229 | delete req.session.smsLogin; | 239 | delete req.session.smsLogin; |
230 | }).catch(error => { | 240 | }).catch(error => { |
231 | - res.json(error); | 241 | + res._sendFn(error); |
232 | }); | 242 | }); |
233 | }).catch(next); | 243 | }).catch(next); |
234 | } | 244 | } |
@@ -169,6 +169,15 @@ router.get('/passport/sms_login', | @@ -169,6 +169,15 @@ router.get('/passport/sms_login', | ||
169 | validateCode.load, | 169 | validateCode.load, |
170 | smsLogin.smsLoginPage); // 短信验证码登录 | 170 | smsLogin.smsLoginPage); // 短信验证码登录 |
171 | router.post('/passport/sms_login/step1_check', validateCode.check, smsLogin.indexCheck); | 171 | router.post('/passport/sms_login/step1_check', validateCode.check, smsLogin.indexCheck); |
172 | +router.get('/passport/sms_login/step1_check', (req, res, next) => { | ||
173 | + if (!req.query.callback) { | ||
174 | + return res.json({code: 400}); | ||
175 | + } | ||
176 | + | ||
177 | + req.body = req.body || {}; | ||
178 | + Object.assign(req.body, req.query); | ||
179 | + next(); | ||
180 | +}, validateCode.check, smsLogin.indexCheck); | ||
172 | 181 | ||
173 | // 兼容老的路由 | 182 | // 兼容老的路由 |
174 | router.get('/signin.html', | 183 | router.get('/signin.html', |
@@ -7,7 +7,8 @@ const config = global.yoho.config; | @@ -7,7 +7,8 @@ const config = global.yoho.config; | ||
7 | 7 | ||
8 | module.exports = () => { | 8 | module.exports = () => { |
9 | return (req, res, next) => { | 9 | return (req, res, next) => { |
10 | - if (!req.yoho.isApp) { | 10 | + // webSession: 活动模板手机号领券,使用web端登录信息 |
11 | + if (!req.yoho.isApp || req.query.webSession) { | ||
11 | // 从 SESSION 中获取到当前登录用户的 UID | 12 | // 从 SESSION 中获取到当前登录用户的 UID |
12 | if (req.session && _.isNumber(req.session.LOGIN_UID_)) { | 13 | if (req.session && _.isNumber(req.session.LOGIN_UID_)) { |
13 | // 调用接口传参时切勿使用toString获得字符串 | 14 | // 调用接口传参时切勿使用toString获得字符串 |
@@ -70,8 +70,12 @@ class ResourceShowYasRpter { | @@ -70,8 +70,12 @@ class ResourceShowYasRpter { | ||
70 | let cacheTheShowSkns = []; // 暂存此次上报的楼层,上报后复制给 lastReportSkns | 70 | let cacheTheShowSkns = []; // 暂存此次上报的楼层,上报后复制给 lastReportSkns |
71 | let tabParams = {}; | 71 | let tabParams = {}; |
72 | 72 | ||
73 | + let $tapDom = $('.guess-like-tab-active'); | ||
74 | + | ||
75 | + $tapDom = $tapDom.length ? $tapDom.parent() : $('.guess-tab-active').parent(); | ||
76 | + | ||
73 | tabParams.TAB_NAME = $('.guess-like-tab-active').parent().data('tab-name') || $('.guess-tab-active').parent().data('tab-name'); | 77 | tabParams.TAB_NAME = $('.guess-like-tab-active').parent().data('tab-name') || $('.guess-tab-active').parent().data('tab-name'); |
74 | - tabParams.TAB_ID = $('.guess-like-tab-active').parent().data('item-idx') + 1 || $('.guess-tab-active').parent().data('item-idx') + 1; | 78 | + tabParams.TAB_ID = $tapDom.data('item-idx'); |
75 | tabParams.P_PARAM = $('.guess-like-tab-active').parent().data('code') || $('.guess-tab-active').parent().data('code'); | 79 | tabParams.P_PARAM = $('.guess-like-tab-active').parent().data('code') || $('.guess-tab-active').parent().data('code'); |
76 | 80 | ||
77 | $('.templates').each((floorIndex, theFloor) => { | 81 | $('.templates').each((floorIndex, theFloor) => { |
@@ -380,7 +380,7 @@ class Group extends Page { | @@ -380,7 +380,7 @@ class Group extends Page { | ||
380 | let tabName = $this.data('tab-name'); | 380 | let tabName = $this.data('tab-name'); |
381 | 381 | ||
382 | let params = { | 382 | let params = { |
383 | - TAB_ID: itemIdx + 1, | 383 | + TAB_ID: itemIdx, |
384 | TAB_NAME: tabName || '', | 384 | TAB_NAME: tabName || '', |
385 | ...custom_params | 385 | ...custom_params |
386 | }; | 386 | }; |
@@ -406,7 +406,7 @@ class Group extends Page { | @@ -406,7 +406,7 @@ class Group extends Page { | ||
406 | F_INDEX: indexIdx + 1, | 406 | F_INDEX: indexIdx + 1, |
407 | I_INDEX: itemIdx + 1, | 407 | I_INDEX: itemIdx + 1, |
408 | ACTION_URL: '', // 拼团不传 | 408 | ACTION_URL: '', // 拼团不传 |
409 | - TAB_ID: this.tabId + 1, | 409 | + TAB_ID: this.tabId, |
410 | TAB_NAME: this.tabName, | 410 | TAB_NAME: this.tabName, |
411 | P_PARAM: this.contentCode, | 411 | P_PARAM: this.contentCode, |
412 | ...custom_params | 412 | ...custom_params |
@@ -91,8 +91,8 @@ module.exports = (list) => { | @@ -91,8 +91,8 @@ module.exports = (list) => { | ||
91 | item.vip1_price && (item.vip1_price = item.vip1_price.toFixed(2)); | 91 | item.vip1_price && (item.vip1_price = item.vip1_price.toFixed(2)); |
92 | item.vip2_price && (item.vip2_price = item.vip2_price.toFixed(2)); | 92 | item.vip2_price && (item.vip2_price = item.vip2_price.toFixed(2)); |
93 | item.vip3_price && (item.vip3_price = item.vip3_price.toFixed(2)); | 93 | item.vip3_price && (item.vip3_price = item.vip3_price.toFixed(2)); |
94 | - item.sales_price && (item.sales_price = item.sales_price.toFixed(2)); | ||
95 | - item.market_price && (item.market_price = item.market_price.toFixed(2)); | 94 | + item.sales_price && (item.sales_price = String(item.sales_price)); |
95 | + item.market_price && (item.market_price = String(item.market_price)); | ||
96 | } | 96 | } |
97 | } | 97 | } |
98 | 98 |
-
Please register or login to post a comment