46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
|
|
import HttpRequest from "../system/request";
|
|
|
|
/**
|
|
* 获取banner列表
|
|
* @returns {Promise} banner列表
|
|
*/
|
|
export const getBannerList = async () => {
|
|
const res = await HttpRequest.get('/get_banner_list');
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return [];
|
|
}
|
|
/**
|
|
* 获取商品列表
|
|
* @param {number} pageNo 页码
|
|
* @param {number} pageSize 每页条数
|
|
* @param {string} searchKeyword 搜索关键词
|
|
* @returns {Promise} 商品列表
|
|
*/
|
|
export const getProductList = async (pageNo, pageSize, searchKeyword) => {
|
|
const res = await HttpRequest.get('/get_product_list', {
|
|
page: pageNo,
|
|
limit: pageSize,
|
|
title: searchKeyword
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
}
|
|
/**
|
|
* 获取商品详情
|
|
* @param {number} id 商品id
|
|
* @returns {Promise} 商品详情
|
|
*/
|
|
export const getProductDetail = async (id) => {
|
|
const res = await HttpRequest.get('/get_product_detail', {
|
|
id: id
|
|
});
|
|
if (res.status == 1) {
|
|
return res.data;
|
|
}
|
|
return null;
|
|
}
|