| | |
| | | </el-form> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | title="提示" |
| | | :visible.sync="dialogVisible" |
| | | width="500px" |
| | | :close-on-click-modal="false" |
| | | :show-close="false" |
| | | top="5vh" |
| | | > |
| | | <div style="font-size:20px;"> |
| | | <!-- <i class="el-icon-warning-outline" style="color: #ffef00" />--> |
| | | 当前账号已登录,是否强制下线! |
| | | </div> |
| | | <span slot="footer" class="dialog-footer"> |
| | | <div class="footerButton"> |
| | | <el-button @click="dialogVisibleCancel">否</el-button> |
| | | <el-button type="primary" @click="dialogVisibleConfirm">是</el-button> |
| | | </div> |
| | | </span> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { validUsername } from '@/utils/validate' |
| | | import { getCookie, removeCookie, setCookie } from '@/utils/auth' |
| | | import { ForcedOffline } from '@/api/user' |
| | | |
| | | export default { |
| | | name: 'Login', |
| | |
| | | passwordType: 'password', |
| | | redirect: undefined, |
| | | focus1: false, |
| | | focus2: false |
| | | focus2: false, |
| | | dialogVisible: false |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | if (valid) { |
| | | this.loading = true |
| | | this.$store.dispatch('user/login', this.loginForm).then(() => { |
| | | this.$router.push({ path: this.redirect || '/' }) |
| | | console.log(getCookie('code') === '302') |
| | | if (getCookie('code') === '302') { |
| | | this.dialogVisible = true |
| | | } else { |
| | | this.$router.push({ path: this.redirect || '/' }) |
| | | } |
| | | this.loading = false |
| | | }).catch(() => { |
| | | this.loading = false |
| | |
| | | return false |
| | | } |
| | | }) |
| | | }, |
| | | |
| | | dialogVisibleCancel() { |
| | | removeCookie('username') |
| | | removeCookie('admin') |
| | | removeCookie('navTabId') |
| | | removeCookie('usertype') |
| | | removeCookie('userid') |
| | | removeCookie('code') |
| | | this.dialogVisible = false |
| | | }, |
| | | async dialogVisibleConfirm() { |
| | | const usercode = getCookie('navTabId') |
| | | const username = getCookie('admin') |
| | | const usertype = getCookie('usertype') |
| | | const userid = getCookie('userid') |
| | | const data = { |
| | | usercode, |
| | | username, |
| | | usertype, |
| | | userid |
| | | } |
| | | const res = await ForcedOffline(data) |
| | | if (res.code === '200') { |
| | | this.$message.success('强制下线成功!') |
| | | this.dialogVisible = false |
| | | this.$router.push({ path: this.redirect || '/' }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | -webkit-text-fill-color: #000 !important; |
| | | } |
| | | } |
| | | ::v-deep .el-dialog__title{ |
| | | color: red; |
| | | } |
| | | </style> |