fix: 解决 ssl 启用和端口修改跳转问题 (#1030)

This commit is contained in:
ssongliu 2023-05-13 20:20:30 +08:00 committed by GitHub
parent 43652b2a54
commit 2ae1db4730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -31,6 +31,8 @@ import { MsgSuccess } from '@/utils/message';
import { updatePort } from '@/api/modules/setting';
import { ElMessageBox, FormInstance } from 'element-plus';
import { Rules } from '@/global/form-rules';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
interface DialogProps {
serverPort: number;
@ -66,9 +68,10 @@ const onSavePort = async (formEl: FormInstance | undefined) => {
.then(() => {
loading.value = false;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
globalStore.isLogin = false;
let href = window.location.href;
let ip = href.split('//')[1].split(':')[0];
window.open(`${href.split('//')[0]}//${ip}:${form.serverPort}/`, '_self');
window.open(`${href.split('//')[0]}//${ip}:${form.serverPort}/${globalStore.entrance}`, '_self');
})
.catch(() => {
loading.value = false;

View File

@ -112,6 +112,8 @@ import { DownloadByPath } from '@/api/modules/files';
import { Rules } from '@/global/form-rules';
import { ElMessageBox, FormInstance } from 'element-plus';
import { Setting } from '@/api/interface/setting';
import { GlobalStore } from '@/store';
const globalStore = GlobalStore();
const loading = ref();
const drawerVisiable = ref();
@ -207,8 +209,10 @@ const onSaveSSL = async (formEl: FormInstance | undefined) => {
await updateSSL(param).then(() => {
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
let href = window.location.href;
globalStore.isLogin = false;
let address = href.split('://')[1];
window.open(`https://${address}/`, '_self');
address = address.replaceAll('settings/safe', globalStore.entrance);
window.open(`https://${address}`, '_self');
});
});
});