perf: 优化权限分配问题

This commit is contained in:
jmal 2024-03-11 11:50:12 +08:00
parent a92330f7d1
commit 5cae241ccc
4 changed files with 12 additions and 10 deletions

View File

@ -47,6 +47,14 @@ export function testLdapConfig(data) {
} }
export function getInfo(params) { export function getInfo(params) {
return request({
url: 'user/info',
method: 'get',
params
})
}
export function getUserInfo(params) {
return request({ return request({
url: 'user/userInfo', url: 'user/userInfo',
method: 'get', method: 'get',

View File

@ -141,10 +141,7 @@ const actions = {
// get user info // get user info
getInfo({ commit, state }) { getInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
getInfo({ getInfo().then(response => {
id: state.userId,
token: state.token
}).then(response => {
const { data } = response const { data } = response
if (!data) { if (!data) {
// reject('Verification failed, please Login again.') // reject('Verification failed, please Login again.')

View File

@ -172,10 +172,7 @@
} }
}, },
getInfo(){ getInfo(){
getInfo({ getInfo().then(async res => {
id: this.$store.state.user.userId,
takeUpSpace: true,
}).then(async res => {
this.userInfo = res.data this.userInfo = res.data
if (this.userInfo.roles && this.userInfo.roles.includes('admin')) { if (this.userInfo.roles && this.userInfo.roles.includes('admin')) {
this.$emit('isAdmin', true) this.$emit('isAdmin', true)

View File

@ -82,7 +82,7 @@
</template> </template>
<script> <script>
import {addUser, delUser, getInfo, resetPass, userList, userUpdate} from '@/api/user' import {addUser, delUser, getUserInfo, resetPass, userList, userUpdate} from '@/api/user'
import roleApi from '@/api/role' import roleApi from '@/api/role'
import CropperDialog from '@/components/Cropper/dialog' import CropperDialog from '@/components/Cropper/dialog'
import TableList from "@/components/table/TableList"; import TableList from "@/components/table/TableList";
@ -269,7 +269,7 @@ export default {
this.editMove = 2 this.editMove = 2
this.dialogVisible = true this.dialogVisible = true
this.dialogTitle = '修改用户' this.dialogTitle = '修改用户'
getInfo({ getUserInfo({
id: id, id: id,
}).then(res => { }).then(res => {
this.form = res.data this.form = res.data