diff --git a/FrontEnd/pages/exhibition/index.vue b/FrontEnd/pages/exhibition/index.vue index bf7a2eb..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,18 +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(); @@ -307,6 +319,9 @@ export default { }); }, async mounted() { + + console.log("mounted"); + // let userSavedList = []; // if (this.$auth.loggedIn) { // // await this.$axios @@ -359,6 +374,7 @@ export default { }, $route() { + console.log("route"); this.getQuery(); }, @@ -425,7 +441,7 @@ export default { }, async getStatusList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -450,7 +466,7 @@ export default { }); }, async getCategoryList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -490,7 +506,7 @@ export default { }); }, async getLocationList() { - this.$axios + await this.$axios .get( `/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}` ) @@ -543,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)}` + @@ -554,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(); @@ -574,7 +597,7 @@ export default { this.favoriteSet.clear(); if (this.$auth.loggedIn) { - this.$axios + await this.$axios .get( `/trending/api/Favorite/Favorites?Type=Exhibition` ) @@ -695,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); @@ -704,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) { @@ -712,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) {