42 lines
777 B
JavaScript
42 lines
777 B
JavaScript
/**
|
|
* Mini program API wrapper for this module.
|
|
* Call guide: require this module in a page, then invoke the matching method from page event handlers or lifecycle hooks.
|
|
*/
|
|
const request = require('../utils/request')
|
|
|
|
module.exports = {
|
|
getProductPage(params) {
|
|
return request({
|
|
url: '/product/list/page',
|
|
params
|
|
})
|
|
},
|
|
|
|
getAllProducts() {
|
|
return request({
|
|
url: '/product/list/all'
|
|
})
|
|
},
|
|
|
|
getProductById(id) {
|
|
return request({
|
|
url: `/product/get/${id}`
|
|
})
|
|
},
|
|
|
|
getProductsByTag(tag) {
|
|
return request({
|
|
url: `/product/list/tag/${encodeURIComponent(tag)}`
|
|
})
|
|
},
|
|
|
|
searchProducts(keyword) {
|
|
return request({
|
|
url: '/product/list/search',
|
|
params: {
|
|
keyword
|
|
}
|
|
})
|
|
}
|
|
}
|