1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <div class="client-details-page">
- <!-- 详情页 -->
- <div class="client-details-box">
- <!--行业资讯详情-->
- <div class="client-details-wrap">
- <h1>{{infoData.title}}</h1>
- <p class="details-visits-box"><i></i><span>{{infoData.startTime}}</span><i type="visits"></i><span>{{infoData.visits}}</span>
- </p>
- <div class="client-content-box" v-html="infoData.content"></div>
- <div class="client-details-pagination">
- <a v-show="infoData.lastId" :href="`${baseUrl}/news/${infoData.lastId}`">
- <span @click.prevent="changeNews(infoData.lastId)">上一篇:{{infoData.lastName}}</span>
- </a>
- <a v-show="infoData.nextId" :href="`${baseUrl}/news/${infoData.nextId}`">
- <span @click.prevent="changeNews(infoData.nextId)">下一篇:{{infoData.nextName}}</span>
- </a>
- </div>
- </div>
- <!-- 最新新闻 -->
- <div class="latest-news-box">
- <h4>最新新闻</h4>
- <ul class="latest-news-list">
- <li v-for="(item, index) in newestData" :key="index">
- <a :href="`${baseUrl}/news/${item.iiId}`">
- <span @click.prevent="changeNews(item.iiId)">{{item.title}}</span>
- </a>
- <p class="details-visits-box"><i></i><span>{{item.startTime}}</span><i type="visits"></i><span>{{item.visits}}</span>
- </p>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex';
- export default {
- name: 'news_id',
- layout: 'templateB',
- async asyncData({ params, $axios, store }) {
- // 设置选中菜单
- store.commit('setActiveNav', '/news');
- try {
- const url = '/home/news/info';
- const opt = {
- iiId: params.id,
- };
- const res = await $axios.post(url, opt);
- const url2 = '/home/news/newest';
- const res2 = await $axios.post(url2);
- return {
- infoData: res.data.data,
- newestData: res2.data.data.data,
- };
- } catch (e) {
- return {};
- }
- },
- computed: {
- baseUrl() {
- return this.getBaseUrl;
- },
- ...mapGetters(['getBaseUrl']),
- },
- methods: {
- changeNews(id) {
- this.$router.push({ name: 'news-id', params: { id } });
- },
- },
- };
- </script>
- <style>
- </style>
|