diff --git a/core/core-frontend/src/views/login/index.vue b/core/core-frontend/src/views/login/index.vue index 1590f1f3ea..31a1d936f9 100644 --- a/core/core-frontend/src/views/login/index.vue +++ b/core/core-frontend/src/views/login/index.vue @@ -230,7 +230,6 @@ onMounted(async () => { if (!checkPlatform()) { const res = await loginCategoryApi() if (res.data) { - debugger loadingText.value = '加载中...' document.getElementsByClassName('ed-loading-text')?.length && (document.getElementsByClassName('ed-loading-text')[0]['innerText'] = loadingText.value) diff --git a/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue b/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue index d7358a2a64..588d3526cd 100644 --- a/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue +++ b/core/core-frontend/src/views/system/parameter/basic/BasicEdit.vue @@ -19,12 +19,7 @@ const pvpOptions = [ { value: '3', label: '三个月' }, { value: '4', label: '一个月' } ] -const loginOptions = [ - { value: '0', label: '普通登录' }, - { value: '1', label: 'LDAP' }, - { value: '2', label: 'OIDC' }, - { value: '3', label: 'CAS' } -] + const state = reactive({ form: reactive({ dsIntervalTime: '30', @@ -33,7 +28,13 @@ const state = reactive({ }), settingList: [], orgOptions: [], - roleOptions: [] + roleOptions: [], + loginOptions: [ + { value: '0', label: '普通登录' }, + { value: '1', label: 'LDAP' }, + { value: '2', label: 'OIDC' }, + { value: '3', label: 'CAS' } + ] }) const rule = reactive({ @@ -117,9 +118,10 @@ const closeLoading = () => { loadingInstance.value?.close() } -const edit = (list, orgOptions, roleOptions) => { +const edit = (list, orgOptions, roleOptions, loginOptions) => { state.orgOptions = orgOptions || [] state.roleOptions = roleOptions || [] + state.loginOptions = loginOptions || [] state.settingList = list.map(item => { const pkey = item.pkey if (pkey === 'basic.logLiveTime') { @@ -331,7 +333,7 @@ defineExpose({
- + {{ item.label }} diff --git a/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue b/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue index a291a33e37..fdb82f0432 100644 --- a/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue +++ b/core/core-frontend/src/views/system/parameter/basic/BasicInfo.vue @@ -22,6 +22,7 @@ import { useI18n } from '@/hooks/web/useI18n' const { t } = useI18n() const editor = ref() const infoTemplate = ref() +const showDefaultLogin = ref(false) const pvpOptions = [ { value: '0', label: '永久' }, { value: '1', label: '一年' }, @@ -29,12 +30,6 @@ const pvpOptions = [ { value: '3', label: '三个月' }, { value: '4', label: '一个月' } ] -const loginOptions = [ - { value: '0', label: '普通登录' }, - { value: '1', label: 'LDAP' }, - { value: '2', label: 'OIDC' }, - { value: '3', label: 'CAS' } -] const tooltips = [ { key: 'setting_basic.frontTimeOut', @@ -65,6 +60,12 @@ const state = reactive({ children: null, disabled: false } + ], + loginOptions: [ + { value: '0', label: '普通登录' }, + { value: '1', label: 'LDAP' }, + { value: '2', label: 'OIDC' }, + { value: '3', label: 'CAS' } ] }) let originData = [] @@ -111,12 +112,27 @@ const search = cb => { selectedPvp.value = item.pval || '0' item.pval = pvpOptions.filter(cur => cur.value === selectedPvp.value)[0].label } else if (item.pkey === 'basic.defaultLogin') { - item.pval = item.pval ? loginOptions[parseInt(item.pval)].label : loginOptions[0].label + await queryCategoryStatus() + if (showDefaultLogin.value) { + if (item.pval) { + const r = state.loginOptions.filter(cur => cur.value === item.pval) + if (r?.length) { + item.pval = r[0].label + } else { + item.pval = state.loginOptions[0].label + resetDefaultLogin() + } + } else { + item.pval = state.loginOptions[0].label + } + } } else { item.pval = item.pval } item.pkey = 'setting_' + item.pkey - state.templateList.push(item) + if (!item.pkey.includes('defaultLogin') || showDefaultLogin.value) { + state.templateList.push(item) + } } cb && cb() }) @@ -132,7 +148,8 @@ const edit = () => { editor?.value.edit( cloneDeep(originData), cloneDeep(state.orgOptions), - cloneDeep(state.roleOptions) + cloneDeep(state.roleOptions), + cloneDeep(state.loginOptions) ) } const loadOrgOptions = async () => { @@ -181,4 +198,39 @@ const groupBy = list => { }) return map } +const queryCategoryStatus = async () => { + const url = `/setting/authentication/status` + const res = await request.get({ url }) + const data = res.data + const map = data.reduce((acc, { name, enable }) => { + acc[name] = enable + return acc + }, {}) + let len = state.loginOptions.length + while (len--) { + const item = state.loginOptions[len] + if (item.value !== '0' && !map[item.label.toLocaleLowerCase()]) { + state.loginOptions.splice(len, 1) + } + } + showDefaultLogin.value = state.loginOptions.length > 1 + if (!showDefaultLogin.value) { + let len = originData.length + while (len--) { + const item = originData[len] + if (item.pkey === 'basic.defaultLogin') { + originData.splice(len, 1) + } + } + } +} +const resetDefaultLogin = () => { + let len = originData.length + while (len--) { + const item = originData[len] + if (item.pkey === 'basic.defaultLogin') { + item.pval = '0' + } + } +} diff --git a/de-xpack b/de-xpack index 6e7664b9ff..d56a37a730 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 6e7664b9ff1dde971b833369f6d8fa590e0fa432 +Subproject commit d56a37a7307c202176e9cfd26c03f2cbed0cf515