Commit 467128613dd6a43e48d53c82acbfb23ace5b49f1

Authored by 范牧
1 parent fb748734ca
Exists in master

筛选逻辑添加

src/components/HMFilterDropdown/HMFilterDropdown.vue
... ... @@ -330,7 +330,6 @@ export default {
330 330 // 选中筛选类label-UI状态
331 331 selectFilterLabel (page_index, box_index, label_index) {
332 332 const findIndex = this.activeMenuArr[page_index][box_index].indexOf(label_index)
333   - console.log('select', page_index, box_index, label_index, findIndex)
334 333 const data = this.filterData[page_index].submenu
335 334 const selected = this.selectedData[`${data[box_index].value}`]
336 335 if (findIndex > -1) {
... ... @@ -338,9 +337,8 @@ export default {
338 337 this.subData[page_index].submenu[box_index].submenu[label_index].selected = false
339 338 for (let i = 0; i < selected.length; i++) {
340 339 if (selected[i] === data[box_index].submenu[label_index].value) {
341   - console.log('dd', this.selectedData[`${data[box_index].value}`], selected)
342   - this.selectedData[`${data[box_index].value}`] = selected.slice(1, 1)
343   - console.log('dd2', this.selectedData[`${data[box_index].value}`], selected)
  340 + selected.splice(i, 1)
  341 + this.selectedData[`${data[box_index].value}`] = selected
344 342 }
345 343 }
346 344 } else {
... ... @@ -350,10 +348,10 @@ export default {
350 348 this.selectedData[`${data[box_index].value}`] = []
351 349 this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value)
352 350 } else {
  351 + // console.log('---', data, this.filterData, this.selectedData)
353 352 this.selectedData[`${data[box_index].value}`].push(data[box_index].submenu[label_index].value)
354 353 }
355 354 // this.selectedData[`${data[box_index].value}`].push(data[box_index][label_index])
356   - console.log('---', data, this.filterData, this.selectedData)
357 355 }
358 356 this.$forceUpdate()
359 357 },
... ... @@ -375,7 +373,7 @@ export default {
375 373 },
376 374 // 菜单开关
377 375 togglePage (index) {
378   - if (index == this.showPage) {
  376 + if (index === this.showPage) {
379 377 this.hidePageLayer(true)
380 378 this.hideMask()
381 379 this.showPage = -1
... ...
src/pages/index/index.vue
... ... @@ -178,6 +178,13 @@ export default {
178 178 search (e) {
179 179 const { on, value, selectedData } = e
180 180 let params = {}
  181 + console.log('dddd-1', params, selectedData)
  182 + for (const key in selectedData) {
  183 + if (selectedData.hasOwnProperty(key)) {
  184 + selectedData[key] = selectedData[key].toString()
  185 + }
  186 + }
  187 + console.log('dddd-2', params, selectedData)
181 188 if (on[0] === 1) {
182 189 // 若点击全部
183 190 this.searchText = ''
... ... @@ -186,7 +193,6 @@ export default {
186 193 for (let i = 1; i <= on.length; i++) { // on[0]是全部
187 194 if (on[i] === 1) { // 若该选项被选中
188 195 if (this.categoryList[i].value === 'filter') {
189   - console.log('dddd', params, selectedData)
190 196 params = {
191 197 ...selectedData,
192 198 ...params
... ...