From e4e98fe102433f072f7627bb55a4bd11792508df Mon Sep 17 00:00:00 2001 From: berlin-tzen Date: Thu, 9 Mar 2023 18:38:09 +0800 Subject: [PATCH] =?UTF-8?q?[WHAT]=20=E4=BF=AE=E6=AD=A3=E5=B1=95=E8=A6=BD?= =?UTF-8?q?=E6=9F=A5=E8=A9=A2=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontEnd/pages/exhibition/index.vue | 60 +++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/FrontEnd/pages/exhibition/index.vue b/FrontEnd/pages/exhibition/index.vue index a8c7da5..52663f8 100644 --- a/FrontEnd/pages/exhibition/index.vue +++ b/FrontEnd/pages/exhibition/index.vue @@ -87,6 +87,12 @@ export default { loading, }, async asyncData({ route, $auth, $axios, i18n }) { + + // get URL link prarm + + // created + + let isPageLoading = true; let langQuery = "?lang=" + i18n.localeProperties["langQuery"]; let keyword = route.query.q; @@ -250,20 +256,24 @@ export default { ], sortBy: "ShowDate", + query: "" }), async created() { + console.log("created"); // to Fred // addjust async/sync orders this.isPageLoading = true; - await this.getQuery(); // this.getAdList(); + await this.getStatusList(); await this.getLocationList(); await this.getCategoryList(); await this.getFavorite(); - await this.getExhibitionCard(); + await this.getQuery(); + // await this.getExhibitionCard(); + // this.getQuery(); // await this.getUnsortLocationList(); // await this.getUnsortCategoryList(); @@ -309,6 +319,9 @@ export default { }); }, async mounted() { + + console.log("mounted"); + // let userSavedList = []; // if (this.$auth.loggedIn) { // // await this.$axios @@ -361,6 +374,7 @@ export default { }, $route() { + console.log("route"); this.getQuery(); }, @@ -427,7 +441,7 @@ export default { }, async getStatusList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -452,7 +466,7 @@ export default { }); }, async getCategoryList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -492,7 +506,7 @@ export default { }); }, async getLocationList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -545,8 +559,12 @@ export default { // to Fred // should add q=? to api + + this.query = this.query + "工具機"; + + console.log("getExhibitionCard"+": "+this.query) - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` + `&RegionIDs=${JSON.stringify(this.selectedRegion)}` + @@ -556,10 +574,13 @@ export default { `&SubCategoryIDs=${JSON.stringify(this.selectedSubCategory)}` + `&Status=${JSON.stringify(this.selectedStatus)}` + `&Date=${JSON.stringify(this.selectedDates)}` + - `&Sort=${this.sortBy}&Query` + `&Sort=${this.sortBy}` + + `&Query=${this.query}` ) .then((result) => { + console.log(result); + if (result.data.DATA.rel) { this.exhibitionList = result.data.DATA.rel; this.setFavorite(); @@ -576,7 +597,7 @@ export default { this.favoriteSet.clear(); if (this.$auth.loggedIn) { - this.$axios + await this.$axios .get( `/trending/api/Favorite/Favorites?Type=Exhibition` ) @@ -697,7 +718,17 @@ export default { async getQuery() { let vm = this; - + + this.selectedMainCategory = []; + this.selectedSubCategory = []; + this.selectedCountry = []; + this.selectedCity = []; + this.query = ""; + + // vm.categoryQueryFilter = {}; + + console.log(this.$route.query); + if (this.$route.query.category) { vm.categoryQueryFilter = vm.$route.query.category; this.selectedMainCategory.push(vm.$route.query.category); @@ -706,7 +737,6 @@ export default { if (this.$route.query.subcategory) { vm.categoryQueryFilter = vm.$route.query.subcategory; this.selectedSubCategory.push(vm.$route.query.subcategory); - console.log(vm.$route.query.subcategory); } if (this.$route.query.country) { @@ -714,10 +744,18 @@ export default { this.selectedCountry.push(vm.$route.query.country); } + if (this.$route.query.city) { + vm.locationQueryFilter = vm.$route.query.city; + this.selectedCity.push(vm.$route.query.city); + } + if (this.$route.query.q) { - console.log(vm.$route.query.q); + this.query = vm.$route.query.q; } + this.getExhibitionCard(); + + }, sortServiceList(data) { switch (this.sortBy) {