From 6be74fae87a57996e8cf1b8778ad16ddbb1f870b Mon Sep 17 00:00:00 2001 From: haoxuan <haoxuan> Date: 星期二, 27 二月 2024 16:57:10 +0800 Subject: [PATCH] 如果销售机会,客户名称为空查询所有销售报价单列表,否则查对应报价单,如果客户名称为空查所有销售机会列表 --- src/components/layout/components/appHeader/index.vue | 127 +++++++++++++++++++++++++++++++++++++++--- 1 files changed, 118 insertions(+), 9 deletions(-) diff --git a/src/components/layout/components/appHeader/index.vue b/src/components/layout/components/appHeader/index.vue index bafd8cc..389d527 100644 --- a/src/components/layout/components/appHeader/index.vue +++ b/src/components/layout/components/appHeader/index.vue @@ -1,14 +1,111 @@ <template> <div class="sales-lead"> <div class="header-title">{{ headerTitle }}</div> + <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> + <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" export default { - name: "SalesLead", + name: "SalesLeads", props: { - headerTitle: String + headerTitle: { + type:String, + default:'' + } + }, + components:{ + UpdatePassWord, + }, + data() { + return { + 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") + }, + 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.113:8080` + } + return loginPathMap[this.environmentType()] + }, + handleCommand(command) { + if (command === "logout") { + // 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: "宸插彇娑堟敞閿�" + }) + }) + } + }, + updatePwd(){ + this.editConfig.dialogVisible=true + } } } </script> @@ -16,14 +113,26 @@ <!-- Add "scoped" attribute to limit CSS to this component only --> <style lang="scss" scoped> .sales-lead { - height: 55px; - line-height: 55px; - background-color: #fff; - margin-bottom: 10px; + display: flex; + height: 50px; + box-sizing: border-box; + line-height: 50px; + background-color: $color-bg; + border: 1px solid #ccc; .header-title { - margin-left: 16px; - font-size: 16px; - color: #475059; + padding-left: 16px; + font-size: 18px; + font-weight: bold; + color: #171718; + } + .header-user-info { + margin-left: auto; + margin-right: 20px; + display: flex; + .avatar { + margin-top: 4px; + margin-right: 10px; + } } } </style> -- Gitblit v1.8.0