From 4512fc9d652e0127441a84f1141b9e074dc16aa6 Mon Sep 17 00:00:00 2001 From: lzhe <lzhe@example.com> Date: 星期日, 09 六月 2024 17:40:24 +0800 Subject: [PATCH] 1 --- src/views/login/components/passwordForm.vue | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue index 380479c..7881276 100644 --- a/src/views/login/components/passwordForm.vue +++ b/src/views/login/components/passwordForm.vue @@ -18,9 +18,11 @@ </template> <script> +//import io from 'socket.io-client'; export default { data() { return { + socket: null, userType: 'admin', form: { user: "admin", @@ -52,7 +54,7 @@ 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 } @@ -65,8 +67,11 @@ 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 @@ -76,15 +81,15 @@ 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) { @@ -136,12 +141,12 @@ transformedArray[0].path = "/home"; transformedArray[0].children = resp.data; var obj = { - dashboardGrid: ["welcome", "ver", "time", "progress", "echarts", "about"], + dashboardGrid: ["Access", "deskNotice", "Entrance"], menu: transformedArray, permissions: ["list.add", "list.edit", "list.delete", "user.add", "user.edit", "user.delete"] } this.$TOOL.data.set("MENU", obj.menu); - console.log(obj.menu,289) + console.log(obj.menu,'menu') this.$TOOL.data.set("PERMISSIONS", obj.permissions) this.$TOOL.data.set("DASHBOARDGRID", obj.dashboardGrid) -- Gitblit v1.9.3