登录接口完成
This commit is contained in:
@@ -29,7 +29,7 @@ VITE_HTTP_PROXY=N
|
|||||||
VITE_ROUTER_HISTORY_MODE=history
|
VITE_ROUTER_HISTORY_MODE=history
|
||||||
|
|
||||||
# success code of backend service, when the code is received, the request is successful
|
# success code of backend service, when the code is received, the request is successful
|
||||||
VITE_SERVICE_SUCCESS_CODE=0000
|
VITE_SERVICE_SUCCESS_CODE=0
|
||||||
|
|
||||||
# logout codes of backend service, when the code is received, the user will be logged out and redirected to login page
|
# logout codes of backend service, when the code is received, the user will be logged out and redirected to login page
|
||||||
VITE_SERVICE_LOGOUT_CODES=8888,8889
|
VITE_SERVICE_LOGOUT_CODES=8888,8889
|
||||||
@@ -47,7 +47,7 @@ VITE_STATIC_SUPER_ROLE=R_SUPER
|
|||||||
VITE_SOURCE_MAP=N
|
VITE_SOURCE_MAP=N
|
||||||
|
|
||||||
# Used to differentiate storage across different domains
|
# Used to differentiate storage across different domains
|
||||||
VITE_STORAGE_PREFIX=SOY_
|
VITE_STORAGE_PREFIX=
|
||||||
|
|
||||||
# used to control whether the program automatically detects updates
|
# used to control whether the program automatically detects updates
|
||||||
VITE_AUTOMATICALLY_DETECT_UPDATE=Y
|
VITE_AUTOMATICALLY_DETECT_UPDATE=Y
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ function handleDropdown(key: DropdownKey) {
|
|||||||
<div>
|
<div>
|
||||||
<ButtonIcon>
|
<ButtonIcon>
|
||||||
<SvgIcon icon="ph:user-circle" class="text-icon-large" />
|
<SvgIcon icon="ph:user-circle" class="text-icon-large" />
|
||||||
<span class="text-16px font-medium">{{ authStore.userInfo.userName }}</span>
|
<span class="text-16px font-medium">{{ authStore.userInfo.username }}</span>
|
||||||
</ButtonIcon>
|
</ButtonIcon>
|
||||||
</div>
|
</div>
|
||||||
</NDropdown>
|
</NDropdown>
|
||||||
|
|||||||
@@ -46,12 +46,12 @@ const { isFullscreen, toggle } = useFullscreen();
|
|||||||
:lang-options="appStore.localeOptions"
|
:lang-options="appStore.localeOptions"
|
||||||
@change-lang="appStore.changeLocale"
|
@change-lang="appStore.changeLocale"
|
||||||
/>
|
/>
|
||||||
<ThemeSchemaSwitch
|
<!-- <ThemeSchemaSwitch
|
||||||
:theme-schema="themeStore.themeScheme"
|
:theme-schema="themeStore.themeScheme"
|
||||||
:is-dark="themeStore.darkMode"
|
:is-dark="themeStore.darkMode"
|
||||||
@switch="themeStore.toggleThemeScheme"
|
@switch="themeStore.toggleThemeScheme"
|
||||||
/>
|
/>
|
||||||
<ThemeButton />
|
<ThemeButton /> -->
|
||||||
<UserAvatar />
|
<UserAvatar />
|
||||||
</div>
|
</div>
|
||||||
</DarkModeContainer>
|
</DarkModeContainer>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function fetchLogin(username: string, password: string) {
|
|||||||
|
|
||||||
/** Get user info */
|
/** Get user info */
|
||||||
export function fetchGetUserInfo() {
|
export function fetchGetUserInfo() {
|
||||||
return request<Api.Auth.UserInfo>({ url: '/auth/getUserInfo' });
|
return request<Api.Auth.UserInfo>({ url: '/api/auth/me' });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
|
|
||||||
const userInfo: Api.Auth.UserInfo = reactive({
|
const userInfo: Api.Auth.UserInfo = reactive({
|
||||||
userId: '',
|
userId: '',
|
||||||
userName: '',
|
username: '',
|
||||||
roles: [],
|
roles: [],
|
||||||
buttons: []
|
buttons: []
|
||||||
});
|
});
|
||||||
@@ -130,7 +130,6 @@ export const useAuthStore = defineStore(SetupStoreId.Auth, () => {
|
|||||||
async function loginByToken(loginToken: Api.Auth.LoginToken) {
|
async function loginByToken(loginToken: Api.Auth.LoginToken) {
|
||||||
// 1. stored in the localStorage, the later requests need it in headers
|
// 1. stored in the localStorage, the later requests need it in headers
|
||||||
localStg.set('token', loginToken.token);
|
localStg.set('token', loginToken.token);
|
||||||
localStg.set('refreshToken', loginToken.refreshToken);
|
|
||||||
|
|
||||||
// 2. get user info
|
// 2. get user info
|
||||||
const pass = await getUserInfo();
|
const pass = await getUserInfo();
|
||||||
|
|||||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare namespace Api {
|
|||||||
|
|
||||||
interface UserInfo {
|
interface UserInfo {
|
||||||
userId: string;
|
userId: string;
|
||||||
userName: string;
|
username: string;
|
||||||
roles: string[];
|
roles: string[];
|
||||||
buttons: string[];
|
buttons: string[];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ interface FormModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const model: FormModel = reactive({
|
const model: FormModel = reactive({
|
||||||
userName: 'Soybean',
|
userName: 'admin1',
|
||||||
password: '123456'
|
password: '123456'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user