diff --git a/nezha-fronted/src/components/page/config/setup.vue b/nezha-fronted/src/components/page/config/setup.vue index 421a9263e..483ca23f7 100644 --- a/nezha-fronted/src/components/page/config/setup.vue +++ b/nezha-fronted/src/components/page/config/setup.vue @@ -31,7 +31,6 @@ - @@ -116,29 +115,6 @@ - - - - - - - - - - - - - - - {{ $t("setup.redis.configTitle") }} - - - {{ $t("setup.redis.configTip") }} - - - - - @@ -169,10 +145,10 @@ {{$t('overall.back')}} - + {{$t('setup.next')}} - + {{$t('setup.finish')}} @@ -216,22 +192,6 @@ export default { username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] }, - redis: { - host: '', - port: 6379, - pin: '' - }, - redisRules: { - host: [ - { - required: true, - message: this.$t('validate.required'), - trigger: 'blur' - }, - { validator: host, trigger: 'blur' } - ], - port: [{ validator: port, trigger: 'blur' }] - }, system: { username: '', pin: '', @@ -328,68 +288,33 @@ export default { } break case 3: - if (this.prevent_next) { return } - this.prevent_next = true - if (this.activeStep > 3) { - this.activeStep = 3 - this.prevent_next = false - } else { - this.$refs['redis-form'].validate((valid) => { - if (valid) { - this.getValidateCode() - this.$post('setup/checkRedis', { redis: this.redis, code: this.validateCode }).then(response => { - if (response.code == 200) { - this.activeStep = 3 - this.step = 3 - } else { - this.activeStep = 2 - this.step = 2 - if (response.code == 574004) { // 密码无效 - this.$alert(this.$t('setup.invalidPin'), { type: 'warning' }) - } else if (response.code == 574005) { - this.$alert(this.$t('setup.requirePin'), { type: 'warning' }) - } else if (response.code == 574002) { - this.$alert(this.$t('setup.invalidCode', { page: this.$t('setup.welcomePage') }), { type: 'warning' }) - } else { - this.$alert(this.$t('setup.invalidRedis'), { type: 'warning' }) - } - } - this.prevent_next = false - }) - } else { - this.prevent_next = false - } - }) - } - break - case 4: if (this.prevent_finish) { return } - this.prevent_next = true + this.prevent_finish = true this.$refs['sys-form'].validate((valid) => { if (valid) { this.getValidateCode() const params = { database: this.database, - redis: this.redis, system: this.system, code: this.validateCode } this.$post('setup/config', params).then(response => { if (response.code == 200) { - this.activeStep = 3 - this.step = 4 + this.activeStep = 2 + this.step = 3 this.$alert(this.$t('setup.wait'), { type: 'success' }) this.reloadTimeout = setTimeout(this.jumpToLogin, this.reloadTime) } else { - this.activeStep = 3 - this.step = 3 + this.activeStep = 2 + this.step = 2 if (response.code == 574002) { this.$alert(this.$t('setup.invalidCode', { page: this.$t('setup.welcomePage') }), { type: 'warning' }) } } + this.prevent_finish = false }) } else { - this.prevent_next = false + this.prevent_finish = false } }) break @@ -420,7 +345,7 @@ export default { this.changeStep(this.activeStep - 1) }, finishStep: function () { - this.changeStep(4) + this.changeStep(3) }, getValidateCode: function () { const saveValidateCodeFunc = function (validateCode) { @@ -465,17 +390,6 @@ export default { username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }] } - this.redisRules = { - host: [ - { - required: true, - message: this.$t('validate.required'), - trigger: 'blur' - }, - { validator: host, trigger: 'blur' } - ], - port: [{ validator: port, trigger: 'blur' }] - } this.sysRules = { username: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }], pin: [{ required: true, message: this.$t('validate.required'), trigger: 'blur' }],