list.vue
3.34 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
<template>
<div class="list">
<Button type="primary" class="create-btn" @click="toCreate">创建新活动</Button>
<div class="activity-list">
<Table :columns="columns1" :data="data"></Table>
</div>
</div>
</template>
<script>
module.exports = {
data() {
return {
columns1: [
{
title: '活动标题',
key: 'title'
},
{
title: '开始时间',
key: 'startTime'
},
{
title: '结束时间',
key: 'endTime'
},
{
title: '操作',
render: (h, {row}) => {
return h('div', [
h('Button', {
props: {
type: 'primary',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.conf(row.id)
}
}
}, '配置'),
h('Button', {
props: {
type: 'error',
size: 'small'
},
on: {
click: () => {
this.delete(row.id)
}
}
}, '删除'),
])
}
}
],
data: []
}
},
methods: {
toCreate() {
this.$router.push({name: 'create'});
},
conf(actId) {
this.$router.push({name: 'conf', query: {actId}});
},
delete(id) {
this.$Modal.warning({
title: '删除',
content: '删除后不可恢复,确认删除?',
onOk: () => {
$.ajax({
method: 'post',
url: '/admin/wheelSurf/api/delete',
data: {id}
}).then(() => {
this.list();
});
}
});
},
list() {
$.ajax({
url: '/admin/wheelSurf/api/list',
}).then(res => {
this.data = res.data;
});
}
},
created() {
this.list();
}
}
</script>
<style lang="scss">
.activity-list {
}
.create-btn {
margin-bottom: 10px;
}
</style>