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.

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