Authored by 王水玲

最近浏览 cookie名称修改

... ... @@ -164,7 +164,7 @@ const component = {
});
},
recordData: (req, res, next) => {
let browserSkn = req.cookies._browseskn;
let browserSkn = req.cookies._browseskn_h5;
let limit = req.query.limit;
// 拆解skn
... ... @@ -239,7 +239,7 @@ const component = {
}
},
addRecords(req, res, next) {
let browserSkn = req.cookies._browseskn;
let browserSkn = req.cookies._browseskn_h5;
if (!req.user.uid) {
res.json({
... ... @@ -249,7 +249,7 @@ const component = {
});
} else {
homeModel.addRecords(req.user.uid, req.sessionID, browserSkn).then(result => {
res.cookie('_browseskn', '', {
res.cookie('_browseskn_h5', '', {
maxAge: 0,
domain: '.yohoblk.com'
});
... ...
... ... @@ -25,7 +25,7 @@ const saveRecentGoodInCookies = (oldSkns, res, addSkns) => {
oldSkns.unshift({product_skn: addSkns, time: (+new Date())});
// res.cookie('_browseskn', oldSkns.splice(0, 30).join(','), {
res.cookie('_browseskn', JSON.stringify(oldSkns.splice(0, 20)), {
res.cookie('_browseskn_h5', JSON.stringify(oldSkns.splice(0, 20)), {
maxAge: 2000000000,
domain: '.yohoblk.com'
});
... ... @@ -59,7 +59,7 @@ const component = {
model.product(params).then(result => {
// 最近浏览存储cookies
if (_.has(result.data, 'product_skn') && !req.user.uid) {
saveRecentGoodInCookies(req.cookies._browseskn, res, result.data.product_skn);
saveRecentGoodInCookies(req.cookies._browseskn_h5, res, result.data.product_skn);
}
res.json(result);
... ...
... ... @@ -97,6 +97,10 @@
&.focus {
color: #000;
span {
border-bottom: 4px solid #000;
}
}
}
... ...
... ... @@ -125,7 +125,7 @@
$('#address').on('click', this.addressClick);
// 之前是否有访客浏览
if (cookie.get('_browseskn')) {
if (cookie.get('_browseskn_h5')) {
$.ajax({
url: '/me/addRecords'
}).then(result => {
... ...