1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-21 17:29:17 +08:00

118 lines
3.7 KiB
Vue
Raw Normal View History

<template>
2022-09-23 16:33:55 +08:00
<LayoutContent :header="$t('app.detail')" :back-name="'App'">
<div class="brief">
<el-row :gutter="20">
<el-col :span="4">
<div class="icon">
2022-09-23 16:33:55 +08:00
<el-image class="image" :src="'data:image/png;base64,' + app.icon"></el-image>
</div>
</el-col>
<el-col :span="20">
<div class="a-detail">
<div class="a-name">
2022-09-23 16:33:55 +08:00
<font size="5" style="font-weight: 800">{{ app.name }}</font>
</div>
<div class="a-description">
<span>
<font>
2022-09-23 16:33:55 +08:00
{{ app.shortDesc }}
</font>
</span>
</div>
2022-09-23 16:33:55 +08:00
<br />
<el-descriptions :column="1">
<el-descriptions-item :label="$t('app.version')">
2022-09-23 16:33:55 +08:00
<el-select v-model="version" @change="getDetail(version)">
<el-option v-for="(v, index) in app.versions" :key="index" :value="v" :label="v">
{{ v }}
</el-option>
</el-select>
</el-descriptions-item>
<el-descriptions-item :label="$t('app.source')">
2022-09-23 16:33:55 +08:00
<el-link @click="toLink(app.source)">
<el-icon><Link /></el-icon>
</el-link>
</el-descriptions-item>
<el-descriptions-item :label="$t('app.author')">{{ app.author }}</el-descriptions-item>
</el-descriptions>
<div>
<el-button @click="openInstall" type="primary">{{ $t('app.install') }}</el-button>
</div>
</div>
</el-col>
</el-row>
</div>
<el-divider border-style="double" />
2022-09-23 16:33:55 +08:00
<div class="detail" v-loading="loadingDetail">
<v-md-preview :text="appDetail.readme"></v-md-preview>
</div>
<Install ref="installRef"></Install>
</LayoutContent>
</template>
<script lang="ts" setup>
2022-09-23 16:33:55 +08:00
import { GetApp, GetAppDetail } from '@/api/modules/app';
import LayoutContent from '@/layout/layout-content.vue';
2022-09-23 16:33:55 +08:00
import { onMounted, ref } from 'vue';
import Install from './install.vue';
2022-09-23 16:33:55 +08:00
interface OperateProps {
id: number;
}
const props = withDefaults(defineProps<OperateProps>(), {
id: 0,
});
2022-09-23 16:33:55 +08:00
let app = ref<any>({});
let appDetail = ref<any>({});
let version = ref('');
let loadingDetail = ref(false);
const installRef = ref();
2022-09-23 16:33:55 +08:00
const getApp = () => {
GetApp(props.id).then((res) => {
app.value = res.data;
version.value = app.value.versions[0];
getDetail(version.value);
});
};
2022-09-23 16:33:55 +08:00
const getDetail = (version: string) => {
loadingDetail.value = true;
GetAppDetail(props.id, version)
.then((res) => {
appDetail.value = res.data;
})
.finally(() => {
loadingDetail.value = false;
});
};
2022-09-23 16:33:55 +08:00
const toLink = (link: string) => {
window.open(link, '_blank');
};
2022-09-23 16:33:55 +08:00
const openInstall = () => {
let params = {
params: appDetail.value.params,
appDetailId: appDetail.value.id,
};
installRef.value.acceptParams(params);
};
2022-09-23 16:33:55 +08:00
onMounted(() => {
getApp();
});
</script>
<style lang="scss">
.brief {
height: 30vh;
.icon {
.image {
width: auto;
height: 20vh;
}
}
}
</style>