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.

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