完善用户管理
This commit is contained in:
parent
2c367ad0ba
commit
cf39de10d8
@ -39,8 +39,8 @@ onMounted(() => {
|
|||||||
<li v-if="store.getters.isAdmin">
|
<li v-if="store.getters.isAdmin">
|
||||||
<router-link to="/account/upload-log">管理: 上传日志</router-link>
|
<router-link to="/account/upload-log">管理: 上传日志</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="store.getters.isSuperAdmin">
|
<li v-if="store.getters.isAdmin">
|
||||||
<router-link to="/account/user-management">超管: 管理用户</router-link>
|
<router-link to="/account/user-management">管理: 管理用户</router-link>
|
||||||
</li>
|
</li>
|
||||||
<li v-if="isMobile">
|
<li v-if="isMobile">
|
||||||
<router-link to="/account">用户信息</router-link>
|
<router-link to="/account">用户信息</router-link>
|
||||||
|
@ -50,7 +50,26 @@ const role2Text = (id) => {
|
|||||||
return '超管';
|
return '超管';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const approve = (uid) => {
|
||||||
|
swal.window('info', '确定认证此账户?', store.getters.isSuperAdmin ? '' : '此操作不可由本账号撤销', '确实', '取消').then(async (result) => {
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
let response;
|
||||||
|
try {
|
||||||
|
response = await api.put(`/users/${uid}/role`, {
|
||||||
|
role: 1
|
||||||
|
})
|
||||||
|
if (response.code === 0) {
|
||||||
|
swal.tip('success', '认证成功');
|
||||||
|
refreshList(currentPage.value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
swal.tip('error', '认证失败');
|
||||||
|
} catch (e) {
|
||||||
|
swal.tip('error', '网络连接错误');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
const changeRole = (uid) => {
|
const changeRole = (uid) => {
|
||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: '修改账号权限为',
|
title: '修改账号权限为',
|
||||||
@ -117,7 +136,8 @@ onMounted(() => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="operating">
|
<div class="operating">
|
||||||
<div class="change-role" @click="changeRole(user.uid)" v-if="user.role_id !== 3">修改权限</div>
|
<div class="change-role" @click="changeRole(user.uid)" v-if="user.role_id !== 3 && store.getters.isSuperAdmin">修改权限</div>
|
||||||
|
<div class="approve" @click="approve(user.uid)" v-if="user.role_id === 0">认证</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<paging-controller v-if="userList.length !== 0" :current-page="currentPage" :amount="amount" :go-page-func="goPage"/>
|
<paging-controller v-if="userList.length !== 0" :current-page="currentPage" :amount="amount" :go-page-func="goPage"/>
|
||||||
@ -220,5 +240,8 @@ onMounted(() => {
|
|||||||
background: white;
|
background: white;
|
||||||
border: black solid 1px;
|
border: black solid 1px;
|
||||||
}
|
}
|
||||||
|
.theme-light .approve:hover {
|
||||||
|
background: black;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
@ -94,6 +94,9 @@ router.beforeEach((to, from, next) => {
|
|||||||
if (to.path === '/account/upload-log' && !store.getters.isAdmin) {
|
if (to.path === '/account/upload-log' && !store.getters.isAdmin) {
|
||||||
next('/account');
|
next('/account');
|
||||||
}
|
}
|
||||||
|
if (to.path === '/account/user-management' && !store.getters.isAdmin) {
|
||||||
|
next('/account');
|
||||||
|
}
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user