2022-09-22 16:16:04 +08:00
|
|
|
<template>
|
2023-01-30 17:24:46 +08:00
|
|
|
<LayoutContent :title="$t('app.detail')" :reload="true" :v-loading="loadingDetail" :divider="true">
|
2023-01-12 15:12:01 +08:00
|
|
|
<template #main>
|
2022-11-28 13:50:53 +08:00
|
|
|
<div class="brief">
|
|
|
|
<el-row :gutter="20">
|
2023-01-30 17:24:46 +08:00
|
|
|
<el-col :span="3">
|
|
|
|
<el-avatar shape="square" :size="180" :src="'data:image/png;base64,' + app.icon" />
|
2022-11-28 13:50:53 +08:00
|
|
|
</el-col>
|
|
|
|
<el-col :span="20">
|
2023-01-30 17:24:46 +08:00
|
|
|
<div class="detail">
|
|
|
|
<div class="name">
|
|
|
|
<span>{{ app.name }}</span>
|
2022-11-28 13:50:53 +08:00
|
|
|
</div>
|
2023-01-30 17:24:46 +08:00
|
|
|
<div class="description">
|
2022-11-28 13:50:53 +08:00
|
|
|
<span>
|
2022-12-08 16:00:59 +08:00
|
|
|
{{ app.shortDesc }}
|
2022-11-28 13:50:53 +08:00
|
|
|
</span>
|
|
|
|
</div>
|
2023-01-30 17:24:46 +08:00
|
|
|
<div class="version">
|
|
|
|
<el-form-item :label="$t('app.version')">
|
2022-11-28 13:50:53 +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>
|
2023-01-30 17:24:46 +08:00
|
|
|
</el-form-item>
|
2022-12-01 16:45:00 +08:00
|
|
|
</div>
|
2023-01-30 17:24:46 +08:00
|
|
|
|
2022-12-01 16:45:00 +08:00
|
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<el-alert
|
|
|
|
style="width: 300px"
|
|
|
|
v-if="!appDetail.enable"
|
|
|
|
:title="$t('app.limitHelper')"
|
|
|
|
type="warning"
|
|
|
|
show-icon
|
|
|
|
:closable="false"
|
|
|
|
/>
|
2022-11-28 13:50:53 +08:00
|
|
|
</div>
|
2023-01-30 17:24:46 +08:00
|
|
|
<div>
|
|
|
|
<el-button round v-if="appDetail.enable" @click="openInstall" type="primary">
|
|
|
|
{{ $t('app.install') }}
|
|
|
|
</el-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<div class="divider"></div>
|
|
|
|
<el-row>
|
|
|
|
<el-col :span="12">
|
|
|
|
<div class="descriptions">
|
|
|
|
<el-descriptions direction="vertical">
|
|
|
|
<el-descriptions-item :label="$t('app.appWebsite')">
|
|
|
|
<el-link @click="toLink(app.website)">
|
|
|
|
<el-icon><OfficeBuilding /></el-icon>
|
|
|
|
<span>{{ $t('app.appOfficeWebsite') }}</span>
|
|
|
|
</el-link>
|
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item :label="$t('app.doc')">
|
|
|
|
<el-link @click="toLink(app.document)">
|
|
|
|
<el-icon><Document /></el-icon>
|
|
|
|
<span>{{ $t('app.document') }}</span>
|
|
|
|
</el-link>
|
|
|
|
</el-descriptions-item>
|
|
|
|
<el-descriptions-item label="Github">
|
|
|
|
<el-link @click="toLink(app.github)">
|
|
|
|
<el-icon><Link /></el-icon>
|
|
|
|
<span>{{ $t('app.github') }}</span>
|
|
|
|
</el-link>
|
|
|
|
</el-descriptions-item>
|
|
|
|
</el-descriptions>
|
2022-09-22 16:16:04 +08:00
|
|
|
</div>
|
2022-11-28 13:50:53 +08:00
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</div>
|
2023-01-30 17:24:46 +08:00
|
|
|
<div v-loading="loadingDetail">
|
2022-11-28 13:50:53 +08:00
|
|
|
<v-md-preview :text="appDetail.readme"></v-md-preview>
|
|
|
|
</div>
|
2023-01-12 15:12:01 +08:00
|
|
|
</template>
|
|
|
|
</LayoutContent>
|
|
|
|
<Install ref="installRef"></Install>
|
2022-09-22 16:16:04 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2022-09-23 16:33:55 +08:00
|
|
|
import { GetApp, GetAppDetail } from '@/api/modules/app';
|
2022-09-22 16:16:04 +08:00
|
|
|
import LayoutContent from '@/layout/layout-content.vue';
|
2022-09-23 16:33:55 +08:00
|
|
|
import { onMounted, ref } from 'vue';
|
2022-11-02 15:19:14 +08:00
|
|
|
import Install from './install/index.vue';
|
2022-09-22 16:16:04 +08:00
|
|
|
|
2022-09-23 16:33:55 +08:00
|
|
|
interface OperateProps {
|
|
|
|
id: number;
|
|
|
|
}
|
|
|
|
const props = withDefaults(defineProps<OperateProps>(), {
|
|
|
|
id: 0,
|
2022-09-22 16:16:04 +08:00
|
|
|
});
|
2022-09-23 16:33:55 +08:00
|
|
|
let app = ref<any>({});
|
|
|
|
let appDetail = ref<any>({});
|
|
|
|
let version = ref('');
|
|
|
|
let loadingDetail = ref(false);
|
2022-09-26 16:32:40 +08:00
|
|
|
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-22 16:16:04 +08:00
|
|
|
|
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-22 16:16:04 +08:00
|
|
|
|
2022-09-23 16:33:55 +08:00
|
|
|
const toLink = (link: string) => {
|
|
|
|
window.open(link, '_blank');
|
2022-09-22 16:16:04 +08:00
|
|
|
};
|
2022-09-23 16:33:55 +08:00
|
|
|
|
2022-09-26 16:32:40 +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();
|
|
|
|
});
|
2022-09-22 16:16:04 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
.brief {
|
|
|
|
height: 30vh;
|
2023-01-30 17:24:46 +08:00
|
|
|
|
|
|
|
.name {
|
|
|
|
span {
|
|
|
|
font-weight: 500;
|
|
|
|
font-size: 18px;
|
2022-09-22 16:16:04 +08:00
|
|
|
}
|
|
|
|
}
|
2023-01-30 17:24:46 +08:00
|
|
|
|
|
|
|
.description {
|
|
|
|
margin-top: 10px;
|
|
|
|
span {
|
|
|
|
font-size: 14px;
|
|
|
|
color: #646a73;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.version {
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.descriptions {
|
|
|
|
margin-top: 5px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.el-avatar {
|
|
|
|
--el-avatar-bg-color: #ffffff;
|
2022-09-22 16:16:04 +08:00
|
|
|
}
|
|
|
|
</style>
|