From 690da60cfe1dadde286faeb2066ec017d06388c5 Mon Sep 17 00:00:00 2001 From: hequan_waynaqua <1669738430@qq.com> Date: Wed, 28 Oct 2020 19:03:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 +++ src/components/fontAwesome/index.js | 12 ++++++++ src/main.js | 2 ++ src/views/search/list.vue | 22 ++++++++++---- src/views/search/modules/FilterBar.vue | 41 +++++++++++++++++++------- 5 files changed, 65 insertions(+), 16 deletions(-) create mode 100644 src/components/fontAwesome/index.js diff --git a/package.json b/package.json index 2d970eb..8018d41 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ }, "dependencies": { "@better-scroll/core": "^2.0.4", + "@fortawesome/fontawesome-svg-core": "^1.2.32", + "@fortawesome/free-brands-svg-icons": "^5.15.1", + "@fortawesome/free-solid-svg-icons": "^5.15.1", + "@fortawesome/vue-fontawesome": "^2.0.0", "axios": "^0.19.2", "core-js": "^3.6.4", "dayjs": "^1.8.36", diff --git a/src/components/fontAwesome/index.js b/src/components/fontAwesome/index.js new file mode 100644 index 0000000..90b7fd3 --- /dev/null +++ b/src/components/fontAwesome/index.js @@ -0,0 +1,12 @@ +import Vue from 'vue' +import { library } from '@fortawesome/fontawesome-svg-core' +import { faSort, faSortDown, faSortUp } from '@fortawesome/free-solid-svg-icons' +// import { faFontAwesome, faUps } from '@fortawesome/free-brands-svg-icons' +import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome' + +library.add(faSort) +library.add(faSortUp) +library.add(faSortDown) + +// library.add(faFontAwesome) +Vue.component('font-awesome-icon', FontAwesomeIcon) diff --git a/src/main.js b/src/main.js index ca017a5..1ee1a0d 100644 --- a/src/main.js +++ b/src/main.js @@ -14,6 +14,8 @@ import './permission' // import vant import '@/components/Vant' +// import fontAwesome +import '@/components/fontAwesome' // register common components globally import '@/components/common' import filters from '@/filter' diff --git a/src/views/search/list.vue b/src/views/search/list.vue index 745d962..8abaa6a 100644 --- a/src/views/search/list.vue +++ b/src/views/search/list.vue @@ -43,11 +43,12 @@ export default { return { value: '', list: [], - pageSize: 8, + pageSize: 10, pageNum: 1, keyword: '', isNew: false, isHot: false, + isPrice: false, loading: false, finished: false, isSkeletonShow: true @@ -76,7 +77,8 @@ export default { pageNum: this.pageNum, keyword: this.keyword, isNew: this.isNew, - isHot: this.isHot + isHot: this.isHot, + isPrice: this.isPrice }).then((res) => { const data = res.map.goods this.list = [...this.list, ...data] @@ -100,16 +102,24 @@ export default { this.reset() if (val['search'] === 'isNew') { this.isNew = true - } - if (val['search'] === 'isHot') { + } else if (val['search'] === 'isHot') { this.isHot = true + } else if (val['search'] === 'price') { + this.isPrice = true + this.orderBy = val['orderBy'] + } else if (val['search'] === 'cancelPrice') { + this.isPrice = false + this.orderBy = '' } + getSearchList({ pageSize: this.pageSize, pageNum: this.pageNum, keyword: this.keyword, isNew: this.isNew, - isHot: this.isHot + isHot: this.isHot, + isPrice: this.isPrice, + orderBy: this.orderBy }).then((res) => { const data = res.map.goods this.list = [...data] @@ -121,7 +131,7 @@ export default { }) }, reset() { - this.pageSize = 8 + this.pageSize = 10 this.pageNum = 1 this.isNew = false this.isHot = false diff --git a/src/views/search/modules/FilterBar.vue b/src/views/search/modules/FilterBar.vue index 93f8c6c..b043546 100644 --- a/src/views/search/modules/FilterBar.vue +++ b/src/views/search/modules/FilterBar.vue @@ -2,9 +2,16 @@