1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

通过微信开发者工具 商城模板 创建新小程序

This commit is contained in:
2023-03-06 23:52:24 +08:00
parent ada464a8cc
commit c21ff901d5
393 changed files with 52952 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
/* eslint-disable no-param-reassign */
import { config } from '../../config/index';
/** 获取搜索历史 */
function mockSearchResult(params) {
const { delay } = require('../_utils/delay');
const { getSearchResult } = require('../../model/search');
const data = getSearchResult(params);
if (data.spuList.length) {
data.spuList.forEach((item) => {
item.spuId = item.spuId;
item.thumb = item.primaryImage;
item.title = item.title;
item.price = item.minSalePrice;
item.originPrice = item.maxLinePrice;
if (item.spuTagList) {
item.tags = item.spuTagList.map((tag) => ({ title: tag.title }));
} else {
item.tags = [];
}
});
}
return delay().then(() => {
return data;
});
}
/** 获取搜索历史 */
export function getSearchResult(params) {
if (config.useMock) {
return mockSearchResult(params);
}
return new Promise((resolve) => {
resolve('real api');
});
}