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.

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