| | |
| | | } from "./api"; |
| | | |
| | | export default { |
| | | async created() {}, |
| | | mounted() { |
| | | this.getInitInfo(); |
| | | let message = "网络正常"; |
| | |
| | | } |
| | | }, |
| | | nextFormNot() { |
| | | this.active++; |
| | | this.$refs["carousel"].next(); |
| | | }, |
| | | 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++; |
| | | this.$refs["carousel"].next(); |
| | | }, |
| | |
| | | } |
| | | |
| | | .formAccount { |
| | | margin-top: 157px; |
| | | margin-top: 0.81rem; |
| | | margin-left: 200px; |
| | | width: 550px; |
| | | } |
| | | |
| | | .formNet, |
| | | .formInfo { |
| | | margin-top: 90px; |
| | | margin-top: 0.47rem; |
| | | margin-left: 200px; |
| | | width: 550px; |
| | | } |
| | | |
| | | .control { |
| | | position: fixed; |
| | | top: 770px; |
| | | top: 80%; |
| | | left: 0; |
| | | right: 0; |
| | | line-height: 40px; |