ok, ora sistemare SignUp

This commit is contained in:
paolo
2018-11-06 00:21:22 +01:00
parent 03d57ba50e
commit 7c1d07797e
8 changed files with 90 additions and 72 deletions

View File

@@ -44,15 +44,15 @@
"vuex-module-decorators": "^0.4.3" "vuex-module-decorators": "^0.4.3"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-transform-runtime": "^7.1.0", "@babel/plugin-transform-runtime": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"@types/dotenv": "^4.0.3", "@types/dotenv": "^4.0.3",
"@types/jest": "^23.1.4",
"@types/js-cookie": "^2.1.0", "@types/js-cookie": "^2.1.0",
"@types/node": "^10.12.2",
"@types/nprogress": "^0.0.29", "@types/nprogress": "^0.0.29",
"@types/webpack-env": "^1.13.6", "@types/webpack-env": "^1.13.6",
"@babel/core": "^7.1.2",
"@babel/preset-env": "^7.1.0",
"@types/jest": "^23.1.4",
"@types/node": "^10.12.2",
"@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-babel": "^3.0.1",
"@vue/cli-plugin-e2e-cypress": "^3.0.1", "@vue/cli-plugin-e2e-cypress": "^3.0.1",
"@vue/cli-plugin-pwa": "^3.0.1", "@vue/cli-plugin-pwa": "^3.0.1",
@@ -63,9 +63,9 @@
"babel-core": "7.0.0-bridge.0", "babel-core": "7.0.0-bridge.0",
"babel-loader": "^8.0.4", "babel-loader": "^8.0.4",
"eslint": "^5.5.0", "eslint": "^5.5.0",
"jest": "^23.6.0",
"html-webpack-plugin": "^2.8.1", "html-webpack-plugin": "^2.8.1",
"http-proxy-middleware": "^0.17.0", "http-proxy-middleware": "^0.17.0",
"jest": "^23.6.0",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"node-sass": "^4.9.0", "node-sass": "^4.9.0",
"quasar-cli": "^0.17.20", "quasar-cli": "^0.17.20",
@@ -74,11 +74,12 @@
"ts-jest": "^23.0.0", "ts-jest": "^23.0.0",
"ts-loader": "^5.3.0", "ts-loader": "^5.3.0",
"tslint": "^5.11.0", "tslint": "^5.11.0",
"tslint-loader": "^3.4.3",
"tslint-config-standard": "^8.0.1", "tslint-config-standard": "^8.0.1",
"tslint-loader": "^3.4.3",
"typescript": "^3.1.6", "typescript": "^3.1.6",
"vue-cli-plugin-element-ui": "^1.1.2", "vue-cli-plugin-element-ui": "^1.1.2",
"vue-template-compiler": "^2.5.17", "vue-template-compiler": "^2.5.17",
"vueify": "^9.4.1",
"webpack": "^2.2.1", "webpack": "^2.2.1",
"webpack-dev-middleware": "^1.8.4", "webpack-dev-middleware": "^1.8.4",
"webpack-hot-middleware": "^2.18.1", "webpack-hot-middleware": "^2.18.1",

View File

