Janie 2 years ago
parent
commit
aaceedaaca
  1. 22
      FrontEnd/pages/exhibition/index.vue
  2. 182
      FrontEnd/pages/user/saveExhibition.vue

22
FrontEnd/pages/exhibition/index.vue

@ -359,16 +359,7 @@ 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.total;
},
@ -382,7 +373,6 @@ export default {
},
$route() {
// console.log("route");
this.getQuery();
},
@ -454,7 +444,7 @@ export default {
`/trending/api/Exhibition/Statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`
)
.then((result) => {
if (result.data.DATA.rel) {
if(result && result.data && result.data.DATA && result.data.DATA.rel){
this.statuses = result.data.DATA.rel;
this.statuses = this.statuses.map((item => {
@ -480,7 +470,7 @@ export default {
)
.then((result) => {
if (result.data.DATA.rel) {
if(result && result.data && result.data.DATA && result.data.DATA.rel){
this.categories = result.data.DATA.rel;
@ -520,7 +510,7 @@ export default {
)
.then((result) => {
if (result.data.DATA.rel) {
if(result && result.data && result.data.DATA && result.data.DATA.rel){
var vm = this;
vm.locations = result.data.DATA.rel;
@ -584,8 +574,6 @@ export default {
)
.then((result) => {
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){
@ -612,7 +600,7 @@ export default {
)
.then((result) => {
if (result.data.DATA.rel) {
if(result && result.data && result.data.DATA && result.data.DATA.rel){
let favoriteList = [];
favoriteList = result.data.DATA.rel;

182
FrontEnd/pages/user/saveExhibition.vue

@ -46,7 +46,7 @@
</select>
</div>
<div
v-if="showUserExhibitionList.length == 0"
v-if="exhibitionCardList.length == 0"
class="tw-mt-[80px] md:tw-mt-[90px]"
>
<img
@ -67,7 +67,7 @@
</nuxt-link>
</div>
<div class="tw-mt-[20px] md:tw-mt-[30px]">
<div v-else class="tw-mt-[20px] md:tw-mt-[30px]">
<!-- <ExhibitionListCard
v-for="(exhibition, index) in countryFilterList"
@ -79,7 +79,7 @@
</ExhibitionListCard> -->
<div v-for="list in exhibitionCardList" :key="list">
<ExhibitionListCard :item="list"></ExhibitionListCard>
<ExhibitionListCard :item="list" @toggle-favorite="updateExhibitionListCard"></ExhibitionListCard>
</div>
<!-- <ExhibitionListCard
@ -163,7 +163,6 @@ export default {
countryFilterList: [],
userSaveExhibitionList: [],
exhibitionList: [],
exhibitionMap: new Map(),
showUserExhibitionList: [],
userSaveExhibition: [],
CountryName:[],
@ -284,24 +283,24 @@ export default {
});
},
watch: {
countrySelect: {
handler: function () {
if (this.countrySelect) {
this.filterSavedExhibition(this.countrySelect,this.statusSelect);
//this.fetchSavedExhibition();
//this.fetchExhibition();
}
},
},
statusSelect: {
handler: function () {
if (this.statusSelect) {
this.filterSavedExhibition(this.countrySelect,this.statusSelect);
//this.fetchSavedExhibition();
//this.fetchExhibition();
}
},
},
// countrySelect: {
// handler: function () {
// if (this.countrySelect) {
// this.filterSavedExhibition(this.countrySelect,this.statusSelect);
// //this.fetchSavedExhibition();
// //this.fetchExhibition();
// }
// },
// },
// statusSelect: {
// handler: function () {
// if (this.statusSelect) {
// this.filterSavedExhibition(this.countrySelect,this.statusSelect);
// //this.fetchSavedExhibition();
// //this.fetchExhibition();
// }
// },
// },
},
computed: {
pageLength() {
@ -310,6 +309,16 @@ export default {
},
methods: {
async updateExhibitionListCard() {
this.userFavoriateList = [];
this.exhibitionCardList = [];
await this.fetchFavoriate();
this.setUserExhibitionCard();
},
async fetchFavoriate() {
await this.$axios
@ -320,7 +329,7 @@ export default {
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
this.userFavoriateList = data;
}
@ -343,16 +352,12 @@ export default {
let data = response.data.DATA.rel
if(data){
console.table(data);
data.DataList.forEach(exhib => {
this.exhibitionMap.set(exhib.ExhibitionID, exhib);
});
// this.setUserExhibitionCard();
};
};
})
@ -368,16 +373,14 @@ export default {
if(this.exhibitionMap.has(fav.ParentID)) {
this.exhibitionCardList.push(this.exhibitionMap.get(fav.ParentID));
const exhibCard = this.exhibitionMap.get(fav.ParentID);
exhibCard.IsFavorite = "Y";
this.exhibitionCardList.push(exhibCard);
}
});
console.log("mdfkkkkkkkuuuu");
console.table(this.exhibitionCardList);
},
updatePage(value) {
@ -507,119 +510,6 @@ export default {
}
this.$auth.logout();
},
async fetchUserFavoriateExhibition() {
this.$axios
.get(
`/trending/api/Favorite/Favorites?Type=Exhibition`
)
.then((response) => {
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
//console.log("data:" + JSON.stringify(data));
this.userSaveExhibition = data;
this.userSaveExhibition = this.userSaveExhibition.map((item) => {
return{
ParentID: item.ParentID,
};
});
this.userSavedExhibitionPageLength = Math.ceil(
this.userSaveExhibition.length / this.savedExhibitionPerPage
);
console.table(this.userSaveExhibition);
//this.userVisibleSavedExhibitionList = JSON.parse(JSON.stringify(this.userSaveExhibition));
}
}
})
.catch((error) => {
console.log(error);
});
},
async fetchExhibition() {
await this.$axios
.get(
`/trending/api/Exhibition/Cards?PageIndex=${this.currentPage}&PageSize=${this.perPageItems}&RegionIDs&CountryIDs&CityIDs&MainCategoryIDs&SubCategoryIDs&Status&Date&Sort&Query&Lang=${this.$i18n.localeProperties["langQuery"]}`
)
.then((response) => {
if(response && response.data && response.data.DATA && response.data.DATA.rel){
let data = response.data.DATA.rel
if(data){
this.exhibitionList = data.DataList;
this.exhibitionList.forEach(exhibition => {
this.exhibitionMap.set(exhibition.ExhibitionID, exhibition);
});
console.log("All exhibitions " + this.exhibitionMap.size);
console.table(this.exhibitionMap);
// this.exhibitionList = data.DataList;
// this.showUserExhibitionList = [];
// this.countryFilterList = [];
// this.userSavedExhib();
//Berlin
// this.exhibitionList.forEach((exhib) => {
// this.exhibitionMap.set(exhib.ExhibitionID, exhib);
// })
console.log("holy shit size");
console.log(this.userSaveExhibition);
this.userSaveExhibition.forEach((exhib) => {
if (this.exhibitionMap.has(exhib.ExhibitionID)) {
this.testArr.push(this.exhibitionMap.get(exhib.ExhibitionID));
}
})
console.log("mdfk");
console.table(this.testArr);
};
};
})
.catch((error) => {
console.log(error);
});
},
// userSavedExhib(){
// this.exhibitionList.forEach(exhib => {
// // console.log(exhib.ExhibitionID);
// this.userSaveExhibition.forEach(user => {
// // console.log(user.ParentID);
// // if(exhib.ExhibitionID === user.ParentID){
// console.log(exhib.ExhibitionID);
// // exhib.IsFavorite = 'Y';
// // this.showUserExhibitionList.push(exhib);
// // }
// })
// });
// // this.countryFilterList = JSON.parse(
// // JSON.stringify(this.showUserExhibitionList));
// },
filterSavedExhibition(countryId, selectId) {
this.countryFilterList = [];

Loading…
Cancel
Save