fix: 修复部分已知的问题
This commit is contained in:
parent
f946d05815
commit
7a27cdb3ab
@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import type { VNode } from 'vue';
|
import type { VNode } from 'vue';
|
||||||
import { useBoolean, useLoading } from '@sa/hooks';
|
import { useBoolean } from '@sa/hooks';
|
||||||
import { useAuthStore } from '@/store/modules/auth';
|
import { useAuthStore } from '@/store/modules/auth';
|
||||||
import { useRouterPush } from '@/hooks/common/router';
|
import { useRouterPush } from '@/hooks/common/router';
|
||||||
import { useSvgIcon } from '@/hooks/common/icon';
|
import { useSvgIcon } from '@/hooks/common/icon';
|
||||||
@ -16,9 +16,6 @@ const authStore = useAuthStore();
|
|||||||
const { routerPushByKey, toLogin } = useRouterPush();
|
const { routerPushByKey, toLogin } = useRouterPush();
|
||||||
const { SvgIconVNode } = useSvgIcon();
|
const { SvgIconVNode } = useSvgIcon();
|
||||||
|
|
||||||
// 使用 useBoolean 管理加载状态
|
|
||||||
const { loading: avatarLoading, endLoading: endAvatarLoading } = useLoading(true);
|
|
||||||
// 使用 useBoolean 管理错误状态
|
|
||||||
const { bool: avatarError, setTrue: setError, setFalse: clearError } = useBoolean(false);
|
const { bool: avatarError, setTrue: setError, setFalse: clearError } = useBoolean(false);
|
||||||
|
|
||||||
function loginOrRegister() {
|
function loginOrRegister() {
|
||||||
@ -26,12 +23,10 @@ function loginOrRegister() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleAvatarLoad() {
|
function handleAvatarLoad() {
|
||||||
endAvatarLoading();
|
|
||||||
clearError();
|
clearError();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleAvatarError() {
|
function handleAvatarError() {
|
||||||
endAvatarLoading();
|
|
||||||
setError();
|
setError();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,7 +90,6 @@ function handleDropdown(key: DropdownKey) {
|
|||||||
</NButton>
|
</NButton>
|
||||||
<NDropdown v-else placement="bottom" trigger="click" :options="options" @select="handleDropdown">
|
<NDropdown v-else placement="bottom" trigger="click" :options="options" @select="handleDropdown">
|
||||||
<div class="flex cursor-pointer items-center rounded-md px-2 py-1 transition-colors duration-300 hover:bg-black/6">
|
<div class="flex cursor-pointer items-center rounded-md px-2 py-1 transition-colors duration-300 hover:bg-black/6">
|
||||||
<NSpin :show="avatarLoading">
|
|
||||||
<div class="flex items-center gap-2" :class="{ 'opacity-50': avatarError }">
|
<div class="flex items-center gap-2" :class="{ 'opacity-50': avatarError }">
|
||||||
<NAvatar
|
<NAvatar
|
||||||
v-if="authStore.userInfo.user?.avatar"
|
v-if="authStore.userInfo.user?.avatar"
|
||||||
@ -110,7 +104,6 @@ function handleDropdown(key: DropdownKey) {
|
|||||||
{{ authStore.userInfo.user?.nickName }}
|
{{ authStore.userInfo.user?.nickName }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</NSpin>
|
|
||||||
</div>
|
</div>
|
||||||
</NDropdown>
|
</NDropdown>
|
||||||
</template>
|
</template>
|
||||||
|
@ -13,7 +13,7 @@ export function fetchSocialAuthBinding(source: Api.System.SocialSource, tenantId
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 解绑账户 */
|
/** 解绑账户 */
|
||||||
export function fetchSocialAuthUnbinding(socialId: string) {
|
export function fetchSocialAuthUnbinding(socialId: CommonType.IdType) {
|
||||||
return request<string>({
|
return request<string>({
|
||||||
url: `/auth/unlock/${socialId}`,
|
url: `/auth/unlock/${socialId}`,
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
|
@ -97,7 +97,9 @@ export const useRouteStore = defineStore(SetupStoreId.Route, () => {
|
|||||||
// @ts-expect-error no query field
|
// @ts-expect-error no query field
|
||||||
const query = route.query ? String(route.query) : undefined;
|
const query = route.query ? String(route.query) : undefined;
|
||||||
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
|
route.path = route.path.startsWith('//') ? route.path.substring(1) : route.path;
|
||||||
|
route.path = parent ? parent.path + route.path : route.path;
|
||||||
const name = humpToLine(route.path.substring(1).replace('/', '_'));
|
const name = humpToLine(route.path.substring(1).replace('/', '_'));
|
||||||
|
|
||||||
route.name = parent ? `${parent.name}_${name}` : name;
|
route.name = parent ? `${parent.name}_${name}` : name;
|
||||||
|
|
||||||
route.meta = route.meta ? route.meta : { title: route.name };
|
route.meta = route.meta ? route.meta : { title: route.name };
|
||||||
|
2
src/typings/api/system.api.d.ts
vendored
2
src/typings/api/system.api.d.ts
vendored
@ -152,6 +152,8 @@ declare namespace Api {
|
|||||||
|
|
||||||
/** social */
|
/** social */
|
||||||
type Social = Common.CommonRecord<{
|
type Social = Common.CommonRecord<{
|
||||||
|
/** 主键 */
|
||||||
|
id: CommonType.IdType;
|
||||||
/** 用户ID */
|
/** 用户ID */
|
||||||
userId: CommonType.IdType;
|
userId: CommonType.IdType;
|
||||||
/** 租户ID */
|
/** 租户ID */
|
||||||
|
@ -30,8 +30,8 @@ const tenantOption = ref<SelectOption[]>([]);
|
|||||||
|
|
||||||
const model: Api.Auth.PwdLoginForm = reactive({
|
const model: Api.Auth.PwdLoginForm = reactive({
|
||||||
tenantId: '000000',
|
tenantId: '000000',
|
||||||
username: '',
|
username: 'admin',
|
||||||
password: ''
|
password: 'admin123'
|
||||||
});
|
});
|
||||||
type RuleKey = Extract<keyof Api.Auth.PwdLoginForm, 'username' | 'password' | 'code' | 'tenantId'>;
|
type RuleKey = Extract<keyof Api.Auth.PwdLoginForm, 'username' | 'password' | 'code' | 'tenantId'>;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ async function bindSsoAccount(type: Api.System.SocialSource) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** 解绑SSO账户 */
|
/** 解绑SSO账户 */
|
||||||
async function unbindSsoAccount(socialId: string) {
|
async function unbindSsoAccount(socialId: CommonType.IdType) {
|
||||||
startBtnLoading();
|
startBtnLoading();
|
||||||
const { error } = await fetchSocialAuthUnbinding(socialId);
|
const { error } = await fetchSocialAuthUnbinding(socialId);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
@ -83,7 +83,7 @@ function getSocial(key: string) {
|
|||||||
type="error"
|
type="error"
|
||||||
size="small"
|
size="small"
|
||||||
:loading="btnLoading"
|
:loading="btnLoading"
|
||||||
@click="unbindSsoAccount(socialList.find(s => s.source === source.key)?.authId || '')"
|
@click="unbindSsoAccount(getSocial(source.key)?.id || '')"
|
||||||
>
|
>
|
||||||
解绑
|
解绑
|
||||||
</NButton>
|
</NButton>
|
||||||
|
Loading…
Reference in New Issue
Block a user