Commit b5c265c5 by 肖康

新闻列表页面 详情页面

parent bdae4d98
<template>
<div id="app">
<keep-alive exclude="">
<keep-alive exclude="newsDetail">
<router-view class="router-view"></router-view>
</keep-alive>
</div>
......
......@@ -78,9 +78,15 @@ export const apis = {
*/
wechatArticle: productionUrlApi + 'Wechat/WechatArticleJinJi/article',
/**
*微信菜单文章锦集api
*新闻列表api
*/
newsArticle: productionUrlApi + 'Article/Article/index'
newsArticle: productionUrlApi + 'Article/Article/index',
/**
* *
* 新闻详情api
* *
*/
newsArticleDetail: productionUrlApi + 'Article/Article/details'
}
export const services = {
index(params) {
......@@ -127,6 +133,9 @@ export const services = {
},
newsArticle(params) {
return axios.post(apis.newsArticle, params)
},
newsArticleDetail(params){
return axios.post(apis.newsArticleDetail,params)
}
}
.news{ ul,li{font-family: "微软雅黑"!important;} .borderBottom{border-bottom:1px solid #e5e5e5;} .navList{ border-bottom:1px solid #e5e5e5; padding:0 10px; clear:both; height:40px; line-height:40px; font-size: 14px; p{ text-align:center;width:33.33%;color:#333;float: left;cursor: pointer;height:40px; line-height:40px; } p.act{color:#e10601;border-bottom:2px solid #e10601;} } .navList44{ p{ width:25%; } } .listBox{ li{ padding:10px; height:100px; .borderBottom; box-sizing: border-box; img{height:75px;width:100px;float:left;border:0px;outline: none;} .boxgrt{height:75px;width:235px;float:right; .title{ overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color:#333;font-size: 0.32rem; font-weight: bold; height:50px; line-height: 25px; } .titleLook{font-size:14px;color:#999;margin-top: 5px;} } } } }
\ No newline at end of file
.news{ ul,li{font-family: "微软雅黑"!important;} .borderBottom{border-bottom:1px solid #e5e5e5;} .navList{ border-bottom:1px solid #e5e5e5; padding:0 10px; clear:both; height:40px; line-height:40px; font-size: 14px; background: #fff; overflow: hidden; p{ text-align:center;width:33.33%;color:#333;float: left;cursor: pointer;height:40px; line-height:40px; } p.act{color:#e10601;border-bottom:2px solid #e10601;} } .navListfixed{ .navList; position: fixed; top:39px; left:0; right:0px; } .navList44{ p{ width:25%; } } .listBox{ li{ padding:10px; height:100px; .borderBottom; box-sizing: border-box; img{height:75px;width:27%;float:left;border:0px;outline: none;} .boxgrt{height:75px;width:66%;float:right; .title{ overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color:#333;font-size: 0.32rem; font-weight: bold; height:50px; line-height: 25px; } .titleLook{font-size:14px;color:#999;margin-top: 5px;} } } } }
\ No newline at end of file
......
.news ul,.news li{font-family:"微软雅黑" !important}.news .borderBottom{border-bottom:1px solid #e5e5e5}.news .navList{border-bottom:1px solid #e5e5e5;padding:0 10px;clear:both;height:40px;line-height:40px;font-size:14px}.news .navList p{text-align:center;width:33.33%;color:#333;float:left;cursor:pointer;height:40px;line-height:40px}.news .navList p.act{color:#e10601;border-bottom:2px solid #e10601}.news .navList44 p{width:25%}.news .listBox li{padding:10px;height:100px;border-bottom:1px solid #e5e5e5;box-sizing:border-box}.news .listBox li img{height:75px;width:100px;float:left;border:0px;outline:none}.news .listBox li .boxgrt{height:75px;width:235px;float:right}.news .listBox li .boxgrt .title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;color:#333;font-size:.32rem;font-weight:bold;height:50px;line-height:25px}.news .listBox li .boxgrt .titleLook{font-size:14px;color:#999;margin-top:5px}/*# sourceMappingURL=index.min.css.map */
\ No newline at end of file
.news ul,.news li{font-family:"微软雅黑" !important}.news .borderBottom{border-bottom:1px solid #e5e5e5}.news .navList{border-bottom:1px solid #e5e5e5;padding:0 10px;clear:both;height:40px;line-height:40px;font-size:14px;background:#fff;overflow:hidden}.news .navList p{text-align:center;width:33.33%;color:#333;float:left;cursor:pointer;height:40px;line-height:40px}.news .navList p.act{color:#e10601;border-bottom:2px solid #e10601}.news .navListfixed{border-bottom:1px solid #e5e5e5;padding:0 10px;clear:both;height:40px;line-height:40px;font-size:14px;background:#fff;overflow:hidden;position:fixed;top:39px;left:0;right:0px}.news .navListfixed p{text-align:center;width:33.33%;color:#333;float:left;cursor:pointer;height:40px;line-height:40px}.news .navListfixed p.act{color:#e10601;border-bottom:2px solid #e10601}.news .navList44 p{width:25%}.news .listBox li{padding:10px;height:100px;border-bottom:1px solid #e5e5e5;box-sizing:border-box}.news .listBox li img{height:75px;width:27%;float:left;border:0px;outline:none}.news .listBox li .boxgrt{height:75px;width:66%;float:right}.news .listBox li .boxgrt .title{overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;color:#333;font-size:.32rem;font-weight:bold;height:50px;line-height:25px}.news .listBox li .boxgrt .titleLook{font-size:14px;color:#999;margin-top:5px}/*# sourceMappingURL=index.min.css.map */
\ No newline at end of file
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,KACE,IADF,KACK,CAAA,GAAG,YAAa,MAAb,YADR,KAEE,eAAc,gCAFhB,KAIE,UACE,+BAAA,CACA,cAAA,CACA,UAAA,CACA,WAAA,CACA,gBAAA,CACA,eAVJ,KAIE,SAOE,GACE,iBAAA,CAAkB,YAAA,CAAa,UAAA,CAAW,UAAA,CAAY,cAAA,CAAgB,WAAA,CACtE,iBAbN,KAIE,SAWE,EAAC,KAAK,aAAA,CAAc,gCAfxB,KAiBE,WACE,GACE,UAnBN,KAsBE,SACE,IACE,YAAA,CACA,YAAA,CAvBU,+BAAA,CAyBV,sBA3BN,KAsBE,SACE,GAKE,KAAI,WAAA,CAAY,WAAA,CAAY,UAAA,CAAW,UAAA,CAAW,aA5BxD,KAsBE,SACE,GAME,SAAQ,WAAA,CAAY,WAAA,CAAY,YA7BtC,KAsBE,SACE,GAME,QACE,QACE,eAAA,CACA,sBAAA,CACA,mBAAA,CACA,oBAAA,CACA,2BAAA,CACA,UAAA,CAAW,gBAAA,CACX,gBAAA,CACA,WAAA,CACA,iBAvCV,KAsBE,SACE,GAME,QAYE,YAAW,cAAA,CAAe,UAAA,CAAW","file":"index.min.css"}
\ No newline at end of file
{"version":3,"sources":["index.less"],"names":[],"mappings":"AAAA,KACE,IADF,KACK,CAAA,GAAG,YAAa,MAAb,YADR,KAEE,eAAc,gCAFhB,KAIE,UACE,+BAAA,CACA,cAAA,CACA,UAAA,CACA,WAAA,CACA,gBAAA,CACA,cAAA,CACA,eAAA,CACA,gBAZJ,KAIE,SASE,GACE,iBAAA,CAAkB,YAAA,CAAa,UAAA,CAAW,UAAA,CAAY,cAAA,CAAgB,WAAA,CACtE,iBAfN,KAIE,SAaE,EAAC,KAAK,aAAA,CAAc,gCAjBxB,KAmBE,eAdE,+BAAA,CACA,cAAA,CACA,UAAA,CACA,WAAA,CACA,gBAAA,CACA,cAAA,CACA,eAAA,CACA,eAAA,CASA,cAAA,CACA,QAAA,CACA,MAAA,CACA,UAxBJ,KAmBE,cANE,GACE,iBAAA,CAAkB,YAAA,CAAa,UAAA,CAAW,UAAA,CAAY,cAAA,CAAgB,WAAA,CACtE,iBAfN,KAmBE,cAFE,EAAC,KAAK,aAAA,CAAc,gCAjBxB,KA0BE,WACE,GACE,UA5BN,KA+BE,SACE,IACE,YAAA,CACA,YAAA,CAhCU,+BAAA,CAkCV,sBApCN,KA+BE,SACE,GAKE,KAAI,WAAA,CAAY,SAAA,CAAU,UAAA,CAAW,UAAA,CAAW,aArCtD,KA+BE,SACE,GAME,SAAQ,WAAA,CAAY,SAAA,CAAU,YAtCpC,KA+BE,SACE,GAME,QACE,QACE,eAAA,CACA,sBAAA,CACA,mBAAA,CACA,oBAAA,CACA,2BAAA,CACA,UAAA,CAAW,gBAAA,CACX,gBAAA,CACA,WAAA,CACA,iBAhDV,KA+BE,SACE,GAME,QAYE,YAAW,cAAA,CAAe,UAAA,CAAW","file":"index.min.css"}
\ No newline at end of file
export default {
bind(el, binding) {
el.addEventListener('click', function (e) {
var t = document.documentElement.scrollTop||document.body.scrollTop;
var step=(t/100).toFixed(0);
var timer=setInterval(function(){
t=t-step;
if(t<=0){
t=0;
clearInterval(timer);
}
document.documentElement.scrollTop=t;
},1)
}, false);
}
}
\ No newline at end of file
import Vue from 'vue'
import BackTopDirective from './backTop'
import BackTopDirective from './backTop';
import backTopWindowDirective from './backTopWindow';
export default {
install (Vue) {
Vue.directive('backTop', BackTopDirective);
Vue.directive('backTopWindow', backTopWindowDirective);
}
}
......@@ -9,7 +9,7 @@ const News = resolve => require(['@/views/news/Index'], resolve);
const NewsDetail = resolve => require(['@/views/news/Detail'], resolve);
Vue.use(Router)
const routes = [
const routes=[
{
path: '/',
component: Home,
......@@ -48,7 +48,7 @@ const routes = [
}
},
{
path: '/news/detail',
path: '/news/detail/:id',
name:'NewsDetail',
component: NewsDetail,
meta: {
......@@ -59,7 +59,7 @@ const routes = [
path: '*',
redirect: '/'
}
];
]
routes.forEach(route => {
route.path = route.path || '/' + (route.name || '');
......
import Vue from 'vue'
import {Toast} from 'vant';
import {services as Services} from '../../../api/index'
var qs = require('qs');
Vue.use(Toast);
const state = {
loadStatus: false,
newsDetailObj:{}
}
const mutations = {
newsArticleDetail(state, payload) {
state.newsDetailObj=payload.data;
}
}
const actions = {
newsArticleDetail({commit}, payload) {
state.newsDetailObj={};
state.loadStatus=true;
var params = {
art_id: payload.art_id
}
Services.newsArticleDetail(qs.stringify(params)).then((res) => {
state.loadStatus=false;
let data = res.data;
if (data.err_code == 0) {
commit({
type: 'newsArticleDetail',
data: data.data
});
}
}).catch(function (err) {
state.loadStatus=false;
});
}
}
const getters = {}
export default {
state,
mutations,
actions,
getters
}
......@@ -19,7 +19,6 @@ const state = {
const mutations = {
newsArticle(state, payload) {
state.rollbanner=payload.data.rollbanner;
state.cat_list = payload.data.cat_list;
//处理数据的数组
......@@ -34,6 +33,8 @@ const mutations = {
//判断数据是否加载完成
if (state.p>= state.totalLimit) {
state.finished = true;
}else{
state.finished = false;
}
}
}
......
......@@ -5,6 +5,7 @@ import common from './modules/common'
import smt from './modules/smt/index'
import wxlist from './modules/wxlist/wxlist'
import news from './modules/news/index'
import newsdetail from './modules/news/detail'
Vue.use(Vuex)
export default new Vuex.Store({
......@@ -13,6 +14,7 @@ export default new Vuex.Store({
common,
smt,
wxlist,
news
news,
newsdetail
}
})
......@@ -52,10 +52,11 @@ export default {
width:100%;
padding: 0 0.2rem;
position:fixed;
z-index: 998;
top:0;
background:#fafafa;
i{font-size:18px;margin-top:10px;color:#666}
h3{font-size:16px;color:#333;width:88%;line-height:40px;text-align:center;height:40px;overflow: hidden;
text-overflow: ellipsis;}
h3{font-size:16px;color:#333;width:68%;line-height:40px;text-align:center;height:40px;overflow: hidden;
text-overflow: ellipsis;white-space: nowrap;padding:0px 10%!important;}
}
</style>
<template>
<section>
<div class="slide-bar">
<div class="customer-service" @click="recordFn">
<div class="customer-service" @click="recordFn" v-if="kefuishow">
<i class="iconfont icon-kefu"></i>
</div>
<div class="backtop" v-backTop v-if="show">
......@@ -39,6 +39,17 @@
export default {
name: 'sidebar',
props: {
kefuishow:{
type: Boolean,//是否展示客服
default: true
},
isWindow:{
type: Boolean,//是否开启windows监听
default: false
}
},
data() {
return {
flag: false,
......@@ -51,7 +62,15 @@
phpParams: state => state.common.phpParams,
}),
mounted() {
this.scrollFn();
if(this.isWindow){
this.scrollFnWindow();
}else{
this.scrollFn();
}
},
methods: {
customsrService() {
......@@ -59,6 +78,18 @@
type: 'customsrService'
})
},
//弹性布局监听不到window
scrollFnWindow(){
var self=this;
window.onscroll= function(){
var t = document.documentElement.scrollTop||document.body.scrollTop;
if(t>=300){
self.show=true;
}else{
self.show=false;
}
}
},
scrollFn() {
var obj = document.querySelector('.container-wrap'), self = this;
obj.onscroll = function () {
......
<template>
<section class="news-detail">
我是新闻详情页面
<section class="news-detail" >
<div v-if="newsDetailObj.current_info">
<Header :title="title" :meaushow='meaushow'></Header>
<h1 class="title" >{{newsDetailObj.current_info.title}}</h1>
<div class="bar">
<span class="f20">{{newsDetailObj.current_info.art_type_text}}</span>
<span class="f24">来源:</span>
<span class="f24">{{newsDetailObj.current_info.writer}}&nbsp;&nbsp;&nbsp;{{newsDetailObj.current_info.publish_time}}</span>
</div>
<div v-html="newsDetailObj.current_info.body" class="content-newsdetail"></div>
</div>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loadStatus"/>
</section>
</template>
<script>
import Vue from 'vue';
import {mapState} from 'vuex'
import {Loading} from 'vant'
import Header from '@/views/common/Header.vue';
Vue.use(Loading);
export default {
name: "detail"
name: 'newsDetail',
data() {
return {
title:"猎芯网-新闻列表详情",
p: 1,
meaushow:true
}
},
computed: {
...mapState({
newsDetailObj: state => state.newsdetail.newsDetailObj,
loadStatus: state => state.newsdetail.loadStatus
})
},
watch:{
newsDetailObj(val){
if(JSON.stringify(val) != "{}"){
this.title=val.current_info.title
window.document.title=val.current_info.title
}
}
},
created() {
this.getData();
},
methods: {
getData() {
this.$store.dispatch({
type: 'newsArticleDetail',
art_id: this.$route.params.id
})
}
},
components: {
Header
}
}
</script>
<style scoped>
<style >
.news-detail .bar, .news-detail .title, .news-detail .content-newsdetail{
padding:0 10px;
}
.news-detail .content-newsdetail img{max-width:100%!important;}
.news-detail h1.title{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
color: #333;
font-size: 22px;
font-weight: 700;
line-height: 30px;
margin-top: 10px;
}
.news-detail .bar{
height:16px;clear:both;font-size:12px;color:#999;margin-top:10px;margin-bottom:10px;
}
.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;}
</style>
\ No newline at end of file
......@@ -9,15 +9,15 @@
<img v-lazy="item" />
</van-swipe-item>
</van-swipe>
<div v-if="cat_list.length>0" class="navList clearfix" :class="{'navList44':cat_list.length==4}">
<div v-if="cat_list.length>0" class="navList clearfix" :class="{'navList44':(cat_list.length==4),'navListfixed':navListfixed}" >
<p @click="tab(index)" class="fl" :class="{'act':act==index}" v-for="(item,index) in cat_list" :key="index">
{{item.cat_name}}
</p>
</div>
<ul class="listBox clr" >
<van-list v-model="loading" :loading="loadStatus" :finished="finished" :offset="10"
finished-text="没有更多了" :immediate-check="immediateCheck" @load="onLoad">
<router-link tag="li" :to="{'name':'NewsDetail'}" v-for="(item,index) in content_list" :key="index">
<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">
<img :src="item.litpic" :alt="item.title">
<div class="boxgrt">
<h1 class="title">{{item.title}}</h1>
......@@ -29,6 +29,11 @@
</router-link>
</van-list>
</ul>
<div class="slide-bar">
<div class="backtop" v-if="navListfixed">
<i class="iconfont icon-xiangshang1" v-backTopWindow></i>
</div>
</div>
</section>
</template>
......@@ -46,14 +51,13 @@
return {
title:"猎芯网-新闻列表",
p: 1,
cat_id:11,
cat_id:'',
bannerHeight:180,
meaushow:true,
loading: false,
limit:10,
act:0,
immediateCheck:false
navListfixed:false
}
},
computed: {
......@@ -68,18 +72,28 @@
},
watch: {
loadStatus(val) {
console.log(val)
this.loading=val;
}
},
created() {
this.getData();
},
mounted() {
this.scrollFns();
},
methods: {
getData() {
var catid="";
if(this.cat_id){
catid=this.cat_id
}else{
if(this.cat_list.length>0){
catid=this.cat_list[0].cat_id;
}
}
this.$store.dispatch({
type: 'newsArticle',
type_id: this.cat_id,
cat_id: catid,
p: this.p,
limit:this.limit
......@@ -89,18 +103,31 @@
if(this.act==index){return}
this.act=index;
this.p=1;
this.cat_id=this.cat_list[index].cat_id;
this.getData();
},
onLoad() {
console.log(0)
if (this.p < this.totalLimit) {
this.p++;
this.getData();
}
}
},
scrollFns() {
var self=this;
window.onscroll= function(){
var t = document.documentElement.scrollTop||document.body.scrollTop;
if (t >= 300) {
self.navListfixed = true;
} else {
self.navListfixed = false;
}
}
},
},
components: {
Header
}
}
</script>
......
{"h":"7094d038121889d3eca1","c":{"0":false}}
\ No newline at end of file
{"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.
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":"d258939462cd879558da","c":{"1":false}}
\ No newline at end of file
{"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.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.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>
<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