From bbb78306850307a150576e0c50bf7b61bfd7a624 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FUS91B7\\Showeasy" Date: Sat, 11 Mar 2023 19:40:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=83=E5=93=A1=E6=94=B6=E8=97=8F=E5=B1=95?= =?UTF-8?q?=E8=A6=BD(=E9=82=84=E9=9C=80=E5=84=AA=E5=8C=96)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FrontEnd/pages/user/saveExhibition.vue | 314 ++++++++++++++++++------- 1 file changed, 223 insertions(+), 91 deletions(-) diff --git a/FrontEnd/pages/user/saveExhibition.vue b/FrontEnd/pages/user/saveExhibition.vue index 0c9c2df..cbfa5da 100644 --- a/FrontEnd/pages/user/saveExhibition.vue +++ b/FrontEnd/pages/user/saveExhibition.vue @@ -67,16 +67,31 @@ -
+
- - + --> + +
+ +
+ + + +
@@ -155,81 +170,94 @@ export default { test:"", isRouterAlive: true, currentPage: 1, - perPageItems: 6, + perPageItems: 600000, + + + exhibitionMap: new Map(), + exhibitionCardList: [], + userFavoriateList: [], + }; }, async created() { this.fetchUserData(); - await this.fetchSavedExhibition(); - await this.fetchExhibition(); - await this.userSavedExhib(); - - - - await this.filterSavedExhibition(); - //await this.showUserExhibitionList(); - this.$axios - .get(`/trending/api/location/countries?RegionID&Lang=${this.$i18n.localeProperties["langQuery"]}`) - .then((response) => { - //console.log(JSON.stringify(response)); - if(response && response.data && response.data.DATA && response.data.DATA.rel){ - let data = response.data.DATA.rel - if(data){ - this.countryList = data; - //console.log(this.countryList); - this.countryOptions = this.countryList.map((item) => { - return { - id: item.CountryID, - name: item.CountryName, - }; - }); - const initial = { - name: this.$t("userProfile.allCountries"), - id: 999, - }; - this.countryOptions.splice(0, 0, initial); + // await this.fetchExhibition(); + // await this.fetchUserFavoriateExhibition(); - } - } - }) - .catch((error) => { - console.log(error); - }); + await this.fetchFavoriate(); + await this.fetchAllExhibition(); + this.setUserExhibitionCard(); + - this.$axios - .get(`/trending/api/exhibition/statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`) - .then((response) => { - //console.log(JSON.stringify(response)); - if(response && response.data && response.data.DATA && response.data.DATA.rel){ - let data = response.data.DATA.rel - if(data){ - this.statusList = data; - - this.statusOptions = this.statusList.map((item) => { - return { - id:"", - Key: item.Key, - Value: item.Value, - }; - }); - - const initial = { - id: 999, - Key: 999, - Value: this.$t("userProfile.allStatus"), - }; - - this.statusOptions.splice(0, 0, initial); - - } - } - }) - .catch((error) => { - console.log(error); - }); - this.countryFilterList = this.showUserExhibitionList; + // await this.userSavedExhib(); + + + + // await this.filterSavedExhibition(); + // //await this.showUserExhibitionList(); + // this.$axios + // .get(`/trending/api/location/countries?RegionID&Lang=${this.$i18n.localeProperties["langQuery"]}`) + // .then((response) => { + // //console.log(JSON.stringify(response)); + // if(response && response.data && response.data.DATA && response.data.DATA.rel){ + // let data = response.data.DATA.rel + // if(data){ + // this.countryList = data; + // //console.log(this.countryList); + // this.countryOptions = this.countryList.map((item) => { + // return { + // id: item.CountryID, + // name: item.CountryName, + // }; + // }); + // const initial = { + // name: this.$t("userProfile.allCountries"), + // id: 999, + // }; + // this.countryOptions.splice(0, 0, initial); + + // } + // } + // }) + // .catch((error) => { + // console.log(error); + // }); + + // this.$axios + // .get(`/trending/api/exhibition/statuses?Lang=${this.$i18n.localeProperties["langQuery"]}`) + // .then((response) => { + // //console.log(JSON.stringify(response)); + // if(response && response.data && response.data.DATA && response.data.DATA.rel){ + // let data = response.data.DATA.rel + // if(data){ + // this.statusList = data; + + // this.statusOptions = this.statusList.map((item) => { + // return { + // id:"", + // Key: item.Key, + // Value: item.Value, + // }; + // }); + + // const initial = { + // id: 999, + // Key: 999, + // Value: this.$t("userProfile.allStatus"), + // }; + + // this.statusOptions.splice(0, 0, initial); + + // } + // } + // }) + // .catch((error) => { + // console.log(error); + // }); + + // this.countryFilterList = this.showUserExhibitionList; }, mounted() { this.yearOptions = Array.from(new Array(103), (val, index) => @@ -281,6 +309,77 @@ export default { }, }, methods: { + + async fetchFavoriate() { + + await 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){ + + this.userFavoriateList = data; + + } + } + }) + .catch((error) => { + console.log(error); + }); + + }, + + async fetchAllExhibition() { + + 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){ + + console.table(data); + + data.DataList.forEach(exhib => { + + this.exhibitionMap.set(exhib.ExhibitionID, exhib); + + }); + + // this.setUserExhibitionCard(); + + }; + }; + }) + .catch((error) => { + console.log(error); + }); + + }, + + setUserExhibitionCard() { + + this.userFavoriateList.forEach( fav => { + + if(this.exhibitionMap.has(fav.ParentID)) { + + this.exhibitionCardList.push(this.exhibitionMap.get(fav.ParentID)); + + + } + + }); + + console.log("mdfkkkkkkkuuuu"); + console.table(this.exhibitionCardList); + + }, + updatePage(value) { this.currentPage = value; this.fetchExhibition(); @@ -409,7 +508,7 @@ export default { this.$auth.logout(); }, - async fetchSavedExhibition() { + async fetchUserFavoriateExhibition() { this.$axios .get( `/trending/api/Favorite/Favorites?Type=Exhibition` @@ -431,6 +530,8 @@ export default { this.userSaveExhibition.length / this.savedExhibitionPerPage ); + console.table(this.userSaveExhibition); + //this.userVisibleSavedExhibitionList = JSON.parse(JSON.stringify(this.userSaveExhibition)); } } @@ -441,7 +542,7 @@ export default { }, async fetchExhibition() { - this.$axios + 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"]}` ) @@ -449,11 +550,25 @@ export default { if(response && response.data && response.data.DATA && response.data.DATA.rel){ let data = response.data.DATA.rel if(data){ - this.exhibitionList = data; - this.showUserExhibitionList = []; - this.countryFilterList = []; + + 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(); + // this.userSavedExhib(); @@ -463,10 +578,24 @@ export default { // this.exhibitionMap.set(exhib.ExhibitionID, exhib); // }) - // this.userSaveExhibition.forEach((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); - // this.showUserExhibitionList.push(this.exhibitionMap.get(exhib.ExhibitionID)); - // }) }; }; }) @@ -475,19 +604,22 @@ export default { }); }, - async userSavedExhib(){ - this.exhibitionList.forEach((exhib) => { - this.userSaveExhibition.forEach((user) => { - if(exhib.ExhibitionID == user.ParentID){ - exhib.IsFavorite = 'Y'; - this.showUserExhibitionList.push(exhib); - } - }) - }); - this.countryFilterList = JSON.parse( - JSON.stringify(this.showUserExhibitionList)); + // 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 = [];