show.vue
2.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<style>
</style>
<template>
<div>
<banner></banner>
<div class="infor container">
<div class="breadcrumb">
当前位置:
<a v-link="{path:'/'}">首页</a> >
<a
v-link="{path:'/list/'+chtype.id+'/0'}">
{{chtype.title}}</a> >
<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>