From 5172557605a46feb3e4ebfc9291134c2287889dd Mon Sep 17 00:00:00 2001 From: taiwan Date: Fri, 4 Mar 2022 16:58:19 +0800 Subject: [PATCH] 搜索框优化 --- pages/goods/search/search.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js index 1a61796..f7812e8 100644 --- a/pages/goods/search/search.js +++ b/pages/goods/search/search.js @@ -30,7 +30,10 @@ Page({ onLoad: function(t) { this.data.rq_data=t; - this.data.rq_data.o = JSON.parse(t.o); + if(t.o) { + this.data.rq_data.o = JSON.parse(t.o); + }; + //接受有没有导购的参数 var first_leader=t.first_leader; @@ -177,10 +180,13 @@ Page({ }; let o = this.data.rq_data.o; - if(o.cat_id) data.cat_id = o.cat_id; - if(o.pid && o.pid != 'three') data.parent_id = o.pid; - if(o.nation_id) data.nation_id = o.nation_id; - if(o.brand_id) data.brand_id = o.brand_id; + if(o) { + if(o.cat_id) data.cat_id = o.cat_id; + if(o.pid && o.pid != 'three') data.parent_id = o.pid; + if(o.nation_id) data.nation_id = o.nation_id; + if(o.brand_id) data.brand_id = o.brand_id; + }; + getApp().request.promiseGet(t, {data:data}).then(async res=>{ th.data.loading=0; -- libgit2 0.21.4