diff --git a/FrontEnd/components/exhibition/ExhibitionIntro.vue b/FrontEnd/components/exhibition/ExhibitionIntro.vue
index 9548ff7..b33ef9b 100644
--- a/FrontEnd/components/exhibition/ExhibitionIntro.vue
+++ b/FrontEnd/components/exhibition/ExhibitionIntro.vue
@@ -61,7 +61,7 @@
v-if="exhibition.area"
class="my-1 frequencyArea neutrals--text text--darken-5"
>
- {{ $t("Event Space :") }} {{ exhibition.area }}
+ {{ $t("Event Space :") }} {{ exhibition.area.toFixed(2) }}
diff --git a/FrontEnd/pages/exhibition/_id.vue b/FrontEnd/pages/exhibition/_id.vue
index 9c06236..e13e492 100644
--- a/FrontEnd/pages/exhibition/_id.vue
+++ b/FrontEnd/pages/exhibition/_id.vue
@@ -35,6 +35,7 @@
{{ $t("Follow Event") }}
+
@@ -102,7 +103,7 @@
-
+
@@ -204,6 +205,8 @@ export default {
exhibitionID: "",
tab: "0",
saved: false,
+ Favorite: {},
+ favoriteSet: new Set(),
exhibition: {
id: null,
name: "",
@@ -257,6 +260,7 @@ export default {
async created() {
this.getExhibitionCard();
this.getAdList();
+ this.getFavorite();
// await this.getExhibition();
// await this.getServiceCategory();
// await this.getCategorySwiperList();
@@ -264,20 +268,7 @@ export default {
// await this.checkRelatedService();
},
async beforeCreate() {
- if (this.$auth.loggedIn) {
- // await this.$axios
- // .get(
- // `/member/exhibitions/user?jwt=${this.$auth.$storage.getUniversal("jwt").token
- // }&exhibition_id=${this.$route.params.id}`
- // )
- // .then((result) => {
- // this.saved = result.data.saved;
- // })
- // .catch((err) => {
- // console.log(err);
- // });
- // await this.$store.dispatch("updatePicture");
- }
+
},
mounted() {
let vm = this;
@@ -435,6 +426,7 @@ export default {
this.exhibition.subcategories = exhib.SubCategories;
this.setSideBarList();
+ this.setFavorite();
}
@@ -489,17 +481,67 @@ export default {
navfix(entries, observer, isIntersecting) {
this.navControl.nav = isIntersecting;
},
+ getFavorite() {
+
+ this.favoriteSet.clear();
+
+ if (this.$auth.loggedIn) {
+ this.$axios.get(`/trending/api/Favorite/Favorites?Type=Exhibition`)
+ .then((result) => {
+
+ if(result && result.data && result.data.DATA && result.data.DATA.rel){
+
+ let favoriteList = [];
+ favoriteList = result.data.DATA.rel;
+
+ favoriteList.forEach(item => {
+
+ this.favoriteSet.add(item.ParentID);
+
+ })
+
+ }
+
+ })
+ .catch((err) => {
+ console.log("getFavorite"+err);
+ });
+
+ }
+
+ },
+ setFavorite() {
+
+ if (this.favoriteSet.size > 0 && this.$auth.loggedIn) {
+
+ if (this.favoriteSet.has(this.exhibition.id)) {
+
+ this.saved = true;
+
+ }
+
+ }
+
+ },
toggleFavorite() {
+ if (this.saved) {
+ this.saved = false;
+ this.Favorite.IsFavorite = 'N';
+ } else {
+ this.saved = true;
+ this.Favorite.IsFavorite = 'Y';
+ }
+
+ this.Favorite.Type = 'Exhibition';
+ this.Favorite.ParentID = this.exhibition.id;
+
if (this.$auth.loggedIn) {
this.$axios
- .put(
- `/member/exhibitions?jwt=${this.$auth.$storage.getUniversal("jwt")
- ? this.$auth.$storage.getUniversal("jwt").token
- : ""
- }&exhibition_id=${this.$route.params.id}&delete=${this.saved}`
+ .post(
+ `/trending/api/Favorite/Favorite`, this.Favorite
)
.then((result) => {
- this.saved = !this.saved;
+
})
.catch((err) => {
console.log(err);
@@ -508,6 +550,25 @@ export default {
this.$router.push(this.localePath("/user"));
}
},
+ // toggleFavorite() {
+ // if (this.$auth.loggedIn) {
+ // this.$axios
+ // .put(
+ // `/member/exhibitions?jwt=${this.$auth.$storage.getUniversal("jwt")
+ // ? this.$auth.$storage.getUniversal("jwt").token
+ // : ""
+ // }&exhibition_id=${this.$route.params.id}&delete=${this.saved}`
+ // )
+ // .then((result) => {
+ // this.saved = !this.saved;
+ // })
+ // .catch((err) => {
+ // console.log(err);
+ // });
+ // } else {
+ // this.$router.push(this.localePath("/user"));
+ // }
+ // },
async getExhibition() {
if (this.$route.query.preview) {
await this.$axios