platform-agreement-edit.vue
3.92 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<style>
</style>
<template>
<div class="container resource" style="min-height: 447px;">
<div class="pop-banner clearfix">
<div class="operate-btns">
<!-- <a href="javascript:void(0)" class="fbtn fb-modify">修改</a> -->
<a href="javascript:void(0);" class="fbtn fb-add"
v-show="addbool" v-on:click="add()">添加</a>
<a href="javascript:void(0)" class="fbtn fb-save"
v-on:click="save()">保存</a>
</div>
<h3 class="current-module">协议</h3>
</div>
<div class="pd-form clearfix">
<div class="form-group">
<label for="cn1" class="label">标题</label>
<div class="control">
<input type="text" id="cn1" v-model="title">
</div>
</div>
<div class="form-group">
<label for="cn1" class="label">文章分类</label>
<div class="control" style="position:relative;z-index:1;">
<select-ui :list="typeselects" :empty="true"
:selected.sync="contenttype">
</select-ui>
</div>
</div>
<div class="form-group mb-20">
<label class="label">正文</label>
<div class="control" style="position:relative;z-index:1;">
<!-- <textarea id="cn10" rows="5"></textarea> -->
<vue-html5-editor :content.sync="content" :height="300"></vue-html5-editor>
</div>
</div>
</div>
</div>
</template>
<script>
module.exports={
data:function(){
return {
id:0,
content:"",title:'',contenttype:'',addbool:true,
typeselects:[
{value:1,label:'运营'}
,{value:2,label:'金融'}
]
}
},methods:{
getData:function(){
this.id=this.$route.params.id || 0;
if(this.id==0){
this.id=0;
this.addbool=false;
this.content="";
this.title="";
this.contenttype='';
}else{
this.addbool=true;
Ajax.post('/platform/sys_helper_getOneDetail',{
guid:this.id
}).then(function(res){
var result=res.data;
if(result.data){
this.title=result.data.title;
this.contenttype=result.data.contenttype;
this.content=result.data.content;
}
}.bind(this))
}
},save:function(){
var obj={
guid:this.id,
title:this.title,
content:this.content,
contenttype:this.contenttype,
hptype:'AG'
}
if(this.id!=0){
Ajax.post('/platform/sys_helper_updateContent',obj).then(function(res){
var result=res.data;
if(result.errorCode==0){
this.title="";
this.id=''
this.contenttype="";
this.content='';
this.$router.go({path:'/platformAgreement'})
}
}.bind(this))
return ;
}
Ajax.post('/platform/sys_helper_addContent',
obj).then(function(res){
var result=res.data;
if(result.errorCode==0){
this.title="";
this.id=''
this.contenttype="";
this.content='';
this.$router.go({path:'/platformAgreement'})
}
}.bind(this))
},add:function(){
this.MessageBox({
title: '提示',
message: '确定放弃修改添加吗',
type: 'success',
showCancelButton: true
}).then(function(action) {
if(action=="confirm"){
this.title='';
this.id=0;
this.content="";
this.contenttype="";
}
}.bind(this));
}
},route:{
activate:function(){
this.getData();
}
}
}
</script>