Merge pull request #9100 from dataease/pr@dev@perf_pwd_tips
perf: 密码到期提示页面
This commit is contained in:
commit
1a0f218fc5
66
core/frontend/src/layout/components/PwdExpTips.vue
Normal file
66
core/frontend/src/layout/components/PwdExpTips.vue
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<template>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="pwdPeriodWarn && !tipClosed"
|
||||||
|
class="lic_tips"
|
||||||
|
>
|
||||||
|
<el-alert
|
||||||
|
class="lic_alert"
|
||||||
|
:title="warnMsg"
|
||||||
|
type="warning"
|
||||||
|
show-icon
|
||||||
|
center
|
||||||
|
@close="closeTip"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'PwdExpTips',
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
tipClosed: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
pwdPeriodWarn() {
|
||||||
|
return this.$store.state.user.validityPeriod > 0 && this.$store.state.user.validityPeriod < 8
|
||||||
|
},
|
||||||
|
warnMsg() {
|
||||||
|
if (this.$store.state.user.validityPeriod > 0 && this.$store.state.user.validityPeriod < 8) {
|
||||||
|
return `密码将于${this.$store.state.user.validityPeriod}后过期,为了不影响正常使用,请及时进行修改!`
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
closeTip() {
|
||||||
|
this.tipClosed = true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.lic_tips {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 2000;
|
||||||
|
position:absolute;
|
||||||
|
top: 0;left:0;right:0;
|
||||||
|
margin: auto;
|
||||||
|
}
|
||||||
|
.lic_alert ::v-deep .el-icon-close{
|
||||||
|
top: 16px !important;
|
||||||
|
right: 10px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
@ -4,3 +4,4 @@ export { default as Sidebar } from './Sidebar'
|
|||||||
export { default as AppMain } from './AppMain'
|
export { default as AppMain } from './AppMain'
|
||||||
export { default as Topbar } from './Topbar'
|
export { default as Topbar } from './Topbar'
|
||||||
export { default as Licbar } from './Licbar'
|
export { default as Licbar } from './Licbar'
|
||||||
|
export { default as PwdExpTips } from './PwdExpTips'
|
||||||
|
|||||||
@ -6,6 +6,8 @@
|
|||||||
class="app-wrapper"
|
class="app-wrapper"
|
||||||
>
|
>
|
||||||
<licbar />
|
<licbar />
|
||||||
|
<pwd-exp-tips />
|
||||||
|
|
||||||
<topbar
|
<topbar
|
||||||
v-if="!fullHeightFlag"
|
v-if="!fullHeightFlag"
|
||||||
:show-tips="showTips"
|
:show-tips="showTips"
|
||||||
@ -57,7 +59,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Sidebar, AppMain, Topbar, Licbar } from './components'
|
import { Sidebar, AppMain, Topbar, Licbar, PwdExpTips } from './components'
|
||||||
import ResizeMixin from './mixin/ResizeHandler'
|
import ResizeMixin from './mixin/ResizeHandler'
|
||||||
import DeMainContainer from '@/components/dataease/DeMainContainer'
|
import DeMainContainer from '@/components/dataease/DeMainContainer'
|
||||||
import DeContainer from '@/components/dataease/DeContainer'
|
import DeContainer from '@/components/dataease/DeContainer'
|
||||||
@ -74,7 +76,8 @@ export default {
|
|||||||
Licbar,
|
Licbar,
|
||||||
DeMainContainer,
|
DeMainContainer,
|
||||||
DeContainer,
|
DeContainer,
|
||||||
DeAsideContainer
|
DeAsideContainer,
|
||||||
|
PwdExpTips
|
||||||
},
|
},
|
||||||
mixins: [ResizeMixin],
|
mixins: [ResizeMixin],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@ -85,13 +85,6 @@ const actions = {
|
|||||||
login({ username: username.trim(), password: password, loginType: loginType }).then(response => {
|
login({ username: username.trim(), password: password, loginType: loginType }).then(response => {
|
||||||
const { data } = response
|
const { data } = response
|
||||||
commit('SET_LOGIN_MSG', null)
|
commit('SET_LOGIN_MSG', null)
|
||||||
if (data.validityPeriod === 0) {
|
|
||||||
commit('SET_LOGIN_MSG', '密码已过期,请联系管理员进行密码重置!')
|
|
||||||
reject(null)
|
|
||||||
return
|
|
||||||
} else if (data.validityPeriod > 0 && data.validityPeriod < 8) {
|
|
||||||
commit('SET_LOGIN_MSG', `密码将于${data.validityPeriod}天后过期,为了不影响正常使用,请及时进行修改!`)
|
|
||||||
}
|
|
||||||
commit('SET_TOKEN', data.token)
|
commit('SET_TOKEN', data.token)
|
||||||
setToken(data.token)
|
setToken(data.token)
|
||||||
setTokenExp(data.expireTime)
|
setTokenExp(data.expireTime)
|
||||||
|
|||||||
@ -122,7 +122,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="login-msg"
|
class="login-msg"
|
||||||
:class="{'login-msg-warn': pwdPeriodWarn}"
|
|
||||||
>
|
>
|
||||||
{{ msg }}
|
{{ msg }}
|
||||||
</div>
|
</div>
|
||||||
@ -266,9 +266,6 @@ export default {
|
|||||||
},
|
},
|
||||||
radioTypes() {
|
radioTypes() {
|
||||||
return this.loginTypes && this.loginTypes.filter(item => item < 4 || item > 6) || []
|
return this.loginTypes && this.loginTypes.filter(item => item < 4 || item > 6) || []
|
||||||
},
|
|
||||||
pwdPeriodWarn() {
|
|
||||||
return this.$store.state.user.validityPeriod > 0 && this.$store.state.user.validityPeriod < 8
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -501,11 +498,7 @@ export default {
|
|||||||
loginType: this.loginForm.loginType
|
loginType: this.loginForm.loginType
|
||||||
}
|
}
|
||||||
this.$store.dispatch('user/login', user).then(() => {
|
this.$store.dispatch('user/login', user).then(() => {
|
||||||
if (this.pwdPeriodWarn) {
|
this.$router.push({ path: this.redirect || '/' })
|
||||||
this.showPwdPeriodMsg()
|
|
||||||
} else {
|
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
|
||||||
}
|
|
||||||
this.loading = false
|
this.loading = false
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
this.loading = false
|
this.loading = false
|
||||||
@ -516,11 +509,6 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
showPwdPeriodMsg() {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.$router.push({ path: this.redirect || '/' })
|
|
||||||
}, 2000)
|
|
||||||
},
|
|
||||||
showMessage() {
|
showMessage() {
|
||||||
showMultiLoginMsg()
|
showMultiLoginMsg()
|
||||||
},
|
},
|
||||||
@ -663,9 +651,6 @@ export default {
|
|||||||
color: $--color-danger;
|
color: $--color-danger;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.login-msg-warn {
|
|
||||||
color: $--color-warning !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.login-image {
|
.login-image {
|
||||||
background: url(../../assets/login-desc.png) no-repeat;
|
background: url(../../assets/login-desc.png) no-repeat;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user