| | |
| | | import { tologin, getLoginUserData, getServerName } from './api.ts' |
| | | import ParticleNetwork from './ParticleNetwork' |
| | | import Licence from '@/components/licence' |
| | | import { getMenuListData, findButtonAuthoritys, findInArr } from "@/api/utils"; |
| | | import { getMenuListData } from "@/api/utils"; |
| | | |
| | | export default { |
| | | name: 'login-pgae', |
| | |
| | | async testLogin() { |
| | | tologin({ username: this.user.loginName, password: this.user.password }) |
| | | .then(json => { |
| | | // console.log(json, "登录请求"); |
| | | const loginedInfo = { |
| | | access_token: json.token_type + ' ' + json.access_token, |
| | | refresh_token: json.refresh_token |
| | |
| | | this.getLoginUserData() |
| | | }) |
| | | .catch(err => { |
| | | // console.log(err, "登录报错"); |
| | | this.loading.close() |
| | | this.$notify({ |
| | | title: '提示', |
| | | type: 'error', |
| | | message: err |
| | | message: err.msg |
| | | }) |
| | | this.$refs.pwd.focus() |
| | | }) |
| | | }, |
| | | async getLoginUserData() { |
| | | let json = await getLoginUserData() |
| | | if (!json.error) { |
| | | // this.loading.close() |
| | | sessionStorage.setItem('userInfo', JSON.stringify(json)) |
| | | this.$notify({ |
| | | title: '提示', |
| | | type: 'success', |
| | | message: '登录成功!' |
| | | }) |
| | | |
| | | debugger |
| | | let res = await getLoginUserData() |
| | | debugger |
| | | if (res.success) { |
| | | sessionStorage.setItem('userInfo', JSON.stringify(res.data)) |
| | | this.$notify.success("登录成功!") |
| | | // 获取权限 |
| | | await this.getMenuList() |
| | | location.assign("/view/desktop/") |
| | | return json |
| | | return res.data |
| | | } else { |
| | | this.$notify({ |
| | | title: '提示', |
| | | type: 'error', |
| | | message: '登录失败!' |
| | | }) |
| | | // this.loading.close() |
| | | this.$notify.error("登录失败!") |
| | | } |
| | | }, |
| | | |
| | | getScreenHeight() { |
| | | this.currentHeight = document.documentElement.clientHeight |
| | | this.currentWidth = document.documentElement.clientWidth |
| | | // console.log(this.currentHeight, "当前窗口大小"); |
| | | window.onresize = () => { |
| | | this.currentHeight = document.documentElement.clientHeight |
| | | this.currentWidth = document.documentElement.clientWidth |
| | | // console.log(this.currentHeight, "当前窗口大小2", this.currentWidth); |
| | | this.$forceUpdate() |
| | | } |
| | | }, |
| | | async getServerName() { |
| | | let res = await getServerName() |
| | | if (res && res.success) { |
| | | console.log(res.data.serverName) |
| | | this.serverTitle = res.data.serverName |
| | | window.document.title = res.data.serverName |
| | | ? res.data.serverName |
| | |
| | | if (results && results.success) { |
| | | /* 存储权限 */ |
| | | let buttonAuthoritys = results.data; |
| | | // console.log(this.$route.query.is_loginsss) |
| | | if (results && results.length && this.$route.query.is_login) { |
| | | this.$router.replace(results[0].url); |
| | | } |
| | |
| | | } |
| | | .login-form { |
| | | margin: 40px 10px; |
| | | // margin: 24px 10px 40px 10px; |
| | | } |
| | | .gradient-text { |
| | | line-height: 36px; |