Authored by 肖亚东

搜索以及跳转规则等修改 — review by 黄义

@@ -8,6 +8,8 @@ Component({ @@ -8,6 +8,8 @@ Component({
8 8
9 }, 9 },
10 methods: { 10 methods: {
11 - 11 + jumpByRule: function(event) {
  12 + this.triggerEvent('jumpByRule', event);
  13 + }
12 } 14 }
13 }) 15 })
@@ -8,6 +8,8 @@ Component({ @@ -8,6 +8,8 @@ Component({
8 8
9 }, 9 },
10 methods: { 10 methods: {
11 - 11 + jumpByRule: function(event) {
  12 + this.triggerEvent('jumpByRule', event);
  13 + }
12 } 14 }
13 }) 15 })
@@ -166,15 +166,15 @@ Page({ @@ -166,15 +166,15 @@ Page({
166 var currentPage = pages[pages.length - 1] 166 var currentPage = pages[pages.length - 1]
167 var url = currentPage.route 167 var url = currentPage.route
168 168
169 - let params = {  
170 - PAGE_NAME: this.data.current_page_name,  
171 - PAGE_PARAM: this.data.current_page_param,  
172 - FROM_PAGE_NAME: this.data.from_page_name,  
173 - FROM_PAGE_PARAM: this.data.from_page_param,  
174 - PV_ID: PV_ID,  
175 - PAGE_PATH: url,  
176 - };  
177 - logEvent(YB_PAGE_OPEN_L, params); 169 + // let params = {
  170 + // PAGE_NAME: this.data.current_page_name,
  171 + // PAGE_PARAM: this.data.current_page_param,
  172 + // FROM_PAGE_NAME: this.data.from_page_name,
  173 + // FROM_PAGE_PARAM: this.data.from_page_param,
  174 + // PV_ID: PV_ID,
  175 + // PAGE_PATH: url,
  176 + // };
  177 + // logEvent(YB_PAGE_OPEN_L, params);
178 178
179 this.fetchBrandInfo(); 179 this.fetchBrandInfo();
180 this.fetchBanner(); 180 this.fetchBanner();
@@ -208,15 +208,15 @@ Page({ @@ -208,15 +208,15 @@ Page({
208 }, 208 },
209 onPullDownRefresh: function() { 209 onPullDownRefresh: function() {
210 // 页面相关事件处理函数--监听用户下拉动作 210 // 页面相关事件处理函数--监听用户下拉动作
211 - var that = this  
212 - let params = {  
213 - PAGE_NAME: that.data.current_page_name,  
214 - PAGE_PARAM: that.data.current_page_param,  
215 - FROM_PAGE_NAME: that.data.from_page_name,  
216 - FROM_PAGE_PARAM: that.data.from_page_param,  
217 - PV_ID: PV_ID,  
218 - };  
219 - logEvent(YB_PAGE_OPEN_L, params); 211 + // var that = this
  212 + // let params = {
  213 + // PAGE_NAME: that.data.current_page_name,
  214 + // PAGE_PARAM: that.data.current_page_param,
  215 + // FROM_PAGE_NAME: that.data.from_page_name,
  216 + // FROM_PAGE_PARAM: that.data.from_page_param,
  217 + // PV_ID: PV_ID,
  218 + // };
  219 + // logEvent(YB_PAGE_OPEN_L, params);
220 220
221 }, 221 },
222 loadMore: function() { 222 loadMore: function() {
@@ -332,12 +332,12 @@ Page({ @@ -332,12 +332,12 @@ Page({
332 let shop_id = brandItem.shop_id; 332 let shop_id = brandItem.shop_id;
333 if (shop_id) { 333 if (shop_id) {
334 tt.navigateTo({ 334 tt.navigateTo({
335 - url: '../brandStore/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + '' 335 + url: '../goodsList/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
336 }); 336 });
337 }else{ 337 }else{
338 shop_id = brandItem.id; 338 shop_id = brandItem.id;
339 tt.navigateTo({ 339 tt.navigateTo({
340 - url: '../brandStore/brand?brandId=' + shop_id + '&brandName=' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + '' 340 + url: '../goodsList/brand?brandId=' + shop_id + '&brandName=' + brandItem.brand_name + '&page_name=' + 'brands' + '&page_param=' + ''
341 }); 341 });
342 } 342 }
343 343
@@ -350,7 +350,7 @@ Page({ @@ -350,7 +350,7 @@ Page({
350 // F_INDEX, 350 // F_INDEX,
351 // I_INDEX, 351 // I_INDEX,
352 // BRD_CATE: this.data.currentBrandFliter, 352 // BRD_CATE: this.data.currentBrandFliter,
353 - // F_URL: '../brandStore/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name, 353 + // F_URL: '../goodsList/brandStore?shop_id=' + shop_id + '&shop_name' + brandItem.brand_name,
354 // SHOP_ID: shop_id, 354 // SHOP_ID: shop_id,
355 // }; 355 // };
356 // logEvent(YB_BRAND_FLR_C, params); 356 // logEvent(YB_BRAND_FLR_C, params);
@@ -358,17 +358,10 @@ Page({ @@ -358,17 +358,10 @@ Page({
358 358
359 359
360 handlerAlphaTap(e) { 360 handlerAlphaTap(e) {
361 - console.log('====================================');  
362 - console.log(e);  
363 - console.log('====================================');  
364 let ap = e.target.dataset.ap; 361 let ap = e.target.dataset.ap;
365 this.setData({ scrollToView: ap }); 362 this.setData({ scrollToView: ap });
366 }, 363 },
367 364
368 - handlerMove() {  
369 -  
370 - },  
371 -  
372 dismissSearchView(e) { 365 dismissSearchView(e) {
373 this.setData({ searching: false }); 366 this.setData({ searching: false });
374 }, 367 },
@@ -450,8 +450,10 @@ Page({ @@ -450,8 +450,10 @@ Page({
450 450
451 jumpByRuleEvent(event) { 451 jumpByRuleEvent(event) {
452 let url = event.detail.currentTarget.dataset.jump_rule; 452 let url = event.detail.currentTarget.dataset.jump_rule;
  453 + console.log('==========jumpByRuleEvent===========');
453 console.log(event.detail); 454 console.log(event.detail);
454 console.log(url); 455 console.log(url);
  456 + console.log('====================================');
455 457
456 router.goUrl(url); 458 router.goUrl(url);
457 }, 459 },
@@ -350,11 +350,6 @@ Page(extend({}, Actionsheet,{ @@ -350,11 +350,6 @@ Page(extend({}, Actionsheet,{
350 let params = Object.assign({method: 'app.search.category.filter'},this.data.origin_param); 350 let params = Object.assign({method: 'app.search.category.filter'},this.data.origin_param);
351 let storageKey = this.data.filterStorageKey; 351 let storageKey = this.data.filterStorageKey;
352 let paramString = JSON.stringify(params); 352 let paramString = JSON.stringify(params);
353 - console.log('====================================');  
354 - console.log(paramString);  
355 - console.log('../productListFilter/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString);  
356 -  
357 - console.log('====================================');  
358 tt.navigateTo({ 353 tt.navigateTo({
359 url: '../productListFilter/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString 354 url: '../productListFilter/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString
360 }) 355 })
@@ -29,9 +29,6 @@ Page({ @@ -29,9 +29,6 @@ Page({
29 29
30 onLoad: function (options) { 30 onLoad: function (options) {
31 let key = options.storageKey; 31 let key = options.storageKey;
32 - console.log('====================================');  
33 - console.log(key);  
34 - console.log('====================================');  
35 let start = options.index; 32 let start = options.index;
36 let that = this; 33 let that = this;
37 wx.getStorage({ 34 wx.getStorage({
@@ -27,7 +27,9 @@ Page({ @@ -27,7 +27,9 @@ Page({
27 */ 27 */
28 onLoad: function (options) { 28 onLoad: function (options) {
29 var params = options.params ? options.params : {}; 29 var params = options.params ? options.params : {};
  30 + if (params) {
30 params = JSON.parse(params); 31 params = JSON.parse(params);
  32 + }
31 var storageKey = options.storageKey ? options.storageKey : ''; 33 var storageKey = options.storageKey ? options.storageKey : '';
32 this.setData({ 34 this.setData({
33 storageKey, 35 storageKey,
@@ -124,7 +126,9 @@ Page({ @@ -124,7 +126,9 @@ Page({
124 }) 126 })
125 if(json.code&&json.code==200){ 127 if(json.code&&json.code==200){
126 var filter = json.data.filter ? json.data.filter : []; 128 var filter = json.data.filter ? json.data.filter : [];
  129 + if (filter) {
127 filter = that.praseFilterData(filter); 130 filter = that.praseFilterData(filter);
  131 + }
128 that.setData({ 132 that.setData({
129 filterData: filter 133 filterData: filter
130 }) 134 })
@@ -328,6 +328,11 @@ Page(extend({}, Actionsheet,{ @@ -328,6 +328,11 @@ Page(extend({}, Actionsheet,{
328 hotKeywordItemTapped: function(event) { 328 hotKeywordItemTapped: function(event) {
329 let keyword = event.currentTarget.dataset.keyword; 329 let keyword = event.currentTarget.dataset.keyword;
330 330
  331 + console.log('====================================');
  332 + console.log(event);
  333 + console.log(keyword);
  334 +
  335 + console.log('====================================');
331 let newList = Object.assign(this.data.list, {currentPage: 0, pageCount: 0, total: 0, endReached: false,}); 336 let newList = Object.assign(this.data.list, {currentPage: 0, pageCount: 0, total: 0, endReached: false,});
332 337
333 addSearchHistory(keyword); 338 addSearchHistory(keyword);
@@ -551,15 +556,21 @@ Page(extend({}, Actionsheet,{ @@ -551,15 +556,21 @@ Page(extend({}, Actionsheet,{
551 updateProductList: function (event) { 556 updateProductList: function (event) {
552 let order = event.detail.order; 557 let order = event.detail.order;
553 let param = {} 558 let param = {}
554 - if (order !== undefined) { 559 + if (typeof(order) !== 'undefined') {
555 param = {'order':order} 560 param = {'order':order}
556 } 561 }
557 this.updateProductListWithFilterParam(param); 562 this.updateProductListWithFilterParam(param);
558 }, 563 },
559 564
560 jumpToFilterPage: function () { 565 jumpToFilterPage: function () {
561 - tt.navigateTo({  
562 - url: '../productListFilter/filter?storageKey=' + this.data.filterStorageKey + '&method=' + 'miniapp.search.fuzzy.filter' + '&query=' + this.data.keyword 566 + let params = Object.assign({ method: 'miniapp.search.fuzzy.filter' }, this.data.keyword_param);
  567 + let storageKey = this.data.filterStorageKey;
  568 + let paramString = JSON.stringify(params);
  569 + console.log('====================================');
  570 + console.log(params);
  571 + console.log('====================================');
  572 + wx.navigateTo({
  573 + url: '../productListFilter/productListFilterPage?storageKey=' + storageKey + '&params=' + paramString
563 }) 574 })
564 }, 575 },
565 576
@@ -8,6 +8,7 @@ const ACTION_TYPE = { @@ -8,6 +8,7 @@ const ACTION_TYPE = {
8 h5: 'go.h5', 8 h5: 'go.h5',
9 productList: 'go.list', 9 productList: 'go.list',
10 brandStore: 'go.shop', 10 brandStore: 'go.shop',
  11 + brand: 'go.brand'
11 } 12 }
12 13
13 const OPEN_BY_TYPE = { 14 const OPEN_BY_TYPE = {
@@ -81,58 +82,17 @@ export default { @@ -81,58 +82,17 @@ export default {
81 this.go('brandStore', yohobuy); 82 this.go('brandStore', yohobuy);
82 break; 83 break;
83 } 84 }
84 - case ACTION_TYPE.ufo: {  
85 - this.handleUFOJumpPage(yoho);  
86 - break;  
87 - }  
88 - default:  
89 - break;  
90 - }  
91 - },  
92 - handleUFOJumpPage(yoho) {  
93 - const params = yoho.params  
94 - switch(params.pagename) {  
95 - case OPEN_BY_TYPE.GO_LIST: {  
96 - console.log(yoho);  
97 - this.go(OPEN_BY_TYPE.GO_LIST, params);  
98 - break;  
99 - }  
100 - case OPEN_BY_TYPE.GO_HOME: {  
101 - this.go(OPEN_BY_TYPE.GO_HOME);  
102 - break;  
103 - }  
104 - case OPEN_BY_TYPE.GO_DETAIL: {  
105 - this.go(OPEN_BY_TYPE.GO_DETAIL, params);  
106 - break;  
107 - }  
108 - case OPEN_BY_TYPE.GO_ORDER_DETAIL: {  
109 - let userInfo = tt.getStorageSync('userInfo');  
110 - if (userInfo && userInfo.uid && userInfo.session_key) {  
111 - this.go('orderDetail', params);  
112 - } else {  
113 - this.go('nativeLogin');  
114 - }  
115 - break;  
116 - }  
117 - case OPEN_BY_TYPE.GO_ORDER_LIST: {  
118 - let userInfo = tt.getStorageSync('userInfo');  
119 - if (userInfo && userInfo.uid && userInfo.session_key) {  
120 - this.go(OPEN_BY_TYPE.GO_ORDER_LIST, params);  
121 - } else {  
122 - this.go('nativeLogin'); 85 + case ACTION_TYPE.brand: {
  86 + let yohobuy = {
  87 + ...yoho.params,
  88 + url: yoho.params.url,
  89 + action: yoho.action
123 } 90 }
  91 + this.go('brand', yohobuy);
124 break; 92 break;
125 } 93 }
126 - case OPEN_BY_TYPE.GO_YOLUCK: {  
127 - let userInfo = tt.getStorageSync('userInfo');  
128 - if (userInfo && userInfo.uid && userInfo.session_key) {  
129 - this.go('yoLuck', params);  
130 - } else {  
131 - this.go('nativeLogin');  
132 - }  
133 - } 94 + default:
134 break; 95 break;
135 - default: break;  
136 } 96 }
137 } 97 }
138 } 98 }
@@ -8,6 +8,9 @@ export default { @@ -8,6 +8,9 @@ export default {
8 brandStore: { 8 brandStore: {
9 path: '../brandStore/brandStore' 9 path: '../brandStore/brandStore'
10 }, 10 },
  11 + brand: {
  12 + path: '../brandStore/brand'
  13 + },
11 webview: { 14 webview: {
12 path: '../webview/webview' 15 path: '../webview/webview'
13 }, 16 },
@@ -17,4 +20,5 @@ export default { @@ -17,4 +20,5 @@ export default {
17 statements: { 20 statements: {
18 path: '../statements/statements' 21 path: '../statements/statements'
19 } 22 }
  23 +
20 } 24 }