Commit baabad2e5a1d26e8b4b6deed3d8b16cd8705490e
1 parent
2a95c67ccc
Exists in
master
搜索bug修改
Showing
2 changed files
with
29 additions
and
28 deletions
Show diff stats
src/components/HMFilterDropdown/HMFilterDropdown.vue
... | ... | @@ -314,6 +314,7 @@ export default { |
314 | 314 | }, |
315 | 315 | // 重置结果和ui,筛选 |
316 | 316 | resetFilterData (pageIndex) { |
317 | + console.log('pageIndex', pageIndex) | |
317 | 318 | const tmpArr = [] |
318 | 319 | let level = this.shadowActiveMenuArr[pageIndex].length |
319 | 320 | while (level > 0) { |
... | ... | @@ -348,7 +349,6 @@ export default { |
348 | 349 | this.selectedData[`${data[box_index].value}`] = [] |
349 | 350 | this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value) |
350 | 351 | } else { |
351 | - console.log('---', data, this.filterData, this.selectedData) | |
352 | 352 | this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value) |
353 | 353 | } |
354 | 354 | // this.selectedData[`${data[box_index].value}`].push(data[box_index][label_index]) |
... | ... | @@ -373,9 +373,9 @@ export default { |
373 | 373 | }, |
374 | 374 | // 菜单开关 |
375 | 375 | togglePage (index, isRequest = true) { |
376 | - if (!isRequest && this.maskVisibility) { | |
377 | - return | |
378 | - } | |
376 | + // if (!isRequest && this.maskVisibility) { | |
377 | + // return | |
378 | + // } | |
379 | 379 | if (index === this.showPage) { |
380 | 380 | this.hidePageLayer(true, isRequest) |
381 | 381 | this.hideMask() |
... | ... | @@ -392,10 +392,12 @@ export default { |
392 | 392 | } |
393 | 393 | this.on[index] = 1 |
394 | 394 | }, |
395 | + // 展示全部 | |
395 | 396 | showAll () { |
396 | 397 | this.on = [1, 0, 0, 0, 0] |
397 | 398 | this.showPage = -1 |
398 | - console.log('showPage-', this.showPage) | |
399 | + this.resetFilterData(4) | |
400 | + this.hideMask() | |
399 | 401 | // 输出 |
400 | 402 | this.$emit('search', { |
401 | 403 | index: {}, |
... | ... | @@ -483,24 +485,13 @@ export default { |
483 | 485 | } |
484 | 486 | index[i] = item |
485 | 487 | }) |
486 | - const params = this.selectedData | |
487 | - console.log('params--1', params) | |
488 | - for (const key in params) { | |
489 | - if (params[key].length === 0) { | |
490 | - delete params[key] | |
491 | - } | |
492 | - } | |
493 | - // 若筛选未选择 | |
494 | - if (Object.getOwnPropertyNames(params).length === 1) { | |
495 | - this.showAll() | |
496 | - } else { | |
497 | - this.$emit('search', { | |
498 | - index: index, | |
499 | - value: value, | |
500 | - on: this.on, | |
501 | - selectedData: params, | |
502 | - }) | |
503 | - } | |
488 | + console.log('this.selectedData', this.selectedData) | |
489 | + this.$emit('search', { | |
490 | + index: index, | |
491 | + value: value, | |
492 | + on: this.on, | |
493 | + selectedData: this.selectedData, | |
494 | + }) | |
504 | 495 | }, |
505 | 496 | // show菜单页 |
506 | 497 | showPageLayer (index) { | ... | ... |
src/pages/index/index.vue
... | ... | @@ -259,7 +259,6 @@ export default { |
259 | 259 | const { on, value, selectedData } = e |
260 | 260 | let params = {} |
261 | 261 | const selectedPayload = {} |
262 | - console.log('on-----', on) | |
263 | 262 | // 将传入数组字符串化 |
264 | 263 | for (const key in selectedData) { |
265 | 264 | if (Object.prototype.hasOwnProperty.call(selectedData, key)) { |
... | ... | @@ -287,10 +286,21 @@ export default { |
287 | 286 | } |
288 | 287 | } |
289 | 288 | } |
290 | - store.dispatch('index/search', { | |
291 | - params, | |
292 | - keyword: this.keyWords, | |
293 | - }) | |
289 | + console.log('params', params) | |
290 | + for (const key in params) { | |
291 | + if (params[key].length === 0) { | |
292 | + delete params[key] | |
293 | + } | |
294 | + } | |
295 | + // 若筛选未选择 | |
296 | + if (Object.getOwnPropertyNames(params).length === 1) { | |
297 | + store.dispatch('index/list') | |
298 | + } else { | |
299 | + store.dispatch('index/search', { | |
300 | + params, | |
301 | + keyword: this.keyWords, | |
302 | + }) | |
303 | + } | |
294 | 304 | } |
295 | 305 | }, |
296 | 306 | }, | ... | ... |