Authored by 郝肖肖

商品详情页,获取咨询加cache

... ... @@ -20,7 +20,7 @@ const getCommonConsult = () => {
return api.get('', params, {
code: 200
}).then(result => {
}, {cache: true}).then(result => {
let data = {};
if (result.data) {
... ... @@ -37,11 +37,10 @@ const getCommonConsult = () => {
* @return {[object]}
*/
const _formatConsultsList = (data) => {
let list = [];
data = data || [];
if (data.length) {
_.forEach(data, (value) => {
list.push({
return data.map(function(value) {
return {
question: value.ask,
time: value.ask_time,
answer: value.answer,
... ... @@ -50,11 +49,8 @@ const _formatConsultsList = (data) => {
like: _.toNumber(value.like),
isUseful: value.is_useful === 'Y',
useful: _.toNumber(value.useful)
};
});
});
}
return list;
};
/**
... ... @@ -75,7 +71,7 @@ const getConsults = (id, page, limit, uid) => {
return api.get('', params, {
code: 200
}).then(result => {
}, {cache: true}).then(result => {
let data = {};
if (result && result.data && result.data.list) {
... ...