Commit d173b078 authored by gick's avatar gick
Browse files

setting menu

parent 54dffc7d
......@@ -53,7 +53,7 @@
<v-ons-list-item>
<div class="center">{{ $t('gamificationMode') }}</div>
<div class="right">
<v-ons-switch v-model="$store.state.user.gamificationMode"></v-ons-switch>
<v-ons-switch v-model="gamificationMode"></v-ons-switch>
</div>
</v-ons-list-item>
<v-ons-list-item>
......@@ -185,6 +185,15 @@ export default {
scores() {
return this.$store.state.user.scores;
},
gamificationMode:{
get(){
return this.$store.state.user.gamificationMode
},
set(val){
this.$store.commit("user/setGamificationMode", val);
}
},
identificationMode: {
get() {
return this.$store.state.commonData.identification;
......@@ -277,11 +286,6 @@ export default {
},
loadUserData() {
axios.get("/api/verification").then(
function(response) {
this.verificationsByUser = this.formatResult(response.data);
}.bind(this)
);
axios.get("/api/identification").then(
function(response) {
this.identificationByUser = this.formatResult(response.data);
......
......@@ -159,6 +159,7 @@ export default {
},
'uid':{
handler(){
this.$store.commit('user/setGamificationMode',this.backup.gamificationMode)
if(this.backup && this.backup.mission){
this.$store.commit('user/restoreBackup')
if(this.backup.time && this.backup.time.duration>0){
......
......@@ -14,6 +14,7 @@
<div class="center">{{ item.title }}</div>
</v-ons-list-item>
<v-ons-list-item @click="logout">{{ $t('logout') }}</v-ons-list-item>
<v-ons-list-item @click="settings">Settings</v-ons-list-item>
<v-ons-list-item @click="admin">Admin</v-ons-list-item>
<v-ons-list-item>{{ $t('language') }} &nbsp;
<select v-model="$i18n.locale">
......@@ -28,6 +29,8 @@
<script>
import Admin from "./Admin.vue";
import Settings from "./Settings.vue";
export default {
methods: {
loadView(index) {
......@@ -41,6 +44,20 @@ export default {
this.$store.dispatch("user/logout");
window.location.reload()
},
settings(){
this.$store.commit("navigator/push", {
extends: Settings,
data() {
return {
toolbarInfo: {
backLabel: "Home",
title: "key"
}
};
}
});
},
admin() {
if(this.isAdmin){
this.$store.commit("navigator/push", {
......
<template>
<v-ons-page>
<custom-toolbar backLabel="Retour"></custom-toolbar>
<div class="content">
<v-ons-list>
<v-ons-list-title>Settings</v-ons-list-title>
<v-ons-list-item>
<div class="center">Groupe test</div>
<div class="right">
<v-ons-switch v-model="gamificationMode"></v-ons-switch>
</div>
</v-ons-list-item>
</v-ons-list>
<v-ons-list>
<v-ons-list-title>{{ $t('usersConnected') }}</v-ons-list-title>
<v-ons-list-item v-for="(user,index) in userList" v-bind:key="index">
<div class="center">{{user.info.name}}</div>
</v-ons-list-item>
</v-ons-list>
</div>
</v-ons-page>
</template>
<style>
</style>
<script>
export default {
data() {
return {};
},
computed: {
userList() {
return this.$store.state.users.userList;
},
gamificationMode: {
get() {
return this.$store.state.user.gamificationMode;
},
set(val) {
this.$store.commit("user/setGamificationMode", val);
}
}
}
};
</script>
......@@ -5,6 +5,10 @@ let restoreSession=(oldState,state)=>{
delete oldState._id
delete oldState.__v
_.forOwn(oldState,(value,key)=>{
if(key=='gamificationMode'){
state.user[key]=value
}
if(value){
if(!key.includes('_')){ //restoring state/user module
if(key=='actionsTransActivite'){
......@@ -54,7 +58,7 @@ let backupPlugin = store => {
case 'user/setActivityStatus' :
backup('activities',state.user.activities)
break
case 'user/gamificationMode':
case 'user/setGamificationMode':
backup('gamificationMode',state.user.gamificationMode)
break
case 'user/updateProgression':
......
Supports Markdown
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