Showing
2 changed files
with
21 additions
and
6 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2024-09-26 13:36:06 | 2 | * @Date: 2024-09-26 13:36:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-23 11:00:04 | 4 | + * @LastEditTime: 2024-10-23 13:03:28 |
| 5 | * @FilePath: /hager/src/api/hager.js | 5 | * @FilePath: /hager/src/api/hager.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| ... | @@ -10,7 +10,9 @@ import { fn, fetch } from '@/api/fn'; | ... | @@ -10,7 +10,9 @@ import { fn, fetch } from '@/api/fn'; |
| 10 | const Api = { | 10 | const Api = { |
| 11 | HONOR: '/srv/?a=cate&type=honor', | 11 | HONOR: '/srv/?a=cate&type=honor', |
| 12 | NEWS: '/srv/?a=cate&type=news', | 12 | NEWS: '/srv/?a=cate&type=news', |
| 13 | + NEWS_DETAIL: '/srv/?a=detail&type=news', | ||
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params)); | 16 | export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params)); |
| 16 | export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params)); | 17 | export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params)); |
| 18 | +export const getNewsDetailAPI = (params) => fn(fetch.get(Api.NEWS_DETAIL, params)); | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2024-10-18 12:06:09 | 2 | * @Date: 2024-10-18 12:06:09 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2024-10-18 13:41:32 | 4 | + * @LastEditTime: 2024-10-23 13:13:10 |
| 5 | * @FilePath: /hager/src/views/news/detail.vue | 5 | * @FilePath: /hager/src/views/news/detail.vue |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | --> | 7 | --> |
| ... | @@ -21,7 +21,7 @@ | ... | @@ -21,7 +21,7 @@ |
| 21 | </hager-box> | 21 | </hager-box> |
| 22 | <hager-box> | 22 | <hager-box> |
| 23 | <div class="news-title">{{ title }}</div> | 23 | <div class="news-title">{{ title }}</div> |
| 24 | - <div v-html="content"></div> | 24 | + <div class="news-content" v-html="content"></div> |
| 25 | </hager-box> | 25 | </hager-box> |
| 26 | </div> | 26 | </div> |
| 27 | </template> | 27 | </template> |
| ... | @@ -29,6 +29,7 @@ | ... | @@ -29,6 +29,7 @@ |
| 29 | <script> | 29 | <script> |
| 30 | import mixin from 'common/mixin'; | 30 | import mixin from 'common/mixin'; |
| 31 | import hagerBox from '@/components/common/hagerBox'; | 31 | import hagerBox from '@/components/common/hagerBox'; |
| 32 | +import { getNewsDetailAPI } from "@/api/hager.js"; | ||
| 32 | 33 | ||
| 33 | export default { | 34 | export default { |
| 34 | components: { hagerBox }, | 35 | components: { hagerBox }, |
| ... | @@ -39,8 +40,12 @@ export default { | ... | @@ -39,8 +40,12 @@ export default { |
| 39 | content: '', | 40 | content: '', |
| 40 | } | 41 | } |
| 41 | }, | 42 | }, |
| 42 | - mounted () { | 43 | + async mounted () { |
| 43 | - | 44 | + const { code, data } = await getNewsDetailAPI({ id: this.$route.query.id }); |
| 45 | + if (code) { | ||
| 46 | + this.title = data.post_title; | ||
| 47 | + this.content = data.product_advantages; | ||
| 48 | + } | ||
| 44 | }, | 49 | }, |
| 45 | methods: { | 50 | methods: { |
| 46 | 51 | ||
| ... | @@ -71,7 +76,15 @@ export default { | ... | @@ -71,7 +76,15 @@ export default { |
| 71 | text-align: center; | 76 | text-align: center; |
| 72 | font-size: 1.75rem; | 77 | font-size: 1.75rem; |
| 73 | font-weight: bold; | 78 | font-weight: bold; |
| 74 | - margin: 2rem 0; | 79 | + margin: 3rem 0; |
| 80 | + } | ||
| 81 | + | ||
| 82 | + :deep(.news-content) { | ||
| 83 | + margin-bottom: 2rem; | ||
| 84 | + img { | ||
| 85 | + width: 100%; | ||
| 86 | + height: auto; | ||
| 87 | + } | ||
| 75 | } | 88 | } |
| 76 | } | 89 | } |
| 77 | </style> | 90 | </style> | ... | ... |
-
Please register or login to post a comment