Update Installation.vue

pull/3445/head
ruibaby 2019-06-01 16:54:24 +08:00
parent ba5ed25558
commit 16b668cb61
1 changed files with 41 additions and 2 deletions

View File

@ -32,11 +32,16 @@
<a-form <a-form
layout="horizontal" layout="horizontal"
v-show="stepCurrent == 0" v-show="stepCurrent == 0"
:form="bloggerForm"
> >
<a-form-item class="animated fadeInUp"> <a-form-item class="animated fadeInUp">
<a-input <a-input
v-model="installation.username" v-model="installation.username"
placeholder="用户名" placeholder="用户名"
v-decorator="[
'username',
{rules: [{ required: true, message: '请输入用户名' }]}
]"
> >
<a-icon <a-icon
slot="prefix" slot="prefix"
@ -67,6 +72,10 @@
<a-input <a-input
v-model="installation.email" v-model="installation.email"
placeholder="用户邮箱" placeholder="用户邮箱"
v-decorator="[
'email',
{rules: [{ required: true, message: '请输入邮箱' }]}
]"
> >
<a-icon <a-icon
slot="prefix" slot="prefix"
@ -83,6 +92,10 @@
v-model="installation.password" v-model="installation.password"
type="password" type="password"
placeholder="用户密码" placeholder="用户密码"
v-decorator="[
'password',
{rules: [{ required: true, message: '请输入密码' }]}
]"
> >
<a-icon <a-icon
slot="prefix" slot="prefix"
@ -99,6 +112,10 @@
v-model="installation.confirmPassword" v-model="installation.confirmPassword"
type="password" type="password"
placeholder="确定密码" placeholder="确定密码"
v-decorator="[
'confirmPassword',
{rules: [{ required: true, message: '请输入密码' }]}
]"
> >
<a-icon <a-icon
slot="prefix" slot="prefix"
@ -182,7 +199,7 @@
<a-button <a-button
type="primary" type="primary"
v-if="stepCurrent != 2" v-if="stepCurrent != 2"
@click="stepCurrent++" @click="handleNextStep"
>下一步</a-button> >下一步</a-button>
</div> </div>
<a-button <a-button
@ -201,6 +218,7 @@
<script> <script>
import adminApi from '@/api/admin' import adminApi from '@/api/admin'
import optionApi from '@/api/option'
import recoveryApi from '@/api/recovery' import recoveryApi from '@/api/recovery'
export default { export default {
@ -225,13 +243,34 @@ export default {
installation: {}, installation: {},
migrationUploadName: 'file', migrationUploadName: 'file',
migrationData: null, migrationData: null,
stepCurrent: 0 stepCurrent: 0,
bloggerForm: this.$form.createForm(this),
keys: ['is_installed']
} }
}, },
created() { created() {
this.verifyIsInstall()
this.installation.url = window.location.protocol + '//' + window.location.host this.installation.url = window.location.protocol + '//' + window.location.host
}, },
methods: { methods: {
verifyIsInstall() {
optionApi.listAll(this.keys).then(response => {
if(response.data.data.is_installed){
this.$router.push({ name: 'Login' })
}
})
},
handleNextStep(e) {
e.preventDefault()
this.bloggerForm.validateFields((error, values) => {
console.log('error', error)
console.log('Received values of form: ', values)
if (error != null) {
} else {
this.stepCurrent++
}
})
},
handleMigrationUpload(data) { handleMigrationUpload(data) {
this.$log.debug('Selected data', data) this.$log.debug('Selected data', data)
this.migrationData = data this.migrationData = data