|
|
|
@ -11,11 +11,11 @@
|
|
|
|
|
<a-row>
|
|
|
|
|
<a-col :span="24">
|
|
|
|
|
<router-link :to="{ name: 'ResetPassword' }">
|
|
|
|
|
<a class="tip animated fadeInRight" v-if="resetPasswordButtonVisible" href="javascript:void(0);">
|
|
|
|
|
<a v-if="resetPasswordButtonVisible" class="tip animated fadeInRight" href="javascript:void(0);">
|
|
|
|
|
找回密码
|
|
|
|
|
</a>
|
|
|
|
|
</router-link>
|
|
|
|
|
<a @click="handleToggleShowApiForm" class="tip animated fadeInUp" :style="{ 'animation-delay': '0.4s' }">
|
|
|
|
|
<a :style="{ 'animation-delay': '0.4s' }" class="tip animated fadeInUp" @click="handleToggleShowApiForm">
|
|
|
|
|
<a-icon type="setting" />
|
|
|
|
|
</a>
|
|
|
|
|
</a-col>
|
|
|
|
@ -23,21 +23,21 @@
|
|
|
|
|
</div>
|
|
|
|
|
<div v-show="apiForm.visible" class="api-form animated">
|
|
|
|
|
<a-form layout="vertical">
|
|
|
|
|
<a-form-item class="animated fadeInUp" :style="{ 'animation-delay': '0.1s' }">
|
|
|
|
|
<a-form-item :style="{ 'animation-delay': '0.1s' }" class="animated fadeInUp">
|
|
|
|
|
<a-tooltip placement="top" title="如果 Admin 不是独立部署,请不要更改此 API" trigger="click">
|
|
|
|
|
<a-input placeholder="API 地址" v-model="apiForm.apiUrl">
|
|
|
|
|
<a-icon slot="prefix" type="api" style="color: rgba(0,0,0,.25)" />
|
|
|
|
|
<a-input v-model="apiForm.apiUrl" placeholder="API 地址">
|
|
|
|
|
<a-icon slot="prefix" style="color: rgba(0,0,0,.25)" type="api" />
|
|
|
|
|
</a-input>
|
|
|
|
|
</a-tooltip>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item class="animated fadeInUp" :style="{ 'animation-delay': '0.2s' }">
|
|
|
|
|
<a-form-item :style="{ 'animation-delay': '0.2s' }" class="animated fadeInUp">
|
|
|
|
|
<a-button :block="true" @click="handleRestoreApiUrl">恢复默认</a-button>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item class="animated fadeInUp" :style="{ 'animation-delay': '0.3s' }">
|
|
|
|
|
<a-button type="primary" :block="true" @click="handleModifyApiUrl">保存设置</a-button>
|
|
|
|
|
<a-form-item :style="{ 'animation-delay': '0.3s' }" class="animated fadeInUp">
|
|
|
|
|
<a-button :block="true" type="primary" @click="handleModifyApiUrl">保存设置</a-button>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-row>
|
|
|
|
|
<a @click="handleToggleShowApiForm" class="tip animated fadeInUp" :style="{ 'animation-delay': '0.4s' }">
|
|
|
|
|
<a :style="{ 'animation-delay': '0.4s' }" class="tip animated fadeInUp" @click="handleToggleShowApiForm">
|
|
|
|
|
<a-icon type="rollback" />
|
|
|
|
|
</a>
|
|
|
|
|
</a-row>
|
|
|
|
@ -51,6 +51,7 @@ import adminApi from '@/api/admin'
|
|
|
|
|
import { mapActions, mapGetters, mapMutations } from 'vuex'
|
|
|
|
|
|
|
|
|
|
import LoginForm from '@/components/Login/LoginForm'
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
components: {
|
|
|
|
|
LoginForm
|
|
|
|
@ -68,13 +69,11 @@ export default {
|
|
|
|
|
...mapGetters({ defaultApiUrl: 'apiUrl' })
|
|
|
|
|
},
|
|
|
|
|
beforeMount() {
|
|
|
|
|
const _this = this
|
|
|
|
|
_this.handleVerifyIsInstall()
|
|
|
|
|
document.addEventListener('keydown', function(e) {
|
|
|
|
|
if (e.keyCode === 72 && e.altKey && e.shiftKey) {
|
|
|
|
|
_this.resetPasswordButtonVisible = !_this.resetPasswordButtonVisible
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.handleVerifyIsInstall()
|
|
|
|
|
document.addEventListener('keydown', this.onRegisterResetPasswordKeydown)
|
|
|
|
|
},
|
|
|
|
|
beforeDestroy() {
|
|
|
|
|
document.removeEventListener('keydown', this.onRegisterResetPasswordKeydown)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
...mapActions(['refreshUserCache', 'refreshOptionsCache']),
|
|
|
|
@ -82,6 +81,14 @@ export default {
|
|
|
|
|
setApiUrl: 'SET_API_URL',
|
|
|
|
|
restoreApiUrl: 'RESTORE_API_URL'
|
|
|
|
|
}),
|
|
|
|
|
onRegisterResetPasswordKeydown(e) {
|
|
|
|
|
// Windows / Linux: Shift + Alt + h
|
|
|
|
|
// maxOS: Shift + Command + h
|
|
|
|
|
if (e.keyCode === 72 && (e.altKey || e.metaKey) && e.shiftKey) {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
this.resetPasswordButtonVisible = !this.resetPasswordButtonVisible
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
async handleVerifyIsInstall() {
|
|
|
|
|
const response = await adminApi.isInstalled()
|
|
|
|
|
if (!response.data.data) {
|
|
|
|
|