feat(search): 大神关键词搜索走服务端(昵称/品类/段位/标签)

- 仓储 getCompanions(keyword?):参数化 LIKE 搜索 name/track/rank_name/tags 及 id 精确匹配
- 接口 /api/companions 支持 ?keyword=(长度截断 40)
- 小程序 api.js getCompanions(keyword) 带 encodeURIComponent;首页监听 searchKeyword 防抖 350ms 走服务端搜索,搜索态以服务端结果为准(含空结果不展示陈旧数据)
- 回归 95 套件/668 用例全绿;冒烟 4/4(昵称/品类命中、无匹配空数组、无关键词向后兼容)
这个提交包含在:
xcbyy
2026-10-19 15:10:11 +08:00
父节点 6576c9e4be
当前提交 d0d31d0380
共有 5 个文件被更改,包括 67 次插入 和 13 次删除

查看文件

@@ -191,10 +191,12 @@ export async function getMyActivities(userId) {
/**
* 获取同城大神列表
*/
export async function getCompanions() {
export async function getCompanions(keyword) {
try {
const list = await http.get('/companions');
if (Array.isArray(list) && list.length > 0) {
const kw = String(keyword == null ? '' : keyword).trim();
const query = kw ? `?keyword=${encodeURIComponent(kw)}` : '';
const list = await http.get(`/companions${query}`);
if (Array.isArray(list)) {
return list
.filter((c) => !c.auditStatus || c.auditStatus === '已通过')
.map((c) => ({