Authored by 陈峰

Merge branch 'feature/catch' into 'master'

Feature/catch

添加catch、修改店铺筛选

See merge request !9
... ... @@ -9,7 +9,7 @@
const model = require('../models');
const config = global.yoho.config;
exports.index = (req, res) => {
exports.index = (req, res, next) => {
const channelType = req.path.substring(1) || 'men';
model.getContent(channelType).then(result => {
... ... @@ -26,5 +26,5 @@ exports.index = (req, res) => {
page: 'home',
dataPage: channelType
}, result));
});
}).catch(next);
};
... ...
... ... @@ -80,7 +80,7 @@ const index = (req, res, next) => {
* @param res
* @param next
*/
const list = (req, res) => {
const list = (req, res, next) => {
let pageNum = req.query.page || 1;
let limit = req.query.limit || 20;
let tag = req.query.query;
... ... @@ -149,7 +149,7 @@ const list = (req, res) => {
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
}
});
});
}).catch(next);
};
/**
... ...
... ... @@ -134,7 +134,7 @@ const delAddressData = (req, res, next) => {
/**
* 设置默认地址
*/
const setDefaultAddress = (req, res) => {
const setDefaultAddress = (req, res, next) => {
logger.info(`address set default, address_id decrypt. address_id = ${req.body.id}`);
let id = crypto.decrypt(config.crypto.common, req.body.id);
... ... @@ -142,7 +142,7 @@ const setDefaultAddress = (req, res) => {
_setDefault(id, uid).then(result => {
res.send(result);
});
}).catch(next);
};
/**
... ... @@ -150,7 +150,7 @@ const setDefaultAddress = (req, res) => {
* @function getAddressData
* @return { Object }
*/
const getAddressData = (req, res) => {
const getAddressData = (req, res, next) => {
addressModel.getAddressData(req.params.areaId).then(result => {
if (result.code === 200) {
result.data = result.data.map((item) => {
... ... @@ -164,7 +164,7 @@ const getAddressData = (req, res) => {
} else {
res.json(result);
}
});
}).catch(next);
};
module.exports = {
... ...
... ... @@ -156,7 +156,7 @@ const getProductInfo = (req, res, next) => {
/**
* 换货详情页
*/
const exchangeDeatail = (req, res) => {
const exchangeDeatail = (req, res, next) => {
let id = parseInt(req.query.orderCode, 10),
uid = req.user.uid;
... ... @@ -176,7 +176,7 @@ const exchangeDeatail = (req, res) => {
}
}
});
});
}).catch(next);
};
/**
... ...
... ... @@ -166,7 +166,7 @@ const bindMobile = (req, res, next) => {
settingModel.getUserInfo(uid).then(result => {
if (result.info.verify_mobile !== '') {
mcHandler.getMeThumb().then((thumb) => {
return mcHandler.getMeThumb().then((thumb) => {
let info = result.info;
info.ellipsisMobile = info.verify_mobile.replace(regMobile, '$1****$2');
... ... @@ -193,7 +193,7 @@ const bindMobile = (req, res, next) => {
});
}
next();
});
}).catch(next);
};
/**
... ... @@ -210,7 +210,7 @@ const bindEmail = (req, res, next) => {
info.ellipsisEmail = info.verify_email.replace(regEmail, '$1****');
info.checkCode = req.csrfToken();
mcHandler.getMeThumb().then((thumb) => {
return mcHandler.getMeThumb().then((thumb) => {
res.display('index', {
module: 'me',
page: 'setting',
... ... @@ -230,13 +230,13 @@ const bindEmail = (req, res, next) => {
});
}
next();
});
}).catch(next);
};
/**
*step1 登录密码进行身份验证
*/
const modifyType = (req, res) => {
const modifyType = (req, res, next) => {
let type = req.params.type;
mcHandler.getMeThumb().then((thumb) => {
... ... @@ -256,13 +256,13 @@ const modifyType = (req, res) => {
checkCode: req.csrfToken()
}
});
});
}).catch(next);
};
/*
* step2 操作界面-渲染页面
* */
const edit = (req, res) => {
const edit = (req, res, next) => {
let type = req.params.type;
if (Number(cookieHelper.getVal(req, type + '_STEP')) !== 1) {
... ... @@ -295,13 +295,13 @@ const edit = (req, res) => {
checkCode: req.csrfToken()
}, result)
});
});
}).catch(next);
};
/*
* step3 操作成功-渲染界面
* */
const success = (req, res) => {
const success = (req, res, next) => {
let type = req.params.type;
let step = Number(cookieHelper.getVal(req, type + '_STEP')) || 0;
... ... @@ -340,14 +340,14 @@ const success = (req, res) => {
captchaUrl: captchaUrl
}, result)
});
});
}).catch(next);
};
/*
* post1 第一步身份验证的post请求
* */
const validate1 = (req, res) => {
const validate1 = (req, res, next) => {
co(function*() {
let type = req.params.type;
let uid = req.user.uid;
... ... @@ -366,13 +366,13 @@ const validate1 = (req, res) => {
cookieHelper.setVal(res, req.body.type + '_STEP', 1);
res.send(a);
}
})();
})().catch(next);
};
/*
* post2 第二步具体操作的post请求
* */
const validate2 = (req, res) => {
const validate2 = (req, res, next) => {
co(function*() {
let type = req.params.type;
let uid = req.user.uid;
... ... @@ -411,7 +411,7 @@ const validate2 = (req, res) => {
});
}
}
})();
})().catch(next);
};
... ... @@ -438,14 +438,14 @@ function getfilePath(req, res, next) {
* @param req
* @param res
*/
const modifyHead = (req, res) => {
const modifyHead = (req, res, next) => {
let uid = req.user.uid;
let bucket = 'yhb-head';
let filePath = req.filePath;
settingModel.modifyHead(uid, bucket, filePath).then(result => {
res.send(result);
});
}).catch(next);
};
module.exports = {
... ...
{{#each products}}
<div class="goods-info" data-skn="{{productSkn}}">
<div class="goods-info" data-skn="{{product_skn}}">
<a href="{{this.url}}" target="_blank">
<img class="lazy thumb" src="{{defaultImages}}">
<img class="lazy thumb" src="{{default_images}}">
</a>
<div class="desc">
<a class="name" href="{{this.url}}" target="_blank">{{productName}}</a>
<p class="price">¥{{salesPrice}}</p>
<a class="name" href="{{this.url}}" target="_blank">{{product_name}}</a>
<p class="price">¥{{sales_price}}</p>
</div>
</div>
{{/each}}
... ...