文件
fenleixinxi/uniapp/common/api/home.js

35 行
1.6 KiB
JavaScript

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

/**
* 接口模块 · 首页与展示(用户端)
* 对应模块:分类导航 / 智能搜索 / 信息流推荐 / 筛选排序
*/
import { get } from '../utils/request.js'
export const homeApi = {
/** 轮播广告位 */
banners: () => get('/home/banners', {}, { silent: true }),
/** 分类导航 */
categories: () => get('/home/categories', {}, { silent: true }),
/** 首页金刚区推荐二级分类 */
navCategories: () => get('/home/nav-categories', {}, { silent: true }),
/**
* 信息流(LBS + 筛选排序)
* 入参:{ page, size, categoryId, subCategoryId, keyword, areaId, area, sort, lat, lng }
* 区域:只按服务区域(区县)筛选,兼容旧的 area 名称
* sort: new 最新 / hot 最热 / nearby 附近(按 distance 升序,无坐标排最后)
* price_asc 价格升序 / price_desc 价格降序(兼容旧值 price = 升序)
* 出参列表项含 distance(float|km,一位小数;信息无坐标时 null)
*/
feed: (params = {}) => get('/home/feed', params, { silent: true }),
/** 热门搜索词 */
hotKeywords: () => get('/home/search/hot', {}, { silent: true }),
/**
* 服务区域列表(平铺:每条记录自带省 / 市 / 区县)
* → [{id,province,city,district,lat,lng}];省/市由前端生成级联列
*/
areas: () => get('/home/areas', {}, { silent: true }),
/** 按定位匹配服务区域 {lat,lng} → {areaId,province,city,district,distance}|null */
locate: (params = {}) => get('/home/locate', params, { silent: true }),
}
export default homeApi