@@ -49,49 +49,61 @@
</div> </div>
</template> </template>
<script lang="ts"> <script>
import { Component, Vue, Watch } from 'vue-property-decorator' import {openURL} from 'quasar';
import { UserModule } from '../store/modules/user' import {Quasar} from 'quasar';
import drawer from '../layouts/drawer/drawer.vue' import drawer from '../layouts/drawer/drawer.vue'
import messagePopover from '../layouts/toolbar/messagePopover.vue' import messagePopover from '../layouts/toolbar/messagePopover.vue'
@Component({ // import user from '../store/modules/user';
import * as types from '../store/mutation-types'
export default {
components: { components: {
drawer, drawer,
messagePopover, messagePopover,
}, },
}) created() {
export default class Header extends Vue { //this.$store.dispatch('initStocks');
prova = 'AA' },
selectOpLang = [ methods: {
{ label: 'Italian', icon: 'fa-facebook', value: 'it' }, openURL,
{ label: 'English (US)', icon: 'fa-flag-us', value: 'en-us' }, },
{ label: 'Spanish', icon: 'fa-flag-es', value: 'es' }, data: function () {
{ label: 'German', icon: 'fa-flag-de', value: 'de' } return {
] prova: 'AA',
lang = this.$q.i18n.lang selectOpLang: [
leftDrawerOpen = this.$q.platform.is.desktop {label: 'Italian', icon: 'fa-facebook', value: 'it'},
{label: 'English (US)', icon: 'fa-flag-us', value: 'en-us'},
{label: 'Spanish', icon: 'fa-flag-es', value: 'es'},
{label: 'German', icon: 'fa-flag-de', value: 'de'}
],
lang: this.$q.i18n.lang,
leftDrawerOpen: this.$q.platform.is.desktop
}
},
watch: {
lang(lang) {
this.$i18n.locale = snakeToCamel(lang);
console.log("LANG LOCALE = " + this.$i18n.locale);
@Watch('lang') // dynamic import, so loading on demand only
lang(lang: string) { import(`quasar-framework/i18n/${lang}`).then(lang => {
this.$i18n.locale = snakeToCamel(lang) //console.log("lang prima = " + this.$q.i18n.lang);
console.log("LANG LOCALE = " + this.$i18n.locale) this.$q.i18n.set(lang.default);
var mylang = this.$q.i18n.lang;
console.log("lang = " + this.$q.i18n.lang);
//console.log("lang DOPO = " + this.$q.i18n.lang);
import(`src/i18n`).then(function () {
// dynamic import, so loading on demand only });
import(`quasar-framework/i18n/${lang}`).then(lang => { });
//console.log("lang prima = " + this.$q.i18n.lang);
this.$q.i18n.set(lang.default)
var mylang = this.$q.i18n.lang
console.log("lang = " + this.$q.i18n.lang)
//console.log("lang DOPO = " + this.$q.i18n.lang);
import(`src/i18n`).then(function () {
}) // dynamic import, so loading on demand only
}) }
// dynamic import, so loading on demand only
} }
} }

View File

@@ -1,10 +1,10 @@
export default { export default {
i18n: { i18n: {
languages: [ languages: [
{ code: 'en-us', name: 'English', active: true }, { code: 'it', name: 'Italiano', active: true },
{ code: 'fr', name: 'Français', active: true } { code: 'en-us', name: 'English', active: true }
], ],
default: 'en-us', default: 'it',
fallbackTo: 'en-us' fallbackTo: 'it'
} }
} }

7
src/i18n/it/index.ts Normal file
View File

@@ -0,0 +1,7 @@
export default {
msg: {
hello: 'Buongiorno',
myAppName: 'FreePlanet',
myDescriz: 'La prima App Libera e per Tutti'
}
}

View File

@@ -69,7 +69,7 @@
set conta(valore) { set conta(valore) {
GlobModule.setConta(valore) GlobModule.setConta(valore)
var my = process.env.LANG_DEFAULT; var my = this.$q.i18n.lang;
this.showNotification(String(my)); this.showNotification(String(my));
} }

View File

@@ -448,7 +448,7 @@ class User extends VuexModule implements IUserState { // Non occorrono i gette
}) })
} }
@Action({ commit: types.USER_AUTOLOGIN }) @Mutation
autologin () { autologin () {
const token = localStorage.getItem('token') const token = localStorage.getItem('token')
if (!token) { if (!token) {

View File

@@ -1,24 +1,24 @@
export const SET_VALUE = 'SET_VALUE'; export const SET_VALUE = 'SET_VALUE'
export const SET_DEFFERED_PROMPT = 'defprompt'; export const SET_DEFFERED_PROMPT = 'defprompt'
export const SET_LOGIN_PAGE = 'setloginpage'; export const SET_LOGIN_PAGE = 'setloginpage'
export const SET_LAYOUT_NEEDED = 'setlayneeded'; export const SET_LAYOUT_NEEDED = 'setlayneeded'
export const SET_MOBILE_MODE = 'setmobilemode'; export const SET_MOBILE_MODE = 'setmobilemode'
export const SET_MENU_COLLAPSED = 'setmenucoll'; export const SET_MENU_COLLAPSED = 'setmenucoll'
export const SET_POSTS = 'setposts'; export const SET_POSTS = 'setposts'
export const SET_FORM_SIGNUP = 'formsignup'; export const SET_FORM_SIGNUP = 'formsignup'
// USER: // USER:
export const USER_REC = 'user_rec'; export const USER_REC = 'user_rec'
export const USER_USERNAME = 'username'; export const USER_USERNAME = 'username'
export const USER_EMAIL = 'email'; export const USER_EMAIL = 'email'
export const USER_LANG = 'lang'; export const USER_LANG = 'lang'
export const USER_PASSWORD = 'password'; export const USER_PASSWORD = 'password'
export const USER_DATEOFBIRTH = 'dateofbirth'; export const USER_DATEOFBIRTH = 'dateofbirth'
export const USER_SIGNUP = 'signup'; export const USER_SIGNUP = 'signup'
export const USER_SIGNIN = 'signin'; export const USER_SIGNIN = 'signin'
export const USER_AUTOLOGIN = 'autologin'; export const USER_AUTOLOGIN = 'autologin'
export const USER_LOGOUT = 'logout'; export const USER_LOGOUT = 'logout'
export const USER_VREG = 'vreg'; export const USER_VREG = 'vreg'
export const USER_REQUESTRESETPWD = 'requestpwd'; export const USER_REQUESTRESETPWD = 'requestpwd'
export const USER_UPDATEPWD = 'resetpwd'; export const USER_UPDATEPWD = 'resetpwd'

View File

@@ -94,10 +94,9 @@
</template> </template>
<script type="ts"> <script type="ts">
import Vue from 'vue' import { Component, Vue, Prop } from 'vue-property-decorator'
import { Component, Prop } from 'vue-property-decorator'
import { UserModule } from '../../store/modules/user' import { UserModule } from '../../store/modules/user'
import { IUserState } from "../../types"; //import { IUserState } from "../../types";
import {ErroriMongoDb} from '../../store/modules/user' import {ErroriMongoDb} from '../../store/modules/user'
/* /*
@@ -114,11 +113,10 @@
//import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar' //import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
@Component({}) @Component({})
export default class Signup extends Vue { export default class Signup extends Vue {
accountId: number = 0 duplicate_email = false
duplicate_email: boolean = false duplicate_username = false
duplicate_username: boolean = false user = {
user: IUserState = {
email: process.env.TEST_EMAIL, email: process.env.TEST_EMAIL,
username: process.env.TEST_USERNAME, username: process.env.TEST_USERNAME,
password: process.env.TEST_PASSWORD, password: process.env.TEST_PASSWORD,