国外MOSE官网
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.

125 lines
5.2 KiB

7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
  1. <script setup lang="ts">
  2. import { computed } from 'vue';
  3. import { useI18n } from 'vue-i18n';
  4. const { t, locale } = useI18n();
  5. // 使用计算属性实现响应式语言切换
  6. const eventsData = computed(() => [
  7. {
  8. id: 1,
  9. date: "2024-05",
  10. title: locale.value === 'zh' ? "新加坡共识大会2024" : "Consensus 2024 Singapore",
  11. description: locale.value === 'zh' ? "隐私技术主题演讲" : "Keynote speech on privacy technology",
  12. location: "Singapore",
  13. link: "#",
  14. icon: 'M19 20H5a2 2 0 01-2-2V6a2 2 0 012-2h2a2 2 0 012 2h6a2 2 0 012-2h2a2 2 0 012 2v12a2 2 0 01-2 2z'
  15. },
  16. {
  17. id: 2,
  18. date: "2024-06",
  19. title: locale.value === 'zh' ? "东京开发者黑客松" : "Tokyo Developer Hackathon",
  20. description: locale.value === 'zh' ? "50万美元奖金池" : "$500,000 prize pool",
  21. location: "Tokyo",
  22. link: "#",
  23. icon: 'M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2'
  24. }
  25. ]);
  26. const events = computed(() => {
  27. return eventsData.value.map(event => ({
  28. ...event,
  29. formattedTitle: event.title,
  30. formattedDescription: event.description,
  31. formattedLocation: event.location
  32. }));
  33. });
  34. // 格式化日期
  35. const formatDate = (dateString: string) => {
  36. // 处理"2024-05"这种格式,转换为"2024-05-01"以便创建Date对象
  37. const fullDateString = dateString.length === 7 ? `${dateString}-01` : dateString;
  38. const date = new Date(fullDateString);
  39. // 如果只有年月,则只显示年月
  40. if (dateString.length === 7) {
  41. return new Intl.DateTimeFormat(locale.value === 'zh' ? 'zh-CN' : 'en-US', {
  42. year: 'numeric',
  43. month: 'long'
  44. }).format(date);
  45. }
  46. // 否则显示完整日期
  47. return new Intl.DateTimeFormat(locale.value === 'zh' ? 'zh-CN' : 'en-US', {
  48. year: 'numeric',
  49. month: 'long',
  50. day: 'numeric'
  51. }).format(date);
  52. };
  53. </script>
  54. <template>
  55. <section class="py-16 px-6 md:px-12 lg:px-24">
  56. <div class="container mx-auto">
  57. <div class="text-center mb-12">
  58. <h2 class="text-2xl md:text-3xl font-bold text-text mb-4 wow animate__animated animate__fadeInUp animate__duration-fast">
  59. {{ t('home.events.title') }}
  60. </h2>
  61. <p class="text-text-secondary max-w-2xl mx-auto wow animate__animated animate__fadeIn animate__delay-xs">
  62. {{ t('home.events.subtitle') }}
  63. </p>
  64. </div>
  65. <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
  66. <div
  67. v-for="(event, index) in events"
  68. :key="event.id"
  69. class="bg-background-light rounded-xl overflow-hidden shadow-card hover:transform hover:scale-105 transition-all duration-300 wow animate__animated animate__fadeInUp animate__duration-fast"
  70. :class="{
  71. 'animate__delay-xs': index === 1,
  72. 'animate__delay-sm': index === 2
  73. }"
  74. >
  75. <div class="p-6">
  76. <div class="flex items-center mb-4">
  77. <div class="w-10 h-10 rounded-full bg-primary bg-opacity-20 flex items-center justify-center mr-3">
  78. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-primary-light" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  79. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" :d="event.icon" />
  80. </svg>
  81. </div>
  82. <div class="text-xs font-medium text-primary-light">
  83. {{ formatDate(event.date) }}
  84. </div>
  85. </div>
  86. <h3 class="text-lg font-bold text-text mb-3">{{ event.formattedTitle }}</h3>
  87. <p class="text-text-secondary text-sm mb-4">{{ event.formattedDescription }}</p>
  88. <div class="flex items-center text-xs text-text-secondary">
  89. <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  90. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
  91. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
  92. </svg>
  93. <span>{{ event.formattedLocation }}</span>
  94. </div>
  95. </div>
  96. <div class="bg-background px-6 py-4 border-t border-background-dark">
  97. <a :href="event.link" class="text-primary-light hover:text-primary-dark text-sm font-medium transition-colors btn-hover-glow inline-block">
  98. {{ t('home.events.learn_more') }}
  99. </a>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="text-center mt-10">
  104. <a href="/community" class="inline-flex items-center text-primary-light hover:text-primary-dark transition-colors">
  105. {{ t('home.events.view_all') }}
  106. <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 ml-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  107. <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3" />
  108. </svg>
  109. </a>
  110. </div>
  111. </div>
  112. </section>
  113. </template>