Janie 2 years ago
parent
commit
221c7d6140
  1. 100
      FrontEnd/pages/exhibition/index.vue

100
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;
@ -208,7 +214,9 @@ export default {
},
data: () => ({
page: 1,
perPage: 10,
perPageItems: 10,
currentPage: 1,
total: 0,
adList: [],
exhibitionList: [],
categoryChecked: [],
@ -250,20 +258,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 +321,9 @@ export default {
});
},
async mounted() {
console.log("mounted");
// let userSavedList = [];
// if (this.$auth.loggedIn) {
// // await this.$axios
@ -344,16 +359,22 @@ export default {
this.fetchUser();
},
computed: {
// result() {
// // return this.exhibitionsFilter.length;
// return this.exhibitionList.length;
// },
// pageLength() {
// return Math.ceil(this.totalPages / this.perPage);
// },
// renderList() {
// return this.sliceRenderList(this.exhibitionsFilter);
// },
result() {
// return this.exhibitionsFilter.length;
return this.exhibitionList.length;
return this.total;
},
pageLength() {
return Math.ceil(this.result / this.perPage);
return Math.ceil(this.result / this.perPageItems);
},
// renderList() {
// return this.sliceRenderList(this.exhibitionsFilter);
// },
},
watch: {
page() {
@ -361,6 +382,7 @@ export default {
},
$route() {
// console.log("route");
this.getQuery();
},
@ -427,7 +449,7 @@ export default {
},
async getStatusList() {
this.$axios
await this.$axios
.get(
`/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
@ -452,7 +474,7 @@ export default {
});
},
async getCategoryList() {
this.$axios
await this.$axios
.get(
`/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
@ -492,7 +514,7 @@ export default {
});
},
async getLocationList() {
this.$axios
await this.$axios
.get(
`/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
@ -543,12 +565,14 @@ export default {
},
async getExhibitionCard() {
// to Fred
// should add q=? to api
this.$axios
// this.query = this.query + "";
// console.log("getExhibitionCard"+": "+this.query)
await this.$axios
.get(
`/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` +
`&PageIndex=${this.currentPage}` +
`&PageSize=${this.perPageItems}` +
`&RegionIDs=${JSON.stringify(this.selectedRegion)}` +
`&CountryIDs=${JSON.stringify(this.selectedCountry)}` +
`&CityIDs=${JSON.stringify(this.selectedCity)}` +
@ -556,13 +580,20 @@ 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) => {
if (result.data.DATA.rel) {
this.exhibitionList = result.data.DATA.rel;
this.setFavorite();
console.table(result);
if(result && result.data && result.data.DATA && result.data.DATA.rel){
let data = result.data.DATA.rel
if(data.DataList.length>0){
this.total = data.Total;
this.exhibitionList = data.DataList;
this.setFavorite();
}
}
})
@ -576,7 +607,7 @@ export default {
this.favoriteSet.clear();
if (this.$auth.loggedIn) {
this.$axios
await this.$axios
.get(
`/trending/api/Favorite/Favorites?Type=Exhibition`
)
@ -622,15 +653,18 @@ export default {
},
updateSortBy(data) {
this.query = "";
this.sortBy = data;
this.getExhibitionCard();
},
updatePage(value) {
this.page = value;
this.currentPage = value;
this.getExhibitionCard();
},
updateCategoryFilter(value) {
this.query = "";
this.selectedMainCategory = [];
this.selectedSubCategory = [];
@ -651,6 +685,7 @@ export default {
},
updateLocationFilter(value) {
this.query = "";
this.selectedRegion = [];
this.selectedCountry = [];
this.selectedCity = [];
@ -676,6 +711,7 @@ export default {
},
updateStatusFilter(value) {
this.query = "";
this.selectedStatus = [];
value.forEach(key => {
@ -691,13 +727,20 @@ export default {
},
updateDateFilter(value) {
this.query = "";
this.selectedDates = value;
this.getExhibitionCard();
},
async getQuery() {
let vm = this;
this.selectedMainCategory = [];
this.selectedSubCategory = [];
this.selectedCountry = [];
this.selectedCity = [];
this.query = "";
if (this.$route.query.category) {
vm.categoryQueryFilter = vm.$route.query.category;
this.selectedMainCategory.push(vm.$route.query.category);
@ -706,7 +749,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 +756,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