Showing
52 changed files
with
485 additions
and
178 deletions
@@ -349,7 +349,7 @@ exports.receiveCoupon = (receiveData, uid) => { | @@ -349,7 +349,7 @@ exports.receiveCoupon = (receiveData, uid) => { | ||
349 | break; | 349 | break; |
350 | default: | 350 | default: |
351 | returnData = { | 351 | returnData = { |
352 | - msg: '领券失败!', | 352 | + msg: result.message || '领券失败!', |
353 | status: false | 353 | status: false |
354 | }; | 354 | }; |
355 | break; | 355 | break; |
@@ -21,6 +21,9 @@ const index = (req, res) => { | @@ -21,6 +21,9 @@ const index = (req, res) => { | ||
21 | signurl: helpers.urlFormat('/signin.html') | 21 | signurl: helpers.urlFormat('/signin.html') |
22 | }; | 22 | }; |
23 | 23 | ||
24 | + // 唤起 APP 的路径 | ||
25 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.shopcart","params":{}}'; | ||
26 | + | ||
24 | res.render('index', Object.assign(pageData, { | 27 | res.render('index', Object.assign(pageData, { |
25 | title: '购物车', | 28 | title: '购物车', |
26 | module: 'cart', | 29 | module: 'cart', |
@@ -156,7 +159,8 @@ const add = (req, res, next) => { | @@ -156,7 +159,8 @@ const add = (req, res, next) => { | ||
156 | return indexModel.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey).then(data => { | 159 | return indexModel.addToCart(productSku, buyNumber, goodsType, isEdit, promotionId, uid, shoppingKey).then(data => { |
157 | if (!shoppingKey && _.has(data, 'data.shopping_key')) { | 160 | if (!shoppingKey && _.has(data, 'data.shopping_key')) { |
158 | res.cookie('_SPK', data.data.shopping_key, { | 161 | res.cookie('_SPK', data.data.shopping_key, { |
159 | - expires: new Date(Date.now() + 86400 * 360) | 162 | + expires: new Date(Date.now() + 86400 * 360), |
163 | + domain: '.m.yohobuy.com' | ||
160 | }); | 164 | }); |
161 | } | 165 | } |
162 | data ? res.json(data) : res.status(400).json({ | 166 | data ? res.json(data) : res.status(400).json({ |
@@ -70,23 +70,26 @@ exports.orderEnsure = (req, res, next) => { | @@ -70,23 +70,26 @@ exports.orderEnsure = (req, res, next) => { | ||
70 | addressModel.addressData(uid) | 70 | addressModel.addressData(uid) |
71 | ]; | 71 | ]; |
72 | 72 | ||
73 | - if (_.isUndefined(req.cookies._isNewUser)) { | ||
74 | - allPromise.push(orderModel.isNewUser(uid)); | ||
75 | - } | 73 | + /* tar note 170426 品众去除 */ |
74 | + // if (_.isUndefined(req.cookies._isNewUser)) { | ||
75 | + // allPromise.push(orderModel.isNewUser(uid)); | ||
76 | + // } | ||
76 | 77 | ||
77 | return Promise.all(allPromise).then(result => { | 78 | return Promise.all(allPromise).then(result => { |
78 | let order = result[0]; | 79 | let order = result[0]; |
79 | let userProfile = result[1]; | 80 | let userProfile = result[1]; |
80 | let address = result[2]; | 81 | let address = result[2]; |
81 | - let isNewUser = result[3]; | ||
82 | 82 | ||
83 | - if (!_.isUndefined(isNewUser)) { | ||
84 | - if (isNewUser) { | ||
85 | - res.cookie('_isNewUser', true, actCkOpthn); | ||
86 | - } else { | ||
87 | - res.cookie('_isNewUser', false, actCkOpthn); | ||
88 | - } | ||
89 | - } | 83 | + /* tar note 170426 品众去除 */ |
84 | + // let isNewUser = result[3]; | ||
85 | + | ||
86 | + // if (!_.isUndefined(isNewUser)) { | ||
87 | + // if (isNewUser) { | ||
88 | + // res.cookie('_isNewUser', true, actCkOpthn); | ||
89 | + // } else { | ||
90 | + // res.cookie('_isNewUser', false, actCkOpthn); | ||
91 | + // } | ||
92 | + // } | ||
90 | 93 | ||
91 | if (order.cartUrl) { | 94 | if (order.cartUrl) { |
92 | logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`); | 95 | logger.info(`orderEnsure: order cartUrl has value:${order.cartUrl}, order data is null`); |
@@ -3,12 +3,27 @@ | @@ -3,12 +3,27 @@ | ||
3 | const api = global.yoho.API; | 3 | const api = global.yoho.API; |
4 | 4 | ||
5 | const cartCount = (uid, shoppingKey) => { | 5 | const cartCount = (uid, shoppingKey) => { |
6 | + let params = { | ||
7 | + method: 'app.Shopping.count' | ||
8 | + }; | ||
6 | 9 | ||
7 | - return api.get('', { | ||
8 | - method: 'app.Shopping.count', | ||
9 | - uid: uid, | 10 | + if (!uid && !shoppingKey) { |
11 | + return Promise.resolve({}); | ||
12 | + } | ||
13 | + | ||
14 | + if (uid) { | ||
15 | + Object.assign(params, { | ||
16 | + uid: uid | ||
17 | + }); | ||
18 | + } | ||
19 | + | ||
20 | + if (shoppingKey) { | ||
21 | + Object.assign(params, { | ||
10 | shopping_key: shoppingKey | 22 | shopping_key: shoppingKey |
11 | - }).then((result) => { | 23 | + }); |
24 | + } | ||
25 | + | ||
26 | + return api.get('', params).then((result) => { | ||
12 | return result; | 27 | return result; |
13 | }); | 28 | }); |
14 | }; | 29 | }; |
@@ -17,6 +17,7 @@ const helpers = global.yoho.helpers; | @@ -17,6 +17,7 @@ const helpers = global.yoho.helpers; | ||
17 | const _ = require('lodash'); | 17 | const _ = require('lodash'); |
18 | const co = require('bluebird').coroutine; | 18 | const co = require('bluebird').coroutine; |
19 | const logger = global.yoho.logger; | 19 | const logger = global.yoho.logger; |
20 | +const stringProcess = require(`${global.utils}/string-process`); | ||
20 | 21 | ||
21 | // 支付方式 | 22 | // 支付方式 |
22 | const payments = { | 23 | const payments = { |
@@ -55,7 +56,7 @@ const _getOthersBuy2 = (param) => { | @@ -55,7 +56,7 @@ const _getOthersBuy2 = (param) => { | ||
55 | 56 | ||
56 | // 订单信息 | 57 | // 订单信息 |
57 | const _getOtherDetail = (param) => { | 58 | const _getOtherDetail = (param) => { |
58 | - if (!param.uid || !param.orderCode) { | 59 | + if (!param.uid || !param.orderCode || !stringProcess.isNumeric(param.orderCode)) { |
59 | return Promise.resolve({}); | 60 | return Promise.resolve({}); |
60 | } | 61 | } |
61 | 62 |
@@ -29,6 +29,9 @@ let index = (req, res, next) => { | @@ -29,6 +29,9 @@ let index = (req, res, next) => { | ||
29 | }; | 29 | }; |
30 | let channel; | 30 | let channel; |
31 | 31 | ||
32 | + // 唤起 APP 的路径 | ||
33 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.attention","params":{"actiontype":"1"}}'; | ||
34 | + | ||
32 | if (!req.query.channel) { | 35 | if (!req.query.channel) { |
33 | channel = '1'; | 36 | channel = '1'; |
34 | } else if (!typeLib.channels[req.query.channel]) { | 37 | } else if (!typeLib.channels[req.query.channel]) { |
@@ -7,6 +7,8 @@ const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab | @@ -7,6 +7,8 @@ const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab | ||
7 | const helpers = global.yoho.helpers; | 7 | const helpers = global.yoho.helpers; |
8 | 8 | ||
9 | let index = (req, res, next) => { | 9 | let index = (req, res, next) => { |
10 | + // 唤起 APP 的路径 | ||
11 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.attention","params":{"actiontype":"0"}}'; | ||
10 | 12 | ||
11 | cateModel.getCateData(req.yoho.channel).then((result) => { | 13 | cateModel.getCateData(req.yoho.channel).then((result) => { |
12 | res.render('cate', { | 14 | res.render('cate', { |
@@ -210,6 +210,10 @@ const index = (req, res, next) => { | @@ -210,6 +210,10 @@ const index = (req, res, next) => { | ||
210 | res.set('Cache-Control', 'no-cache'); | 210 | res.set('Cache-Control', 'no-cache'); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | + | ||
214 | + // 唤起 APP 的路径 | ||
215 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy= {"action":"go.guangchannel","params":{"id":${param.type}}}`; | ||
216 | + | ||
213 | res.render('guang', Object.assign(responseData, result, { | 217 | res.render('guang', Object.assign(responseData, result, { |
214 | localCss: true | 218 | localCss: true |
215 | })); | 219 | })); |
@@ -26,6 +26,9 @@ exports.index = (req, res, next) => { | @@ -26,6 +26,9 @@ exports.index = (req, res, next) => { | ||
26 | 26 | ||
27 | let studentSwitch = !_.get(req.app.locals.wap, 'user.removeStudentIdentification', true); | 27 | let studentSwitch = !_.get(req.app.locals.wap, 'user.removeStudentIdentification', true); |
28 | 28 | ||
29 | + // 唤起 APP 的路径 | ||
30 | + res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy= {"action":"go.mine"}'; | ||
31 | + | ||
29 | indexModel.index(params).then(result => { | 32 | indexModel.index(params).then(result => { |
30 | if (result) { | 33 | if (result) { |
31 | res.render('home', Object.assign(result, { | 34 | res.render('home', Object.assign(result, { |
@@ -8,12 +8,14 @@ | @@ -8,12 +8,14 @@ | ||
8 | const installmentModel = require('../models/installment'); | 8 | const installmentModel = require('../models/installment'); |
9 | const _ = require('lodash'); | 9 | const _ = require('lodash'); |
10 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
11 | +const logger = global.yoho.logger; | ||
11 | 12 | ||
12 | // 服务器报错页面 | 13 | // 服务器报错页面 |
13 | const _serverCrash = (res, params, err, next) => { | 14 | const _serverCrash = (res, params, err, next) => { |
14 | if (err && err.code === 401) { | 15 | if (err && err.code === 401) { |
15 | return next(err); | 16 | return next(err); |
16 | } | 17 | } |
18 | + logger.error(err); | ||
17 | params.title = params.title || '有货分期'; | 19 | params.title = params.title || '有货分期'; |
18 | res.render('installment/server-crash', params); | 20 | res.render('installment/server-crash', params); |
19 | }; | 21 | }; |
@@ -54,6 +56,7 @@ const _repaymentList = (req, res, next, opt, params) => { | @@ -54,6 +56,7 @@ const _repaymentList = (req, res, next, opt, params) => { | ||
54 | const index = (req, res, next) => { | 56 | const index = (req, res, next) => { |
55 | let uid = req.user.uid; | 57 | let uid = req.user.uid; |
56 | 58 | ||
59 | + logger.info(`installment index info: client_type=${req.query.client_type},req.user.uid=${req.user.uid},req.query.uid=${req.query.uid},cookies=${JSON.stringify(req.cookies)}`); // eslint-disable-line | ||
57 | Promise.all([ | 60 | Promise.all([ |
58 | installmentModel.getStauts(uid), | 61 | installmentModel.getStauts(uid), |
59 | installmentModel.getSearchIntallment({ | 62 | installmentModel.getSearchIntallment({ |
@@ -145,8 +145,7 @@ const addressModify = (req, res, next) => { | @@ -145,8 +145,7 @@ const addressModify = (req, res, next) => { | ||
145 | 145 | ||
146 | addressModel.getAddressData({uid: uid}).then(result => { | 146 | addressModel.getAddressData({uid: uid}).then(result => { |
147 | let userAddressList = result; | 147 | let userAddressList = result; |
148 | - let addressData = addressProcess.getAddressByAreaCode(areaCode, | ||
149 | - _.get(userAddressList, 'data', [])) || {}; | 148 | + let addressData = addressProcess.getAddressByAreaCode(areaCode, _.get(userAddressList, 'data', [])) || {}; |
150 | 149 | ||
151 | Object.assign(addressData, { | 150 | Object.assign(addressData, { |
152 | orderCode: orderCode, | 151 | orderCode: orderCode, |
@@ -154,7 +153,7 @@ const addressModify = (req, res, next) => { | @@ -154,7 +153,7 @@ const addressModify = (req, res, next) => { | ||
154 | 153 | ||
155 | if (provinceAreaCode) { | 154 | if (provinceAreaCode) { |
156 | // 不允许修改省份,字符串拆分 | 155 | // 不允许修改省份,字符串拆分 |
157 | - let areaArray = addressData.area.split(' '); | 156 | + let areaArray = addressData.area ? addressData.area.split(' ') : []; |
158 | let area = _.slice(areaArray, 1); | 157 | let area = _.slice(areaArray, 1); |
159 | 158 | ||
160 | Object.assign(addressData, { | 159 | Object.assign(addressData, { |
@@ -12,6 +12,7 @@ const helpers = global.yoho.helpers; | @@ -12,6 +12,7 @@ const helpers = global.yoho.helpers; | ||
12 | const api = global.yoho.API; | 12 | const api = global.yoho.API; |
13 | const serviceAPI = global.yoho.ServiceAPI; | 13 | const serviceAPI = global.yoho.ServiceAPI; |
14 | const logger = global.yoho.logger; | 14 | const logger = global.yoho.logger; |
15 | +const stringProcess = require(`${global.utils}/string-process`); | ||
15 | const API_TIMEOUT = 10000; | 16 | const API_TIMEOUT = 10000; |
16 | const codeContent = { | 17 | const codeContent = { |
17 | openN: '0876085ff46bed27f1a1eb6ee8b68987', | 18 | openN: '0876085ff46bed27f1a1eb6ee8b68987', |
@@ -207,7 +208,7 @@ const getStauts = (uid) => { | @@ -207,7 +208,7 @@ const getStauts = (uid) => { | ||
207 | if (result && result.code === 200) { | 208 | if (result && result.code === 200) { |
208 | return result.data.status; | 209 | return result.data.status; |
209 | } else { | 210 | } else { |
210 | - logger.error('get installment open status return code is not 200'); | 211 | + logger.error(`get installment open status return code is not 200,uid:${uid},result=${JSON.stringify(result)}`); // eslint-disable-line |
211 | return Promise.reject(result); | 212 | return Promise.reject(result); |
212 | } | 213 | } |
213 | }); | 214 | }); |
@@ -423,6 +424,10 @@ const getBankCards = (uid) => { | @@ -423,6 +424,10 @@ const getBankCards = (uid) => { | ||
423 | const getInstallmentOrderDetail = (params) => { | 424 | const getInstallmentOrderDetail = (params) => { |
424 | const method = 'app.SpaceOrders.installDetail'; | 425 | const method = 'app.SpaceOrders.installDetail'; |
425 | 426 | ||
427 | + if (!params.uid || !params.orderCode || !stringProcess.isNumeric(params.orderCode)) { | ||
428 | + return Promise.resolve({}); | ||
429 | + } | ||
430 | + | ||
426 | return api.get('', { | 431 | return api.get('', { |
427 | method: method, | 432 | method: method, |
428 | uid: params.uid, | 433 | uid: params.uid, |
@@ -10,6 +10,7 @@ const _ = require('lodash'); | @@ -10,6 +10,7 @@ const _ = require('lodash'); | ||
10 | const helpers = global.yoho.helpers; | 10 | const helpers = global.yoho.helpers; |
11 | const camelCase = global.yoho.camelCase; | 11 | const camelCase = global.yoho.camelCase; |
12 | const logger = global.yoho.logger; | 12 | const logger = global.yoho.logger; |
13 | +const stringProcess = require(`${global.utils}/string-process`); | ||
13 | 14 | ||
14 | const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码 | 15 | const CODE_LOGISTIC_BANNER = '1fc9b2484fcd559049f2f7e0db313f20'; // 物流详情banner资源码 |
15 | 16 | ||
@@ -143,6 +144,10 @@ const _getOrderStatus = (order, showLogistics) => { | @@ -143,6 +144,10 @@ const _getOrderStatus = (order, showLogistics) => { | ||
143 | 144 | ||
144 | const orderDetailData = (uid, orderCode) => { | 145 | const orderDetailData = (uid, orderCode) => { |
145 | 146 | ||
147 | + if (!uid || !orderCode || !stringProcess.isNumeric(orderCode)) { | ||
148 | + return Promise.resolve({}); | ||
149 | + } | ||
150 | + | ||
146 | return api.get('', { | 151 | return api.get('', { |
147 | method: 'app.SpaceOrders.detail', | 152 | method: 'app.SpaceOrders.detail', |
148 | uid: uid, | 153 | uid: uid, |
@@ -237,6 +237,8 @@ const sendCodeToMobileAPI = (req, res, next) => { | @@ -237,6 +237,8 @@ const sendCodeToMobileAPI = (req, res, next) => { | ||
237 | _.set(req.session, 'backupCaptch.timeout', Date.now() + 5 * 60 * 1000); | 237 | _.set(req.session, 'backupCaptch.timeout', Date.now() + 5 * 60 * 1000); |
238 | } | 238 | } |
239 | 239 | ||
240 | + req.session.backupCaptchStep2 = true; // 允许跳到第二步 | ||
241 | + | ||
240 | return res.json({ | 242 | return res.json({ |
241 | code: 200, | 243 | code: 200, |
242 | data: helpers.urlFormat('/passport/back/mobilecode', { | 244 | data: helpers.urlFormat('/passport/back/mobilecode', { |
@@ -286,14 +288,17 @@ const verifyCodeByMobileAPI = (req, res, next) => { | @@ -286,14 +288,17 @@ const verifyCodeByMobileAPI = (req, res, next) => { | ||
286 | 288 | ||
287 | service.validateMobileCodeAsync(phoneNum, code, areaCode) | 289 | service.validateMobileCodeAsync(phoneNum, code, areaCode) |
288 | .then(result => { | 290 | .then(result => { |
289 | - if (result.code === 200) { | ||
290 | - res.json({ | ||
291 | - code: 200, | ||
292 | - data: helpers.urlFormat('/passport/back/backcode', { | 291 | + if (result.code === 200 && result.data) { |
292 | + req.session.backcode = { | ||
293 | phoneNum: phoneNum, | 293 | phoneNum: phoneNum, |
294 | token: result.data.token, | 294 | token: result.data.token, |
295 | - areaCode: areaCode | ||
296 | - }) | 295 | + areaCode: areaCode, |
296 | + code: code | ||
297 | + }; | ||
298 | + | ||
299 | + res.json({ | ||
300 | + code: 200, | ||
301 | + data: helpers.urlFormat('/passport/back/backcode') | ||
297 | }); | 302 | }); |
298 | } else { | 303 | } else { |
299 | res.json({ | 304 | res.json({ |
@@ -309,16 +314,15 @@ const verifyCodeByMobileAPI = (req, res, next) => { | @@ -309,16 +314,15 @@ const verifyCodeByMobileAPI = (req, res, next) => { | ||
309 | * 找回密码页面,设置新密码页面-手机 | 314 | * 找回密码页面,设置新密码页面-手机 |
310 | */ | 315 | */ |
311 | const setNewPasswordByMobilePage = (req, res) => { | 316 | const setNewPasswordByMobilePage = (req, res) => { |
312 | - let phoneNum = req.query.phoneNum || ''; | ||
313 | - let token = req.query.token || ''; | ||
314 | - let areaCode = req.query.areaCode || '86'; | ||
315 | - let code = req.query.code || ''; | 317 | + let backcode = req.session.backcode; |
316 | 318 | ||
317 | - if (!(code || (token && helpers.verifyMobile(phoneNum)))) { | 319 | + if (!backcode || !(backcode.code || (backcode.token && helpers.verifyMobile(backcode.phoneNum)))) { |
318 | res.redirect(400); | 320 | res.redirect(400); |
319 | return; | 321 | return; |
320 | } | 322 | } |
321 | 323 | ||
324 | + req.session.backcode = null; | ||
325 | + | ||
322 | res.render('back/new-password', Object.assign({ | 326 | res.render('back/new-password', Object.assign({ |
323 | module: 'passport', | 327 | module: 'passport', |
324 | page: 'back-new-password', | 328 | page: 'back-new-password', |
@@ -328,10 +332,10 @@ const setNewPasswordByMobilePage = (req, res) => { | @@ -328,10 +332,10 @@ const setNewPasswordByMobilePage = (req, res) => { | ||
328 | headerText: '找回密码', | 332 | headerText: '找回密码', |
329 | isPassportPage: true, | 333 | isPassportPage: true, |
330 | backNewPwd: true, | 334 | backNewPwd: true, |
331 | - phoneNum: phoneNum, | ||
332 | - token: token, | ||
333 | - areaCode: areaCode, | ||
334 | - code: code | 335 | + phoneNum: backcode.phoneNum, |
336 | + token: backcode.token, | ||
337 | + areaCode: backcode.areaCode, | ||
338 | + code: backcode.code | ||
335 | })); | 339 | })); |
336 | }; | 340 | }; |
337 | 341 | ||
@@ -361,6 +365,20 @@ const setNewPasswordByMobileAPI = (req, res, next) => { | @@ -361,6 +365,20 @@ const setNewPasswordByMobileAPI = (req, res, next) => { | ||
361 | .catch(next); | 365 | .catch(next); |
362 | }; | 366 | }; |
363 | 367 | ||
368 | +/** | ||
369 | + * 直接调用发短信接口的情况 | ||
370 | + */ | ||
371 | +const verifySmsAllow = (req, res, next) => { | ||
372 | + if (_.get(req, 'session.backupCaptch.verifyResult')) { | ||
373 | + return next(); | ||
374 | + } else { | ||
375 | + return res.json({ | ||
376 | + code: 400, | ||
377 | + message: '非法请求' | ||
378 | + }); | ||
379 | + } | ||
380 | +}; | ||
381 | + | ||
364 | module.exports = { | 382 | module.exports = { |
365 | indexEmailPage, | 383 | indexEmailPage, |
366 | sendCodeToEmailAPI, | 384 | sendCodeToEmailAPI, |
@@ -373,5 +391,6 @@ module.exports = { | @@ -373,5 +391,6 @@ module.exports = { | ||
373 | verifyCodeByMobileAPI, | 391 | verifyCodeByMobileAPI, |
374 | setNewPasswordByMobilePage, | 392 | setNewPasswordByMobilePage, |
375 | setNewPasswordByMobileAPI, | 393 | setNewPasswordByMobileAPI, |
376 | - generateCodeImg | 394 | + generateCodeImg, |
395 | + verifySmsAllow | ||
377 | }; | 396 | }; |
@@ -38,6 +38,7 @@ exports.imgCheck = (req, res, next) => { | @@ -38,6 +38,7 @@ exports.imgCheck = (req, res, next) => { | ||
38 | }, ''); | 38 | }, ''); |
39 | 39 | ||
40 | req.session.captcha = codeStr; | 40 | req.session.captcha = codeStr; |
41 | + req.session.captchaTimeout = new Date().getTime() + 1000 * 60; | ||
41 | req.session.captchaSrc = result.data.verifiedGraphicCode; | 42 | req.session.captchaSrc = result.data.verifiedGraphicCode; |
42 | 43 | ||
43 | return request(`${result.data.verifiedGraphicCode}?imageView2/0/format/jpg/q/70|watermark/2/text/${uuid.v4()}/fontsize/120/dissolve/10`).pipe(res); // eslint-disable-line | 44 | return request(`${result.data.verifiedGraphicCode}?imageView2/0/format/jpg/q/70|watermark/2/text/${uuid.v4()}/fontsize/120/dissolve/10`).pipe(res); // eslint-disable-line |
@@ -52,6 +53,18 @@ exports.imgCheck = (req, res, next) => { | @@ -52,6 +53,18 @@ exports.imgCheck = (req, res, next) => { | ||
52 | exports.validate = (req, res, next) => { | 53 | exports.validate = (req, res, next) => { |
53 | let captchaInput = req.body.captcha; | 54 | let captchaInput = req.body.captcha; |
54 | let captchaCode = _.get(req.session, 'captcha'); | 55 | let captchaCode = _.get(req.session, 'captcha'); |
56 | + let captchaTimeout = _.get(req.session, 'captchaTimeout'); | ||
57 | + | ||
58 | + if (new Date().getTime() > captchaTimeout) { | ||
59 | + _.set(req.session, 'captchaValidCount', 5); | ||
60 | + req.session.captcha = null; | ||
61 | + return res.json({ | ||
62 | + code: 400, | ||
63 | + message: '验证码超时,请重试', | ||
64 | + changeCaptcha: true, | ||
65 | + captchaShow: true | ||
66 | + }); | ||
67 | + } | ||
55 | 68 | ||
56 | let errorCount = _.get(req.session, 'captchaValidCount'); // 初始1次 + 后续4次, 同一个验证码 共5次 | 69 | let errorCount = _.get(req.session, 'captchaValidCount'); // 初始1次 + 后续4次, 同一个验证码 共5次 |
57 | 70 |
@@ -117,8 +117,29 @@ const common = { | @@ -117,8 +117,29 @@ const common = { | ||
117 | return next(); | 117 | return next(); |
118 | }); | 118 | }); |
119 | } | 119 | } |
120 | + }, | ||
121 | + isLoginUser: (req, res, next) => { | ||
122 | + // 微信里边已经登录的时候,不再跳转登录 | ||
123 | + if (req.user.uid) { | ||
124 | + AuthHelper.profile(req.user.uid).then(function(result) { | ||
125 | + if (result.code !== 200) { | ||
126 | + return next(); | ||
120 | } | 127 | } |
128 | + let refer = req.query.refer || decodeURI(req.cookies.refer) || config.siteUrl; | ||
121 | 129 | ||
130 | + if (/sign|login/.test(refer)) { | ||
131 | + refer = `${config.siteUrl}/home`; | ||
132 | + } | ||
133 | + | ||
134 | + refer = utils.refererLimit(refer); | ||
135 | + return res.redirect(refer); | ||
136 | + }).catch(() => { | ||
137 | + return next(); | ||
138 | + }); | ||
139 | + } else { | ||
140 | + return next(); | ||
141 | + } | ||
142 | + } | ||
122 | }; | 143 | }; |
123 | 144 | ||
124 | 145 | ||
@@ -280,19 +301,6 @@ const local = { | @@ -280,19 +301,6 @@ const local = { | ||
280 | 301 | ||
281 | const wechat = { | 302 | const wechat = { |
282 | login: (req, res, next) => { | 303 | login: (req, res, next) => { |
283 | - // 微信里边已经登录的时候,不再跳转登录 | ||
284 | - // 与 5.6 的 session 有冲突 | ||
285 | - // if (req.user.uid) { | ||
286 | - // let refer = req.query.refer || decodeURI(req.cookies.refer) || config.siteUrl; | ||
287 | - | ||
288 | - // if (/sign|login/.test(refer)) { | ||
289 | - // refer = `${config.siteUrl}/home`; | ||
290 | - // } | ||
291 | - | ||
292 | - // refer = utils.refererLimit(refer); | ||
293 | - // return res.redirect(refer); | ||
294 | - // } | ||
295 | - | ||
296 | // 设置为原链接标识originalUrl | 304 | // 设置为原链接标识originalUrl |
297 | req.session.originalUrl = 'true'; | 305 | req.session.originalUrl = 'true'; |
298 | req.session.authState = uuid.v4(); | 306 | req.session.authState = uuid.v4(); |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-04-13 10:21:07 | 3 | * @Date: 2017-04-13 10:21:07 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-04-20 18:33:48 | 5 | + * @Last Modified time: 2017-04-24 10:52:08 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* ******************** | 8 | /* ******************** |
@@ -49,9 +49,9 @@ const passwordResetPage = (req, res) => { | @@ -49,9 +49,9 @@ const passwordResetPage = (req, res) => { | ||
49 | */ | 49 | */ |
50 | const passwordReset = (req, res, next) => { | 50 | const passwordReset = (req, res, next) => { |
51 | let passwordWeakObj = req.session.passwordWeak; | 51 | let passwordWeakObj = req.session.passwordWeak; |
52 | - let uid = req.user && req.user.uid || passwordWeakObj.uid; | 52 | + let uid = (req.user && req.user.uid) || (passwordWeakObj && passwordWeakObj.uid); |
53 | 53 | ||
54 | - if (!uid || !passwordWeakObj.token) { | 54 | + if (!uid || !passwordWeakObj || !passwordWeakObj.token) { |
55 | return res.json({ | 55 | return res.json({ |
56 | code: 400, | 56 | code: 400, |
57 | massage: '非法请求' | 57 | massage: '非法请求' |
@@ -75,7 +75,7 @@ router.post('/passport/sms_login/password.json', smsLogin.password); | @@ -75,7 +75,7 @@ router.post('/passport/sms_login/password.json', smsLogin.password); | ||
75 | router.get('/passport/login/user', login.user); | 75 | router.get('/passport/login/user', login.user); |
76 | 76 | ||
77 | // 微信登录 | 77 | // 微信登录 |
78 | -router.get('/passport/login/wechat', login.common.beforeLogin, login.wechat.login); | 78 | +router.get('/passport/login/wechat', login.common.beforeLogin, login.common.isLoginUser, login.wechat.login); |
79 | router.get('/passport/login/wechat/callback', login.wechat.callback); | 79 | router.get('/passport/login/wechat/callback', login.wechat.callback); |
80 | 80 | ||
81 | // sina登录 | 81 | // sina登录 |
@@ -134,6 +134,7 @@ router.get('/passport/back/mobile', validateCode.load, back.indexMobilePage);// | @@ -134,6 +134,7 @@ router.get('/passport/back/mobile', validateCode.load, back.indexMobilePage);// | ||
134 | router.get('/passport/back/mobilecode', back.verifyCodeByMobilePage);// 输入手机验证码页面 | 134 | router.get('/passport/back/mobilecode', back.verifyCodeByMobilePage);// 输入手机验证码页面 |
135 | router.get('/passport/back/generatecodeimg.png', back.generateCodeImg);// 生成图片验证码 | 135 | router.get('/passport/back/generatecodeimg.png', back.generateCodeImg);// 生成图片验证码 |
136 | router.post('/passport/back/sendcode', validateCode.check, back.sendCodeToMobileAPI);// 发送手机验证码 | 136 | router.post('/passport/back/sendcode', validateCode.check, back.sendCodeToMobileAPI);// 发送手机验证码 |
137 | +router.post('/passport/back/sendcodeagain', back.verifySmsAllow, back.sendCodeToMobileAPI);// 重新发送手机验证码 | ||
137 | router.post('/passport/back/verifycode', back.verifyCodeByMobileAPI);// 校验手机验证码 | 138 | router.post('/passport/back/verifycode', back.verifyCodeByMobileAPI);// 校验手机验证码 |
138 | 139 | ||
139 | router.get('/passport/back/backcode', back.setNewPasswordByMobilePage);// 设置新密码页面 | 140 | router.get('/passport/back/backcode', back.setNewPasswordByMobilePage);// 设置新密码页面 |
@@ -69,6 +69,9 @@ const shop = { | @@ -69,6 +69,9 @@ const shop = { | ||
69 | 69 | ||
70 | params.brand = brandId; | 70 | params.brand = brandId; |
71 | 71 | ||
72 | + // 唤起 APP 的路径 | ||
73 | + res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.brand","params":{"brand_id":"${brandId}"}}`; | ||
74 | + | ||
72 | let searchParam = Object.assign({ | 75 | let searchParam = Object.assign({ |
73 | isApp: req.yoho.isApp, | 76 | isApp: req.yoho.isApp, |
74 | brand: brandId, | 77 | brand: brandId, |
@@ -221,7 +224,7 @@ const shop = { | @@ -221,7 +224,7 @@ const shop = { | ||
221 | } | 224 | } |
222 | 225 | ||
223 | /* 红人店铺直接跳转 */ | 226 | /* 红人店铺直接跳转 */ |
224 | - if (shopInfoResult.is_red_shop) { | 227 | + if (shopInfoResult && shopInfoResult.is_red_shop) { |
225 | shop.redShop(req, res, next); | 228 | shop.redShop(req, res, next); |
226 | return false; | 229 | return false; |
227 | } | 230 | } |
@@ -7,11 +7,17 @@ | @@ -7,11 +7,17 @@ | ||
7 | 7 | ||
8 | const newsaleModel = require('../models/newsale'); | 8 | const newsaleModel = require('../models/newsale'); |
9 | const headerModel = require('../../../doraemon/models/header'); | 9 | const headerModel = require('../../../doraemon/models/header'); |
10 | + | ||
11 | +let yhchannels = { | ||
12 | + '1,3': 1, | ||
13 | + '2,3': 2 | ||
14 | +}; | ||
15 | + | ||
10 | let channels = { | 16 | let channels = { |
11 | - boys: '1,3', | ||
12 | - girl: '2,3', | ||
13 | - kids: '1,2,3', | ||
14 | - lifestyle: '1,2,3' | 17 | + boys: 1, |
18 | + girls: 2, | ||
19 | + kids: 3, | ||
20 | + lifestyle: 4 | ||
15 | }; | 21 | }; |
16 | 22 | ||
17 | const index = (req, res, next) => { | 23 | const index = (req, res, next) => { |
@@ -56,10 +62,10 @@ const selectHotrank = (req, res, next) => { | @@ -56,10 +62,10 @@ const selectHotrank = (req, res, next) => { | ||
56 | let limit = 50; | 62 | let limit = 50; |
57 | let page = req.query.page || 1; | 63 | let page = req.query.page || 1; |
58 | let notab = req.query.notab || 0; | 64 | let notab = req.query.notab || 0; |
59 | - let yhChannel = req.query.yh_channel || 1; | ||
60 | - let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3'; | 65 | + let yhChannel = (req.query.gender && yhchannels[req.query.gender]) || |
66 | + (req.cookies._Channel && channels[req.cookies._Channel]) || 1; | ||
61 | 67 | ||
62 | - newsaleModel.selectHotrank(yhChannel, gender, sort, tab_id, limit, page, notab).then((result) => { | 68 | + newsaleModel.selectHotrank(yhChannel, sort, tab_id, limit, page, notab).then((result) => { |
63 | 69 | ||
64 | res.render('newsale/hotlist', { | 70 | res.render('newsale/hotlist', { |
65 | layout: false, | 71 | layout: false, |
@@ -11,6 +11,7 @@ const helpers = global.yoho.helpers; | @@ -11,6 +11,7 @@ const helpers = global.yoho.helpers; | ||
11 | const api = global.yoho.API; | 11 | const api = global.yoho.API; |
12 | const searchModel = require('./search'); | 12 | const searchModel = require('./search'); |
13 | const productProcess = require(`${utils}/product-process`); | 13 | const productProcess = require(`${utils}/product-process`); |
14 | +const stringProcess = require(`${global.utils}/string-process`); | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * 频道 | 17 | * 频道 |
@@ -122,14 +123,22 @@ const _getShopDecorator = (shopId) => { | @@ -122,14 +123,22 @@ const _getShopDecorator = (shopId) => { | ||
122 | * @return array | 123 | * @return array |
123 | */ | 124 | */ |
124 | const _getShopInfo = (shopId, uid) => { | 125 | const _getShopInfo = (shopId, uid) => { |
125 | - if (uid === 'undefined') { | ||
126 | - uid = 0; | ||
127 | - } | ||
128 | - return api.get('', { | 126 | + let finalParams = { |
129 | method: 'app.shops.getIntro', | 127 | method: 'app.shops.getIntro', |
130 | shop_id: shopId, | 128 | shop_id: shopId, |
131 | - uid: uid || 0 | ||
132 | - }, {code: 200}).then((result) => { | 129 | + }; |
130 | + | ||
131 | + if (!shopId || !stringProcess.isNumeric(shopId)) { | ||
132 | + return Promise.resolve({}); | ||
133 | + } | ||
134 | + | ||
135 | + if (uid && uid !== 'undefined') { | ||
136 | + Object.assign(finalParams, { | ||
137 | + uid: uid | ||
138 | + }); | ||
139 | + } | ||
140 | + | ||
141 | + return api.get('', finalParams, {code: 200}).then((result) => { | ||
133 | return result && result.data; | 142 | return result && result.data; |
134 | }); | 143 | }); |
135 | }; | 144 | }; |
@@ -144,6 +153,10 @@ const getShopIntro = (shopId, uid) => { | @@ -144,6 +153,10 @@ const getShopIntro = (shopId, uid) => { | ||
144 | shop_id: shopId | 153 | shop_id: shopId |
145 | }; | 154 | }; |
146 | 155 | ||
156 | + if (!shopId || !stringProcess.isNumeric(shopId)) { | ||
157 | + return Promise.resolve({}); | ||
158 | + } | ||
159 | + | ||
147 | if (uid && uid !== 'undefined') { | 160 | if (uid && uid !== 'undefined') { |
148 | params.uid = uid; | 161 | params.uid = uid; |
149 | } | 162 | } |
@@ -40,10 +40,9 @@ const getHotRank = (codeKey) => { | @@ -40,10 +40,9 @@ const getHotRank = (codeKey) => { | ||
40 | }); | 40 | }); |
41 | }; | 41 | }; |
42 | 42 | ||
43 | -const selectHotrank = (yhChannel, gender, sort, tabId, limit, page, notab) => { | 43 | +const selectHotrank = (yhChannel, sort, tabId, limit, page, notab) => { |
44 | let param = { | 44 | let param = { |
45 | method: 'app.search.top', | 45 | method: 'app.search.top', |
46 | - gender: gender, | ||
47 | yh_channel: yhChannel, | 46 | yh_channel: yhChannel, |
48 | page: page, | 47 | page: page, |
49 | limit: limit | 48 | limit: limit |
@@ -5,6 +5,7 @@ | @@ -5,6 +5,7 @@ | ||
5 | 5 | ||
6 | const api = global.yoho.API; | 6 | const api = global.yoho.API; |
7 | const singleAPI = global.yoho.SingleAPI; | 7 | const singleAPI = global.yoho.SingleAPI; |
8 | +const stringProcess = require(`${global.utils}/string-process`); | ||
8 | 9 | ||
9 | /** | 10 | /** |
10 | * 频道 | 11 | * 频道 |
@@ -41,6 +42,10 @@ exports.getIntro = shopId => { | @@ -41,6 +42,10 @@ exports.getIntro = shopId => { | ||
41 | shop_id: shopId | 42 | shop_id: shopId |
42 | }; | 43 | }; |
43 | 44 | ||
45 | + if (!shopId || !stringProcess.isNumeric(shopId)) { | ||
46 | + return Promise.resolve({}); | ||
47 | + } | ||
48 | + | ||
44 | return api.get('', params, {cache: true, code: 200}); | 49 | return api.get('', params, {cache: true, code: 200}); |
45 | }; | 50 | }; |
46 | 51 | ||
@@ -77,12 +82,19 @@ exports.getShopCategory = (shopId, channel) => { | @@ -77,12 +82,19 @@ exports.getShopCategory = (shopId, channel) => { | ||
77 | * 店铺收藏数量 | 82 | * 店铺收藏数量 |
78 | */ | 83 | */ |
79 | exports.favCount = (shopId, uid, channel, udid) => { | 84 | exports.favCount = (shopId, uid, channel, udid) => { |
80 | - return singleAPI.get('favorite', { | 85 | + let finalParams = { |
81 | method: 'app.favorite.queryFavoriteCountByShopIds', | 86 | method: 'app.favorite.queryFavoriteCountByShopIds', |
82 | favIds: shopId, | 87 | favIds: shopId, |
83 | type: 'shop', | 88 | type: 'shop', |
84 | udid: udid, | 89 | udid: udid, |
85 | - uid: uid, | ||
86 | physical_channel: yhChannel[channel], | 90 | physical_channel: yhChannel[channel], |
91 | + }; | ||
92 | + | ||
93 | + if (uid) { | ||
94 | + Object.assign(finalParams, { | ||
95 | + uid: uid | ||
87 | }); | 96 | }); |
97 | + } | ||
98 | + | ||
99 | + return singleAPI.get('favorite', finalParams); | ||
88 | }; | 100 | }; |
@@ -212,8 +212,8 @@ const _searchSales = (params) => { | @@ -212,8 +212,8 @@ const _searchSales = (params) => { | ||
212 | * @param {[string]} uid | 212 | * @param {[string]} uid |
213 | * @return {[array]} | 213 | * @return {[array]} |
214 | */ | 214 | */ |
215 | -const _getUserProfile = (uid) => { | ||
216 | - if (!uid) { | 215 | +const _getUserProfile = (uid, params) => { |
216 | + if (!uid || params.saleType !== '2') { | ||
217 | return Promise.resolve({ | 217 | return Promise.resolve({ |
218 | code: 200, | 218 | code: 200, |
219 | data: {} | 219 | data: {} |
@@ -278,14 +278,15 @@ const getSearchData = (params, uid) => { | @@ -278,14 +278,15 @@ const getSearchData = (params, uid) => { | ||
278 | if (result && result.code === 200) { | 278 | if (result && result.code === 200) { |
279 | return productProcess.processProductList(result.data.product_list || [], { | 279 | return productProcess.processProductList(result.data.product_list || [], { |
280 | yh_channel: params.yh_channel, | 280 | yh_channel: params.yh_channel, |
281 | - showSale: false | 281 | + showSale: false, |
282 | + isApp: params.isApp | ||
282 | }); | 283 | }); |
283 | } else { | 284 | } else { |
284 | logger.error('api SALE product search code no 200'); | 285 | logger.error('api SALE product search code no 200'); |
285 | return []; | 286 | return []; |
286 | } | 287 | } |
287 | }), | 288 | }), |
288 | - _getUserProfile(uid).then((result) => { | 289 | + _getUserProfile(uid, params).then((result) => { |
289 | 290 | ||
290 | if (result && result.code === 200) { | 291 | if (result && result.code === 200) { |
291 | return result.data.vip_info ? result.data.vip_info : {}; | 292 | return result.data.vip_info ? result.data.vip_info : {}; |
@@ -123,7 +123,7 @@ router.get('/recommend-for-you/userCenter', recommendForYou.userCenter); | @@ -123,7 +123,7 @@ router.get('/recommend-for-you/userCenter', recommendForYou.userCenter); | ||
123 | router.get('/recommend-for-you/cart', recommendForYou.cart); | 123 | router.get('/recommend-for-you/cart', recommendForYou.cart); |
124 | 124 | ||
125 | 125 | ||
126 | -router.get('/seckill', seckill.checkAppVer('5.1.0'), seckill.index); // 秒杀列表页 | 126 | +router.get('/seckill', seckill.index); // 秒杀列表页 |
127 | router.get('/seckill/list', seckill.indexData); | 127 | router.get('/seckill/list', seckill.indexData); |
128 | 128 | ||
129 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 | 129 | router.post('/seckill/remind', seckill.remind); // only app; 秒杀提醒 |
@@ -43,6 +43,9 @@ | @@ -43,6 +43,9 @@ | ||
43 | <div id="red-index" class="tab-panel red-shop-index active"> | 43 | <div id="red-index" class="tab-panel red-shop-index active"> |
44 | <div class="shop-coupon coupon-group"></div> | 44 | <div class="shop-coupon coupon-group"></div> |
45 | {{> reds-shop/modules}} | 45 | {{> reds-shop/modules}} |
46 | + <div id="indexGoodsContainer" class="goods-container"> | ||
47 | + <div class="default-goods container clearfix"></div> | ||
48 | + </div> | ||
46 | <div class="all-goods"> | 49 | <div class="all-goods"> |
47 | <a href="{{allGoodsUrl}}">点击查看全部商品</a> | 50 | <a href="{{allGoodsUrl}}">点击查看全部商品</a> |
48 | </div> | 51 | </div> |
1 | <div class="seckill-list yoho-page"> | 1 | <div class="seckill-list yoho-page"> |
2 | <div id="seckill-list-loading" style="height: 100vh"></div> | 2 | <div id="seckill-list-loading" style="height: 100vh"></div> |
3 | </div> | 3 | </div> |
4 | +<div class="floor-header-more"> | ||
5 | + <h2>限时热促</h2> | ||
6 | +</div> | ||
7 | +<div id="goodsContainer" class="goods-container hide" style="background-color: #fff"> | ||
8 | + <div id="container" class="default-goods container clearfix"></div> | ||
9 | +</div> |
1 | <div class="item"> | 1 | <div class="item"> |
2 | <a {{#if link}}href="{{link}}"{{/if}}> | 2 | <a {{#if link}}href="{{link}}"{{/if}}> |
3 | {{#if isGood}} | 3 | {{#if isGood}} |
4 | - {{#ifor triple double}} | ||
5 | - <img class="item-pic" src="{{image2 src w=235 h=314}}" alt=""> | 4 | + {{#ifor triple double single}} |
5 | + {{#within index 3}} | ||
6 | + <img class="item-pic" src="{{image2 src w=235 h=314}}"> | ||
7 | + {{^}} | ||
8 | + <img class="item-pic lazy" data-original="{{image2 src w=235 h=314}}"> | ||
9 | + {{/within}} | ||
6 | {{/ifor}} | 10 | {{/ifor}} |
7 | {{^}} | 11 | {{^}} |
12 | + {{#within index 3}} | ||
8 | <img class="item-pic" src="{{image2 src}}" alt=""> | 13 | <img class="item-pic" src="{{image2 src}}" alt=""> |
14 | + {{^}} | ||
15 | + <img class="item-pic lazy" data-original="{{image2 src}}"> | ||
16 | + {{/within}} | ||
9 | {{/if}} | 17 | {{/if}} |
10 | </a> | 18 | </a> |
11 | 19 |
@@ -15,13 +15,13 @@ | @@ -15,13 +15,13 @@ | ||
15 | <ul class="swiper-wrapper"> | 15 | <ul class="swiper-wrapper"> |
16 | {{#each ../pics}} | 16 | {{#each ../pics}} |
17 | <li class="swiper-slide"> | 17 | <li class="swiper-slide"> |
18 | - {{#if link}} | ||
19 | - <a href="{{link}}"> | 18 | + <a{{#if link}} href="{{link}}"{{/if}}> |
19 | + {{#within @../index 3}} | ||
20 | <img src="{{image2 src}}" alt=""> | 20 | <img src="{{image2 src}}" alt=""> |
21 | - </a> | ||
22 | {{^}} | 21 | {{^}} |
23 | - <img src="{{image2 src}}" alt=""> | ||
24 | - {{/if}} | 22 | + <img class="lazy" data-original="{{image2 src}}" alt=""> |
23 | + {{/within}} | ||
24 | + </a> | ||
25 | </li> | 25 | </li> |
26 | {{/each}} | 26 | {{/each}} |
27 | </ul> | 27 | </ul> |
@@ -51,7 +51,7 @@ | @@ -51,7 +51,7 @@ | ||
51 | {{#isEqual module_type 'SingleImage'}} | 51 | {{#isEqual module_type 'SingleImage'}} |
52 | <div class="items-s1 clearfix"> | 52 | <div class="items-s1 clearfix"> |
53 | {{#each ../pics}} | 53 | {{#each ../pics}} |
54 | - {{> reds-shop/item}} | 54 | + {{> reds-shop/item index=@../index single=true}} |
55 | {{/each}} | 55 | {{/each}} |
56 | </div> | 56 | </div> |
57 | {{#if ../isModuleMargin}} | 57 | {{#if ../isModuleMargin}} |
@@ -61,7 +61,7 @@ | @@ -61,7 +61,7 @@ | ||
61 | {{#isEqual module_type 'DoubleImage'}} | 61 | {{#isEqual module_type 'DoubleImage'}} |
62 | <div class="items-s2 clearfix"> | 62 | <div class="items-s2 clearfix"> |
63 | {{#each ../pics}} | 63 | {{#each ../pics}} |
64 | - {{> reds-shop/item double=true}} | 64 | + {{> reds-shop/item index=@../index double=true}} |
65 | {{/each}} | 65 | {{/each}} |
66 | </div> | 66 | </div> |
67 | {{#if ../isModuleMargin}} | 67 | {{#if ../isModuleMargin}} |
@@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
71 | {{#isEqual module_type 'TripleImage'}} | 71 | {{#isEqual module_type 'TripleImage'}} |
72 | <div class="{{#isEqual ../displayType 1}}items-3-3{{/isEqual}}{{#isEqual ../displayType 2}}items-3-3 items-small{{/isEqual}}{{#isEqual ../displayType 3}}items-3-2 items-3-2-right{{/isEqual}}{{#isEqual ../displayType 4}}items-3-2 items-3-2-left{{/isEqual}} clearfix"> | 72 | <div class="{{#isEqual ../displayType 1}}items-3-3{{/isEqual}}{{#isEqual ../displayType 2}}items-3-3 items-small{{/isEqual}}{{#isEqual ../displayType 3}}items-3-2 items-3-2-right{{/isEqual}}{{#isEqual ../displayType 4}}items-3-2 items-3-2-left{{/isEqual}} clearfix"> |
73 | {{#each ../pics}} | 73 | {{#each ../pics}} |
74 | - {{> reds-shop/item triple=true}} | 74 | + {{> reds-shop/item index=@../index triple=true}} |
75 | {{/each}} | 75 | {{/each}} |
76 | </div> | 76 | </div> |
77 | {{#if ../isModuleMargin}} | 77 | {{#if ../isModuleMargin}} |
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | {{#isEqual module_type 'FourImage'}} | 81 | {{#isEqual module_type 'FourImage'}} |
82 | <div class="items-s4 clearfix"> | 82 | <div class="items-s4 clearfix"> |
83 | {{#each ../pics}} | 83 | {{#each ../pics}} |
84 | - {{> reds-shop/item four=true}} | 84 | + {{> reds-shop/item index=@../index four=true}} |
85 | {{/each}} | 85 | {{/each}} |
86 | </div> | 86 | </div> |
87 | {{#if ../isModuleMargin}} | 87 | {{#if ../isModuleMargin}} |
@@ -14,9 +14,10 @@ const domains = { | @@ -14,9 +14,10 @@ const domains = { | ||
14 | liveApi: 'http://testapi.live.yohops.com:9999/', | 14 | liveApi: 'http://testapi.live.yohops.com:9999/', |
15 | singleApi: 'http://api-test3.yohops.com:9999/', | 15 | singleApi: 'http://api-test3.yohops.com:9999/', |
16 | 16 | ||
17 | - api: 'http://api.yoho.cn/', | ||
18 | - service: 'http://service.yoho.cn/', | 17 | + api: 'http://api-test3.yohops.com:9999/', |
18 | + service: 'http://service-test3.yohops.com:9999/', | ||
19 | global: 'http://api-global.yohobuy.com', | 19 | global: 'http://api-global.yohobuy.com', |
20 | + store: 'http://192.168.102.210:8080/portal-gateway/', | ||
20 | 21 | ||
21 | // liveApi: 'http://api.live.yoho.cn/', | 22 | // liveApi: 'http://api.live.yoho.cn/', |
22 | // singleApi: 'http://single.yoho.cn/', | 23 | // singleApi: 'http://single.yoho.cn/', |
@@ -114,6 +115,7 @@ if (isProduction) { | @@ -114,6 +115,7 @@ if (isProduction) { | ||
114 | api: 'http://api.yoho.yohoops.org/', | 115 | api: 'http://api.yoho.yohoops.org/', |
115 | service: 'http://service.yoho.yohoops.org/', | 116 | service: 'http://service.yoho.yohoops.org/', |
116 | global: 'http://api-global.yohobuy.com', | 117 | global: 'http://api-global.yohobuy.com', |
118 | + store: '', // 线上域名尚未确定 | ||
117 | liveApi: 'http://api.live.yoho.cn/', | 119 | liveApi: 'http://api.live.yoho.cn/', |
118 | singleApi: 'http://single.yoho.cn/', | 120 | singleApi: 'http://single.yoho.cn/', |
119 | imSocket: 'wss://imsocket.yohobuy.com:443', | 121 | imSocket: 'wss://imsocket.yohobuy.com:443', |
@@ -162,7 +164,8 @@ if (isProduction) { | @@ -162,7 +164,8 @@ if (isProduction) { | ||
162 | domains: { | 164 | domains: { |
163 | api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/', | 165 | api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/', |
164 | service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/', | 166 | service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/', |
165 | - global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999', | 167 | + global: process.env.TEST_GLOBAL || 'http://global-test-soa.yohops.com:9999/', |
168 | + store: process.env.TEST_STORE || 'http://192.168.102.210:8080/portal-gateway/', | ||
166 | liveApi: process.env.TEST_LIVE || 'http://testapi.live.yohops.com:9999/', | 169 | liveApi: process.env.TEST_LIVE || 'http://testapi.live.yohops.com:9999/', |
167 | singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/', | 170 | singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/', |
168 | imSocket: process.env.TEST_IM_SOCKET || 'ws://socket.yohobuy.com:10240', | 171 | imSocket: process.env.TEST_IM_SOCKET || 'ws://socket.yohobuy.com:10240', |
@@ -51,6 +51,8 @@ exports.serverError = () => { | @@ -51,6 +51,8 @@ exports.serverError = () => { | ||
51 | forceNoCache(res); | 51 | forceNoCache(res); |
52 | 52 | ||
53 | if (err && err.code === 401) { | 53 | if (err && err.code === 401) { |
54 | + logger.error(`401 error info:client_type=${req.query.client_type},req.user=${JSON.stringify(req.user)},req.query=${JSON.stringify(req.query)},cookies=${JSON.stringify(req.cookies)}`); // eslint-disable-line | ||
55 | + | ||
54 | if (req.xhr) { | 56 | if (req.xhr) { |
55 | return res.status(401).json(err); | 57 | return res.status(401).json(err); |
56 | } else if (req.yoho.isApp) { | 58 | } else if (req.yoho.isApp) { |
@@ -6,12 +6,14 @@ const authcode = require('../../utils/authcode'); | @@ -6,12 +6,14 @@ const authcode = require('../../utils/authcode'); | ||
6 | 6 | ||
7 | module.exports = () => { | 7 | module.exports = () => { |
8 | return (req, res, next) => { | 8 | return (req, res, next) => { |
9 | + | ||
10 | + if (!req.yoho.isApp) { | ||
9 | // 从 SESSION 中获取到当前登录用户的 UID | 11 | // 从 SESSION 中获取到当前登录用户的 UID |
10 | if (req.session && _.isNumber(req.session.LOGIN_UID)) { | 12 | if (req.session && _.isNumber(req.session.LOGIN_UID)) { |
11 | // 调用接口传参时切勿使用toString获得字符串 | 13 | // 调用接口传参时切勿使用toString获得字符串 |
12 | req.user.uid = { | 14 | req.user.uid = { |
13 | toString: () => { | 15 | toString: () => { |
14 | - return req.session.LOGIN_UID; | 16 | + return _.parseInt(req.session.LOGIN_UID); |
15 | }, | 17 | }, |
16 | sessionKey: req.session.SESSION_KEY | 18 | sessionKey: req.session.SESSION_KEY |
17 | }; | 19 | }; |
@@ -22,17 +24,18 @@ module.exports = () => { | @@ -22,17 +24,18 @@ module.exports = () => { | ||
22 | 24 | ||
23 | // session 没有读取到的时候,从 cookie 读取 UID | 25 | // session 没有读取到的时候,从 cookie 读取 UID |
24 | if (!req.user.uid && req.cookies._UID) { | 26 | if (!req.user.uid && req.cookies._UID) { |
25 | - let sessionKey = req.cookies._SESSION_KEY && authcode(req.cookies._SESSION_KEY, '_SESSION_KEY', 2592000000); | 27 | + let sessionKey = req.cookies._SESSION_KEY && |
28 | + authcode(req.cookies._SESSION_KEY, '_SESSION_KEY', 2592000000); | ||
26 | 29 | ||
27 | // 调用接口传参时切勿使用toString获得字符串 | 30 | // 调用接口传参时切勿使用toString获得字符串 |
28 | req.user.uid = { | 31 | req.user.uid = { |
29 | toString: () => { | 32 | toString: () => { |
30 | - return cookie.getUid(req); | 33 | + return _.parseInt(cookie.getUid(req)); |
31 | }, | 34 | }, |
32 | sessionKey | 35 | sessionKey |
33 | }; | 36 | }; |
34 | } | 37 | } |
35 | - | 38 | + } |
36 | if (!req.user.uid && | 39 | if (!req.user.uid && |
37 | req.cookies.app_uid && | 40 | req.cookies.app_uid && |
38 | req.cookies.app_uid !== '0' && | 41 | req.cookies.app_uid !== '0' && |
@@ -57,7 +57,7 @@ | @@ -57,7 +57,7 @@ | ||
57 | <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> | 57 | <link rel="apple-touch-startup-image" sizes="320x460" href="http://static.yohobuy.com/m/v1/img/startup/startup.png" media="screen and (max-device-width: 320)"> |
58 | </head> | 58 | </head> |
59 | <body class="{{pageStyle}} {{#if isWechat}}wechat-body{{/if}} {{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}"> | 59 | <body class="{{pageStyle}} {{#if isWechat}}wechat-body{{/if}} {{#if width750}}width750{{/if}} {{#if isPassportPage}}passport-body{{/if}} {{#if isStarIndexPage}}star-index-bg{{/if}} {{#if isStarDetailPage}}star-class-body{{/if}} {{#if isInstallmentPage}}installment-body{{/if}}"> |
60 | - <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{appPath}}'{{/if}}> | 60 | + <div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}}> |
61 | {{#if systemUpdate}} | 61 | {{#if systemUpdate}} |
62 | {{> updata}} | 62 | {{> updata}} |
63 | {{/if}} | 63 | {{/if}} |
@@ -75,8 +75,8 @@ | @@ -75,8 +75,8 @@ | ||
75 | }, 1000); | 75 | }, 1000); |
76 | }()); | 76 | }()); |
77 | 77 | ||
78 | - /* tar add 190222 */ | ||
79 | - window._fxcmd = window._fxcmd || []; | 78 | + /* tar add 170426 品众代码去除 */ |
79 | + {{!--window._fxcmd = window._fxcmd || []; | ||
80 | _fxcmd.sid = 'bb3b16fa1106a6ab8619da0095755f32'; | 80 | _fxcmd.sid = 'bb3b16fa1106a6ab8619da0095755f32'; |
81 | _fxcmd.trackAll = false; | 81 | _fxcmd.trackAll = false; |
82 | // 参数配置(可选)... | 82 | // 参数配置(可选)... |
@@ -89,7 +89,7 @@ | @@ -89,7 +89,7 @@ | ||
89 | _pzfx.src = '//static.w3t.cn/fx/1/1/fx.js'; | 89 | _pzfx.src = '//static.w3t.cn/fx/1/1/fx.js'; |
90 | var sc = document.getElementsByTagName('script')[0]; | 90 | var sc = document.getElementsByTagName('script')[0]; |
91 | sc.parentNode.insertBefore(_pzfx,sc); | 91 | sc.parentNode.insertBefore(_pzfx,sc); |
92 | - }, 1000); | 92 | + }, 1000);--}} |
93 | 93 | ||
94 | 94 | ||
95 | </script> | 95 | </script> |
@@ -22,6 +22,9 @@ | @@ -22,6 +22,9 @@ | ||
22 | </span> | 22 | </span> |
23 | {{/if}} | 23 | {{/if}} |
24 | </p> | 24 | </p> |
25 | + {{#if appearDate}} | ||
26 | + <span class="appear-date">上市期:{{appearDate}}</span> | ||
27 | + {{/if}} | ||
25 | <p class="row price-wrap"> | 28 | <p class="row price-wrap"> |
26 | <span class="price"> | 29 | <span class="price"> |
27 | ¥{{price}} | 30 | ¥{{price}} |
@@ -29,9 +32,6 @@ | @@ -29,9 +32,6 @@ | ||
29 | <span class="count"> | 32 | <span class="count"> |
30 | ×{{count}} | 33 | ×{{count}} |
31 | </span> | 34 | </span> |
32 | - {{#if appearDate}} | ||
33 | - <span class="appear-date">上市期:{{appearDate}}</span> | ||
34 | - {{/if}} | ||
35 | </p> | 35 | </p> |
36 | </div> | 36 | </div> |
37 | </div> | 37 | </div> |
1 | { | 1 | { |
2 | "name": "m-yohobuy-node", | 2 | "name": "m-yohobuy-node", |
3 | - "version": "5.6.1", | 3 | + "version": "5.7.0", |
4 | "private": true, | 4 | "private": true, |
5 | "description": "A New Yohobuy Project With Express", | 5 | "description": "A New Yohobuy Project With Express", |
6 | "repository": { | 6 | "repository": { |
@@ -26,7 +26,7 @@ | @@ -26,7 +26,7 @@ | ||
26 | "body-parser": "^1.16.1", | 26 | "body-parser": "^1.16.1", |
27 | "captchapng": "0.0.1", | 27 | "captchapng": "0.0.1", |
28 | "cheerio": "^0.22.0", | 28 | "cheerio": "^0.22.0", |
29 | - "client-sessions": "^0.7.0", | 29 | + "client-sessions": "^0.8.0", |
30 | "compression": "^1.6.2", | 30 | "compression": "^1.6.2", |
31 | "connect-memcached": "^0.2.0", | 31 | "connect-memcached": "^0.2.0", |
32 | "connect-multiparty": "^2.0.0", | 32 | "connect-multiparty": "^2.0.0", |
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | "lodash": "^4.17.4", | 37 | "lodash": "^4.17.4", |
38 | "memory-cache": "^0.1.6", | 38 | "memory-cache": "^0.1.6", |
39 | "moment": "^2.18.1", | 39 | "moment": "^2.18.1", |
40 | - "oneapm": "^1.2.20", | 40 | + "oneapm": "^2.0.0", |
41 | "passport": "^0.3.2", | 41 | "passport": "^0.3.2", |
42 | "passport-local": "^1.0.0", | 42 | "passport-local": "^1.0.0", |
43 | "passport-qq": "0.0.3", | 43 | "passport-qq": "0.0.3", |
@@ -50,15 +50,15 @@ | @@ -50,15 +50,15 @@ | ||
50 | "xml2js": "^0.4.17", | 50 | "xml2js": "^0.4.17", |
51 | "yoho-express-session": "^2.0.0", | 51 | "yoho-express-session": "^2.0.0", |
52 | "yoho-md5": "^2.0.0", | 52 | "yoho-md5": "^2.0.0", |
53 | - "yoho-node-lib": "=0.2.22", | 53 | + "yoho-node-lib": "=0.2.25", |
54 | "yoho-zookeeper": "^1.0.8" | 54 | "yoho-zookeeper": "^1.0.8" |
55 | }, | 55 | }, |
56 | "devDependencies": { | 56 | "devDependencies": { |
57 | "autoprefixer": "^6.7.4", | 57 | "autoprefixer": "^6.7.4", |
58 | "babel-core": "^6.24.1", | 58 | "babel-core": "^6.24.1", |
59 | - "babel-loader": "^6.4.1", | 59 | + "babel-loader": "^7.0.0", |
60 | "babel-polyfill": "^6.23.0", | 60 | "babel-polyfill": "^6.23.0", |
61 | - "babel-preset-env": "^1.3.3", | 61 | + "babel-preset-env": "^1.4.0", |
62 | "css-loader": "^0.28.0", | 62 | "css-loader": "^0.28.0", |
63 | "cssnano": "^3.10.0", | 63 | "cssnano": "^3.10.0", |
64 | "eslint": "^3.19.0", | 64 | "eslint": "^3.19.0", |
@@ -66,7 +66,7 @@ | @@ -66,7 +66,7 @@ | ||
66 | "eslint-loader": "^1.7.1", | 66 | "eslint-loader": "^1.7.1", |
67 | "eslint-plugin-html": "^2.0.1", | 67 | "eslint-plugin-html": "^2.0.1", |
68 | "extract-text-webpack-plugin": "^2.1.0", | 68 | "extract-text-webpack-plugin": "^2.1.0", |
69 | - "handlebars-loader": "^1.4.0", | 69 | + "handlebars-loader": "^1.5.0", |
70 | "happypack": "^3.0.3", | 70 | "happypack": "^3.0.3", |
71 | "husky": "^0.13.3", | 71 | "husky": "^0.13.3", |
72 | "nodemon": "^1.11.0", | 72 | "nodemon": "^1.11.0", |
@@ -81,7 +81,7 @@ | @@ -81,7 +81,7 @@ | ||
81 | "postcss-pxtorem": "^4.0.0", | 81 | "postcss-pxtorem": "^4.0.0", |
82 | "postcss-scss": "^0.4.1", | 82 | "postcss-scss": "^0.4.1", |
83 | "postcss-short": "^3.0.3", | 83 | "postcss-short": "^3.0.3", |
84 | - "postcss-sprites": "^4.2.0", | 84 | + "postcss-sprites": "^4.2.1", |
85 | "postcss-use": "^2.3.0", | 85 | "postcss-use": "^2.3.0", |
86 | "precss": "^1.4.0", | 86 | "precss": "^1.4.0", |
87 | "shelljs": "^0.7.6", | 87 | "shelljs": "^0.7.6", |
@@ -94,8 +94,8 @@ | @@ -94,8 +94,8 @@ | ||
94 | "vue": "^2.2.6", | 94 | "vue": "^2.2.6", |
95 | "vue-loader": "^11.3.4", | 95 | "vue-loader": "^11.3.4", |
96 | "vue-template-compiler": "^2.2.6", | 96 | "vue-template-compiler": "^2.2.6", |
97 | - "webpack": "^2.3.3", | ||
98 | - "webpack-dev-server": "^2.4.2", | 97 | + "webpack": "^2.4.1", |
98 | + "webpack-dev-server": "^2.4.4", | ||
99 | "webpack-uglify-parallel": "^0.1.3", | 99 | "webpack-uglify-parallel": "^0.1.3", |
100 | "yoho-cookie": "^1.2.0", | 100 | "yoho-cookie": "^1.2.0", |
101 | "yoho-fastclick": "^1.0.6", | 101 | "yoho-fastclick": "^1.0.6", |
@@ -27,7 +27,7 @@ _.mergeWith(baseConfig, { | @@ -27,7 +27,7 @@ _.mergeWith(baseConfig, { | ||
27 | }] | 27 | }] |
28 | }, | 28 | }, |
29 | devServer: { | 29 | devServer: { |
30 | - host: '0.0.0.0', | 30 | + host: devInfo.host, |
31 | port: devInfo.port, | 31 | port: devInfo.port, |
32 | publicPath: devInfo.publicPath, | 32 | publicPath: devInfo.publicPath, |
33 | contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')], | 33 | contentBase: [path.join(__dirname, './bundle/'), path.join(__dirname, '../')], |
@@ -235,7 +235,9 @@ function pullPicBig(cIndex) { | @@ -235,7 +235,9 @@ function pullPicBig(cIndex) { | ||
235 | $('.swiper-pagination-bullet:eq(' + cIndex + ')').click(); | 235 | $('.swiper-pagination-bullet:eq(' + cIndex + ')').click(); |
236 | mySwiper.slideTo(cIndex, 1000, false); | 236 | mySwiper.slideTo(cIndex, 1000, false); |
237 | $('.big-pic').show(); | 237 | $('.big-pic').show(); |
238 | + if ($('.share-photography').length === 0) { | ||
238 | $('.foot-btn').hide(); | 239 | $('.foot-btn').hide(); |
240 | + } | ||
239 | $('.swiper-slide img').each( | 241 | $('.swiper-slide img').each( |
240 | function() { | 242 | function() { |
241 | let newTop = (w_height - $(this).height()) / 2; | 243 | let newTop = (w_height - $(this).height()) / 2; |
@@ -298,7 +300,10 @@ $( | @@ -298,7 +300,10 @@ $( | ||
298 | } | 300 | } |
299 | 301 | ||
300 | if ($('.clearCookie').length > 0) { | 302 | if ($('.clearCookie').length > 0) { |
303 | + $('.foot-btn').on('click', function() { | ||
301 | clearCookieArr(3); | 304 | clearCookieArr(3); |
305 | + chosenDefault(); | ||
306 | + }); | ||
302 | } | 307 | } |
303 | 308 | ||
304 | // 默认选中菜单 | 309 | // 默认选中菜单 |
@@ -323,15 +323,15 @@ function submitOrder() { | @@ -323,15 +323,15 @@ function submitOrder() { | ||
323 | }, true); | 323 | }, true); |
324 | } | 324 | } |
325 | 325 | ||
326 | - /* tar add 190222 */ | ||
327 | - if (window._fxcmd) { | ||
328 | - window._fxcmd.push(['trackOrder', { | ||
329 | - oid: res.data.order_code, | ||
330 | - otp: res.data.order_amount, | ||
331 | - u_info: cookie.get('_UID'), | ||
332 | - u_type: cookie.get('_isNewUser') ? 1 : 0 | ||
333 | - }, []]); | ||
334 | - } | 326 | + /* tar add 170426 品众代码去除 */ |
327 | + // if (window._fxcmd) { | ||
328 | + // window._fxcmd.push(['trackOrder', { | ||
329 | + // oid: res.data.order_code, | ||
330 | + // otp: res.data.order_amount, | ||
331 | + // u_info: cookie.get('_UID'), | ||
332 | + // u_type: cookie.get('_isNewUser') ? 1 : 0 | ||
333 | + // }, []]); | ||
334 | + // } | ||
335 | 335 | ||
336 | cookie.remove(['order-info', 'activity-info']); | 336 | cookie.remove(['order-info', 'activity-info']); |
337 | window.location.href = url; | 337 | window.location.href = url; |
@@ -118,7 +118,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) { | @@ -118,7 +118,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) { | ||
118 | 118 | ||
119 | $.ajax({ | 119 | $.ajax({ |
120 | type: 'POST', | 120 | type: 'POST', |
121 | - url: (useForBind || useForRelate) ? '/passport/bind/sendBindMsg' : '/passport/' + urlMid + '/sendcode', | 121 | + url: (useForBind || useForRelate) ? '/passport/bind/sendBindMsg' : '/passport/' + urlMid + '/sendcodeagain', |
122 | data: { | 122 | data: { |
123 | phoneNum: phoneNum, | 123 | phoneNum: phoneNum, |
124 | areaCode: areaCode | 124 | areaCode: areaCode |
@@ -6,6 +6,9 @@ | @@ -6,6 +6,9 @@ | ||
6 | let $ = require('yoho-jquery'), | 6 | let $ = require('yoho-jquery'), |
7 | ImgCheck = require('plugin/img-check'), | 7 | ImgCheck = require('plugin/img-check'), |
8 | tip = require('plugin/tip'); | 8 | tip = require('plugin/tip'); |
9 | + | ||
10 | +let loading = require('plugin/loading'); | ||
11 | + | ||
9 | const validType = { | 12 | const validType = { |
10 | IMG_CHECK: 1, | 13 | IMG_CHECK: 1, |
11 | GEETEST: 2 | 14 | GEETEST: 2 |
@@ -94,7 +97,9 @@ class Validate { | @@ -94,7 +97,9 @@ class Validate { | ||
94 | } | 97 | } |
95 | return Promise.resolve({captcha}); | 98 | return Promise.resolve({captcha}); |
96 | } else { | 99 | } else { |
100 | + loading.showLoadingMask(); | ||
97 | return new Promise((resolve) => { | 101 | return new Promise((resolve) => { |
102 | + loading.hideLoadingMask(); | ||
98 | this.$container.removeClass('hide'); | 103 | this.$container.removeClass('hide'); |
99 | this.captchaObj.onSuccess(() => { | 104 | this.captchaObj.onSuccess(() => { |
100 | resolve(this.captchaObj.getValidate()); | 105 | resolve(this.captchaObj.getValidate()); |
1 | let $ = require('yoho-jquery'), | 1 | let $ = require('yoho-jquery'), |
2 | Swiper = require('yoho-swiper'), | 2 | Swiper = require('yoho-swiper'), |
3 | lazyLoad = require('yoho-jquery-lazyload'), | 3 | lazyLoad = require('yoho-jquery-lazyload'), |
4 | - loading = require('plugin/loading'); | 4 | + loading = require('plugin/loading'), |
5 | + qs = require('yoho-qs'); | ||
5 | 6 | ||
6 | let page = 1, | 7 | let page = 1, |
7 | winH, | 8 | winH, |
@@ -34,7 +35,8 @@ function hotrank(pageIndex, sortIndex, tabId, noTab) { | @@ -34,7 +35,8 @@ function hotrank(pageIndex, sortIndex, tabId, noTab) { | ||
34 | data: { | 35 | data: { |
35 | page: pageIndex, | 36 | page: pageIndex, |
36 | tab_id: tabId, | 37 | tab_id: tabId, |
37 | - notab: noTab | 38 | + notab: noTab, |
39 | + gender: qs.gender | ||
38 | }, | 40 | }, |
39 | success: function(data) { | 41 | success: function(data) { |
40 | if (data === ' ') { | 42 | if (data === ' ') { |
@@ -45,22 +45,26 @@ seckillObj = { | @@ -45,22 +45,26 @@ seckillObj = { | ||
45 | 45 | ||
46 | self.$productList = $('.product-list'); | 46 | self.$productList = $('.product-list'); |
47 | 47 | ||
48 | - // 在app webview中click捕获不到translate样式后的新位置 | ||
49 | - let $navLis = $el.$navUl.find('>li'); | ||
50 | - | ||
51 | - $navLis.on('touchmove', function() { | ||
52 | - self.navMove = true; | ||
53 | - }); | ||
54 | - $navLis.on('touchend', function(event) { | ||
55 | - if (self.navMove) { | ||
56 | - self.navMove = false; | ||
57 | - return; | ||
58 | - } | ||
59 | - setTimeout(() => { | 48 | + $el.$navUl.find('>li').click(function(event) { |
60 | self.selectTime(event.currentTarget); | 49 | self.selectTime(event.currentTarget); |
61 | - }, 200); | ||
62 | }); | 50 | }); |
63 | 51 | ||
52 | + // 在app webview中click捕获不到translate样式后的新位置 | ||
53 | + // let $navLis = $el.$navUl.find('>li'); | ||
54 | + | ||
55 | + // $navLis.on('touchmove', function() { | ||
56 | + // self.navMove = true; | ||
57 | + // }); | ||
58 | + // $navLis.on('touchend', function(event) { | ||
59 | + // if (self.navMove) { | ||
60 | + // self.navMove = false; | ||
61 | + // return; | ||
62 | + // } | ||
63 | + // setTimeout(() => { | ||
64 | + // self.selectTime(event.currentTarget); | ||
65 | + // }, 200); | ||
66 | + // }); | ||
67 | + | ||
64 | $(window).resize(function() { | 68 | $(window).resize(function() { |
65 | self.initNav(); | 69 | self.initNav(); |
66 | }); | 70 | }); |
@@ -115,6 +119,7 @@ seckillObj = { | @@ -115,6 +119,7 @@ seckillObj = { | ||
115 | tap: true, | 119 | tap: true, |
116 | eventPassthrough: true, | 120 | eventPassthrough: true, |
117 | preventDefault: true, | 121 | preventDefault: true, |
122 | + HWCompositing: false, | ||
118 | bounceTime: 400, | 123 | bounceTime: 400, |
119 | bounceEasing: { | 124 | bounceEasing: { |
120 | style: 'cubic-bezier(0.333333, 0.666667, 0.666667, 1)' | 125 | style: 'cubic-bezier(0.333333, 0.666667, 0.666667, 1)' |
@@ -466,3 +471,5 @@ window.seckillRefresh = function() { | @@ -466,3 +471,5 @@ window.seckillRefresh = function() { | ||
466 | $(function() { | 471 | $(function() { |
467 | seckillObj.init(); | 472 | seckillObj.init(); |
468 | }); | 473 | }); |
474 | + | ||
475 | +require('./seckill/goods-list'); |
public/js/product/seckill/goods-list.js
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-04-21 13:36:34 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-04-21 14:17:40 | ||
6 | + */ | ||
7 | + | ||
8 | +const $ = require('yoho-jquery'); | ||
9 | +const lazyLoad = require('yoho-jquery-lazyload'); | ||
10 | +const yoho = require('yoho-app'); | ||
11 | +const qs = require('yoho-qs'); | ||
12 | +const cookie = require('yoho-cookie'); | ||
13 | + | ||
14 | +/** | ||
15 | + * 获取 APP 传过来的参数 | ||
16 | + */ | ||
17 | +const getChannel = { | ||
18 | + 1: 'boys', | ||
19 | + 2: 'girls', | ||
20 | + 3: 'kids', | ||
21 | + 4: 'lifestyle', | ||
22 | + '1,2,3,4': 'all' | ||
23 | +}; | ||
24 | + | ||
25 | +let $goodsContainer = $('#goodsContainer'); | ||
26 | +let $container = $('#container'); | ||
27 | +let channel = getChannel[qs.yh_channel] || cookie.get('_Channel'); | ||
28 | +let page = 1; | ||
29 | +let beforeScroll = document.body.scrollTop; // 滚动前位置记录 | ||
30 | +let onSearching = false; // 是否正在搜索 | ||
31 | + | ||
32 | +const loadGoodsList = () => { | ||
33 | + | ||
34 | + if (onSearching) { | ||
35 | + return false; | ||
36 | + } | ||
37 | + | ||
38 | + onSearching = true; | ||
39 | + $.ajax({ | ||
40 | + method: 'get', | ||
41 | + url: location.protocol + '//m.yohobuy.com/product/sale/search?type=discount&order=1', | ||
42 | + data: { | ||
43 | + yh_channel: channel, | ||
44 | + page: page++, | ||
45 | + isApp: yoho.isApp | ||
46 | + }, | ||
47 | + complete: function() { | ||
48 | + onSearching = false; | ||
49 | + }, | ||
50 | + success: function(result) { | ||
51 | + let $result = $(result); | ||
52 | + | ||
53 | + let noResult = !result || result.length < 1 || (result.list && result.list.length < 1); | ||
54 | + | ||
55 | + if (noResult) { | ||
56 | + return false; | ||
57 | + } | ||
58 | + | ||
59 | + $container.append($result); | ||
60 | + $goodsContainer.removeClass('hide'); | ||
61 | + lazyLoad($result.find('img')); | ||
62 | + } | ||
63 | + }); | ||
64 | +}; | ||
65 | + | ||
66 | +/** | ||
67 | + * 当scroll到1/2$goodsContainer高度后继续请求下一页数据 | ||
68 | + */ | ||
69 | +const scrollHandler = function() { | ||
70 | + if ($(window).scrollTop() > $goodsContainer.height() * 0.6) { | ||
71 | + loadGoodsList(); | ||
72 | + } | ||
73 | +}; | ||
74 | + | ||
75 | +/** | ||
76 | + * 滚动加载 | ||
77 | + */ | ||
78 | +$(window).scroll(function() { | ||
79 | + setTimeout(function() { | ||
80 | + let afterScroll = document.body.scrollTop; | ||
81 | + | ||
82 | + if (afterScroll - beforeScroll > 0) { | ||
83 | + window.requestAnimationFrame(scrollHandler); | ||
84 | + beforeScroll = afterScroll; | ||
85 | + } else { | ||
86 | + return false; | ||
87 | + } | ||
88 | + }, 5); | ||
89 | +}); | ||
90 | + | ||
91 | +$(function() { | ||
92 | + loadGoodsList(); | ||
93 | +}); |
@@ -2,19 +2,64 @@ | @@ -2,19 +2,64 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-03-23 11:31:51 | 3 | * @Date: 2017-03-23 11:31:51 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-04-14 11:17:55 | 5 | + * @Last Modified time: 2017-04-25 11:45:13 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /** ***************** | 8 | /** ***************** |
9 | * 红人店铺首页 | 9 | * 红人店铺首页 |
10 | ********************/ | 10 | ********************/ |
11 | const Swiper2 = require('yoho-swiper2'); | 11 | const Swiper2 = require('yoho-swiper2'); |
12 | +const lazyLoad = require('yoho-jquery-lazyload'); | ||
12 | let tip = require('../../plugin/tip'); | 13 | let tip = require('../../plugin/tip'); |
13 | let $goodsContainer = $('.index-goods-container'); | 14 | let $goodsContainer = $('.index-goods-container'); |
15 | +let $indexGoodsContaniner = $('#indexGoodsContainer'); | ||
14 | let $collect = $('#collect'); | 16 | let $collect = $('#collect'); |
15 | 17 | ||
16 | const shopId = $('#shopId').val(); | 18 | const shopId = $('#shopId').val(); |
17 | 19 | ||
20 | +lazyLoad($('.lazy')); | ||
21 | + | ||
22 | +/** | ||
23 | + * 异步检测是否已经收藏 | ||
24 | + */ | ||
25 | +$.ajax({ | ||
26 | + type: 'GET', | ||
27 | + url: location.protocol + '//m.yohobuy.com/product/index/shopFav', | ||
28 | + xhrFields: { | ||
29 | + withCredentials: true | ||
30 | + }, | ||
31 | + data: { | ||
32 | + shopId: shopId | ||
33 | + }, | ||
34 | + success: function(data) { | ||
35 | + if (data.collect) { | ||
36 | + $collect.attr('class', 'already-collect pull-left'); | ||
37 | + } | ||
38 | + }, | ||
39 | + error: function() { | ||
40 | + tip.show('网络断开连接了~'); | ||
41 | + } | ||
42 | +}); | ||
43 | + | ||
44 | +/** | ||
45 | + * 店铺轮播图 | ||
46 | + */ | ||
47 | +if ($('.shop-swiper')) { | ||
48 | + let num = $('.shop-swiper').length; | ||
49 | + | ||
50 | + for (let i = 1; i <= num; i++) { | ||
51 | + new Swiper2('.shop-swiper-' + i, { | ||
52 | + lazyLoading: true, | ||
53 | + lazyLoadingInPrevNext: true, | ||
54 | + loop: true, | ||
55 | + autoplay: 3000, | ||
56 | + slideElement: 'li', | ||
57 | + paginationClickable: true, | ||
58 | + pagination: $(this).closest('.shop-swiper-' + i).find('.pagination-inner').get(0) | ||
59 | + }); | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
18 | /** | 63 | /** |
19 | * 异步加载推荐商品 | 64 | * 异步加载推荐商品 |
20 | */ | 65 | */ |
@@ -47,51 +92,33 @@ $.each($goodsContainer, function(index, elem) { | @@ -47,51 +92,33 @@ $.each($goodsContainer, function(index, elem) { | ||
47 | }, | 92 | }, |
48 | data: data, | 93 | data: data, |
49 | success: function(result) { | 94 | success: function(result) { |
95 | + let $result = $(result); | ||
96 | + | ||
97 | + lazyLoad($result.find('img[class=lazy]')); | ||
50 | $(elem).html(result); | 98 | $(elem).html(result); |
51 | } | 99 | } |
52 | }); | 100 | }); |
53 | }); | 101 | }); |
54 | 102 | ||
55 | /** | 103 | /** |
56 | - * 异步检测是否已经收藏 | 104 | + * 异步加载首页全部商品 |
57 | */ | 105 | */ |
58 | $.ajax({ | 106 | $.ajax({ |
59 | type: 'GET', | 107 | type: 'GET', |
60 | - url: location.protocol + '//m.yohobuy.com/product/index/shopFav', | 108 | + url: '/product/search/search', |
61 | xhrFields: { | 109 | xhrFields: { |
62 | withCredentials: true | 110 | withCredentials: true |
63 | }, | 111 | }, |
64 | data: { | 112 | data: { |
65 | - shopId: shopId | 113 | + shop_id: shopId |
66 | }, | 114 | }, |
67 | - success: function(data) { | ||
68 | - if (data.collect) { | ||
69 | - $collect.attr('class', 'already-collect pull-left'); | ||
70 | - } | ||
71 | - }, | ||
72 | - error: function() { | ||
73 | - tip.show('网络断开连接了~'); | ||
74 | - } | ||
75 | -}); | ||
76 | - | ||
77 | -/** | ||
78 | - * 店铺轮播图 | ||
79 | - */ | ||
80 | -if ($('.shop-swiper')) { | ||
81 | - let num = $('.shop-swiper').length; | 115 | + success: function(result) { |
116 | + let $result = $(result); | ||
82 | 117 | ||
83 | - for (let i = 1; i <= num; i++) { | ||
84 | - new Swiper2('.shop-swiper-' + i, { | ||
85 | - lazyLoading: true, | ||
86 | - lazyLoadingInPrevNext: true, | ||
87 | - loop: true, | ||
88 | - autoplay: 3000, | ||
89 | - slideElement: 'li', | ||
90 | - paginationClickable: true, | ||
91 | - pagination: $(this).closest('.shop-swiper-' + i).find('.pagination-inner').get(0) | ||
92 | - }); | 118 | + lazyLoad($result.find('img[class=lazy]')); |
119 | + $indexGoodsContaniner.find('.container').html($result); | ||
93 | } | 120 | } |
94 | -} | 121 | +}); |
95 | 122 | ||
96 | /** | 123 | /** |
97 | * 店铺收藏取消收藏操作 | 124 | * 店铺收藏取消收藏操作 |
@@ -4,8 +4,9 @@ | @@ -4,8 +4,9 @@ | ||
4 | .tips { | 4 | .tips { |
5 | font-size: 24px; | 5 | font-size: 24px; |
6 | line-height: 1.4; | 6 | line-height: 1.4; |
7 | - color: #b0b0b0; | ||
8 | - padding: 30px 30px 185px; | 7 | + color: #666; |
8 | + padding: 30px; | ||
9 | + background-color: #fff; | ||
9 | 10 | ||
10 | h5 { | 11 | h5 { |
11 | font-size: 25px; | 12 | font-size: 25px; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-03-23 17:12:53 | 3 | * @Date: 2017-03-23 17:12:53 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-04-20 10:19:41 | 5 | + * @Last Modified time: 2017-04-25 15:54:23 |
6 | */ | 6 | */ |
7 | // 红人店铺首页 | 7 | // 红人店铺首页 |
8 | 8 | ||
@@ -230,16 +230,29 @@ | @@ -230,16 +230,29 @@ | ||
230 | 230 | ||
231 | /* 四张小图 */ | 231 | /* 四张小图 */ |
232 | .items-s4 { | 232 | .items-s4 { |
233 | + border-bottom: 1px solid #e0e0e0; | ||
234 | + | ||
233 | .item { | 235 | .item { |
234 | float: left; | 236 | float: left; |
235 | width: 25%; | 237 | width: 25%; |
238 | + border-top: 1px solid #e0e0e0; | ||
239 | + border-right: 1px solid #e0e0e0; | ||
240 | + } | ||
241 | + | ||
242 | + .item:last-child { | ||
243 | + border-right: none; | ||
236 | } | 244 | } |
237 | 245 | ||
238 | .item-info { | 246 | .item-info { |
239 | text-align: center; | 247 | text-align: center; |
248 | + background-color: #f5f7f6; | ||
240 | color: #000; | 249 | color: #000; |
241 | position: relative; | 250 | position: relative; |
242 | 251 | ||
252 | + .text { | ||
253 | + line-height: 36px; | ||
254 | + } | ||
255 | + | ||
243 | .name, | 256 | .name, |
244 | .price { | 257 | .price { |
245 | display: none; | 258 | display: none; |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-03-23 11:02:31 | 3 | * @Date: 2017-03-23 11:02:31 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-04-20 15:41:44 | 5 | + * @Last Modified time: 2017-04-26 16:33:07 |
6 | */ | 6 | */ |
7 | /* 红人店铺数据处理 */ | 7 | /* 红人店铺数据处理 */ |
8 | 8 | ||
@@ -34,7 +34,7 @@ const _linkhandle = (linkParent) => { | @@ -34,7 +34,7 @@ const _linkhandle = (linkParent) => { | ||
34 | switch (parseInt(linkParent.linkType, 10)) { | 34 | switch (parseInt(linkParent.linkType, 10)) { |
35 | case 0: | 35 | case 0: |
36 | return helpers.urlFormat('', { | 36 | return helpers.urlFormat('', { |
37 | - categoryId: linkParent.resource | 37 | + filter_poolId: linkParent.resource |
38 | }, 'list'); | 38 | }, 'list'); |
39 | case 1: | 39 | case 1: |
40 | return helpers.urlFormat('/product/' + linkParent.resource + '.html'); | 40 | return helpers.urlFormat('/product/' + linkParent.resource + '.html'); |
@@ -339,8 +339,11 @@ const pushGoodsInfo = (decorators, goodsList) => { | @@ -339,8 +339,11 @@ const pushGoodsInfo = (decorators, goodsList) => { | ||
339 | decorators[key].pics[subKey].marketPrice = marketPrice ? '¥' + marketPrice : ''; | 339 | decorators[key].pics[subKey].marketPrice = marketPrice ? '¥' + marketPrice : ''; |
340 | decorators[key].pics[subKey].isGood = true; | 340 | decorators[key].pics[subKey].isGood = true; |
341 | 341 | ||
342 | - if (value.module_type === 'TripleImage' || value.module_type === 'DoubleImage') { | ||
343 | - decorators[key].pics[subKey].src = imageSrc; | 342 | + if (value.module_type === 'TripleImage' || |
343 | + value.module_type === 'DoubleImage' || | ||
344 | + value.module_type === 'SingleImage') { | ||
345 | + | ||
346 | + // decorators[key].pics[subKey].src = imageSrc; // 为了和 APP 统一,图暂时不取商品图 | ||
344 | } else if (value.module_type === 'FourImage') { | 347 | } else if (value.module_type === 'FourImage') { |
345 | decorators[key].pics[subKey].isGood = false; | 348 | decorators[key].pics[subKey].isGood = false; |
346 | } else { | 349 | } else { |
-
Please register or login to post a comment