Browse Source

[WHAT] 展覽列表分頁查詢

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

58
FrontEnd/pages/exhibition/index.vue

@ -214,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: [],
@ -357,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() {
@ -374,7 +382,7 @@ export default {
}, },
$route() { $route() {
console.log("route");
// console.log("route");
this.getQuery(); this.getQuery();
}, },
@ -557,16 +565,14 @@ export default {
}, },
async getExhibitionCard() { async getExhibitionCard() {
// to Fred
// should add q=? to api
// this.query = this.query + "";
// console.log("getExhibitionCard"+": "+this.query)
this.query = this.query + "工具機";
console.log("getExhibitionCard"+": "+this.query)
await this.$axios 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)}` +
@ -579,11 +585,15 @@ export default {
) )
.then((result) => { .then((result) => {
console.log(result);
console.table(result);
if (result.data.DATA.rel) {
this.exhibitionList = result.data.DATA.rel;
this.setFavorite();
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();
}
} }
}) })
@ -643,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 = [];
@ -672,6 +685,7 @@ export default {
}, },
updateLocationFilter(value) { updateLocationFilter(value) {
this.query = "";
this.selectedRegion = []; this.selectedRegion = [];
this.selectedCountry = []; this.selectedCountry = [];
this.selectedCity = []; this.selectedCity = [];
@ -697,6 +711,7 @@ export default {
}, },
updateStatusFilter(value) { updateStatusFilter(value) {
this.query = "";
this.selectedStatus = []; this.selectedStatus = [];
value.forEach(key => { value.forEach(key => {
@ -712,6 +727,7 @@ export default {
}, },
updateDateFilter(value) { updateDateFilter(value) {
this.query = "";
this.selectedDates = value; this.selectedDates = value;
this.getExhibitionCard(); this.getExhibitionCard();
}, },
@ -725,10 +741,6 @@ export default {
this.selectedCity = []; this.selectedCity = [];
this.query = ""; this.query = "";
// vm.categoryQueryFilter = {};
console.log(this.$route.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);

Loading…
Cancel
Save