mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决域名非 80 端口时快速跳转地址错误的问题 (#3281)
This commit is contained in:
parent
d60e8167b0
commit
d567491770
@ -5,7 +5,7 @@
|
||||
</template>
|
||||
<el-table-column width="30px">
|
||||
<template #default="{ row }">
|
||||
<el-button link :icon="Promotion" @click="openUrl(row.domain, row.port)"></el-button>
|
||||
<el-button link :icon="Promotion" @click="openUrl(row)"></el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('website.domain')" prop="domain"></el-table-column>
|
||||
@ -31,6 +31,7 @@ import { computed, onMounted, ref } from 'vue';
|
||||
import i18n from '@/lang';
|
||||
import { Promotion } from '@element-plus/icons-vue';
|
||||
import { GlobalStore } from '@/store';
|
||||
import { CheckAppInstalled } from '@/api/modules/app';
|
||||
const globalStore = GlobalStore();
|
||||
|
||||
const props = defineProps({
|
||||
@ -50,6 +51,8 @@ const data = ref<Website.Domain[]>([]);
|
||||
const domainRef = ref();
|
||||
const website = ref<Website.WebsiteDTO>();
|
||||
const opRef = ref();
|
||||
const httpPort = ref(80);
|
||||
const httpsPort = ref(443);
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
@ -67,10 +70,14 @@ const openCreate = () => {
|
||||
domainRef.value.acceptParams(id.value);
|
||||
};
|
||||
|
||||
const openUrl = (domain: string, port: string) => {
|
||||
let url = website.value.protocol.toLowerCase() + '://' + domain;
|
||||
if (port != '80') {
|
||||
url = url + ':' + port;
|
||||
const openUrl = (domain: Website.Domain) => {
|
||||
const protocol = website.value.protocol.toLowerCase();
|
||||
let url = protocol + '://' + domain.domain;
|
||||
if (protocol == 'http' && domain.port != 80) {
|
||||
url = url + ':' + domain.port;
|
||||
}
|
||||
if (protocol == 'https') {
|
||||
url = url + ':' + httpsPort.value;
|
||||
}
|
||||
window.open(url);
|
||||
};
|
||||
@ -97,6 +104,7 @@ const search = (id: number) => {
|
||||
.finally(() => {
|
||||
loading.value = false;
|
||||
});
|
||||
onCheck();
|
||||
};
|
||||
|
||||
const getWebsite = (id: number) => {
|
||||
@ -105,6 +113,15 @@ const getWebsite = (id: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
const onCheck = async () => {
|
||||
await CheckAppInstalled('openresty', '')
|
||||
.then((res) => {
|
||||
httpPort.value = res.data.httpPort;
|
||||
httpsPort.value = res.data.httpsPort;
|
||||
})
|
||||
.catch(() => {});
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
search(id.value);
|
||||
getWebsite(id.value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user