123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <script setup>
- import { ref, reactive } from "vue";
- import { useRoute } from "vue-router";
- import axios from "axios";
- import moment from "moment";
- import Navbar from "@/components/Navbar.vue";
- const route = useRoute();
- const newsId = route.params.id; // 網址參數
- const news = reactive({
- data: [],
- });
- let loading = ref(false);
- (async function getData() {
- loading.value = true;
- try {
- const response = await axios.get(
- `${store.apiUrl}/api/get_news?news_id=${newsId}`
- );
- news.data = response.data.news[0];
- loading.value = false;
- console.log("news.data", news.data);
- } catch (error) {
- console.error(error);
- }
- })();
- </script>
- <template>
- <Navbar />
- <div class="position-relative">
- <img
- src="@/assets/img/news/news-01.png"
- alt="臺灣工藝學校全球學習共享平台"
- class="material-img"
- />
- <v-container class="pa-0 py-16 position-relative">
- <div class="content">
- <div v-if="loading" class="d-flex justify-center my-10">
- <v-progress-circular
- color="grey-lighten-4"
- indeterminate
- ></v-progress-circular>
- </div>
- <div v-else class="article">
- <v-row>
- <v-col cols="12">
- <div class="d-flex align-center mb-10">
- <v-chip size="large" variant="elevated" class="px-8 me-3">
- {{ news.data.category }}
- </v-chip>
- <p>
- {{ moment(`${news.data.create_time}`).format("YYYY.MM.DD") }}
- </p>
- </div>
- <h2>{{ news.data.title }}</h2>
- <!-- <img src="@/assets/img/img-01.jpg" alt="臺灣工藝學校全球學習共享平台" class="cover-img" /> -->
- <!-- <img :src="`https://cmm.ai/ntcri/${news.data.cover_img}`" alt="臺灣工藝學校全球學習共享平台" /> -->
- </v-col>
- <v-col cols="12" class="mt-10">
- <section
- class="d-flex flex-column pa-0"
- v-html="news.data.content"
- ></section>
- <!-- <div class="btn-block mt-10">
- <v-btn rounded="xl" color="grey-darken-2" class="px-7">
- 檔案下載
- </v-btn>
- <v-btn rounded="xl" color="grey-darken-2" class="px-7 ms-3">
- 前往連結
- </v-btn>
- </div> -->
- </v-col>
- </v-row>
- </div>
- </div>
- <router-link to="/news" class="mt-16 back-link"
- >< 返回重要訊息</router-link
- >
- </v-container>
- <img
- src="@/assets/img/news/news-01.png"
- alt="臺灣工藝學校全球學習共享平台"
- class="material-img"
- />
- </div>
- </template>
- <style lang="scss" scoped>
- .content {
- padding: 1.25em;
- background-image: url("@/assets/img/news/news-bg.webp");
- background-position: center;
- background-size: cover;
- border-radius: 3.125em;
- @media (max-width: 960px) {
- width: 90%;
- margin: auto;
- }
- }
- .material-img {
- position: absolute;
- &:first-child {
- top: -15vw;
- }
- &:last-child {
- bottom: -9.375em;
- z-index: -5;
- transform: scaleX(-1);
- @media (max-width: 600px) {
- bottom: -3.125em;
- }
- }
- }
- </style>
|