| | |
| | | </template> |
| | | |
| | | <script> |
| | | //import io from 'socket.io-client'; |
| | | export default { |
| | | data() { |
| | | return { |
| | | socket: null, |
| | | userType: 'admin', |
| | | form: { |
| | | user: "admin", |
| | |
| | | mounted() { |
| | | //this.$HTTP.get('/api/blade-sync/outer-app-config/appStatus') |
| | | }, |
| | | methods: { |
| | | methods: { |
| | | async login() { |
| | | var validate = await this.$refs.loginForm.validate().catch(() => { }) |
| | | if (!validate) { return false } |
| | |
| | | grant_type: "password", |
| | | scope: "all" |
| | | } |
| | | var isToken = false; |
| | | await this.$HTTP.postJ("/api/blade-auth/oauth/token?" + this.$TOOL.qsStringify(data)).then(res => { |
| | | this.islogin = false; |
| | | if (res.user_id) { |
| | | isToken = true; |
| | | //获取token |
| | | this.$TOOL.cookie.set("TOKEN", res.access_token, { |
| | | expires: this.form.autologin ? 24 * 60 * 60 : 0 |
| | |
| | | res.dashboard = "0"; |
| | | res.userId = "1"; |
| | | this.$TOOL.data.set("USER_INFO", res); |
| | | this.islogin = false; |
| | | } else { |
| | | this.$message({ |
| | | showClose: true, |
| | | message: res.error_description, |
| | | message: res.msg || res.error_description, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | }) |
| | | if(!isToken) return; |
| | | //获取菜单 |
| | | await this.$HTTP.get("/api/blade-system/menu/routes?" + this.$TOOL.qsStringify({ "appCode": "CPS" })).then(res => { |
| | | if (res.data.length == 0) { |