perf: 第三方登录允许选择logo

This commit is contained in:
xiaojunnuo
2025-12-03 00:35:17 +08:00
parent 78b1650bdb
commit bb3085ef84
11 changed files with 57 additions and 37 deletions
+1 -1
View File
@@ -69,7 +69,7 @@ export function errorLog(error: any, notify = true) {
* @description 创建一个错误
*/
export function errorCreate(msg: string, notify = true, data?: any) {
const err = new CodeError(msg, data.code, data.data);
const err = new CodeError(msg, data?.code || 1, data?.data);
console.error("errorCreate", err);
if (notify) {
uiContext.get().notification.error({ message: err.message });
@@ -142,6 +142,7 @@ export const useUserStore = defineStore({
url: provider.logoutUrl,
method: "get",
withCredentials: true,
showErrorNotify: false,
});
} catch (e) {
console.error("注销第三方登录失败:", e);
@@ -278,7 +278,7 @@ export default defineComponent({
//}
.fs-icon {
color: rgba(0, 0, 0, 0.45);
// color: rgba(0, 0, 0, 0.45);
margin-right: 4px;
}
@@ -18,6 +18,7 @@ import { computed, onMounted, ref } from "vue";
import * as api from "./api";
import { useI18n } from "vue-i18n";
import { useSettingStore } from "/@/store/settings";
import { useRoute } from "vue-router";
const oauthProviderList = ref([]);
const props = defineProps<{
@@ -30,10 +31,13 @@ const computedTitle = computed(() => {
});
const settingStore = useSettingStore();
const route = useRoute();
const queryOauthOnly = route.query.oauthOnly as string;
onMounted(async () => {
oauthProviderList.value = await api.GetOauthProviders();
//如果开启了自动跳转登录
if (settingStore.sysPublic.oauthAutoRedirect) {
if (settingStore.sysPublic.oauthAutoRedirect && queryOauthOnly !== "false") {
const firstOauth = oauthProviderList.value.find(item => item.addonId > 0);
if (firstOauth) {
goOauthLogin(firstOauth.name);
@@ -99,7 +103,7 @@ async function goOauthLogin(type: string) {
border-radius: 100px;
.fs-icon {
font-size: 36px;
color: #006be6 !important;
color: #006be6;
margin: 0px !important;
}
}
@@ -128,6 +128,7 @@ const onFinish = async (form: any) => {
notification.success({
message: t("certd.saveSuccess"),
});
await loadOauthProviders();
} finally {
saveLoading.value = false;
}