Commit 07231de8 by 肖康

新闻列表 文章详情

parent b5c265c5
......@@ -86,7 +86,13 @@ export const apis = {
* 新闻详情api
* *
*/
newsArticleDetail: productionUrlApi + 'Article/Article/details'
newsArticleDetail: productionUrlApi + 'Article/Article/details',
/**
* *
* 新闻详情api
* *
*/
newsArticleDetailAd: productionUrl + 'api/newsdetailad'
}
export const services = {
index(params) {
......@@ -136,6 +142,9 @@ export const services = {
},
newsArticleDetail(params){
return axios.post(apis.newsArticleDetail,params)
},
newsArticleDetailAd(params){
return axios.post(apis.newsArticleDetailAd,params)
}
}
......@@ -48,7 +48,7 @@ const routes=[
}
},
{
path: '/news/detail/:id',
path: '/news/detail/:art_id/:cat_id',
name:'NewsDetail',
component: NewsDetail,
meta: {
......
import Vue from 'vue'
import {Toast} from 'vant';
import {services as Services} from '../../../api/index'
import Util from "../../../util";
var qs = require('qs');
......@@ -8,14 +9,25 @@ Vue.use(Toast);
const state = {
loadStatus: false,
newsDetailObj:{}
newsDetailObj:{},
newsDetailAd:{}
}
const mutations = {
newsArticleDetail(state, payload) {
state.newsDetailObj=payload.data;
},
newsArticleDetailAd(state, payload) {
state.newsDetailAd=payload.data;
if(Util.getCookie("newsdetailpop")){
state.newsDetailAd.h5_news_ad_pop="";
}else{
Util.setCookie("newsdetailpop","1",1)
}
}
}
const actions = {
......@@ -38,6 +50,25 @@ const actions = {
}).catch(function (err) {
state.loadStatus=false;
});
},
newsArticleDetailAd({commit}, payload) {
var param = {
cat_id: payload.cat_id
}
console.log(param)
var params = Util.getParams(param);
Services.newsArticleDetailAd(params).then((res) => {
let data = res.data;
if (data.err_code == 0) {
commit({
type: 'newsArticleDetailAd',
data: data.data
});
}
}).catch(function (err) {
});
}
}
......
......@@ -8,8 +8,30 @@
<span class="f24">来源:</span>
<span class="f24">{{newsDetailObj.current_info.writer}}&nbsp;&nbsp;&nbsp;{{newsDetailObj.current_info.publish_time}}</span>
</div>
<template v-if="newsDetailAd.news_details_ad">
<template v-if="newsDetailAd.news_details_ad.header">
<a :href="newsDetailAd.news_details_ad.header.url" :target="newsDetailAd.news_details_ad.header.window_open > 0 ?'_blank':'_self'">
<img :src="newsDetailAd.news_details_ad.header.images" :alt="newsDetailAd.news_details_ad.header.title" width="100%" height="120"/>
</a>
</template>
</template>
<div v-html="newsDetailObj.current_info.body" class="content-newsdetail"></div>
<template v-if="newsDetailAd.news_details_ad">
<template v-if="newsDetailAd.news_details_ad.footer">
<a :href="newsDetailAd.news_details_ad.footer.url" :target="newsDetailAd.news_details_ad.footer.window_open > 0 ?'_blank':'_self'">
<img :src="newsDetailAd.news_details_ad.footer.images" :alt="newsDetailAd.news_details_ad.footer.title" width="100%" height="120"/>
</a>
</template>
</template>
</div>
<template v-if="newsDetailAd.h5_news_ad_pop">
<div class="detail-pop" v-show="popdetailbool">
<van-icon name="close" class="closexdetailad" @click="popdetailact()"/>
<a :href="newsDetailAd.h5_news_ad_pop.url" :target="newsDetailAd.h5_news_ad_pop.window_open > 0 ?'_blank':'_self'">
<img :src="newsDetailAd.h5_news_ad_pop.images" :alt="newsDetailAd.h5_news_ad_pop.title">
</a>
</div>
</template>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loadStatus"/>
</section>
</template>
......@@ -18,22 +40,24 @@
import Vue from 'vue';
import {mapState} from 'vuex'
import {Loading} from 'vant'
import {Loading,Icon } from 'vant'
import Header from '@/views/common/Header.vue';
Vue.use(Loading);
Vue.use(Loading).use(Icon );
export default {
name: 'newsDetail',
data() {
return {
title:"猎芯网-新闻列表详情",
p: 1,
meaushow:true
meaushow:true,
popdetailbool:false
}
},
computed: {
...mapState({
newsDetailObj: state => state.newsdetail.newsDetailObj,
loadStatus: state => state.newsdetail.loadStatus
loadStatus: state => state.newsdetail.loadStatus,
newsDetailAd:state=> state.newsdetail.newsDetailAd
})
},
......@@ -47,15 +71,37 @@
},
created() {
this.getDataAd();
this.getData();
this.scrollFns();
},
methods: {
getData() {
this.$store.dispatch({
type: 'newsArticleDetail',
art_id: this.$route.params.id
art_id: this.$route.params.art_id
})
},
getDataAd:function(){
this.$store.dispatch({
type: 'newsArticleDetailAd',
cat_id: this.$route.params.cat_id
})
},
popdetailact:function(){
this.popdetailbool=false;
this.newsDetailAd.h5_news_ad_pop="";
},
scrollFns() {
var self=this;
window.onscroll= function(){
var t = document.documentElement.scrollTop||document.body.scrollTop;
if (t >= 100) {
self.popdetailbool = true;
}
}
}
},
components: {
Header
......@@ -87,5 +133,7 @@
.news-detail .bar span{line-height: 16px;height:16px;float:left;}
.news-detail .bar .f24{color:#333;}
.news-detail .bar .f20{font-size: 12px;padding-left: 5px;padding-right:5px;border-radius:2px;border:1px solid #ccc;margin-right: 10px;}
.news-detail .detail-pop{width:8.66rem;height:7.44rem;position: fixed;top:50%;left:50%;margin-left:-4.33rem;margin-top: -3.72rem;}
.news-detail .detail-pop img{width:100%;height:100%;}
.news-detail .closexdetailad{font-size: 26px;float:right;color:#ccc}
</style>
\ No newline at end of file
......@@ -17,7 +17,7 @@
<ul class="listBox clr" >
<van-list v-model="loading" :loading="loadStatus" :finished="finished"
finished-text="没有更多了" @load="onLoad">
<router-link tag="li" :to="{'path':'/news/detail/'+item.art_id}" v-for="(item,index) in content_list" :key="index">
<router-link tag="li" :to="{'path':'/news/detail/'+item.art_id+'/'+item.cat_id}" v-for="(item,index) in content_list" :key="index">
<img :src="item.litpic" :alt="item.title">
<div class="boxgrt">
<h1 class="title">{{item.title}}</h1>
......@@ -123,7 +123,7 @@
self.navListfixed = false;
}
}
},
}
},
components: {
Header
......
{"h":"a3193c9866299121ec7b","c":{"5":true}}
\ No newline at end of file
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
{"h":"16df1da942b642a2da1e","c":{"5":true}}
\ No newline at end of file
......@@ -27,7 +27,7 @@
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js" type="text/javascript" charset="utf-8"></script>
<script src="//szh5static.ichunt.com/static/js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
<script src="//szh5static.ichunt.com/static/js/shence.min.js" type="text/javascript" charset="utf-8"></script>
<link href="//szh5static.ichunt.com/0.js" rel="prefetch"><link href="//szh5static.ichunt.com/1.js" rel="prefetch"><link href="//szh5static.ichunt.com/2.js" rel="prefetch"><link href="//szh5static.ichunt.com/3.js" rel="prefetch"><link href="//szh5static.ichunt.com/4.js" rel="prefetch"><link href="//szh5static.ichunt.com/5.16df1da942b642a2da1e.hot-update.js" rel="prefetch"><link href="//szh5static.ichunt.com/5.js" rel="prefetch"><link href="//szh5static.ichunt.com/6.js" rel="prefetch"><link href="//szh5static.ichunt.com/7.js" rel="prefetch"><link href="//szh5static.ichunt.com/app.js" rel="preload" as="script"></head>
<link href="//szh5static.ichunt.com/0.js" rel="prefetch"><link href="//szh5static.ichunt.com/1.js" rel="prefetch"><link href="//szh5static.ichunt.com/2.js" rel="prefetch"><link href="//szh5static.ichunt.com/3.js" rel="prefetch"><link href="//szh5static.ichunt.com/4.js" rel="prefetch"><link href="//szh5static.ichunt.com/5.0b64a10f97de49dbd8ae.hot-update.js" rel="prefetch"><link href="//szh5static.ichunt.com/5.js" rel="prefetch"><link href="//szh5static.ichunt.com/6.js" rel="prefetch"><link href="//szh5static.ichunt.com/7.js" rel="prefetch"><link href="//szh5static.ichunt.com/app.js" rel="preload" as="script"></head>
<body class="boxsiz">
<noscript>
<strong>网站出现了一点小问题,正在紧急修复中.......</strong>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment