| | |
| | | const res1 = await savePassword(data); |
| | | console.log(data); |
| | | } |
| | | |
| | | if (this.active == 1) { |
| | | const data = this.$refs[`form${this.active}`].getFormData(); |
| | | await initNetwork(data); |
| | | console.log(data); |
| | | }, |
| | | systemLogin() { |
| | | this.nullRule = this.rules |
| | | this.$nextTick(() => { |
| | | this.$refs['ruleForm'].validate(valid => { |
| | | if (valid) { |
| | | this.loading = this.$loading({ |
| | | lock: true, |
| | | text: 'Loading', |
| | | spinner: 'el-icon-loading', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }) |
| | | this.testLogin() |
| | | } else { |
| | | this.nullRule = {} |
| | | } |
| | | }) |
| | | this.nullRule = {} |
| | | }) |
| | | }, |
| | | async testLogin() { |
| | | // location.assign("/view/desktop/") |
| | | tologin({ username: this.user.loginName, password: this.user.password }) |
| | | .then(json => { |
| | | const loginedInfo = { |
| | | access_token: json.token_type + ' ' + json.access_token, |
| | | refresh_token: json.refresh_token |
| | | } |
| | | sessionStorage.setItem('expires_in', json.expires_in) |
| | | sessionStorage.setItem('loginedInfo', JSON.stringify(loginedInfo)) |
| | | this.loading.close() |
| | | this.getLoginUserData() |
| | | }) |
| | | .catch(err => { |
| | | this.loading.close() |
| | | this.$notify({ |
| | | title: '提示', |
| | | type: 'error', |
| | | message: err.msg |
| | | }) |
| | | this.$refs.pwd.focus() |
| | | }) |
| | | }, |
| | | async getLoginUserData() { |
| | | let res = await getLoginUserData() |
| | | if (res.success) { |
| | | sessionStorage.setItem('userInfo', JSON.stringify(res.data)) |
| | | this.$notify.success("登录成功!") |
| | | // 获取权限 |
| | | await this.getMenuList() |
| | | location.assign("/view/desktop/") |
| | | return res.data |
| | | } else { |
| | | this.$notify.error("登录失败!") |
| | | } |
| | | |
| | | this.active++; |