Commit bf1c12d1 authored by les's avatar les
Browse files

[refactoring] eventAdmin component

parent 734f937b
<template lang='pug'>
div
el-divider {{$t('common.admin')}}
el-menu-item
div(@click.prevents='toggle') {{$t(event.is_visible?'common.hide':'common.confirm')}}
el-menu-item
div(@click.prevent='remove') {{$t('common.remove')}}
el-menu-item(@click='$router.replace(`/add/${event.id}`)') {{$t('common.edit')}}
</template>
<script>
export default {
name: 'EventAdmin',
props: ['event'],
methods: {
async remove () {
try {
await MessageBox.confirm(this.$t('event.remove_confirmation'), this.$t('common.confirm'), {
confirmButtonText: this.$t('common.ok'),
cancelButtonText: this.$t('common.cancel'),
type: 'error' })
await this.$axios.delete(`/user/event/${this.event.id}`)
this.delEvent(Number(this.event.id))
this.$router.replace('/')
} catch (e) {
console.error(e)
}
},
async toggle () {
try {
if (this.event.is_visible) {
await this.$axios.$get(`/event/unconfirm/${this.event.id}`)
this.event.is_visible = false
} else {
await this.$axios.$get(`/event/confirm/${this.event.id}`)
this.event.is_visible = true
}
} catch (e) {
console.error(e)
}
}
}
}
</script>
\ No newline at end of file
......@@ -2,7 +2,7 @@ import Vue from 'vue'
import { Button, Select, Tag, Option, Table, FormItem, Card, Row, Col, Upload, Checkbox, RadioButton, RadioGroup,
Form, Tabs, TabPane, Switch, Input, Loading, TimeSelect, Badge, ButtonGroup, Divider, Step, Steps, Radio, Main,
TableColumn, ColorPicker, Pagination, Popover, Tooltip, Dialog, Image, Backtop, Collapse, CollapseItem, Link,
Dropdown, DropdownMenu, DropdownItem, Submenu, PageHeader, Header,
Dropdown, DropdownMenu, DropdownItem, Submenu, PageHeader, Header, Icon,
Container, Footer, Timeline, TimelineItem, Menu, MenuItem } from 'element-ui'
import locale from 'element-ui/lib/locale'
......@@ -15,6 +15,7 @@ const locales = {
export default ({ app, store }) => {
locale.use(locales[store.state.locale])
Vue.use(Button)
Vue.use(Icon)
Vue.use(Dropdown)
Vue.use(Header)
Vue.use(PageHeader)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment