diff --git a/frontend/src/components/layout/Person.vue b/frontend/src/components/layout/Person.vue index ac689b12e..730c94567 100644 --- a/frontend/src/components/layout/Person.vue +++ b/frontend/src/components/layout/Person.vue @@ -20,6 +20,7 @@ import { useUserStore } from '@/stores/user' import { userApi } from '@/api/auth' import { toLoginPage } from '@/utils/utils' import { useCache } from '@/utils/useCache' +import { resolveHelpUrl } from '@/utils/helpUrl' const { wsCache } = useCache() const router = useRouter() @@ -90,7 +91,7 @@ const changeLanguage = (lang: string) => { } const openHelp = () => { - window.open(appearanceStore.getHelp || 'https://dataease.cn/sqlbot/', '_blank') + window.open(resolveHelpUrl(appearanceStore.getHelp), '_blank') } const openPwd = () => { diff --git a/frontend/src/utils/helpUrl.ts b/frontend/src/utils/helpUrl.ts new file mode 100644 index 000000000..4bc752a40 --- /dev/null +++ b/frontend/src/utils/helpUrl.ts @@ -0,0 +1,7 @@ +export const DEFAULT_HELP_URL = 'https://docs.fit2cloud.com/sqlbot/' + +const legacyDefaultHelpUrl = /^https:\/\/dataease\.cn\/sqlbot(?:\/v1)?\/?$/ + +export const resolveHelpUrl = (url?: string | null): string => { + return !url || legacyDefaultHelpUrl.test(url) ? DEFAULT_HELP_URL : url +} diff --git a/frontend/src/views/system/appearance/index.vue b/frontend/src/views/system/appearance/index.vue index 45a07c869..0ac803fc1 100644 --- a/frontend/src/views/system/appearance/index.vue +++ b/frontend/src/views/system/appearance/index.vue @@ -295,6 +295,7 @@ import { useAppearanceStoreWithOut } from '@/stores/appearance' import LoginPreview from './LoginPreview.vue' import Person from './Person.vue' import { setCurrentColor } from '@/utils/utils' +import { DEFAULT_HELP_URL, resolveHelpUrl } from '@/utils/helpUrl' // import TinymceEditor from '@/components/rich-text/TinymceEditor.vue' import { cloneDeep } from 'lodash-es' @@ -371,7 +372,7 @@ const rules = reactive({ }) const defaultTopForm = { - help: 'https://dataease.cn/sqlbot/v1/', + help: DEFAULT_HELP_URL, showDoc: '0', showAbout: '0', pc_welcome: '', @@ -506,7 +507,8 @@ const init = () => { } else if (Object.prototype.hasOwnProperty.call(loginForm, pkey)) { loginForm[pkey as keyof typeof loginForm] = pval } else if (Object.prototype.hasOwnProperty.call(topForm, pkey)) { - topForm[pkey as keyof typeof topForm] = pval + topForm[pkey as keyof typeof topForm] = + pkey === 'help' && pval ? resolveHelpUrl(pval) : pval } else if (pkey === 'mobileLogin') { mobileLogin.value = pval } else if (pkey === 'mobileLoginBg') {