hookehuyr

联调新闻详情页接口

/*
* @Date: 2024-09-26 13:36:06
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-23 11:00:04
* @LastEditTime: 2024-10-23 13:03:28
* @FilePath: /hager/src/api/hager.js
* @Description: 文件描述
*/
......@@ -10,7 +10,9 @@ import { fn, fetch } from '@/api/fn';
const Api = {
HONOR: '/srv/?a=cate&type=honor',
NEWS: '/srv/?a=cate&type=news',
NEWS_DETAIL: '/srv/?a=detail&type=news',
};
export const honorAPI = (params) => fn(fetch.get(Api.HONOR, params));
export const newsAPI = (params) => fn(fetch.get(Api.NEWS, params));
export const getNewsDetailAPI = (params) => fn(fetch.get(Api.NEWS_DETAIL, params));
......
<!--
* @Date: 2024-10-18 12:06:09
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-10-18 13:41:32
* @LastEditTime: 2024-10-23 13:13:10
* @FilePath: /hager/src/views/news/detail.vue
* @Description: 文件描述
-->
......@@ -21,7 +21,7 @@
</hager-box>
<hager-box>
<div class="news-title">{{ title }}</div>
<div v-html="content"></div>
<div class="news-content" v-html="content"></div>
</hager-box>
</div>
</template>
......@@ -29,6 +29,7 @@
<script>
import mixin from 'common/mixin';
import hagerBox from '@/components/common/hagerBox';
import { getNewsDetailAPI } from "@/api/hager.js";
export default {
components: { hagerBox },
......@@ -39,8 +40,12 @@ export default {
content: '',
}
},
mounted () {
async mounted () {
const { code, data } = await getNewsDetailAPI({ id: this.$route.query.id });
if (code) {
this.title = data.post_title;
this.content = data.product_advantages;
}
},
methods: {
......@@ -71,7 +76,15 @@ export default {
text-align: center;
font-size: 1.75rem;
font-weight: bold;
margin: 2rem 0;
margin: 3rem 0;
}
:deep(.news-content) {
margin-bottom: 2rem;
img {
width: 100%;
height: auto;
}
}
}
</style>
......