From 9056af795c75b6330ed42d7444e0e86432f88441 Mon Sep 17 00:00:00 2001 From: Cyy <547766613@qq.com> Date: Wed, 8 Mar 2023 15:03:34 +0800 Subject: [PATCH] 首页进入分类搜索 --- pages/goods/search/search.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index 27e59dd..1bfc900 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -44,23 +44,29 @@ Page({ onLoad: function (t) { this.data.rq_data = t; - + if (t.o) { this.data.rq_data.o = JSON.parse(t.o); }; - var req = t.o; - if(req.cat_id){ - var baseUrl= "/api/weshop/goods/page?isnewwhere=1&cat_id="+req.cat_id - this.setData({ baseUrl: baseUrl }); - } - if(req.nation_id){ - var baseUrl= "/api/weshop/goods/page?isnewwhere=1&nation_id="+req.nation_id - this.setData({ baseUrl: baseUrl }); - } - if(req.brand_id){ - var baseUrl= "/api/weshop/goods/page?isnewwhere=1&brand_id="+req.brand_id + if(t.o) { + var req = t.o; + if(req.cat_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&cat_id="+req.cat_id + this.setData({ baseUrl: baseUrl }); + } + if(req.nation_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&nation_id="+req.nation_id + this.setData({ baseUrl: baseUrl }); + } + if(req.brand_id){ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1&brand_id="+req.brand_id + this.setData({ baseUrl: baseUrl }); + } + }else{ + var baseUrl= "/api/weshop/goods/page?isnewwhere=1" this.setData({ baseUrl: baseUrl }); } + //接受有没有导购的参数 -- libgit2 0.21.4