feat: 应用增加跳转功能 (#1520)

This commit is contained in:
ssongliu 2023-07-04 10:46:11 +08:00 committed by GitHub
parent 0a55dec949
commit 72dcdbad1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 34 additions and 19 deletions

View file

@ -114,6 +114,7 @@ const message = {
fileNameErr:
'You can upload only files whose name contains 1 to 256 characters, including English, Chinese, digits, or periods (.-_)',
confirmNoNull: 'Make sure the value {0} is not empty',
errPort: 'Incorrect port information, please confirm!',
},
login: {
username: 'UserName',

View file

@ -115,6 +115,7 @@ const message = {
fileExist: '當前文件夾已存在該文件不支持重復上傳',
fileNameErr: '僅支持上傳名稱包含英文中文數字或者 .-_ ,長度 1-256 位的文件',
confirmNoNull: '請確認 {0} 值不為空',
errPort: '錯誤的端口信息請確認',
},
login: {
username: '用戶名',

View file

@ -115,6 +115,7 @@ const message = {
fileExist: '当前文件夹已存在该文件不支持重复上传',
fileNameErr: '仅支持上传名称包含英文中文数字或者 .-_ ,长度 1-256 位的文件',
confirmNoNull: '请确认 {0} 值不为空',
errPort: '错误的端口信息请确认',
},
login: {
username: '用户名',

View file

@ -1,4 +1,6 @@
import { getSettingInfo } from '@/api/modules/setting';
import i18n from '@/lang';
import { MsgError } from './message';
export function deepCopy<T>(obj: any): T {
let newObj: any;
@ -256,3 +258,16 @@ export function downloadFile(filePath: string) {
let url = `${import.meta.env.VITE_API_URL as string}/files/download?`;
window.open(url + 'path=' + filePath, '_blank');
}
export async function JumpDashboard(port: any) {
if (Number(port) === 0) {
MsgError(i18n.global.t('setting.errPort'));
return;
}
const res = await getSettingInfo();
if (!res.data.systemIP) {
MsgError(i18n.global.t('setting.systemIPWarning'));
return;
}
window.open(`http://${res.data.systemIP}:${port}`, '_blank');
}

View file

@ -187,8 +187,15 @@
</el-button>
</div>
<div class="d-description">
<el-tag>{{ $t('app.version') }}{{ installed.version }}</el-tag>
<el-tag v-if="installed.httpPort > 0">
<el-tag class="middle-center">
{{ $t('app.version') }}{{ installed.version }}
</el-tag>
<el-tag
class="middle-center"
v-if="installed.httpPort > 0"
@click="JumpDashboard(installed.httpPort)"
>
<el-icon class="middle-center"><Position /></el-icon>
{{ $t('app.busPort') }}{{ installed.httpPort }}
</el-tag>
<div class="description">
@ -257,6 +264,7 @@ import { getAge } from '@/utils/util';
import { useRouter } from 'vue-router';
import { MsgSuccess } from '@/utils/message';
import { toFolder } from '@/global/business';
import { JumpDashboard } from '@/utils/util';
const data = ref<any>();
const loading = ref(false);

View file

@ -164,9 +164,8 @@ import { Container } from '@/api/interface/container';
import { ElMessageBox } from 'element-plus';
import i18n from '@/lang';
import router from '@/routers';
import { MsgError, MsgSuccess } from '@/utils/message';
import { computeSize } from '@/utils/util';
import { getSettingInfo } from '@/api/modules/setting';
import { MsgSuccess } from '@/utils/message';
import { JumpDashboard, computeSize } from '@/utils/util';
const loading = ref();
const data = ref();
@ -201,12 +200,7 @@ const goDashboard = async (port: any) => {
return;
}
let portEx = port.split(':')[0];
const res = await getSettingInfo();
if (!res.data.systemIP) {
MsgError(i18n.global.t('setting.systemIPWarning'));
return;
}
window.open(`http://${res.data.systemIP}:${portEx}`, '_blank');
JumpDashboard(portEx);
};
const goSetting = async () => {

View file

@ -155,7 +155,7 @@ import Setting from '@/views/database/mysql/setting/index.vue';
import AppStatus from '@/components/app-status/index.vue';
import Backups from '@/components/backup/index.vue';
import UploadDialog from '@/components/upload/index.vue';
import { dateFormat } from '@/utils/util';
import { JumpDashboard, dateFormat } from '@/utils/util';
import { reactive, ref } from 'vue';
import { deleteCheckMysqlDB, loadRemoteAccess, searchMysqlDBs, updateMysqlDescription } from '@/api/modules/database';
import i18n from '@/lang';
@ -165,7 +165,6 @@ import { GetAppPort } from '@/api/modules/app';
import router from '@/routers';
import { MsgError, MsgSuccess } from '@/utils/message';
import useClipboard from 'vue-clipboard3';
import { getSettingInfo } from '@/api/modules/setting';
const { toClipboard } = useClipboard();
const loading = ref(false);
@ -265,13 +264,9 @@ const goDashboard = async () => {
phpVisiable.value = true;
return;
}
const res = await getSettingInfo();
if (!res.data.systemIP) {
MsgError(i18n.global.t('setting.systemIPWarning'));
return;
}
window.open(`http://${res.data.systemIP}:${phpadminPort.value}`, '_blank');
JumpDashboard(phpadminPort.value);
};
const getAppDetail = (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: key } });
};