From 1a0e437bd073d428e276a804c6846e409d92a99e Mon Sep 17 00:00:00 2001
From: charles <981744753@qq.com>
Date: 星期四, 18 七月 2024 23:45:56 +0800
Subject: [PATCH] fix:与aps共享token
---
src/components/layout/components/appHeader/index.vue | 52 ++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 42 insertions(+), 10 deletions(-)
diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue
index 44f019b..fbdbf5a 100644
--- a/src/components/layout/components/appHeader/index.vue
+++ b/src/components/layout/components/appHeader/index.vue
@@ -4,29 +4,56 @@
<div class="header-user-info">
<div class="avatar"><el-avatar icon="el-icon-user-solid"></el-avatar></div>
<el-dropdown @command="handleCommand">
- <div class="el-dropdown-link">{{ username }}<i class="el-icon-arrow-down el-icon--right"></i></div>
+ <div class="el-dropdown-link">浣犲ソ {{ username }}<i class="el-icon-arrow-down el-icon--right"></i></div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="logout">閫�鍑�</el-dropdown-item>
+ <el-dropdown-item @click.native="updatePwd">
+ <d2-icon name="unlock" class="d2-mr-5" />
+ 淇敼瀵嗙爜
+ </el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
+ <UpdatePassWord :editCommonConfig="editConfig"></UpdatePassWord>
</div>
</div>
</template>
<script>
import Cookies from "js-cookie"
+import UpdatePassWord from "./components/updatePassWord"
+import {getApsPage} from '@/common/untils/index.js'
export default {
- name: "SalesLead",
+ name: "SalesLeads",
props: {
- headerTitle: String
+ headerTitle: {
+ type:String,
+ default:''
+ }
+ },
+ components:{
+ UpdatePassWord,
},
data() {
return {
- username: ""
+ username: "",
+ editConfig:{
+ dialogVisible:false,
+ userId:"",
+ }
}
},
+ created(){
+ const userObj = Cookies.get('userObj');
+ if (userObj) {
+ let userInfo = JSON.parse(userObj);
+ this.editConfig.userId=userInfo.id
+ this.username=userInfo.nickName
+ } else {
+ console.log('Object not found in cookie');
+ }
+ },
mounted() {
- this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
+ // this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1")
},
methods: {
environmentType() {
@@ -41,7 +68,7 @@
return type
},
- getApsPage() {
+ /* getApsPage() {
// 棣栭〉閮ㄧ讲鍦ㄥ悇涓幆澧冪殑绔彛
const loginPathMap = {
prod: `//${window.location.hostname}:9080`,
@@ -50,9 +77,8 @@
dev: `//192.168.8.113:8080`
}
return loginPathMap[this.environmentType()]
- },
+ },*/
handleCommand(command) {
- console.log(command)
if (command === "logout") {
// this.$router.push({ path: "/login" })
document.cookie = "cookieName=; path=/;"
@@ -64,11 +90,14 @@
.then(() => {
Cookies.remove("token")
// window.location.href = 'http://localhost:8080/login'; //鏈湴鐨勬櫤鎱у伐鍘�-鐧诲綍椤�
- window.location.href = "http:" + this.getApsPage() + "/login"
+ //window.location.href = "http:" + this.getApsPage() + "/login"
this.$message({
type: "success",
message: "娉ㄩ攢鎴愬姛!"
- })
+ });
+ setTimeout(()=>{
+ window.open(`//${getApsPage()}/login`);
+ },500);
})
.catch(() => {
this.$message({
@@ -77,6 +106,9 @@
})
})
}
+ },
+ updatePwd(){
+ this.editConfig.dialogVisible=true
}
}
}
--
Gitblit v1.8.0