[mega] settings, timezone

This commit is contained in:
les
2019-10-20 14:22:55 +02:00
parent 4a03d60667
commit 66aa6a8692
24 changed files with 214 additions and 85 deletions

View File

@@ -1,5 +1,5 @@
<template lang="pug">
el-card
el-main
nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
@@ -390,8 +390,8 @@ export default {
formData.append('place_address', this.event.place.address)
formData.append('description', this.event.description)
formData.append('multidate', this.event.type === 'multidate')
formData.append('start_datetime', start_datetime.utc(true).unix())
formData.append('end_datetime', end_datetime.utc(true).unix())
formData.append('start_datetime', start_datetime.unix())
formData.append('end_datetime', end_datetime.unix())
if (this.edit) {
formData.append('id', this.event.id)

View File

@@ -31,7 +31,7 @@
el-table-column(:label='$t("common.name")' width='300')
template(slot-scope='data') {{data.row.title}}
el-table-column(:label='$t("common.where")' width='250')
template(slot-scope='data') {{dperPageata.row.place.name}}
template(slot-scope='data') {{data.row.place.name}}
el-table-column(:label='$t("common.confirm")' width='250')
template(slot-scope='data')
el-button(type='primary' @click='confirm(data.row.id)' size='mini') {{$t('common.confirm')}}

View File

@@ -7,11 +7,18 @@
<script>
import Home from '~/components/Home.vue'
import Nav from '~/components/Nav.vue'
import moment from 'moment-timezone'
import { mapState } from 'vuex'
export default {
name: 'Index',
computed: mapState(['settings']),
mounted (ctx) {
moment.tz.setDefault(this.settings.instance_timezone)
},
async fetch ({ store, $axios }) {
try {
moment.tz.setDefault(store.state.settings.instance_timezone)
const now = new Date()
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
store.commit('setEvents', events)

View File

@@ -1,5 +1,5 @@
<template lang="pug">
el-card
el-main
nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
h5 {{$t('common.settings')}}

View File

@@ -3,27 +3,52 @@
nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
h5 <img src='/favicon.ico'/> {{$t('confirm.title')}}
p(v-if='valid' v-html='$t("confirm.valid")')
p(v-else) {{$t('confirm.not_valid')}}
h5 <img src='/favicon.ico'/> {{$t('common.set_password')}}
div(v-if='valid')
el-form
el-form-item {{$t('common.new_password')}}
el-input(type='password', v-model='new_password')
el-button(plain type="success" icon='el-icon-send'
:disabled='!new_password' @click='change_password') {{$t('common.send')}}
div(v-else) {{$t('recover.not_valid_code')}}
</template>
<script>
import { Message } from 'element-ui'
export default {
name: 'Confirm',
name: 'Recover',
data () {
return { valid: true }
return { new_password: '' }
},
async asyncData ({ params, $axios }) {
const recover_code = params.code
const code = params.code
try {
const valid = await $axios.$post('/user/check_recover_code', { recover_code })
return { valid }
const valid = await $axios.$post('/user/check_recover_code', { recover_code: code })
return { valid, code }
} catch (e) {
return { valid: false }
}
},
methods: {
async change_password () {
try {
const res = await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
Message({
showClose: true,
type: 'success',
message: this.$t('common.password_updated')
})
this.$router.replace('/login')
} catch (e) {
Message({
showClose: true,
type: 'warning',
message: e
})
}
}
}
}
</script>
</script>

View File

@@ -0,0 +1,53 @@
<template lang="pug">
el-card
nuxt-link.float-right(to='/')
el-button(circle icon='el-icon-close' type='danger' size='small' plain)
h5 <img src='/favicon.ico'/> {{$t('common.set_password')}}
div(v-if='valid')
el-form
el-form-item {{$t('common.new_password')}}
el-input(type='password', v-model='new_password')
el-button(plain type="success" icon='el-icon-send', @click='change_password') {{$t('common.send')}}
div(v-else) {{$t('recover.not_valid_code')}}
</template>
<script>
import { Message } from 'element-ui'
export default {
name: 'Recover',
data () {
return { new_password: '' }
},
async asyncData ({ params, $axios }) {
const code = params.code
try {
const valid = await $axios.$post('/user/check_recover_code', { recover_code: code })
return { valid, code }
} catch (e) {
return { valid: false }
}
},
methods: {
async change_password () {
try {
const res = await this.$axios.$post('/user/recover_password', { recover_code: this.code, password: this.new_password })
Message({
showClose: true,
type: 'success',
message: this.$t('common.password_updated')
})
this.$router.replace('/login')
} catch (e) {
Message({
showClose: true,
type: 'warning',
message: e
})
}
}
}
}
</script>