235 lines
8.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="tw-mb-[20px]">
  3. <div
  4. class="tw-grid tw-grid-cols-[auto_28px] tw-bg-white tw-border-solid tw-border tw-border-neutrals-200 tw-rounded-[20px] md:tw-p-[20px]">
  5. <div class="tw-grid tw-grid-cols-[102px_auto] tw-gap-[10px] tw-p-[10px] md:tw-grid-cols-[160px_auto]">
  6. <div class="tw-bg-primary-brigh">
  7. <img src="~/assets/svg/bookmark_outline.svg" class="tw-mb-[30px] md:tw-hidden" alt="" />
  8. <!-- exhibition status -->
  9. <div v-if="item.ExhibStatus != null && item.ExhibStatus != ''">
  10. <div v-if="item.ExhibStatus == 'Upcoming'"
  11. class="tw-hidden tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-border-primary-1 tw-text-primary-1 tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  12. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  13. </div>
  14. <div v-else-if="item.ExhibStatus == 'Ongoing'"
  15. class="tw-hidden tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-border-complementary-1 tw-text-complementary-1 tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  16. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  17. </div>
  18. <div v-else-if="item.ExhibStatus == 'Finished'"
  19. class="tw-hidden tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-border-neutrals-500 tw-text-neutrals-500 tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  20. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  21. </div>
  22. <div v-else-if="item.ExhibStatus == 'Cancelled'"
  23. class="tw-hidden tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-border-error-default tw-text-error-default tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  24. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  25. </div>
  26. <div v-else-if="item.ExhibStatus == 'Postponed'"
  27. class="tw-hidden tw-w-fit tw-body-5 tw-bg-error-default tw-border tw-border-solid tw-border-error-default tw-text-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  28. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  29. </div>
  30. <div v-else
  31. class="tw-hidden tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-text-white tw-rounded-[8px] tw-px-[10px] tw-py-[4px] md:tw-block md:tw-mb-[10px] md:tw-text-[14px]">
  32. {{ item.ExhibStatus ? item.ExhibStatus : "" }}
  33. </div>
  34. </div>
  35. <!-- exhibition logo -->
  36. <div v-if="item.Logo === ''">
  37. <img src="~/assets/svg/noLogo.svg" class="md:tw-w-[160px] md:tw-p-[10px]" alt="" />
  38. </div>
  39. <nuxt-link v-else :to="localePath('/exhibition/' + item.ExhibitionID)"><img :src="item.Logo"
  40. class="tw-py-[35px]" alt="" />
  41. </nuxt-link>
  42. </div>
  43. <div>
  44. <div>
  45. <div class="tw-grid tw-grid-cols-[107px_auto] tw-gap-[10px] tw-mb-[10px] md:tw-justify-between">
  46. <div v-if="item.IsRecommend === 'Y'"
  47. class="tw-w-fit tw-grid tw-grid-cols-[12px_auto] tw-gap-[5px] tw-rounded-[8px] tw-items-center tw-border tw-border-solid tw-border-primary-light tw-bg-primary-1 tw-py-[4px] tw-px-[10px]">
  48. <img src="~/assets/svg/recommend.svg" alt="" />
  49. <div class="tw-body-5 tw-text-white md:tw-text-[14px]">Recommend</div>
  50. </div>
  51. <div
  52. class="tw-w-fit tw-body-5 tw-bg-white tw-border tw-border-solid tw-border-complementary-1 tw-rounded-[8px] tw-text-complementary-1 tw-py-[4px] tw-px-[10px] md:tw-hidden">
  53. {{ item.ExhibStatus }}
  54. </div>
  55. <!-- <img src="~/assets/svg/bookmark_outline.svg" class="tw-hidden md:tw-block" alt="" /> -->
  56. </div>
  57. </div>
  58. <div>
  59. <div class="tw-body-4 tw-font-bold tw-mb-[8px] md:tw-text-[18px]">
  60. {{ item.ExhibitionName }}
  61. </div>
  62. <nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?region=${item.RegionID}`)">{{
  63. item.RegionName == null ? "" : item.RegionName + "."
  64. }}</nuxt-link>
  65. <nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?country=${item.CountryID}`)">{{
  66. item.CountryName == null ? "" : item.CountryName + "."
  67. }}</nuxt-link>
  68. <nuxt-link class="tw-text-neutrals-800" :to="localePath(`/exhibition?city=${item.CityID}`)">{{
  69. item.CityName
  70. == null ? "" : item.CityName
  71. }}</nuxt-link>
  72. <!-- star and review-->
  73. <!-- <div class="tw-hidden md:tw-block md:tw-mb-[8px]">
  74. <div class="tw-flex">
  75. <div class="tw-flex tw-items-center tw-mr-[10px]">
  76. <div class="tw-text-primary-1 tw-text-[14px] tw-mr-[5px]">4.6</div>
  77. <img src="~/assets/svg/star.svg" class="tw-w-[15px]" alt="">
  78. </div>
  79. <div class="tw-text-neutrals-600 tw-text-[14px]">
  80. (344 reviews)
  81. </div>
  82. </div>
  83. </div> -->
  84. <div v-if="item.MainCategoryList.length > 0"
  85. class="tw-w-fit tw-p-[5px] tw-body-5 tw-rounded-[10px] tw-bg-[#f6f6f6] tw-text-hint tw-mb-[8px] md:tw-text-[14px] md:tw-px-[10px] md:tw-py-[6px]">
  86. <div v-for="(Category, index) in item.MainCategoryList">
  87. {{ Category.CategoryName }}
  88. </div>
  89. </div>
  90. <div class="tw-hidden xl:tw-block tw-h-[62px]">
  91. {{ item.Intro }}
  92. </div>
  93. <div class="tw-body-3 tw-text-black md:tw-text-[18px]">
  94. {{ formatDate(item.StartDate) + " - " + formatDate(item.EndDate) }}
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. <!-- 電腦版save exhibition -->
  100. <div class="tw-hidden md:tw-cursor-pointer md:tw-block" @click="onToggleFavorite">
  101. <div v-if="item.saved">
  102. <img src="~/assets/svg/bookmark.svg" class="tw-w-[24px] md:tw-w-[28px]" alt="" />
  103. </div>
  104. <div v-else>
  105. <img src="~/assets/svg/bookmark_outline.svg" class="tw-w-[24px] md:tw-w-[28px]" alt="" />
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. </template>
  111. <script>
  112. import CardStatus from "~/components/exhibition/CardStatus.vue";
  113. import { formatDate, dateCountDown } from "~/utils/assist";
  114. import { ExhibitCardStatus, needLeftTagStatus } from "~/utils/constant";
  115. export default {
  116. name: "ExhibitionListCard",
  117. props: {
  118. item: {
  119. type: Object,
  120. default: () => ({}),
  121. },
  122. },
  123. components: {
  124. CardStatus,
  125. },
  126. data: () => ({
  127. StatusMap: ExhibitCardStatus,
  128. }),
  129. methods: {
  130. formatDate,
  131. dateCountDown,
  132. needLeftTagStatus,
  133. onToggleFavorite(id) {
  134. if (this.$auth.loggedIn) {
  135. // this.$axios
  136. // .put(
  137. // `/member/exhibitions?jwt=${
  138. // this.$auth.$storage.getUniversal("jwt")
  139. // ? this.$auth.$storage.getUniversal("jwt").token
  140. // : ""
  141. // }&exhibition_id=${this.item.id}&delete=${
  142. // this.item.saved ? this.item.saved : false
  143. // }`
  144. // )
  145. // .then((result) => {
  146. // if (result.data.message == "successfully unsaved exhibition") {
  147. // this.item.saved = false;
  148. // } else if (result.data.message == "successfully saved exhibition") {
  149. // this.item.saved = true;
  150. // }
  151. // this.$emit("toggle-favorite", {
  152. // id: this.item.id,
  153. // saved: this.item.saved,
  154. // });
  155. // })
  156. // .catch((err) => {
  157. // console.log(err);
  158. // });
  159. // this.$nextTick(() => {
  160. // this.$forceUpdate();
  161. // });
  162. } else {
  163. this.$router.push(this.localePath("/user"));
  164. }
  165. },
  166. },
  167. };
  168. </script>
  169. <style scoped lang="scss">
  170. .exhibit-card {
  171. max-width: 836px;
  172. &.disabled .card__right {
  173. opacity: 0.5;
  174. }
  175. }
  176. .exhibit-title {
  177. position: relative;
  178. font-weight: bold;
  179. color: #232323;
  180. word-break: break-word;
  181. .bookmark-tag {
  182. position: absolute;
  183. color: $primary-light-orange;
  184. right: 0;
  185. top: 0.5em;
  186. }
  187. }
  188. .status-tag {
  189. position: absolute;
  190. top: 16px;
  191. left: 20px;
  192. }
  193. .recommend-tag {
  194. border: 1px solid $primary-light-orange;
  195. max-width: 108px !important;
  196. img {
  197. width: 11px;
  198. height: 12px;
  199. }
  200. }
  201. .category-tag {
  202. border: 1px solid #f7ede4;
  203. height: 16px;
  204. }
  205. .last-dates {
  206. color: #ef5a5a;
  207. }
  208. a {
  209. text-decoration: none;
  210. }
  211. </style>