mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-10 20:39:48 +08:00
fix: Console error when login redirect to window. (#412)
* fix: Console error when login redirect. * Update file.
This commit is contained in:
parent
83081b6d6d
commit
8258da6001
@ -326,14 +326,14 @@ export default {
|
||||
computed: {
|
||||
getterContextMenu() {
|
||||
const process = this.$store.getters.getContextMenu(this.containerUuid)
|
||||
if (process) {
|
||||
if (process && !this.isEmptyValue(process.actions)) {
|
||||
return process.actions.filter(menu => {
|
||||
if (menu.type === 'process' || menu.type === 'application') {
|
||||
return menu
|
||||
}
|
||||
})
|
||||
}
|
||||
return false
|
||||
return []
|
||||
},
|
||||
getShowContextMenuTable() {
|
||||
return this.$store.getters.getShowContextMenuTable
|
||||
|
@ -22,16 +22,17 @@
|
||||
>
|
||||
{{ $t('table.dataTable.deleteSelection') }}
|
||||
</el-menu-item>
|
||||
<el-menu-item
|
||||
v-for="(process, key) in processMenu"
|
||||
v-show="isPanelWindow && processMenu"
|
||||
:key="key"
|
||||
:disabled="process.type === 'application' ? false : Boolean(getDataSelection.length < 1)"
|
||||
index="process"
|
||||
@click="process.type === 'application' ? sortTab(process) : showModalTable(process)"
|
||||
>
|
||||
{{ process.name }}
|
||||
</el-menu-item>
|
||||
<template v-if="isPanelWindow && !isEmptyValue(processMenu)">
|
||||
<el-menu-item
|
||||
v-for="(process, key) in processMenu"
|
||||
:key="key"
|
||||
:disabled="process.type === 'application' ? false : Boolean(getDataSelection.length < 1)"
|
||||
index="process"
|
||||
@click="process.type === 'application' ? sortTab(process) : showModalTable(process)"
|
||||
>
|
||||
{{ process.name }}
|
||||
</el-menu-item>
|
||||
</template>
|
||||
<el-menu-item
|
||||
@click="exporZipRecordTable"
|
||||
>
|
||||
|
@ -40,7 +40,7 @@
|
||||
{{ $t('login.submit') }}
|
||||
</el-button>
|
||||
|
||||
<el-button type="text" style="float: left" @click.native.prevent="$router.push({ path: 'login' })">
|
||||
<el-button type="text" style="float: left" @click.native.prevent="pathRedirect('login')">
|
||||
{{ $t('login.title') }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
@ -48,11 +48,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
import { loginMixin } from '@/views/login/loginMixin'
|
||||
|
||||
export default {
|
||||
name: 'ForgotPassword',
|
||||
components: { LangSelect },
|
||||
mixins: [loginMixin],
|
||||
data() {
|
||||
return {
|
||||
forgotForm: {
|
||||
@ -65,11 +65,6 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showPwd() {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.userName.focus()
|
||||
})
|
||||
},
|
||||
handleSubmit() {
|
||||
if (!this.isEmptyValue(this.forgotForm.userName)) {
|
||||
this.loading = true
|
||||
|
@ -59,14 +59,14 @@
|
||||
<el-button
|
||||
type="text"
|
||||
style="float: left"
|
||||
@click.native.prevent="$router.push({ path: 'forgotPassword' })"
|
||||
@click.native.prevent="pathRedirect('forgotPassword')"
|
||||
>
|
||||
{{ $t('route.forgotPassword') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
style="float: right"
|
||||
@click.native.prevent="$router.push({ path: 'userEnrollment' })"
|
||||
@click.native.prevent="pathRedirect('userEnrollment')"
|
||||
>
|
||||
{{ $t('route.userEnrollment') }}
|
||||
</el-button>
|
||||
@ -94,12 +94,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
import { loginMixin } from '@/views/login/loginMixin'
|
||||
import SocialSign from './components/SocialSignin'
|
||||
|
||||
export default {
|
||||
name: 'Login',
|
||||
components: { LangSelect, SocialSign },
|
||||
components: { SocialSign },
|
||||
mixins: [loginMixin],
|
||||
data() {
|
||||
const validateUsername = (rule, value, callback) => {
|
||||
if ((value.trim()).length < 1) {
|
||||
@ -165,16 +166,6 @@ export default {
|
||||
this.capsTooltip = false
|
||||
}
|
||||
},
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
if (valid) {
|
||||
@ -186,11 +177,12 @@ export default {
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
let message = this.$t('login.unexpectedError')
|
||||
if (error.code === 13) {
|
||||
this.$message.error(this.$t('login.invalidLogin'))
|
||||
} else {
|
||||
this.$message.error(this.$t('login.unexpectedError'))
|
||||
message = this.$t('login.invalidLogin')
|
||||
}
|
||||
|
||||
this.$message.error(message)
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
|
25
src/views/login/loginMixin.js
Normal file
25
src/views/login/loginMixin.js
Normal file
@ -0,0 +1,25 @@
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
|
||||
export const loginMixin = {
|
||||
name: 'loginMixin',
|
||||
components: {
|
||||
LangSelect
|
||||
},
|
||||
methods: {
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
},
|
||||
pathRedirect(path) {
|
||||
this.$router.push({
|
||||
path
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
@ -31,7 +31,7 @@
|
||||
@keyup.native="checkCapslock"
|
||||
@blur="capsTooltip = false"
|
||||
/>
|
||||
<span class="show-pwd" @click="showPassword">
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
@ -61,7 +61,7 @@
|
||||
</el-tooltip>
|
||||
|
||||
<el-button
|
||||
:disabled="isEmptyValue(changePasswordForm.password) || changePasswordForm.password !== changePasswordForm.passwordConfirm"
|
||||
:disabled="isDisabled"
|
||||
:loading="loading"
|
||||
type="primary"
|
||||
style="width:100%;margin-bottom:30px;"
|
||||
@ -70,7 +70,7 @@
|
||||
{{ $t('login.submit') }}
|
||||
</el-button>
|
||||
|
||||
<el-button type="text" style="float: left" @click.native.prevent="$router.push({ path: 'login' })">
|
||||
<el-button type="text" style="float: left" @click.native.prevent="pathRedirect('login')">
|
||||
{{ $t('login.title') }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
@ -78,11 +78,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
import { loginMixin } from '@/views/login/loginMixin'
|
||||
|
||||
export default {
|
||||
name: 'ChangePassword',
|
||||
components: { LangSelect },
|
||||
mixins: [loginMixin],
|
||||
data() {
|
||||
const validatePass = (rule, value, callback) => {
|
||||
if (this.isEmptyValue(value)) {
|
||||
@ -119,6 +119,15 @@ export default {
|
||||
computed: {
|
||||
formName() {
|
||||
return this.$route.name
|
||||
},
|
||||
isDisabled() {
|
||||
if (this.isEmptyValue(this.changePasswordForm.password)) {
|
||||
return true
|
||||
}
|
||||
if (this.changePasswordForm.password !== this.changePasswordForm.passwordConfirm) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -141,17 +150,7 @@ export default {
|
||||
}
|
||||
},
|
||||
checkCapslockNew({ shiftKey, key } = {}, isNew = true) {
|
||||
this.checkCapslock({ shiftKey: shiftKey, key: key }, true)
|
||||
},
|
||||
showPassword() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
this.checkCapslock({ shiftKey, key }, true)
|
||||
},
|
||||
showPasswordConfirm() {
|
||||
if (this.passwordConfirmType === 'password') {
|
||||
|
@ -71,7 +71,7 @@
|
||||
@keyup.native="checkCapslock"
|
||||
@blur="capsTooltip = false"
|
||||
/>
|
||||
<span class="show-pwd" @click="showPassword">
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
@ -110,7 +110,7 @@
|
||||
{{ $t('login.submit') }}
|
||||
</el-button>
|
||||
|
||||
<el-button type="text" style="float: left" @click.native.prevent="$router.push({ path: 'login' })">
|
||||
<el-button type="text" style="float: left" @click.native.prevent="pathRedirect('login')">
|
||||
{{ $t('login.title') }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
@ -118,11 +118,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import LangSelect from '@/components/LangSelect'
|
||||
import { loginMixin } from '@/views/login/loginMixin'
|
||||
|
||||
export default {
|
||||
name: 'UserEnrollment',
|
||||
components: { LangSelect },
|
||||
mixins: [loginMixin],
|
||||
data() {
|
||||
const validateField = (rule, value, callback) => {
|
||||
if (this.isEmptyValue(value)) {
|
||||
@ -189,20 +189,21 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
isReadyFormSubmit() {
|
||||
if (this.isEmptyValue(this.enrollmentUserForm.name)) {
|
||||
const { name, userName, eMail, password, passwordConfirm } = this.enrollmentUserForm
|
||||
if (this.isEmptyValue(name)) {
|
||||
return false
|
||||
}
|
||||
if (this.isEmptyValue(this.enrollmentUserForm.userName)) {
|
||||
if (this.isEmptyValue(userName)) {
|
||||
return false
|
||||
}
|
||||
if (this.isEmptyValue(this.enrollmentUserForm.eMail) || !this.eMailPattern.test(this.enrollmentUserForm.eMail)) {
|
||||
if (this.isEmptyValue(eMail) || !this.eMailPattern.test(eMail)) {
|
||||
return false
|
||||
}
|
||||
if (this.isShowPassword) {
|
||||
if (this.isEmptyValue(this.enrollmentUserForm.password)) {
|
||||
if (this.isEmptyValue(password)) {
|
||||
return false
|
||||
}
|
||||
if (this.enrollmentUserForm.password !== this.enrollmentUserForm.passwordConfirm) {
|
||||
if (password !== passwordConfirm) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@ -229,17 +230,7 @@ export default {
|
||||
}
|
||||
},
|
||||
checkCapslockNew({ shiftKey, key } = {}, isNew = true) {
|
||||
this.checkCapslock({ shiftKey: shiftKey, key: key }, true)
|
||||
},
|
||||
showPassword() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
this.checkCapslock({ shiftKey, key }, true)
|
||||
},
|
||||
showPasswordConfirm() {
|
||||
if (this.passwordConfirmType === 'password') {
|
||||
|
Loading…
x
Reference in New Issue
Block a user