You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

235 lines
8.2 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
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <div class="tw-mb-[20px]">
  3. <div
  4. class="tw-grid xl: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. {{ $t(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. {{ $t(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. {{ $t(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. {{ $t(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. {{ $t(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. {{ $t(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-flex tw-mb-[10px]">
  46. <div v-if="item.IsRecommend === 'Y'"
  47. class="tw-w-fit tw-mr-[5px] 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] tw-whitespace-nowrap">{{ $t("exhibition.Recommended") }}</div>
  50. </div>
  51. <div
  52. class="tw-w-fit tw-body-5 tw-bg-white tw-whitespace-nowrap tw-border tw-border-solid tw-justify-between tw-border-complementary-1 tw-rounded-[8px] tw-text-complementary-1 tw-py-[4px] tw-px-[10px] md:tw-hidden">
  53. {{ $t(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(item)">
  101. <div v-if="item.IsFavorite ==='Y' ">
  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. Favorite: {
  129. Type: "",
  130. ParentID: "",
  131. IsFavorite: "",
  132. Memo: ""
  133. }
  134. }),
  135. methods: {
  136. formatDate,
  137. dateCountDown,
  138. needLeftTagStatus,
  139. onToggleFavorite(item) {
  140. if (item.IsFavorite === 'Y') {
  141. item.IsFavorite = 'N';
  142. } else {
  143. item.IsFavorite = 'Y';
  144. }
  145. this.Favorite.IsFavorite = item.IsFavorite;
  146. this.Favorite.Type = 'Exhibition';
  147. this.Favorite.ParentID = item.ExhibitionID;
  148. if (this.$auth.loggedIn) {
  149. this.$axios
  150. .post(
  151. `/trending/api/Favorite/Favorite`, this.Favorite
  152. )
  153. .then((result) => {
  154. })
  155. .catch((err) => {
  156. console.log(err);
  157. });
  158. } else {
  159. this.$router.push(this.localePath("/user"));
  160. }
  161. },
  162. },
  163. };
  164. </script>
  165. <style scoped lang="scss">
  166. .exhibit-card {
  167. max-width: 836px;
  168. &.disabled .card__right {
  169. opacity: 0.5;
  170. }
  171. }
  172. .exhibit-title {
  173. position: relative;
  174. font-weight: bold;
  175. color: #232323;
  176. word-break: break-word;
  177. .bookmark-tag {
  178. position: absolute;
  179. color: $primary-light-orange;
  180. right: 0;
  181. top: 0.5em;
  182. }
  183. }
  184. .status-tag {
  185. position: absolute;
  186. top: 16px;
  187. left: 20px;
  188. }
  189. .recommend-tag {
  190. border: 1px solid $primary-light-orange;
  191. max-width: 108px !important;
  192. img {
  193. width: 11px;
  194. height: 12px;
  195. }
  196. }
  197. .category-tag {
  198. border: 1px solid #f7ede4;
  199. height: 16px;
  200. }
  201. .last-dates {
  202. color: #ef5a5a;
  203. }
  204. a {
  205. text-decoration: none;
  206. }
  207. </style>