Skip to content

Commit ff9f807

Browse files
committed
[fix]bug
1 parent ac3c2ff commit ff9f807

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/api/user.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { request } from '@/utils/request';
22
import { FindUserReply, UserCaptchaReply, UserInfoReply, UserLoginReply, UserStatusReply } from '@/api/model/userModel';
33

44
const Api = {
5-
UserLogin: '/auth/login',
6-
UserCaptcha: '/auth/captcha',
7-
UserStatus: '/auth/status',
5+
UserLogin: '/auth/pub/login',
6+
UserLogout: '/auth/logout',
7+
UserCaptcha: '/auth/pub/captcha',
8+
UserStatus: '/auth/pub/status',
89
UserInfo: '/auth/info',
9-
Register: '/auth/register',
10+
Register: '/auth/pub/register',
1011
FindUser: '/auth/user',
1112
UpdateUser: '/auth/user',
1213
DeleteUser: '/auth/user',
@@ -19,6 +20,12 @@ export function login(data) {
1920
});
2021
}
2122

23+
export function logout() {
24+
return request.post({
25+
url: Api.UserLogout,
26+
});
27+
}
28+
2229
export function captcha() {
2330
return request.get<UserCaptchaReply>({
2431
url: Api.UserCaptcha,

src/constants/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const BOOL = {
2-
TRUE: '1',
3-
FALSE: '0',
2+
TRUE: true,
3+
FALSE: false,
44
};
55

66
export const LOCKED_OPTIONS = [

src/layouts/components/Header.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ import type { MenuRoute } from '@/types/interface';
7676
import Notice from './Notice.vue';
7777
import Search from './Search.vue';
7878
import MenuContent from './MenuContent.vue';
79+
import { logout } from '@/api/user';
7980
8081
const props = defineProps({
8182
theme: {
@@ -143,7 +144,8 @@ const handleNav = (url) => {
143144
router.push(url);
144145
};
145146
146-
const handleLogout = () => {
147+
const handleLogout = async () => {
148+
await logout();
147149
router.push({
148150
path: '/login',
149151
query: { redirect: encodeURIComponent(router.currentRoute.value.fullPath) },

src/pages/system/user/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ const cancelUnlock = () => {
409409
const confirmUnlock = async () => {
410410
const params = {
411411
id: unlockIdx.value,
412-
locked: 0,
412+
locked: false,
413413
};
414414
try {
415415
await updateUser(params);
@@ -434,7 +434,7 @@ const cancelLock = () => {
434434
const confirmLock = async () => {
435435
const params = {
436436
id: lockIdx.value,
437-
locked: 1,
437+
locked: true,
438438
lockExpireTime: '',
439439
};
440440
if (!lockFormData.value.forever) {
@@ -595,7 +595,7 @@ const handleRowLock = ({ row }) => {
595595
596596
const handleRowUnlock = ({ row }) => {
597597
unlockIdx.value = row.id;
598-
lockHeader.value = `解锁"${row.username}"?`;
598+
unlockHeader.value = `解锁"${row.username}"?`;
599599
unlockVisible.value = true;
600600
};
601601

0 commit comments

Comments
 (0)