Creazione Sito Web da pagina
This commit is contained in:
1
src/views/admin/install_site/index.ts
Executable file
1
src/views/admin/install_site/index.ts
Executable file
@@ -0,0 +1 @@
|
||||
export {default as cfgServer} from './install_site.vue'
|
||||
30
src/views/admin/install_site/install_site-validate.ts
Executable file
30
src/views/admin/install_site/install_site-validate.ts
Executable file
@@ -0,0 +1,30 @@
|
||||
import { ISignupOptions } from 'model'
|
||||
import { email, minLength, required, sameAs } from '@vuelidate/validators'
|
||||
// import { ValidationRuleset } from 'vuelidate'
|
||||
import { complexity, complexityUser, registeredemail, registereduser, aportadorexist } from '../../../validation'
|
||||
|
||||
export const validations = {
|
||||
email: {
|
||||
email,
|
||||
required
|
||||
},
|
||||
name: {
|
||||
required,
|
||||
},
|
||||
host: {
|
||||
required,
|
||||
},
|
||||
code: {
|
||||
required,
|
||||
},
|
||||
password: {
|
||||
required,
|
||||
minLength: minLength(8),
|
||||
complexity,
|
||||
},
|
||||
username: {
|
||||
required,
|
||||
minLength: minLength(8),
|
||||
complexityUser,
|
||||
},
|
||||
}
|
||||
0
src/views/admin/install_site/install_site.scss
Executable file
0
src/views/admin/install_site/install_site.scss
Executable file
88
src/views/admin/install_site/install_site.ts
Executable file
88
src/views/admin/install_site/install_site.ts
Executable file
@@ -0,0 +1,88 @@
|
||||
import { defineComponent, reactive, ref, watch } from 'vue'
|
||||
|
||||
import { serv_constants } from '@store/Modules/serv_constants'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { useI18n } from '@/boot/i18n'
|
||||
import { useGlobalStore } from '@store/globalStore'
|
||||
import { useUserStore } from '@store/UserStore'
|
||||
import { useRouter } from 'vue-router'
|
||||
import useVuelidate from '@vuelidate/core'
|
||||
import { validations } from '@src/views/admin/install_site/install_site-validate'
|
||||
import { tools } from '@store/Modules/tools'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'install_site',
|
||||
setup() {
|
||||
const $q = useQuasar()
|
||||
const { t } = useI18n()
|
||||
const userStore = useUserStore()
|
||||
const globalStore = useGlobalStore()
|
||||
const $router = useRouter()
|
||||
|
||||
const emailsent = ref(false)
|
||||
|
||||
const form = reactive({
|
||||
idappSent: '',
|
||||
email: '',
|
||||
name: '',
|
||||
host: '',
|
||||
code: '',
|
||||
username: '',
|
||||
password: '',
|
||||
|
||||
})
|
||||
|
||||
const emailRef = ref(null)
|
||||
const idapp = ref('')
|
||||
|
||||
const v$ = useVuelidate(validations, form)
|
||||
|
||||
function submit() {
|
||||
console.log('submit')
|
||||
|
||||
// @ts-ignore
|
||||
emailRef.value!.validate()
|
||||
|
||||
// @ts-ignore
|
||||
if (emailRef.value!.hasError) {
|
||||
// form has error
|
||||
tools.showNotif($q, t('reg.err.errore_generico'))
|
||||
return
|
||||
}
|
||||
|
||||
$q.loading.show({ message: t('reset.incorso') })
|
||||
|
||||
userStore.addNewSite({...form})
|
||||
.then((ris: any) => {
|
||||
if (ris.code === serv_constants.RIS_CODE_OK) {
|
||||
emailsent.value = true
|
||||
idapp.value = ris.idapp
|
||||
tools.showPositiveNotif($q, t('install.created', {idapp: ris.idapp}))
|
||||
form.password = ''
|
||||
} else
|
||||
tools.showNegativeNotif($q, t('reg.err.site_not_created'))
|
||||
$q.loading.hide()
|
||||
}).catch((err: any) => {
|
||||
console.log('ERROR = ' + err.error)
|
||||
$q.loading.hide()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function emailinviata() {
|
||||
return emailsent.value
|
||||
}
|
||||
|
||||
return {
|
||||
globalStore,
|
||||
submit,
|
||||
tools,
|
||||
form,
|
||||
v$,
|
||||
emailsent,
|
||||
emailinviata,
|
||||
emailRef,
|
||||
idapp,
|
||||
}
|
||||
},
|
||||
})
|
||||
143
src/views/admin/install_site/install_site.vue
Executable file
143
src/views/admin/install_site/install_site.vue
Executable file
@@ -0,0 +1,143 @@
|
||||
<template>
|
||||
<q-page>
|
||||
<q-banner rounded class="bg-primary text-white" style="text-align: center">
|
||||
<span class="mybanner">{{ $t('install.Installazione_Sito') }}</span>
|
||||
</q-banner>
|
||||
|
||||
<q-banner
|
||||
v-if="idapp"
|
||||
rounded
|
||||
class="bg-positive text-white"
|
||||
style="text-align: center"
|
||||
>
|
||||
<div>
|
||||
ID APP ASSEGNATA {{ idapp }} !
|
||||
</div>
|
||||
</q-banner>
|
||||
|
||||
<form
|
||||
@submit.prevent.stop="submit"
|
||||
class="row justify-center text-center padding"
|
||||
>
|
||||
<div class="q-gutter-sm q-ma-sm">
|
||||
<div>
|
||||
<q-banner
|
||||
rounded
|
||||
class="bg-primary text-white"
|
||||
style="text-align: center"
|
||||
>
|
||||
<span class="mybanner">{{ $t('install.title_inst') }}</span>
|
||||
</q-banner>
|
||||
<br />
|
||||
|
||||
<q-input
|
||||
ref="emailRef"
|
||||
v-model="form.email"
|
||||
rounded
|
||||
outlined
|
||||
autocomplete="email"
|
||||
maxlength="50"
|
||||
debounce="1000"
|
||||
:error="v$.email.$error"
|
||||
:error-message="tools.errorMsg('email', v$.email)"
|
||||
:label="$t('reg.email')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="email" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.idappSent"
|
||||
rounded
|
||||
outlined
|
||||
maxlength="50"
|
||||
:label="$t('install.idapp')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-home" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.name"
|
||||
rounded
|
||||
outlined
|
||||
maxlength="50"
|
||||
:label="$t('install.name')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-home" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.username"
|
||||
rounded
|
||||
outlined
|
||||
maxlength="50"
|
||||
:label="$t('install.username')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-user" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.password"
|
||||
rounded
|
||||
outlined
|
||||
maxlength="50"
|
||||
:label="$t('install.password')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-key" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.host"
|
||||
rounded
|
||||
outlined
|
||||
:label="$t('install.domain')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-home" />
|
||||
</template>
|
||||
</q-input>
|
||||
<br />
|
||||
<q-input
|
||||
v-model="form.code"
|
||||
rounded
|
||||
outlined
|
||||
maxlength="50"
|
||||
:label="$t('install.code')"
|
||||
>
|
||||
<template v-slot:prepend>
|
||||
<q-icon name="fas fa-key" />
|
||||
</template>
|
||||
</q-input>
|
||||
|
||||
<br />
|
||||
|
||||
<div class="center q-ma-sm">
|
||||
<q-btn
|
||||
rounded
|
||||
size="lg"
|
||||
color="primary"
|
||||
type="submit"
|
||||
:disable="v$.$error || v$.$invalid"
|
||||
>{{ $t('install.submit') }}
|
||||
</q-btn>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</q-page>
|
||||
</template>
|
||||
<script lang="ts" src="./install_site.ts">
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import './install_site';
|
||||
</style>
|
||||
Reference in New Issue
Block a user