show.vue 2.07 KB
<style>

</style>
<template>
<div>
	<banner></banner>
	<div class="infor container">
	  <div class="breadcrumb">
	    当前位置:
	    <a v-link="{path:'/'}">首页</a> &gt;
	    <a 
	    v-link="{path:'/list/'+chtype.id+'/0'}">
	    {{chtype.title}}</a> &gt;    
	    <span>{{type.title}}</span>
	  </div>
	  <div class="infor-detail">
	    <h2 class="infor-title">{{obj.title}}</h2>
	    <p style="text-indent: 0px;border-bottom: 1px #ccc solid;
    padding-bottom: 10px;margin-bottom:10px;"
    v-show="sourceshow">消息来源:{{obj.source}}</p>
	    
	    {{{obj.content}}}
	  </div>
	</div>	
</div>
</template>
<script>
module.exports={
	data:function(){
		return {
			guid:'',typelist:[],obj:{},
			chtype:{id:'',title:''},type:{id:'',title:''},
			sourceshow:false
		}
	},methods:{
		getData:function(){
			this.guid=this.$route.params.id;
			this.type.id=this.$route.params.type;
			if(this.type.id<200){
				this.sourceshow=false;
			}else{
				this.sourceshow=true;
			}
			Ajax.get('/cms/public_act_getOneAct?guid='+this.guid).then(function(res){
				var result=res.data;
		        console.log('public_act_getOneAct',result);
		        if(result.data){
		            this.obj=result.data;
		        }		       
			}.bind(this))	
		},gettype:function(){
	    	Ajax.get('/cms/typelist').then(function(res){
				var result=res.data;
		        console.log('typelist',result);
		        if(result.data){
		            this.$set('typelist',result.data);
		        }
		        this.getData();
			}.bind(this))
	    }
	},route:{
		activate:function(){
			this.gettype();
			//this.getData();			
		}
	},watch:{
		'$route.path':function(val){
			if(val.indexOf('show')>-1){
				this.getData();
			}			
		},'type.id':function(val){
			console.log(val);
			for(var i=0;i<this.typelist.length;i++){
				if(this.typelist[i].id==val){
					this.type.title=this.typelist[i].title;
					this.chtype.id=this.typelist[i].parentid;


					for(var i=0;i<this.typelist.length;i++){
						if(this.typelist[i].id==this.chtype.id){
							this.chtype.title=this.typelist[i].title;
						}
					}
				}
			}

			
		}
	}
}
</script>