Browse Source

[WHAT] 修正展覽查詢問題

Dev
berlin-tzen 2 years ago
parent
commit
e4e98fe102
  1. 60
      FrontEnd/pages/exhibition/index.vue

60
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) {

Loading…
Cancel
Save