Main.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <script setup>
  2. import { ref, reactive, computed, watch } from "vue";
  3. import { useRouter, useRoute } from "vue-router";
  4. import { useMainStore } from "@/stores/store";
  5. import axios from "axios";
  6. import Navbar from "@/components/Navbar.vue";
  7. const route = useRoute();
  8. const router = useRouter();
  9. const store = useMainStore();
  10. let isLifeChildren = ref(false);
  11. router.beforeEach((to, from) => {
  12. groupId.value = to.meta.group_id;
  13. getGroup(groupId.value);
  14. // 判斷是否前往生活工藝內頁
  15. if (to.path.includes("/college-group/life/")) {
  16. isLifeChildren.value = true;
  17. } else {
  18. isLifeChildren.value = false;
  19. }
  20. });
  21. let groupId = ref(null);
  22. let groupName = ref("");
  23. let groupDescribe = ref("");
  24. groupId.value = route.meta.group_id;
  25. getGroup(groupId.value);
  26. // 取得學群介紹
  27. async function getGroup(id) {
  28. console.log("getGroup", id);
  29. if (!id) {
  30. return;
  31. }
  32. if (id === 1) {
  33. groupName = "未來工藝";
  34. } else if (id === 2) {
  35. groupName = "技藝工藝";
  36. } else if (id === 3) {
  37. groupName = "生活工藝";
  38. } else if (id === 7) {
  39. groupName = "跨域增能";
  40. } else if (id === 8) {
  41. groupName = "線上工藝";
  42. } else if (id === 9) {
  43. groupName = "希望工程";
  44. }
  45. try {
  46. let response = await axios.get(
  47. `${store.apiUrl}/api/get_group_name?id=${id}`
  48. );
  49. groupDescribe.value = response.data.school_groups[0].describe;
  50. console.log("學群介紹", response.data.school_groups);
  51. } catch (error) {
  52. console.error(error);
  53. }
  54. }
  55. // const description = computed(() => {
  56. // let text = "";
  57. // switch (title.value) {
  58. // case "未來工藝":
  59. // text =
  60. // "深入探索未來工藝的發展趨勢,以 Metacraft 為核心,專注於工藝領域的未來研究與設計。整合研發補助和研究報告等多項計畫。";
  61. // break;
  62. // case "技藝工藝":
  63. // text =
  64. // "技藝工藝旨在培養專業型、旗艦型工藝人才。我們提供專業工藝課程、修復工藝、青年培訓及國際交流。深掘台灣在地工藝智慧,並與國際接軌。";
  65. // break;
  66. // case "跨域增能":
  67. // text =
  68. // "您可以在跨域增能獲得多元知識的學習機會、培養工藝師傅的綜合能力,其中包括智財、法律、商業等全方位的領域。";
  69. // break;
  70. // case "線上工藝":
  71. // text =
  72. // "線上工藝包含中國古典文化的古老工藝、具有台灣在地特色的民俗工藝、工藝匠人的創作故事,是工藝教育者的影音寶庫!";
  73. // break;
  74. // case "希望工程":
  75. // text =
  76. // "希望工程以綠工藝精神結合人文關懷,串聯工藝、社會,我們希望以「One Community, One Craft」理念帶來「希望‧療癒‧陪伴」的力量、讓工藝治癒身心靈,促進社會共好。";
  77. // break;
  78. // case "生活工藝":
  79. // text =
  80. // "從精選綠色工藝品牌「旅物SHOP」,到深度工藝之旅「工藝行旅」。「一日學徒」帶您用一天的時間體會工藝師的一生。以及培養新一代工藝教育者啓發潛能的「校園扎根」。";
  81. // break;
  82. // }
  83. // return text;
  84. // });
  85. </script>
  86. <template>
  87. <div class="college-bg-img">
  88. <Navbar />
  89. <v-container fluid class="college-content pb-16 px-lg-0">
  90. <div v-if="!isLifeChildren" class="college-banner">
  91. <img
  92. class="d-none d-md-block"
  93. src="@/assets/img/college-group/banner.png"
  94. alt="臺灣工藝學校全球學習共享平台"
  95. />
  96. <img
  97. class="d-block d-md-none"
  98. src="@/assets/img/college-group/banner-mb.webp"
  99. alt="臺灣工藝學校全球學習共享平台"
  100. />
  101. <div class="description-item">
  102. <h1>{{ groupName }}</h1>
  103. <p>
  104. {{ groupDescribe }}
  105. </p>
  106. </div>
  107. <!-- <h1>{{ title }}</h1>
  108. <p class="description-item">
  109. {{ description }}
  110. </p> -->
  111. </div>
  112. <div class="main-block" :class="{ life: isLifeChildren }">
  113. <router-view></router-view>
  114. </div>
  115. </v-container>
  116. </div>
  117. </template>
  118. <style lang="scss" scoped>
  119. .content {
  120. padding: 0;
  121. width: 90%;
  122. @media (max-width: 600px) {
  123. width: 85%;
  124. }
  125. .main-block {
  126. padding: 6.25em 5em;
  127. margin-top: -30%;
  128. background-color: #fff;
  129. @media (max-width: 960px) {
  130. padding: 6.25em 3.125em;
  131. }
  132. @media (max-width: 600px) {
  133. padding: 6.25em 1.25em;
  134. }
  135. h2 {
  136. font-size: 1.875em;
  137. font-weight: 500;
  138. line-height: 2em;
  139. margin-left: 0.625em;
  140. @media (max-width: 960px) {
  141. font-size: 1.5em;
  142. }
  143. @media (max-width: 600px) {
  144. margin-left: 0;
  145. margin-bottom: 3.125em;
  146. }
  147. }
  148. .title {
  149. margin: 5em 0;
  150. @media (max-width: 600px) {
  151. margin: 3.125em 0;
  152. }
  153. }
  154. .v-breadcrumbs {
  155. position: relative;
  156. z-index: 100;
  157. justify-content: flex-start;
  158. @media (max-width: 600px) {
  159. justify-content: center;
  160. }
  161. }
  162. }
  163. }
  164. </style>