From d7c06cca16d12ecf5d0f233395dcf6062261b39b Mon Sep 17 00:00:00 2001 From: yangfeng <wanwan926_4@163.com> Date: 星期三, 29 十一月 2023 17:01:28 +0800 Subject: [PATCH] 服务管理模块新增增加负责人默认值 --- src/components/layout/components/appHeader/index.vue | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 52 insertions(+), 3 deletions(-) diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue index 5427586..92ac453 100644 --- a/src/components/layout/components/appHeader/index.vue +++ b/src/components/layout/components/appHeader/index.vue @@ -4,7 +4,7 @@ <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">鐢ㄦ埛鍚�<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-menu> @@ -14,19 +14,68 @@ </template> <script> +import Cookies from "js-cookie" export default { name: "SalesLead", props: { headerTitle: String }, data() { - return {} + return { + username: "" + } + }, + mounted() { + this.username = document.cookie.replace(/(?:(?:^|.*;\s*)username\s*=\s*([^;]*).*$)|^.*$/, "$1") }, methods: { + environmentType() { + let type + if (location.href.includes("192.168.20.119")) { + type = "test" + } else if (location.href.includes("192.168") || location.href.includes("localhost")) { + type = "dev" + } else { + type = "prod" + } + + return type + }, + getApsPage() { + // 棣栭〉閮ㄧ讲鍦ㄥ悇涓幆澧冪殑绔彛 + const loginPathMap = { + prod: `//${window.location.hostname}:9080`, + test: `//192.168.20.119:9080`, + // 鎯宠烦鍒版湰鍦板惎鍔ㄧ殑鐧诲綍椤电殑璇濋渶瑕佹妸dev鏀规垚浣犳湰鍦伴」鐩矾寰� + dev: `//192.168.8.112:8081` + } + return loginPathMap[this.environmentType()] + }, handleCommand(command) { console.log(command) if (command === "logout") { - this.$router.push({ path: "/login" }) + // this.$router.push({ path: "/login" }) + document.cookie = "cookieName=; path=/;" + this.$confirm("纭畾瑕佹敞閿�褰撳墠鐢ㄦ埛鍚�?", "娉ㄩ攢鐢ㄦ埛", { + confirmButtonText: "纭畾", + cancelButtonText: "鍙栨秷", + type: "warning" + }) + .then(() => { + Cookies.remove("token") + // window.location.href = 'http://localhost:8080/login'; //鏈湴鐨勬櫤鎱у伐鍘�-鐧诲綍椤� + window.location.href = "http:" + this.getApsPage() + "/login" + this.$message({ + type: "success", + message: "娉ㄩ攢鎴愬姛!" + }) + }) + .catch(() => { + this.$message({ + type: "info", + message: "宸插彇娑堟敞閿�" + }) + }) } } } -- Gitblit v1.8.0