From eef1cd4c6ffd669d43fd525918bda9ed3db7e25a Mon Sep 17 00:00:00 2001 From: feige <791364011@qq.com> Date: 星期六, 30 十一月 2024 15:53:05 +0800 Subject: [PATCH] 修改bug --- ruoyi-ui/vue.config.js | 2 +- ruoyi-ui/src/api/system/user.js | 8 ++++++++ ruoyi-ui/src/layout/components/Navbar.vue | 45 ++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ruoyi-ui/src/api/system/user.js b/ruoyi-ui/src/api/system/user.js index 8c527f0..57da77e 100644 --- a/ruoyi-ui/src/api/system/user.js +++ b/ruoyi-ui/src/api/system/user.js @@ -9,6 +9,14 @@ params: query }) } +// 鏌ヨ鏅�氱敤鎴峰垪琛� +export function listCommonUser(query) { + return request({ + url: '/system/user/listCommonUser', + method: 'get', + params: query + }) +} // 鏌ヨ鐢ㄦ埛璇︾粏 export function getUser(userId) { diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 2be56e8..cdf066c 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -31,7 +31,7 @@ <el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> <div class="avatar-wrapper"> - <img :src="avatar" class="user-avatar"> + <img :src="ximg" class="user-avatar"> <i class="el-icon-caret-bottom" /> </div> <el-dropdown-menu slot="dropdown"> @@ -74,9 +74,9 @@ }, data() { return { - + xm: {"寮�":"zhang.png","鏉�":"li.png"}, greeting: "", - + ximg: "", }; }, @@ -109,10 +109,49 @@ } }, methods: { + getLastName(fullname) + { + let hyphenated = ['娆ч槼', '澶彶', '绔湪', '涓婂畼', '鍙搁┈', '涓滄柟', '鐙', '鍗楀', '涓囦繜', '闂讳汉', + '澶忎警', '璇歌憶', '灏夎繜', '鍏緤', '璧繛', '婢瑰彴', '鐨囩敨', '瀹楁斂', '婵槼', '鍏喍', + '澶彅', '鐢冲睜', '鍏瓩', '鎱曞', '浠插瓩', '閽熺', '闀垮瓩', '瀹囨枃', '鍩庢睜', '鍙稿緬', + '椴滀簬', '鍙哥┖', '姹濆', '闂句笜', '瀛愯溅', '浜撳畼', '鍙稿瘒', '宸┈', '鍏タ', '棰涘瓩', + '澹ら┓', '鍏壇', '婕嗛洉', '涔愭', '瀹扮埗', '璋锋', '鎷撹穻', '澶硅胺', '杞╄緯', '浠ょ嫄', + '娈靛共', '鐧鹃噷', '鍛煎欢', '涓滈儹', '鍗楅棬', '缇婅垖', '寰敓', '鍏埛', '鍏帀', '鍏华', + '姊佷笜', '鍏徊', '鍏笂', '鍏棬', '鍏北', '鍏潥', '宸︿笜', '鍏集', '瑗块棬', '鍏', + '绗簲', '鍏箻', '璐笜', '鍏殭', '鍗楄崳', '涓滈噷', '涓滃', '浠查暱', '瀛愪功', '瀛愭', + '鍗冲ⅷ', '杈惧', '瑜氬笀']; + let hyset = new Set(hyphenated); + let vLength = fullname.length; + // 鍓嶄负濮�,鍚庝负鍚� + let lastname = '', firstname = ''; + if (vLength > 2){ + var preTwoWords = fullname.substr(0, 2); + // 鍙栧懡鍚嶇殑鍓嶄袱涓瓧,鐪嬫槸鍚﹀湪澶嶅搴撲腑 + if (hyset.has(preTwoWords)){ + lastname = preTwoWords; + firstname = fullname.substr(2); + }else{ + lastname = fullname.substr(0, 1); + firstname = fullname.substr(1); + } + }else if (vLength === 2){ + // 鍏ㄥ悕鍙湁涓や釜瀛楁椂,浠ュ墠涓�涓负濮�,鍚庝竴涓嬩负鍚� + lastname = fullname.substr(0, 1); + firstname = fullname.substr(1); + }else{ + lastname = fullname; + } + return lastname; + }, setGreeting() { const currentTime = new Date(); const currentHour = currentTime.getHours(); let name = this.$store.state.user.name + let lnm = this.getLastName(name) + if(this.xm[lnm]!=null) + this.ximg = require("@/assets/images/"+this.xm[lnm]) + else + this.ximg = require("@/assets/images/login_logo.png") if (currentHour < 12) { this.greeting = "鏃╀笂濂�,"+name; } else if (currentHour < 14) { diff --git a/ruoyi-ui/vue.config.js b/ruoyi-ui/vue.config.js index 02bed06..e7c426e 100644 --- a/ruoyi-ui/vue.config.js +++ b/ruoyi-ui/vue.config.js @@ -37,7 +37,7 @@ // detail: https://cli.vuewww.bendudu.comjs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { // target: `https://10.39.18.174:8080/`, - // target: `https://192.168.1.7:8080/`, + // target: `https://192.168.1.5:8080/`, target: 'https://www.bendudu.com:8080/', changeOrigin: true, pathRewrite: { -- Gitblit v1.9.1