Browse Source

[WHAT] 展覽首頁+展覽卡片

Dev
berlin-tzen 2 years ago
parent
commit
33dbcbed00
  1. 213
      FrontEnd/components/exhibition/ExhibitionListCard.vue
  2. 432
      FrontEnd/pages/exhibition/index.vue

213
FrontEnd/components/exhibition/ExhibitionListCard.vue

@ -1,29 +1,18 @@
<template>
<div
class="exhibitionListCard tw-border tw-border-solid tw-border-neutrals-200 tw-rounded-[20px] tw-p-[10px] tw-mb-[20px] md:tw-px-[20px] md:tw-py-[15px] md:tw-grid md:tw-grid-cols-[auto_28px]"
>
class="exhibitionListCard tw-border tw-border-solid tw-border-neutrals-200 tw-rounded-[20px] tw-p-[10px] tw-mb-[20px] md:tw-px-[20px] md:tw-py-[15px] md:tw-grid md:tw-grid-cols-[auto_28px]">
<!-- 手機版save exhibition -->
<div
class="tw-absolute tw-cursor-pointer md:tw-hidden"
@click="onToggleFavorite"
>
<div class="tw-absolute tw-cursor-pointer md:tw-hidden" @click="onToggleFavorite">
<div v-if="item.saved">
<nuxt-link :to="localePath('/exhibition/' + item.id)"
><img
src="~/assets/svg/bookmark.svg"
class="tw-w-[24px] md:tw-w-[28px]"
alt=""
/></nuxt-link>
<nuxt-link :to="localePath('/exhibition/' + item.ExhibitionID)"><img src="~/assets/svg/bookmark.svg"
class="tw-w-[24px] md:tw-w-[28px]" alt="" /></nuxt-link>
</div>
<div v-else>
<nuxt-link :to="localePath('/exhibition/' + item.id)"
><img
src="~/assets/svg/bookmark_outline.svg"
class="tw-w-[24px] md:tw-w-[28px]"
alt=""
/></nuxt-link>
<nuxt-link :to="localePath('/exhibition/' + item.ExhibitionID)"><img src="~/assets/svg/bookmark_outline.svg"
class="tw-w-[24px] md:tw-w-[28px]" alt="" /></nuxt-link>
</div>
</div>
<!-- 電腦版exhibition status -->
<!-- <div
class="tw-hidden md:tw-block md:tw-absolute tw-border-solid tw-border tw-border-complementary-1 tw-text-complementary-1 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
@ -31,27 +20,20 @@
Ongoing
</div> -->
<div
class="tw-grid tw-grid-cols-[102px_auto] tw-gap-[10px] tw-items-center md:tw-grid-cols-[160px_auto]"
>
<div v-if="item.logo == null">
<div class="tw-grid tw-grid-cols-[102px_auto] tw-gap-[10px] tw-items-center md:tw-grid-cols-[160px_auto]">
<div v-if="item.Logo == null">
<img src="~/assets/svg/noLogo.svg" alt="" />
</div>
<nuxt-link v-else :to="localePath('/exhibition/' + item.id)"
><img :src="item.logo" class="tw-py-[35px]" alt=""
/></nuxt-link>
<nuxt-link v-else :to="localePath('/exhibition/' + item.ExhibitionID)"><img :src= "item.Logo" class="tw-py-[35px]"
alt="" /></nuxt-link>
<div>
<div class="tw-flex tw-flex-row tw-mb-[8px]">
<div
v-if="item.isRecommend != null"
class="tw-grid tw-grid-cols-[12px_auto] tw-gap-[4px] tw-items-center tw-w-fit tw-border tw-border-solid tw-border-primary-2 tw-bg-primary-1 tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-mr-[8px] md:tw-grid-cols-[14px_auto]"
>
<img
src="~/assets/svg/recommend.svg"
class="tw-w-[12px] md:tw-w-[14px]"
alt=""
/>
<div v-if="item.IsRecommend != null"
class="tw-grid tw-grid-cols-[12px_auto] tw-gap-[4px] tw-items-center tw-w-fit tw-border tw-border-solid tw-border-primary-2 tw-bg-primary-1 tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-mr-[8px] md:tw-grid-cols-[14px_auto]">
<img src="~/assets/svg/recommend.svg" class="tw-w-[12px] md:tw-w-[14px]" alt="" />
<div class="tw-text-white tw-text-[12px] md:tw-text-[16px]">
Recommend
</div>
@ -62,150 +44,98 @@
Ongoing
</div> -->
<!-- exhibition status -->
<!-- <div v-if="item.status != null && item.status.name != null">
<div
v-if="item.status.name == 'Upcoming'"
class="tw-border-solid tw-border tw-border-primary-1 tw-text-primary-1 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
>
{{ item.status ? item.status.name : "" }}
</div>
<div
v-else-if="item.status.name == 'Ongoing'"
class="tw-border-solid tw-border tw-border-complementary-1 tw-text-complementary-1 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
>
{{ item.status ? item.status.name : "" }}
</div>
<div
v-else-if="item.status.name == 'Finished'"
class="tw-border-solid tw-border tw-border-neutrals-500 tw-text-neutrals-500 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
>
{{ item.status ? item.status.name : "" }}
</div>
<div
v-else-if="item.status.name == 'Cancelled'"
class="tw-border-solid tw-border tw-border-error-default tw-text-error-default tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
>
{{ item.status ? item.status.name : "" }}
</div>
<div
v-else
class="tw-border-solid tw-border tw-bg-error-default tw-text-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]"
>
{{ item.status ? item.status.name : "" }}
<div v-if="item.ExhibStatus != null && item.ExhibStatus != '' ">
<div v-if="item.ExhibStatus == 'Upcoming'"
class="tw-border-solid tw-border tw-border-primary-1 tw-text-primary-1 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]">
{{ item.ExhibStatus ? item.ExhibStatus : "" }}
</div>
<div v-else-if="item.ExhibStatus == 'Ongoing'"
class="tw-border-solid tw-border tw-border-complementary-1 tw-text-complementary-1 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]">
{{ item.ExhibStatus ? item.ExhibStatus : "" }}
</div>
<div v-else-if="item.ExhibStatus == 'Finished'"
class="tw-border-solid tw-border tw-border-neutrals-500 tw-text-neutrals-500 tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]">
{{ item.ExhibStatus ? item.ExhibStatus : "" }}
</div>
<div v-else-if="item.ExhibStatus == 'Cancelled'"
class="tw-border-solid tw-border tw-border-error-default tw-text-error-default tw-bg-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]">
{{ item.ExhibStatus ? item.ExhibStatus : "" }}
</div>
<div v-else
class="tw-border-solid tw-border tw-bg-error-default tw-text-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] tw-text-[12px] md:tw-text-[14px]">
{{ item.ExhibStatus ? item.ExhibStatus : "" }}
</div>
</div>
</div> -->
</div>
<div class="tw-mb-[8px] xl:tw-mb-[10px]">
<nuxt-link :to="localePath('/exhibition/' + item.id)">
<nuxt-link :to="localePath('/exhibition/' + item.ExhibitionID)">
<div
class="tw-line-clamp-3 md:tw-line-clamp-2 xl:tw-line-clamp-1 tw-text-base-primary tw-text-[14px] tw-font-medium md:tw-font-bold md:tw-text-[18px]"
>
{{ item.name }}
class="tw-line-clamp-3 md:tw-line-clamp-2 xl:tw-line-clamp-1 tw-text-base-primary tw-text-[14px] tw-font-medium md:tw-font-bold md:tw-text-[18px]">
{{ item.ExhibitionName }}
</div>
</nuxt-link>
</div>
<div
v-if="$i18n.locale == 'zh-tw'"
v-show="item.short_name != null"
class="tw-mb-[8px] xl:tw-mb-[10px]"
>
<nuxt-link :to="localePath('/exhibition/' + item.id)">
<div v-if="$i18n.locale == 'zh-tw'" v-show="item.AbbreviatedName != null" class="tw-mb-[8px] xl:tw-mb-[10px]">
<nuxt-link :to="localePath('/exhibition/' + item.ExhibitionID)">
<div
class="tw-line-clamp-3 md:tw-line-clamp-2 xl:tw-line-clamp-1 tw-text-base-primary tw-text-[14px] tw-font-medium md:tw-font-bold md:tw-text-[18px]"
>
{{ item.short_name }}
class="tw-line-clamp-3 md:tw-line-clamp-2 xl:tw-line-clamp-1 tw-text-base-primary tw-text-[14px] tw-font-medium md:tw-font-bold md:tw-text-[18px]">
{{ item.AbbreviatedName }}
</div>
</nuxt-link>
</div>
<div
class="tw-text-[14px] tw-font-normal tw-mb-[8px] md:tw-text-[16px] xl:tw-mb-[4px]"
>
<nuxt-link
class="tw-text-neutrals-800"
:to="localePath(`/exhibition?region=${item.region.id}`)"
>{{
item.region.name == null ? "" : item.region.name + "."
}}</nuxt-link
>
<nuxt-link
class="tw-text-neutrals-800"
:to="localePath(`/exhibition?country=${item.country.id}`)"
>{{
item.country.name == null ? "" : item.country.name + "."
}}</nuxt-link
>
<nuxt-link
class="tw-text-neutrals-800"
:to="localePath(`/exhibition?city=${item.city.id}`)"
>{{ item.city.name == null ? "" : item.city.name }}</nuxt-link
>
<div class="tw-text-[14px] tw-font-normal tw-mb-[8px] md:tw-text-[16px] xl:tw-mb-[4px]">
<nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?region=${item.RegionID}`)">{{
item.RegionName == null ? "" : item.RegionName + "."
}}</nuxt-link>
<nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?country=${item.CountryID}`)">{{
item.CountryName == null ? "" : item.CountryName + "."
}}</nuxt-link>
<nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?city=${item.CityID}`)">{{
item.CityName
== null ? "" : item.CityName
}}</nuxt-link>
</div>
<div class="tw-hidden md:tw-block md:tw-mb-[8px] xl:tw-mb-[10px]">
<div class="tw-flex tw-flex-row tw-items-center">
<div class="tw-text-[14px] tw-text-primary-1 tw-mr-[4px]">
{{ item.rating }}
<!-- {{ item.rating }} -->
</div>
<img src="~/assets/svg/start.svg" class="tw-w-[14px]" alt="" />
<div class="tw-text-[14px] tw-text-neutral-600 tw-ml-[8px]">
({{ item.reviewCount ? item.reviewCount : "0" }} reviews)
<!-- ({{ item.reviewCount ? item.reviewCount : "0" }} reviews) -->
</div>
</div>
</div>
<div>
<div
v-if="item.categories != null"
class="md:tw-flex md:tw-flex-row md:tw-items-center tw-mb-[8px]"
>
<div
v-for="(item, index) in item.categories"
v-show="index < 1"
:key="index"
class="tw-bg-[#f6f6f6] tw-w-fit tw-rounded-[10px] tw-px-[10px] tw-py-[5px] tw-text-[14px] tw-mr-[10px]"
>
<nuxt-link
class="tw-text-neutrals-800"
:to="localePath('/exhibition?category=' + item.id)"
>{{ item.name }}</nuxt-link
>
<div v-if="item.categories != null" class="md:tw-flex md:tw-flex-row md:tw-items-center tw-mb-[8px]">
<div v-for="(item, index) in item.categories" v-show="index < 1" :key="index"
class="tw-bg-[#f6f6f6] tw-w-fit tw-rounded-[10px] tw-px-[10px] tw-py-[5px] tw-text-[14px] tw-mr-[10px]">
<nuxt-link class="tw-text-neutrals-800" :to="localePath('/exhibition?category=' + item.id)">{{
item.name
}}</nuxt-link>
</div>
<div
class="tw-text-[12px] tw-text-complementary-1"
v-if="item.categories.length > 1"
>
<div class="tw-text-[12px] tw-text-complementary-1" v-if="item.categories.length > 1">
More
</div>
</div>
</div>
<div
class="tw-hidden xl:tw-block xl:tw-line-clamp-2 tw-text-neutrals-600 tw-text-[14px] xl:tw-mb-[14px]"
v-if="!!item.about"
>
<div v-html="item.about"></div>
<div class="tw-hidden xl:tw-block xl:tw-line-clamp-2 tw-text-neutrals-600 tw-text-[14px] xl:tw-mb-[14px]"
v-if="!!item.Intro">
<div v-html="item.Intro"></div>
</div>
<div class="tw-text-[16px] tw-text-base-primary md:tw-text-[18px]">
{{ formatDate(item.startdate) + " - " + formatDate(item.enddate) }}
{{ formatDate(item.StartDate) + " - " + formatDate(item.EndDate) }}
</div>
</div>
</div>
<!-- 電腦版save exhibition -->
<div
class="tw-hidden md:tw-cursor-pointer md:tw-block"
@click="onToggleFavorite"
>
<div class="tw-hidden md:tw-cursor-pointer md:tw-block" @click="onToggleFavorite">
<div v-if="item.saved">
<img
src="~/assets/svg/bookmark.svg"
class="tw-w-[24px] md:tw-w-[28px]"
alt=""
/>
<img src="~/assets/svg/bookmark.svg" class="tw-w-[24px] md:tw-w-[28px]" alt="" />
</div>
<div v-else>
<img
src="~/assets/svg/bookmark_outline.svg"
class="tw-w-[24px] md:tw-w-[28px]"
alt=""
/>
<img src="~/assets/svg/bookmark_outline.svg" class="tw-w-[24px] md:tw-w-[28px]" alt="" />
</div>
</div>
</div>
@ -274,6 +204,7 @@ export default {
<style scoped lang="scss">
.exhibit-card {
max-width: 836px;
&.disabled .card__right {
opacity: 0.5;
}

432
FrontEnd/pages/exhibition/index.vue

@ -1,80 +1,53 @@
<template>
<div
class="tw-px-[30px] tw-mb-[60px] md:tw-mb-[100px] xl:tw-px-[60px] xl:tw-max-w-screen-xl xl:tw-mx-auto xl:tw-grid xl:tw-grid-cols-[380px_auto] xl:tw-gap-[30px]"
>
class="tw-px-[30px] tw-mb-[60px] md:tw-mb-[100px] xl:tw-px-[60px] xl:tw-max-w-screen-xl xl:tw-mx-auto xl:tw-grid xl:tw-grid-cols-[380px_auto] xl:tw-gap-[30px]">
<section class="xl:tw-col-span-2 tw-mb-5 md:tw-mb-0">
<centerMode :list="ads" v-if="ads.length"></centerMode>
</section>
<section class="xl:tw-col-span-2 tw-mb-[40px] xl:tw-mb-[10px]">
<Breadcrumbs
class="tw-py-[7px] md:tw-py-[10px] xl:tw-py-[13px] tw-mb-4 md:tw-mb-6 xl:tw-mb-0"
></Breadcrumbs>
<sort
:results="result"
:sortType="sortType"
:sortBy="sortBy"
@change="updateSortBy($event)"
@filter="$modal.show(`sidebar-filter-modal`)"
></sort>
<Breadcrumbs class="tw-py-[7px] md:tw-py-[10px] xl:tw-py-[13px] tw-mb-4 md:tw-mb-6 xl:tw-mb-0"></Breadcrumbs>
<sort :results="result" :sortType="sortType" :sortBy="sortBy" @change="updateSortBy($event)"
@filter="$modal.show(`sidebar-filter-modal`)"></sort>
</section>
<section class="tw-grid tw-grid-cols-1 tw-gap-[30px] tw-auto-rows-min">
<div class="tw-max-h-min" v-if="$vuetify.breakpoint.xl">
<DateCard @update="updateDateFilter" :modalChecked="datesChecked" />
</div>
<div v-if="$vuetify.breakpoint.xl">
<oneLevel
:label="'Show Status'"
:list="statuses"
@update="updateStatusFilter"
></oneLevel>
<oneLevel :label="'Show Status'" :list="statuses" @update="updateStatusFilter"></oneLevel>
</div>
<div v-if="$vuetify.breakpoint.xl">
<multipleLevel
:label="'Categories'"
:placeholder="'Find Categories...'"
:list="categories"
:queryItem="categoryQueryFilter"
@update="updateCategoryFilter"
></multipleLevel>
<multipleLevel :label="'Categories'" :placeholder="'Find Categories...'" :list="categories"
:queryItem="categoryQueryFilter" @update="updateCategoryFilter"></multipleLevel>
</div>
<div v-if="$vuetify.breakpoint.xl">
<multipleLevel
:label="'Location'"
:placeholder="'Find country/city ...'"
:list="locations"
:queryItem="locationQueryFilter"
@update="updateLocationFilter"
></multipleLevel>
<multipleLevel :label="'Location'" :placeholder="'Find country/city ...'" :list="locations"
:queryItem="locationQueryFilter" @update="updateLocationFilter"></multipleLevel>
</div>
<div v-if="$vuetify.breakpoint.xl">
<!-- <rating></rating> -->
</div>
</section>
<!-- <section class="">
<ExhibitionListCard v-for="(item, index) in renderList" :key="index" :item="item"
@toggle-favorite="onToggleFavorite"></ExhibitionListCard>
<div class="tw-mt-[34px] tw-flex tw-justify-end">
<pagination :pageLength="pageLength" @update="updatePage"></pagination>
</div>
</section> -->
<section class="">
<ExhibitionListCard
v-for="(item, index) in renderList"
:key="index"
:item="item"
@toggle-favorite="onToggleFavorite"
></ExhibitionListCard>
<ExhibitionListCard v-for="(item, index) in exhibitionList" :key="index" :item="item"
@toggle-favorite="onToggleFavorite"></ExhibitionListCard>
<div class="tw-mt-[34px] tw-flex tw-justify-end">
<pagination :pageLength="pageLength" @update="updatePage"></pagination>
</div>
</section>
<div v-if="!$vuetify.breakpoint.xl">
<ShowSidebarFilterModal
:statusList="statuses"
:locationList="locations"
:categoryList="categories"
:statusChecked="statusesChecked"
:locationChecked="locationChecked"
:categoryChecked="categoryChecked"
:datesChecked="datesChecked"
@updateCategoryFilter="updateCategoryFilter"
@updateLocationFilter="updateLocationFilter"
@updateStatusFilter="updateStatusFilter"
@updateDateFilter="updateDateFilter"
></ShowSidebarFilterModal>
<ShowSidebarFilterModal :statusList="statuses" :locationList="locations" :categoryList="categories"
:statusChecked="statusesChecked" :locationChecked="locationChecked" :categoryChecked="categoryChecked"
:datesChecked="datesChecked" @updateCategoryFilter="updateCategoryFilter"
@updateLocationFilter="updateLocationFilter" @updateStatusFilter="updateStatusFilter"
@updateDateFilter="updateDateFilter"></ShowSidebarFilterModal>
</div>
<loading :isLoading="isPageLoading"></loading>
</div>
@ -121,11 +94,11 @@ export default {
let data;
// ({ data } = await $axios.get("/exhibitions/filters" + langQuery));
let statuses;
if(data){
if (data) {
statuses = data.filters.statuses.map((item) => {
return {
key: item.id,
title: item.status,
key: item.Key,
title: item.Value,
};
});
}
@ -133,7 +106,7 @@ export default {
// `/t/exhibitions/locations${langQuery}&sort=true`
// ));
let locations;
if(data){
if (data) {
locations = data.sort_results.map((item) => {
item.country_list = item.country_list.map((country) => {
country.city_list = country.city_list.map((city) => {
@ -159,7 +132,7 @@ export default {
// `/t/exhibitions/categories${langQuery}&sort=true`
// ));
let categories;
if(data){
if (data) {
categories = data.sort_results.map((item) => {
item.subcategories_list = item.subcategories_list.map((children) => {
return {
@ -195,8 +168,8 @@ export default {
};
console.log(e);
}
console.log(data.exhibitions);
let exhibitionList = data.exhibitions; // exhibitionApi2CardType();
// console.log(data.exhibitions);
// let exhibitionList = data.exhibitions; // exhibitionApi2CardType();
let userSavedList = [];
if ($auth.loggedIn) {
@ -213,14 +186,14 @@ export default {
// console.log(err);
// });
}
userSavedList = userSavedList.map((item) => item.exhibition_id);
for (let i = 0; i < exhibitionList.length; i++) {
if (userSavedList.includes(exhibitionList[i].id)) {
exhibitionList[i].saved = true;
} else {
exhibitionList[i].saved = false;
}
}
// userSavedList = userSavedList.map((item) => item.exhibition_id);
// for (let i = 0; i < exhibitionList.length; i++) {
// if (userSavedList.includes(exhibitionList[i].id)) {
// exhibitionList[i].saved = true;
// } else {
// exhibitionList[i].saved = false;
// }
// }
let ads = data.ads;
return {
@ -229,7 +202,7 @@ export default {
// locations: locations,
// rating: rating,
isPageLoading: isPageLoading,
exhibitionList: exhibitionList,
// exhibitionList: exhibitionList,
ads: ads,
langQuery: langQuery,
};
@ -243,7 +216,25 @@ export default {
categoryChecked: [],
locationChecked: [],
ratingChecked: [],
selectedStatusJson: "",
locations: [],
statusMap: new Map(),
regionMap: new Map(),
countryMap: new Map(),
cityMap: new Map(),
selectedRegionJson: "",
selectedCountryJson: "",
selectedCityJson: "",
mainCategoryMap: new Map(),
subCategoryMap: new Map(),
selectedMainCategoryJson: "",
selectedSubCategoryJson: "",
categories: [],
unsortRegionList: [],
unsortCountryList: [],
@ -261,24 +252,25 @@ export default {
sortBy: "Show Dates",
}),
async created() {
await this.getLocationList();
await this.getCategoryList();
await this.getUnsortLocationList();
await this.getUnsortCategoryList();
await this.getQuery();
if (this.$route.query.hasOwnProperty("q")) {
this.sortType.splice(0, 0, {
name: "ShowEasy Recommended",
value: "ShowEasy Recommended",
});
this.sortBy = "ShowEasy Recommended";
}
this.getStatusList();
this.getLocationList();
this.getCategoryList();
this.getExhibitionCard();
// await this.getUnsortLocationList();
// await this.getUnsortCategoryList();
// await this.getQuery();
// if (this.$route.query.hasOwnProperty("q")) {
// this.sortType.splice(0, 0, {
// name: "ShowEasy Recommended",
// value: "ShowEasy Recommended",
// });
// this.sortBy = "ShowEasy Recommended";
// }
let userSavedList = [];
if (this.$auth.loggedIn) {
await this.$axios
.get(
`/member/users/${
this.$auth.$storage.getUniversal("jwt").user_id
`/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
}?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
)
.then((res) => {
@ -312,8 +304,7 @@ export default {
if (this.$auth.loggedIn) {
await this.$axios
.get(
`/member/users/${
this.$auth.$storage.getUniversal("jwt").user_id
`/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
}?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
)
.then((res) => {
@ -345,29 +336,30 @@ export default {
},
computed: {
result() {
return this.exhibitionsFilter.length;
},
exhibitionsFilter() {
const copyData = JSON.parse(JSON.stringify(this.exhibitionList));
const statusList = this.filterByStatus(copyData, this.statusesChecked);
const locationList = this.filterByLocation(
statusList,
this.locationChecked
);
const categoryList = this.filterByCategory(
locationList,
this.categoryChecked
);
const dateList = this.filterByDate(categoryList, this.datesChecked);
const sortedList = this.sortServiceList(dateList);
return sortedList;
// return this.exhibitionsFilter.length;
return this.exhibitionList.length;
},
// exhibitionsFilter() {
// const copyData = JSON.parse(JSON.stringify(this.exhibitionList));
// const statusList = this.filterByStatus(copyData, this.statusesChecked);
// const locationList = this.filterByLocation(
// statusList,
// this.locationChecked
// );
// const categoryList = this.filterByCategory(
// locationList,
// this.categoryChecked
// );
// const dateList = this.filterByDate(categoryList, this.datesChecked);
// const sortedList = this.sortServiceList(dateList);
// return sortedList;
// },
pageLength() {
return Math.ceil(this.result / this.perPage);
},
renderList() {
return this.sliceRenderList(this.exhibitionsFilter);
},
// renderList() {
// return this.sliceRenderList(this.exhibitionsFilter);
// },
},
watch: {
page() {
@ -388,8 +380,7 @@ export default {
if (this.$auth.loggedIn) {
await this.$axios
.get(
`/member/users/${
this.$auth.$storage.getUniversal("jwt").user_id
`/member/users/${this.$auth.$storage.getUniversal("jwt").user_id
}?jwt=${this.$auth.$storage.getUniversal("jwt").token}`
)
.then((res) => {
@ -415,6 +406,31 @@ export default {
}
});
},
getStatusList() {
this.$axios
.get(
`/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
.then((result) => {
if (result.data.DATA.rel) {
this.statuses = result.data.DATA.rel;
this.statuses = this.statuses.map((item => {
this.statusMap.set(item.Key, item.Value);
return {
title: item.Value,
key: item.Key,
};
}));
}
})
.catch((err) => {
console.log(err);
});
},
async getUnsortLocationList() {
await this.$axios
.get(
@ -442,67 +458,119 @@ export default {
console.log(err);
});
},
async getCategoryList() {
await this.$axios
getCategoryList() {
this.$axios
.get(
`/t/exhibitions/categories?lang=${this.$i18n.localeProperties["langQuery"]}&sort=true`
`/trending/api/Exhibition/Categories?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
.then((result) => {
this.categories = result.data.sort_results;
this.categories = this.categories.map((item) => {
item.subcategories_list = item.subcategories_list.map(
(children) => {
return {
title: children.subcategory_name,
key: children.subcategory_name,
};
}
);
return {
title: item.category_name,
key: item.category_name,
children: item.subcategories_list,
};
});
if (result.data.DATA.rel) {
this.categories = result.data.DATA.rel;
this.categories = this.categories.map((item) => {
this.mainCategoryMap.set(item.CategoryID, item);
item.SubCategoryList = item.SubCategoryList.map(
(children) => {
this.subCategoryMap.set(children.CategoryID, children);
return {
title: children.CategoryName,
key: children.CategoryID,
};
}
);
return {
title: item.CategoryName,
key: item.CategoryID,
children: item.SubCategoryList,
};
});
}
})
.catch((err) => {
console.log(err);
});
},
async getLocationList() {
await this.$axios
getLocationList() {
this.$axios
.get(
`/t/exhibitions/locations?lang=${this.$i18n.localeProperties["langQuery"]}&sort=true`
`/trending/api/Exhibition/Locations?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
.then((result) => {
var vm = this;
vm.locations = result.data.sort_results;
vm.locations = vm.locations.map((item) => {
item.country_list = item.country_list.map((country) => {
country.city_list = country.city_list.map((city) => {
if (result.data.DATA.rel) {
var vm = this;
vm.locations = result.data.DATA.rel;
vm.locations = vm.locations.map((region) => {
this.regionMap.set(region.RegionID, region);
region.CountryList = region.CountryList.map((country) => {
this.countryMap.set(country.CountryID, country);
country.CityList = country.CityList.map((city) => {
this.cityMap.set(city.CityID, city);
return {
title: city.CityName,
key: city.CityID,
};
});
return {
title: city.city_name,
key: city.city_name,
title: country.CountryName,
key: country.CountryID,
children: country.CityList,
};
});
return {
title: country.country_name,
key: country.country_name,
children: country.city_list,
title: region.RegionName,
key: region.RegionID,
children: region.CountryList,
};
});
return {
title: item.region_name,
key: item.region_name,
children: item.country_list,
};
});
return result.data;
return result.data.DATA.rel;
}
})
.catch((err) => {
console.log(err);
});
},
getExhibitionCard() {
this.$axios
.get(
`/trending/api/Exhibition/Cards?Lang=${this.$i18n.localeProperties["langQuery"]}` +
`&RegionIDs=${this.selectedRegionJson}` +
`&CountryIDs=${this.selectedCountryJson}` +
`&CityIDs=${this.selectedCityJson}` +
`&MainCategoryIDs=${this.selectedMainCategoryJson}` +
`&SubCategoryIDs=${this.selectedSubCategoryJson}` +
`&Status=${this.selectedStatusJson}` +
`&Date`
)
.then((result) => {
if (result.data.DATA.rel) {
this.exhibitionList = result.data.DATA.rel;
}
})
.catch((err) => {
console.log(err);
this.exhibitionList = [];
});
},
async getQuery() {
this.locationQueryFilter = "";
this.categoryQueryFilter = "";
@ -541,7 +609,30 @@ export default {
this.page = value;
},
updateCategoryFilter(value) {
this.categoryChecked = value;
var SelectedMainCategoryArray = [];
var SelectedSubCategoryArray = [];
this.selectedMainCategoryJson = "";
this.selectedSubCategoryJson = "";
value.forEach(key => {
if (this.mainCategoryMap.has(key)) {
SelectedMainCategoryArray.push(key);
}
if (this.subCategoryMap.has(key)) {
SelectedSubCategoryArray.push(key);
}
});
this.selectedMainCategoryJson = JSON.stringify(SelectedMainCategoryArray);
this.selectedSubCategoryJson = JSON.stringify(SelectedSubCategoryArray);
this.getExhibitionCard();
},
filterByCategory(data, categories) {
if (categories.length > 0) {
@ -568,7 +659,37 @@ export default {
}
},
updateLocationFilter(value) {
this.locationChecked = value;
var SelectedRegionArray = [];
var SelectedCountryArray = [];
var SelectedCityArray = [];
this.selectedRegionJson = "";
this.selectedCountryJson = "";
this.selectedCityJson = "";
value.forEach(key => {
if (this.regionMap.has(key)) {
SelectedRegionArray.push(key);
}
if (this.countryMap.has(key)) {
SelectedCountryArray.push(key);
}
if (this.cityMap.has(key)) {
SelectedCityArray.push(key);
}
});
this.selectedRegionJson = JSON.stringify(SelectedRegionArray);
this.selectedCountryJson = JSON.stringify(SelectedCountryArray);
this.selectedCityJson = JSON.stringify(SelectedCityArray);
this.getExhibitionCard();
},
filterByLocation(data, locations) {
if (locations.length > 0) {
@ -583,7 +704,21 @@ export default {
}
},
updateStatusFilter(value) {
this.statusesChecked = value;
var SelectedStatusArray = [];
this.selectedStatusJson = "";
value.forEach(key => {
if (this.statusMap.has(key)) {
SelectedStatusArray.push(key);
}
});
this.selectedStatusJson = JSON.stringify(SelectedStatusArray);
this.getExhibitionCard();
},
filterByStatus(data, status) {
if (status.length > 0) {
@ -594,6 +729,9 @@ export default {
},
updateDateFilter(value) {
this.datesChecked = value;
console.log("update");
this.getExhibitionCard();
},
filterByDate(data, dates) {
let start = null;
@ -682,7 +820,7 @@ export default {
.sort-by-text {
max-width: 142px;
> h3 {
>h3 {
border-right: 1px solid #e5e5e5;
}
}
@ -690,7 +828,7 @@ export default {
.sort-by-text-sm {
max-width: 112px;
> h3 {
>h3 {
border-right: 1px solid #e5e5e5;
}
}

Loading…
Cancel
Save