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,24 +37,20 @@ const getCommonConsult = () => {
* @return {[object]}
*/
const _formatConsultsList = (data) => {
let list = [];
if (data.length) {
_.forEach(data, (value) => {
list.push({
question: value.ask,
time: value.ask_time,
answer: value.answer,
id: value.id,
isLike: value.is_like === 'Y',
like: _.toNumber(value.like),
isUseful: value.is_useful === 'Y',
useful: _.toNumber(value.useful)
});
});
}
return list;
data = data || [];
return data.map(function(value) {
return {
question: value.ask,
time: value.ask_time,
answer: value.answer,
id: value.id,
isLike: value.is_like === 'Y',
like: _.toNumber(value.like),
isUseful: value.is_useful === 'Y',
useful: _.toNumber(value.useful)
};
});
};
/**
... ... @@ -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) {
... ...