corretto altro ts...
ora manca ancora il vuelidate
This commit is contained in:
@@ -58,7 +58,6 @@
|
||||
import { mapActions } from 'vuex'
|
||||
import * as types from '../../../store/mutation-types'
|
||||
export default {
|
||||
name: 'Home',
|
||||
mounted () {
|
||||
// Axios.all not working
|
||||
},
|
||||
|
||||
@@ -62,10 +62,10 @@
|
||||
} from 'vuelidate/lib/validators'
|
||||
|
||||
import {mapGetters, mapActions} from 'vuex'
|
||||
import * as types from '../../../store/mutation-types'
|
||||
import * as types from '../../store/mutation-types'
|
||||
|
||||
//import {ErroriMongoDb} from '../../store/modules/user'
|
||||
import {serv_constants} from "../../../store/modules/serv_constants";
|
||||
import {serv_constants} from "../../store/modules/serv_constants";
|
||||
import axios from 'axios';
|
||||
|
||||
import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
||||
@@ -1,100 +0,0 @@
|
||||
<div>
|
||||
<q-page padding class="signup">
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<!--<img src="../../../assets/quasar-logo-full.svg">-->
|
||||
<img :src="`../../../assets/`+`${env('LOGO_REG')}`">
|
||||
</p>
|
||||
</div>
|
||||
|
||||
PROVAA
|
||||
|
||||
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
|
||||
<!--
|
||||
|
||||
<q-field
|
||||
:error="v.user.email.error"
|
||||
error-label="{{ errors.first('email') }}"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.email"
|
||||
v-validate="'required|email|truthy'"
|
||||
:value="user.email"
|
||||
@change="val => { user.email = val }"
|
||||
:before="[{icon: 'mail', handler () {}}]"
|
||||
@blur="v.user.email.touch"
|
||||
:error="v.user.email.error"
|
||||
:float-label="$t('reg.email')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.username.$error"
|
||||
:error-label="`${errorMsg('username', v.user.username)}`"
|
||||
>
|
||||
<q-input
|
||||
:value="user.username"
|
||||
@change="val => { user.username = val }"
|
||||
:before="[{icon: 'person', handler () {}}]"
|
||||
@blur="v.user.username.$touch"
|
||||
:error="v.user.username.$error"
|
||||
:float-label="$t('reg.username')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.password.$error"
|
||||
:error-label="`${errorMsg('password', v.user.password)}`"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.password"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
@blur="v.user.password.$touch"
|
||||
:error="v.user.password.$error"
|
||||
:float-label="$t('reg.password')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.repeatPassword.$error"
|
||||
:error-label="`${errorMsg('repeatpassword', v.user.repeatPassword)}`"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.repeatPassword"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
@blur="v.user.repeatPassword.$touch"
|
||||
:error="v.user.repeatPassword.$error"
|
||||
:float-label="$t('reg.repeatPassword')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.terms.$error"
|
||||
:error-label="`${errorMsg('terms', v.user.terms)}`"
|
||||
>
|
||||
|
||||
<q-checkbox
|
||||
v-model="user.terms"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
color="secondary"
|
||||
@blur="v.user.terms.$touch"
|
||||
:error="v.user.terms.$error"
|
||||
:float-label="$t('reg.terms')"
|
||||
:label="$t('reg.terms')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
-->
|
||||
|
||||
<br>
|
||||
|
||||
<!--
|
||||
<div align="center">
|
||||
<q-btn rounded size="lg" color="primary" @click="submit" :disable="">{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
</q-page>
|
||||
</div>
|
||||
@@ -6,20 +6,18 @@ import { validationMixin } from 'vuelidate'
|
||||
import { required, minValue } from 'vuelidate/lib/validators'
|
||||
import { ISignupOptions, IUserState } from '@/model'
|
||||
import { validations, TSignup } from './signup-validate'
|
||||
// import './signup.scss'
|
||||
|
||||
import './signup.scss'
|
||||
|
||||
// import {Loading, QSpinnerFacebook, QSpinnerGears} from 'quasar'
|
||||
|
||||
@Component({
|
||||
mixins: [validationMixin],
|
||||
name: 'Signup',
|
||||
// template: require('./signup.html'),
|
||||
validations: validations
|
||||
})
|
||||
|
||||
export default class Signup extends Vue {
|
||||
myProperty: string = ''
|
||||
|
||||
duplicate_email: boolean = false
|
||||
duplicate_username: boolean = false
|
||||
user: ISignupOptions = {
|
||||
@@ -31,6 +29,7 @@ export default class Signup extends Vue {
|
||||
terms = true
|
||||
|
||||
$v: any
|
||||
$t: any
|
||||
|
||||
constructor() {
|
||||
super()
|
||||
@@ -96,8 +95,7 @@ export default class Signup extends Vue {
|
||||
this.$q.notify(msg)
|
||||
}
|
||||
|
||||
/*
|
||||
errorMsg(cosa: string, item: string) {
|
||||
errorMsg(cosa: string, item: any) {
|
||||
try {
|
||||
if (!item.$error) return ''
|
||||
if (item.$params.email && !item.email) return this.$t('reg.err.email')
|
||||
@@ -109,11 +107,11 @@ export default class Signup extends Vue {
|
||||
}
|
||||
|
||||
if (cosa === 'email') {
|
||||
//console.log("EMAIL " + item.isUnique);
|
||||
//console.log(item);
|
||||
// console.log("EMAIL " + item.isUnique);
|
||||
// console.log(item);
|
||||
if (!item.isUnique) return this.$t('reg.err.duplicate_email')
|
||||
} else if (cosa === 'username') {
|
||||
//console.log(item);
|
||||
// console.log(item);
|
||||
if (!item.isUnique) return this.$t('reg.err.duplicate_username')
|
||||
}
|
||||
|
||||
@@ -122,12 +120,12 @@ export default class Signup extends Vue {
|
||||
if (!item.maxLength) return this.$t('reg.err.notmore') + ` ${item.$params.maxLength.max} ` + this.$t('reg.err.char')
|
||||
return ''
|
||||
} catch (error) {
|
||||
//console.log("ERR : " + error);
|
||||
// console.log("ERR : " + error);
|
||||
}
|
||||
}
|
||||
|
||||
checkErrors(riscode) {
|
||||
//console.log("RIS = " + riscode);
|
||||
checkErrors(riscode: number) {
|
||||
// console.log("RIS = " + riscode);
|
||||
if (riscode === ErroriMongoDb.DUPLICATE_EMAIL_ID) {
|
||||
this.showNotif(this.$t('reg.err.duplicate_email'))
|
||||
} else if (riscode === ErroriMongoDb.DUPLICATE_USERNAME_ID) {
|
||||
@@ -135,10 +133,11 @@ export default class Signup extends Vue {
|
||||
} else if (riscode === ErroriMongoDb.OK) {
|
||||
this.$router.push('/')
|
||||
} else {
|
||||
this.showNotif("Errore num " + riscode)
|
||||
this.showNotif('Errore num ' + riscode)
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
|
||||
|
||||
submit() {
|
||||
|
||||
@@ -1,8 +1,103 @@
|
||||
<template src="./signup.html">
|
||||
<template >
|
||||
<q-page padding class="signup">
|
||||
<div class="text-center">
|
||||
<p>
|
||||
<!--<img src="../../../assets/quasar-logo-full.svg">-->
|
||||
<img :src="`../../../assets/`+`${env('LOGO_REG')}`">
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<!--Prova URL : {{env('PROVA_PAOLO')}}-->
|
||||
|
||||
<q-field
|
||||
:error="$v.user.email.$error"
|
||||
error-label="`${errorMsg('username', $v.user.username)}`"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.email"
|
||||
v-validate="'required|email|truthy'"
|
||||
:value="user.email"
|
||||
@change="val => { user.email = val }"
|
||||
:before="[{icon: 'mail', handler () {}}]"
|
||||
@blur="$v.user.email.touch"
|
||||
:error="$v.user.email.$error"
|
||||
:float-label="$t('reg.email')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<!--
|
||||
|
||||
<q-field
|
||||
:error="v.user.username.$error"
|
||||
:error-label="`${errorMsg('username', v.user.username)}`"
|
||||
>
|
||||
<q-input
|
||||
:value="user.username"
|
||||
@change="val => { user.username = val }"
|
||||
:before="[{icon: 'person', handler () {}}]"
|
||||
@blur="v.user.username.$touch"
|
||||
:error="v.user.username.$error"
|
||||
:float-label="$t('reg.username')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.password.$error"
|
||||
:error-label="`${errorMsg('password', v.user.password)}`"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.password"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
@blur="v.user.password.$touch"
|
||||
:error="v.user.password.$error"
|
||||
:float-label="$t('reg.password')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.repeatPassword.$error"
|
||||
:error-label="`${errorMsg('repeatpassword', v.user.repeatPassword)}`"
|
||||
>
|
||||
<q-input
|
||||
v-model="user.repeatPassword"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
@blur="v.user.repeatPassword.$touch"
|
||||
:error="v.user.repeatPassword.$error"
|
||||
:float-label="$t('reg.repeatPassword')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
<q-field
|
||||
:error="v.user.terms.$error"
|
||||
:error-label="`${errorMsg('terms', v.user.terms)}`"
|
||||
>
|
||||
|
||||
<q-checkbox
|
||||
v-model="user.terms"
|
||||
:before="[{icon: 'vpn_key', handler () {}}]"
|
||||
color="secondary"
|
||||
@blur="v.user.terms.$touch"
|
||||
:error="v.user.terms.$error"
|
||||
:float-label="$t('reg.terms')"
|
||||
:label="$t('reg.terms')"
|
||||
/>
|
||||
</q-field>
|
||||
|
||||
-->
|
||||
|
||||
<br>
|
||||
|
||||
<!--
|
||||
<div align="center">
|
||||
<q-btn rounded size="lg" color="primary" @click="submit" :disable="">{{$t('reg.submit')}}
|
||||
</q-btn>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
</q-page>
|
||||
|
||||
</template>
|
||||
|
||||
<script lang='ts' src="signup.ts" >
|
||||
<script lang="ts" src="./signup.ts">
|
||||
</script>
|
||||
|
||||
<style src="signup.scss" lang="scss">
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user