Browse Source

[WHAT] 展覽ID頁收藏開發

Dev
berlin-tzen 2 years ago
parent
commit
23e64f8b31
  1. 2
      FrontEnd/components/exhibition/ExhibitionIntro.vue
  2. 105
      FrontEnd/pages/exhibition/_id.vue

2
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) }}
</div>
</div>
</v-col>

105
FrontEnd/pages/exhibition/_id.vue

@ -35,6 +35,7 @@
</v-icon>
<span>{{ $t("Follow Event") }}</span>
</div>
</div>
</div>
</section>
@ -102,7 +103,7 @@
<ExhibitionDetailDescription class="mt-lg-13 mt-7" :exhibition="exhibition" />
</div>
</section>
<section class="section6 tw-px-[30px] md:tw-px-0 xl:tw-col-span-2 xl:tw-row-start-6">
<!-- <section class="section6 tw-px-[30px] md:tw-px-0 xl:tw-col-span-2 xl:tw-row-start-6">
<h3>
<two-dots class="step tw-mr-7" />{{ $t("You might like ...") }}
</h3>
@ -115,7 +116,7 @@
</v-slide-item>
</template>
</v-slide-group>
</section>
</section> -->
<section class="section7 tw-hidden xl:tw-block xl:tw-row-start-2 xl:tw-row-end-6">
<sideBarMenu :fixBarList="fixBarList" :currStep="currStep"></sideBarMenu>
</section>
@ -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

Loading…
Cancel
Save