From 99b2cc369d54f276aba53218db61fb9d56e8bc23 Mon Sep 17 00:00:00 2001 From: chy Date: Wed, 11 Mar 2026 00:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=95=E7=82=B9=E7=99=BB?= =?UTF-8?q?=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/dev.env.js | 4 ++-- src/api/login/index.js | 12 ++++++++++ src/store/modules/user.js | 1 + src/views/layout/components/Navbar.vue | 31 +++++++++++++++++++++++--- src/views/login.vue | 5 +++-- 5 files changed, 46 insertions(+), 7 deletions(-) diff --git a/config/dev.env.js b/config/dev.env.js index 28237ff..c1d675c 100644 --- a/config/dev.env.js +++ b/config/dev.env.js @@ -4,8 +4,8 @@ const prodEnv = require('./prod.env') module.exports = merge(prodEnv, { NODE_ENV: '"development"', - // BASE_API: '"http://127.0.0.1:48090"' + BASE_API: '"http://127.0.0.1:48090"' - BASE_API: '"http://192.168.1.241:8080/prod-api"' + // BASE_API: '"http://192.168.1.241:8080/prod-api"' }) diff --git a/src/api/login/index.js b/src/api/login/index.js index 4d87d9c..da1bdd4 100644 --- a/src/api/login/index.js +++ b/src/api/login/index.js @@ -23,6 +23,18 @@ export function logout () { }) } + +export function outlogcas (data) { + console.log(data) + return request({ + url: 'accessUser/outlogcas', + method: 'post', + data + }) +} + + + // 登录之后 根据旧修改密码 export function reqUpdatePassword (data) { return request({ diff --git a/src/store/modules/user.js b/src/store/modules/user.js index 066dee9..4e029a3 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -32,6 +32,7 @@ const user = { const repCode = response.repCode const repData = response.repData if (repCode === '0000') { + commit('SET_TOKEN', repData.token) commit('SET_ACCESSUSER', repData.accessUser) resolve(response) diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index a213bdc..deacd9b 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -82,6 +82,8 @@ import Hamburger from "@/components/Hamburger"; import { getStorageItem } from "@/utils/storage"; import { reqUpdatePassword } from "@/api/login"; import { transPsw } from "@/utils/encrypted"; +import {getAccessUser} from "@/utils/auth"; +import {outlogcas} from "@/api/login"; export default { data() { @@ -156,11 +158,34 @@ export default { cancelButtonText: "取消", type: "warning" }).then(() => { - sessionStorage.clear(); - localStorage.clear(); - this.$router.push("/login"); + debugger + //获取登录人 + let user = getAccessUser() + console.log(user.loginName) + debugger + + + this.outlogincasapi(); + debugger + console.log(user.loginName) + // sessionStorage.clear(); + // localStorage.clear(); + // this.$router.push("/login"); }); }, + async outlogincasapi() { + debugger + const obj = { + loginName: "admin", + password: "demo", + verifyCode: "", + }; + const { code, data } = await outlogcas(obj); + sessionStorage.clear(); + localStorage.clear(); + this.$router.push("/login"); + + }, // 修改密码 updatePassword() { this.wordVisible = true; diff --git a/src/views/login.vue b/src/views/login.vue index 48c4041..d3864a1 100644 --- a/src/views/login.vue +++ b/src/views/login.vue @@ -152,8 +152,8 @@ export default { //跳转统一身份认证 var isTs = true; if (isTs) { - window.location.href = 'http://192.168.1.241/login?redirect=/lig/oauth2/oauth2/application&appid=330b4ecb60c9a6802b957fe1e5a5ecd3&url=http%3A%2F%2F192.168.1.241%3A8080%2F%23%2Flogin'+(this.redirect?'&ssUrl='+this.redirect:''); - // window.location.href = 'http://localhost:8099/login?redirect=/lig/oauth2/oauth2/application&appid=330b4ecb60c9a6802b957fe1e5a5ecd3&url=http%3A%2F%2Flocalhost%3A9528%2F%23%2Flogin'+(this.redirect?'&ssUrl='+this.redirect:''); + window.location.href = 'http://192.168.1.241/login?redirect=/lig/oauth2/oauth2/application&appid=330b4ecb60c9a6802b957fe1e5a5ecd3&url=http%3A%2F%2F192.168.1.241%3A8080%2F%23%2Flogin'+(this.redirect?'&ssUrl='+this.redirect:''); + // window.location.href = 'http://localhost/login?redirect=/lig/oauth2/oauth2/application&appid=330b4ecb60c9a6802b957fe1e5a5ecd3&url=http%3A%2F%2Flocalhost%3A9528%2F%23%2Flogin'+(this.redirect?'&ssUrl='+this.redirect:''); } } else if (ticket != undefined && token == null) { @@ -242,6 +242,7 @@ export default { if (code != "200") return; setToken(data.token); setAccessUser(data); + debugger // 选中记住密码时 把密码存到cookie里,时效15天 this.rememberPsw && cookies.set(