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, loading,
}, },
async asyncData({ route, $auth, $axios, i18n }) { async asyncData({ route, $auth, $axios, i18n }) {
// get URL link prarm
// created
let isPageLoading = true; let isPageLoading = true;
let langQuery = "?lang=" + i18n.localeProperties["langQuery"]; let langQuery = "?lang=" + i18n.localeProperties["langQuery"];
let keyword = route.query.q; let keyword = route.query.q;
@ -208,7 +214,9 @@ export default {
}, },
data: () => ({ data: () => ({
page: 1, page: 1,
perPage: 10,
perPageItems: 10,
currentPage: 1,
total: 0,
adList: [], adList: [],
exhibitionList: [], exhibitionList: [],
categoryChecked: [], categoryChecked: [],
@ -250,20 +258,24 @@ export default {
], ],
sortBy: "ShowDate", sortBy: "ShowDate",
query: ""
}), }),
async created() { async created() {
console.log("created");
// to Fred // to Fred
// addjust async/sync orders // addjust async/sync orders
this.isPageLoading = true; this.isPageLoading = true;
await this.getQuery();
// this.getAdList(); // this.getAdList();
await this.getStatusList(); await this.getStatusList();
await this.getLocationList(); await this.getLocationList();
await this.getCategoryList(); await this.getCategoryList();
await this.getFavorite(); await this.getFavorite();
await this.getExhibitionCard();
await this.getQuery();
// await this.getExhibitionCard();
// this.getQuery(); // this.getQuery();
// await this.getUnsortLocationList(); // await this.getUnsortLocationList();
// await this.getUnsortCategoryList(); // await this.getUnsortCategoryList();
@ -309,6 +321,9 @@ export default {
}); });
}, },
async mounted() { async mounted() {
console.log("mounted");
// let userSavedList = []; // let userSavedList = [];
// if (this.$auth.loggedIn) { // if (this.$auth.loggedIn) {
// // await this.$axios // // await this.$axios
@ -344,16 +359,22 @@ export default {
this.fetchUser(); this.fetchUser();
}, },
computed: { 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() { result() {
// return this.exhibitionsFilter.length;
return this.exhibitionList.length;
return this.total;
}, },
pageLength() { pageLength() {
return Math.ceil(this.result / this.perPage);
return Math.ceil(this.result / this.perPageItems);
}, },
// renderList() {
// return this.sliceRenderList(this.exhibitionsFilter);
// },
}, },
watch: { watch: {
page() { page() {
@ -361,6 +382,7 @@ export default {
}, },
$route() { $route() {
// console.log("route");
this.getQuery(); this.getQuery();
}, },
@ -427,7 +449,7 @@ export default {
}, },
async getStatusList() { async getStatusList() {
this.$axios
await this.$axios
.get( .get(
`/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}` `/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`
) )
@ -452,7 +474,7 @@ export default {
}); });
}, },
async getCategoryList() { async getCategoryList() {
this.$axios
await this.$axios
.get( .get(
`/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}` `/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}`
) )
@ -492,7 +514,7 @@ export default {
}); });
}, },
async getLocationList() { async getLocationList() {
this.$axios
await this.$axios
.get( .get(
`/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}` `/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}`
) )
@ -543,12 +565,14 @@ export default {
}, },
async getExhibitionCard() { async getExhibitionCard() {
// to Fred
// should add q=? to api
this.$axios
// this.query = this.query + "";
// console.log("getExhibitionCard"+": "+this.query)
await this.$axios
.get( .get(
`/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` + `/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` +
`&PageIndex=${this.currentPage}` +
`&PageSize=${this.perPageItems}` +
`&RegionIDs=${JSON.stringify(this.selectedRegion)}` + `&RegionIDs=${JSON.stringify(this.selectedRegion)}` +
`&CountryIDs=${JSON.stringify(this.selectedCountry)}` + `&CountryIDs=${JSON.stringify(this.selectedCountry)}` +
`&CityIDs=${JSON.stringify(this.selectedCity)}` + `&CityIDs=${JSON.stringify(this.selectedCity)}` +
@ -556,13 +580,20 @@ export default {
`&SubCategoryIDs=${JSON.stringify(this.selectedSubCategory)}` + `&SubCategoryIDs=${JSON.stringify(this.selectedSubCategory)}` +
`&Status=${JSON.stringify(this.selectedStatus)}` + `&Status=${JSON.stringify(this.selectedStatus)}` +
`&Date=${JSON.stringify(this.selectedDates)}` + `&Date=${JSON.stringify(this.selectedDates)}` +
`&Sort=${this.sortBy}&Query`
`&Sort=${this.sortBy}` +
`&Query=${this.query}`
) )
.then((result) => { .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(); this.favoriteSet.clear();
if (this.$auth.loggedIn) { if (this.$auth.loggedIn) {
this.$axios
await this.$axios
.get( .get(
`/trending/api/Favorite/Favorites?Type=Exhibition` `/trending/api/Favorite/Favorites?Type=Exhibition`
) )
@ -622,15 +653,18 @@ export default {
}, },
updateSortBy(data) { updateSortBy(data) {
this.query = "";
this.sortBy = data; this.sortBy = data;
this.getExhibitionCard(); this.getExhibitionCard();
}, },
updatePage(value) { updatePage(value) {
this.page = value;
this.currentPage = value;
this.getExhibitionCard();
}, },
updateCategoryFilter(value) { updateCategoryFilter(value) {
this.query = "";
this.selectedMainCategory = []; this.selectedMainCategory = [];
this.selectedSubCategory = []; this.selectedSubCategory = [];
@ -651,6 +685,7 @@ export default {
}, },
updateLocationFilter(value) { updateLocationFilter(value) {
this.query = "";
this.selectedRegion = []; this.selectedRegion = [];
this.selectedCountry = []; this.selectedCountry = [];
this.selectedCity = []; this.selectedCity = [];
@ -676,6 +711,7 @@ export default {
}, },
updateStatusFilter(value) { updateStatusFilter(value) {
this.query = "";
this.selectedStatus = []; this.selectedStatus = [];
value.forEach(key => { value.forEach(key => {
@ -691,13 +727,20 @@ export default {
}, },
updateDateFilter(value) { updateDateFilter(value) {
this.query = "";
this.selectedDates = value; this.selectedDates = value;
this.getExhibitionCard(); this.getExhibitionCard();
}, },
async getQuery() { async getQuery() {
let vm = this; let vm = this;
this.selectedMainCategory = [];
this.selectedSubCategory = [];
this.selectedCountry = [];
this.selectedCity = [];
this.query = "";
if (this.$route.query.category) { if (this.$route.query.category) {
vm.categoryQueryFilter = vm.$route.query.category; vm.categoryQueryFilter = vm.$route.query.category;
this.selectedMainCategory.push(vm.$route.query.category); this.selectedMainCategory.push(vm.$route.query.category);
@ -706,7 +749,6 @@ export default {
if (this.$route.query.subcategory) { if (this.$route.query.subcategory) {
vm.categoryQueryFilter = vm.$route.query.subcategory; vm.categoryQueryFilter = vm.$route.query.subcategory;
this.selectedSubCategory.push(vm.$route.query.subcategory); this.selectedSubCategory.push(vm.$route.query.subcategory);
console.log(vm.$route.query.subcategory);
} }
if (this.$route.query.country) { if (this.$route.query.country) {
@ -714,10 +756,18 @@ export default {
this.selectedCountry.push(vm.$route.query.country); 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) { if (this.$route.query.q) {
console.log(vm.$route.query.q);
this.query = vm.$route.query.q;
} }
this.getExhibitionCard();
}, },
sortServiceList(data) { sortServiceList(data) {
switch (this.sortBy) { switch (this.sortBy) {

Loading…
Cancel
Save