添加poolName

master
夜笙歌 4 months ago
parent 4d7e4aae1a
commit ea79b08b0e

@ -134,3 +134,15 @@ export function deptTreeSelect() {
method: 'get'
})
}
export function changePoolName(poolName) {
const data = {
poolName
}
return request({
url: '/system/user/changePoolName',
method: 'put',
data: data
})
}

@ -7,6 +7,20 @@
<div class="right-menu">
<template v-if="device!=='mobile'">
<el-select
v-model="poolName"
placeholder="请选择园区"
@change="handleChange"
:disabled="poolNameList.length <= 1"
class="right-menu-item hover-effect"
>
<el-option
v-for="item in poolNameList"
:key="item.poolName"
:label="item.parkName"
:value="item.poolName"
></el-option>
</el-select>
<search id="header-search" class="right-menu-item" />
<el-tooltip content="源码地址" effect="dark" placement="bottom">
@ -56,8 +70,19 @@ import SizeSelect from '@/components/SizeSelect'
import Search from '@/components/HeaderSearch'
import RuoYiGit from '@/components/RuoYi/Git'
import RuoYiDoc from '@/components/RuoYi/Doc'
import { changePoolName } from "@/api/system/user";
export default {
data() {
return {
poolNameList: [],
poolName: "",
};
},
mounted() {
this.poolNameList = JSON.parse(localStorage.getItem("POOL_NAME_LIST"));
this.poolName = localStorage.getItem("USER_POOL_NAME_CURRENT");
},
components: {
Breadcrumb,
TopNav,
@ -105,7 +130,16 @@ export default {
location.href = '/index';
})
}).catch(() => {});
}
},
//
handleChange(value) {
//
changePoolName(value).then((res) => {
localStorage.setItem("USER_POOL_NAME_CURRENT", value);
this.poolName = value
window.location.reload();
});
},
}
}
</script>

@ -71,6 +71,8 @@ const user = {
commit('SET_ID', user.userId)
commit('SET_NAME', user.userName)
commit('SET_AVATAR', avatar)
localStorage.setItem('POOL_NAME_LIST',JSON.stringify(res.poolNameList))
localStorage.setItem('USER_POOL_NAME_CURRENT',user.poolName)
resolve(res)
}).catch(error => {
reject(error)
@ -98,6 +100,8 @@ const user = {
commit('SET_TOKEN', '')
commit('SET_ROLES', [])
commit('SET_PERMISSIONS', [])
localStorage.setItem('POOL_NAME_LIST',[])
localStorage.setItem('USER_POOL_NAME_CURRENT','')
removeToken()
resolve()
}).catch(error => {
@ -110,6 +114,8 @@ const user = {
FedLogOut({ commit }) {
return new Promise(resolve => {
commit('SET_TOKEN', '')
localStorage.setItem('POOL_NAME_LIST',[])
localStorage.setItem('USER_POOL_NAME_CURRENT','')
removeToken()
resolve()
})

@ -22,6 +22,9 @@ const service = axios.create({
// request拦截器
service.interceptors.request.use(config => {
if(localStorage.getItem('USER_POOL_NAME_CURRENT')){
config.headers['poolName'] = localStorage.getItem('USER_POOL_NAME_CURRENT');
}
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
// 是否需要防止数据重复提交

Loading…
Cancel
Save