list.vue
3.49 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
<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: '活动ID',
key: 'id'
},
{
title: '活动标题',
key: 'title'
},
{
title: '开始时间',
key: 'startTime',
render: (h, {row}) => {
return h('span', {}, moment(row.startTime * 1000).format('YYYY-MM-DD HH:mm:ss '));
}
},
{
title: '结束时间',
key: 'endTime',
render: (h, {row}) => {
return h('span', {}, moment(row.endTime * 1000).format('YYYY-MM-DD HH:mm:ss '));
}
},
{
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: 'success',
size: 'small'
},
style: {
marginRight: '5px'
},
on: {
click: () => {
this.prizeSent(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}});
},
prizeSent(actId) {
this.$router.push({name: 'prizeSent', 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>