create.vue
2.29 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
<template>
<div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>活动创建</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<Form :label-width="80">
<FormItem label="活动名称">
<Input v-model="title" placeholder="活动名称" style="width: 400px"></Input>
</FormItem>
<FormItem label="活动时间">
<DatePicker type="datetimerange" placeholder="开始时间-结束时间"
style="width: 400px" @on-change="dateTimeChange"></DatePicker>
</FormItem>
<FormItem>
<Button type="primary" @click="save">保存</Button>
<Button style="margin-left: 8px" @click="cancel">取消</Button>
</FormItem>
</Form>
</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
title: '',
startTime: '',
endTime: ''
};
},
methods: {
dateTimeChange(range) {
this.startTime = range[0];
this.endTime = range[1];
},
save() {
$.ajax({
method: 'post',
url: '/admin/wheelSurf/api/create',
data: {
title: this.title,
type: 1,
startTime: moment(this.startTime).format('X'),
endTime: moment(this.endTime).format('X')
}
}).then(res => {
this.$router.push({name: 'list'})
});
},
cancel() {
this.$router.push({name: 'list'});
}
},
components: {
}
}
</script>
<style>
</style>