This commit is contained in:
lesion
2019-06-07 17:02:33 +02:00
parent 7455553129
commit c408c44676
40 changed files with 270 additions and 279 deletions

View File

@@ -1,5 +1,9 @@
<template lang="pug">
el-dialog(:title='$t("common.admin")' width='80%' :visible='open' :before-close='close')
el-card(:title='$t("common.admin")' width='80%' :visible='open' :before-close='close')
nuxt-link.float-right(to='/')
v-icon(name='times' color='red')
h5 {{$t('common.admin')}}
el-tabs(tabPosition='left' v-model='tab')
//- USERS
@@ -81,9 +85,18 @@
template(slot='label')
v-icon(name='cog')
span {{$t('common.settings')}}
//- el-form(inline @submit.prevent.stop='save_settings' label-width='140px')
//- p {{$t('settings.name_description')}}
//- el-form-item(:label="$t('settings.name')")
//- el-input(v-model="settings.title")
//- el-form-item(:label="$t('settings.description')")
//- el-input(v-model="settings.description")
//- el-button(slot='append' @click='associate' :disabled='!mastodon_instance.length') {{$t('common.associate')}}
el-form(inline @submit.prevent.stop='associatemastodon_instance')
span {{$t('admin.mastodon_description')}}
el-input(v-model="mastodon_instance")
el-input(v-model="settings.mastodon_instance")
span(slot='prepend') {{$t('admin.mastodon_instance')}}
el-button(slot='append' @click='associate' :disabled='!mastodon_instance.length') {{$t('common.associate')}}
@@ -111,7 +124,9 @@ export default {
tag: {name: '', color: ''},
events: [],
loading: false,
mastodon_instance: '',
settings: {
mastodon_instance: '',
},
settings: {},
tab: "0",
open: true

View File

@@ -11,9 +11,9 @@ export default {
components: { List },
computed: mapState(['config']),
async asyncData ({ $axios, req, res }) {
const title = req.query.title || config.title
const tags = req.query.tags
const places = req.query.places
const title = req && req.query && req.query.title || this.config.title
const tags = req && req.query && req.query.tags
const places = req && req.query && req.query.places
const now = new Date()
let params = []

View File

@@ -2,7 +2,6 @@
#home
Nav
Home
</template>
<script>
@@ -12,22 +11,16 @@ import { mapState } from 'vuex'
export default {
name: 'Index',
async asyncData ({ redirect, store }) {
// console.error('diocane', store.state.settings)
// const firstRun = store.state.settings.firstRun
// if (firstRun!==true) {
// redirect('/firstrun')
// }
},
async fetch ({ store, $axios }) {
const now = new Date()
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
console.error(events)
store.commit('setEvents', events)
const { tags, places } = await $axios.$get('/event/meta')
store.commit('update', { tags, places })
// const settings = await $axios.$get('/settings')
// store.commit('setSettings', settings)
try {
const now = new Date()
const events = await $axios.$get(`/event/${now.getMonth()}/${now.getFullYear()}`)
store.commit('setEvents', events)
const { tags, places } = await $axios.$get('/event/meta')
store.commit('update', { tags, places })
} catch(e) {
console.error(e)
}
},
computed: mapState(['events']),
components: { Nav, Home },

View File

@@ -27,7 +27,6 @@
</template>
<script>
const Cookie = process.client ? require('js-cookie') : undefined
import { mapActions } from 'vuex'
import { Message } from 'element-ui'
import get from 'lodash/get'

View File

@@ -5,26 +5,26 @@
v-icon(name='times' color='red')
h5 {{$t('common.register')}}
el-form(method='POST' action='/api/user')
el-form(@submit.native.prevent='register' method='POST' action='/api/user')
p(v-html="$t('register.description')")
el-input.mb-2(ref='email' v-model='user.email' type='email' required
:placeholder='$t("common.email")' autocomplete='email' name='email')
span(slot='prepend') @
el-input.mb-2(v-model='user.password' type="password" placeholder="Password" name='password')
el-input.mb-2(v-model='user.password' type="password" placeholder="Password" name='password' required)
v-icon(name='lock' slot='prepend')
el-input.mb-2(v-model='user.description' type="textarea" rows='3' :placeholder="$t('common.description')")
v-icon(name='envelope-open-text')
el-button(plain type="success" native-type='submit'
:disabled='disabled'
@click='register') {{$t('common.send')}} <v-icon name='chevron-right'/>
:disabled='disabled') {{$t('common.send')}} <v-icon name='chevron-right'/>
</template>
<script>
import { mapActions } from 'vuex'
import { Message } from 'element-ui'
import get from 'lodash/get'
export default {
name: 'Register',
@@ -44,14 +44,14 @@ export default {
...mapActions(['login']),
async register () {
try {
const user = await this.$axios.$post('/user', this.user)
const { user } = await this.$axios.$post('/user', this.user)
Message({
message: this.$t(`register.${user.is_admin && 'admin_'}complete`),
message: this.$t(`register.${user.is_admin ? 'admin_' : ''}complete`),
type: 'success'
})
this.$router.replace("/")
} catch (e) {
const error = e && e.response && e.response.data && e.response.data.errors[0].message || e
const error = get(e, 'e.response.data.errors[0].message', String(e))
Message({
message: this.$t('register.error') + this.$t(error),
type: 'error'

View File

@@ -1,5 +1,9 @@
<template lang="pug">
el-dialog(:title="$t('common.settings')" :before-close='close' visible)
el-card
nuxt-link.float-right(to='/')
v-icon(name='times' color='red')
h5 {{$t('common.settings')}}
//- el-form
//- el-form-item {{$t('settings.change_password')}}
el-divider {{$t('settings.change_password')}}
@@ -23,11 +27,11 @@ export default {
methods: {
async change () {
if (!this.password) return
const user = this.user
user.password = this.password
// this.$auth.user.password = this.password
const user_data = { id : this.$auth.user.id, password: this.password }
try {
// this.$axios.
// await api.updateUser(user)
const user = await this.$axios.$put('/user', user_data)
console.error(user)
} catch (e) {
console.log(e)
}