550 lines
14 KiB
Vue
550 lines
14 KiB
Vue
<template>
|
||
<div class="dis-f jus-x pop-bg">
|
||
<div class="info-box dis-f jus-x al-item text-f pos-r">
|
||
<div class="title">
|
||
{{ info.name }}
|
||
<div class="close" @click="closePop">
|
||
<el-icon><el-icon-close-bold /></el-icon>
|
||
</div>
|
||
</div>
|
||
<div class="info-data-box">
|
||
<div class="dis-f al-item jus-bet">
|
||
<div class="dis-f al-item" style="flex:0.75;">
|
||
<img :src="info.icon" class="img" alt="">
|
||
<div style="flex:1;">
|
||
<div class="data-title">{{ info.name }}</div>
|
||
<div class="data-info-text">目录:<code>{{ info.app }}</code></div>
|
||
<span class="data-info-type data-info-type-m jus-x">
|
||
{{ info.islocal ? '本地插件' : '线上插件' }}
|
||
</span>
|
||
|
||
<span class="data-info-type data-info-type-m jus-x" style="margin-left: 5px; color: #fff; background-color: #67c23a;">
|
||
免费
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div class="install-btn" @click="install" style="flex:0.2;" v-if="!info.installed">
|
||
安装
|
||
</div>
|
||
<div v-else class="install-btn" @click="uninstall" style="flex:0.2;background: #9E9E9E; border-color: #9E9E9E;">
|
||
卸载
|
||
</div>
|
||
</div>
|
||
<div class="plugin-tag-title">
|
||
插件详情
|
||
</div>
|
||
<div class="plugin-introduce">
|
||
{{ info.description }}
|
||
<div v-if="info.exec" style="padding: 10px 0;">
|
||
<p>当前应用需要第三方组件支持请使用命令行先安装</p>
|
||
<pre style="background: #848484; padding: 15px; color: #fff; font-size: 13px; border-radius: 4px;margin-top: 20px;">{{ info.exec }}
|
||
|
||
|
||
或手动安装组件后再来操作安装
|
||
|
||
|
||
{{ info.otherexec }}</pre>
|
||
</div>
|
||
</div>
|
||
<div class="plugin-tag-title">
|
||
相关详情
|
||
</div>
|
||
<div class="related-details">
|
||
<div class="box">
|
||
<div style="margin-bottom:8px;">
|
||
版本
|
||
</div>
|
||
<div class="text">
|
||
{{ info.version }} <span class="history-text">版本历史</span>
|
||
</div>
|
||
</div>
|
||
<div class="line"></div>
|
||
<div class="box">
|
||
<div style="margin-bottom:8px;">开发者</div>
|
||
<div class="text">
|
||
{{ info.author }}
|
||
</div>
|
||
</div>
|
||
<div class="line" v-if="info.tables"></div>
|
||
<div class="box" v-if="info.tables">
|
||
<div style="margin-bottom:8px;">数据表</div>
|
||
<div class="dis-f" style="flex-wrap: wrap;">
|
||
<div class="business-type">{{ info.tables }}</div>
|
||
</div>
|
||
</div>
|
||
<div class="line"></div>
|
||
<div class="box">
|
||
<div style="margin-bottom:8px;">
|
||
帮助
|
||
</div>
|
||
<div class="dis-f al-item help-btn jus-x">
|
||
<el-icon><el-icon-collection /></el-icon>
|
||
<span class="text-mg">
|
||
使用说明
|
||
</span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import { ElMessageBox } from 'element-plus';
|
||
import tool from '@/utils/tool';
|
||
import store from '@/store'
|
||
import api from '@/api'
|
||
|
||
import router from '@/router/index.js';
|
||
|
||
export default {
|
||
props: {
|
||
showPop: {
|
||
type: Function,
|
||
required: true
|
||
},
|
||
item: {
|
||
type: Object,
|
||
required: true
|
||
}
|
||
},
|
||
data() {
|
||
return {
|
||
info: this.item,
|
||
isupdate: false,
|
||
}
|
||
},
|
||
mounted() {
|
||
this.info = this.item;
|
||
},
|
||
methods: {
|
||
//关闭弹窗
|
||
closePop() {
|
||
this.showPop(this.isupdate)
|
||
},
|
||
|
||
updateMenu() {
|
||
// 重新获取菜单路
|
||
api.system.index.get().then((response) => {
|
||
if (response.code == 200) {
|
||
// 缓存
|
||
for (const key in response.data) {
|
||
tool.data.set(key, response.data[key]);
|
||
if (key == 'layout') {
|
||
store.commit("SET_layout", response.data[key])
|
||
}
|
||
}
|
||
router.x_getMenu();
|
||
}
|
||
}).catch((error) => {
|
||
console.log(error);
|
||
});
|
||
},
|
||
// 卸载
|
||
uninstall() {
|
||
ElMessageBox.confirm('当前操作不可逆,可能会造成无法访问或数据清空.', '正在卸载应用', {
|
||
type: 'error',
|
||
closeOnClickModal: false,
|
||
confirmButtonText: '确认卸载',
|
||
}).then(() => {
|
||
|
||
this.$http.post('admin/application/uninstall', { app: this.info.app }).then((res) => {
|
||
if (res.code == 200) {
|
||
this.info.installed = false;
|
||
this.isupdate = true;
|
||
// 加载菜单
|
||
this.updateMenu();
|
||
|
||
this.$message.success(res.message || "操作成功")
|
||
return true;
|
||
}
|
||
this.$alert(res.message, "提示", { type: 'error' });
|
||
});
|
||
|
||
}).catch(() => { })
|
||
|
||
},
|
||
// 安装
|
||
install() {
|
||
|
||
ElMessageBox.confirm(this.info.islocal ? '在安装插件之前,请阅读插件的使用说明。' : '此插件为远程应用, 如安装失败请确认是否有写入权限.或前往应用中心下载至本地再进行安装', '安装应用', {
|
||
type: 'warning',
|
||
closeOnClickModal: false,
|
||
confirmButtonText: '确认安装',
|
||
}).then(() => {
|
||
|
||
this.$http.post('admin/application/install', { app: this.info.app }).then((res) => {
|
||
|
||
// 请先确认身份
|
||
if (res.code == 205) {
|
||
this.$message.warning(res.message || "请前往在线升级频道登录X-PHP后进行安装");
|
||
if (res.url) {
|
||
this.$router.replace({
|
||
path: res.url
|
||
})
|
||
}
|
||
return false;
|
||
}
|
||
if (res.code == 200) {
|
||
// 更新为已安装
|
||
this.info.installed = true;
|
||
this.isupdate = true;
|
||
|
||
// 加载菜单
|
||
this.updateMenu();
|
||
|
||
|
||
this.$message.success(res.message || "操作成功")
|
||
return true;
|
||
}
|
||
this.$alert(res.message, "提示", { type: 'error' });
|
||
});
|
||
|
||
}).catch(() => { })
|
||
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped>
|
||
code {
|
||
padding: 2px 4px;
|
||
font-size: 90%;
|
||
color: #c7254e;
|
||
background-color: #f9f2f4;
|
||
border-radius: 4px;
|
||
clear: both;
|
||
display: initial;
|
||
cursor: pointer;
|
||
}
|
||
|
||
img {
|
||
object-fit: contain;
|
||
}
|
||
|
||
.text-f {
|
||
font-family: -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.dis-f {
|
||
display: flex;
|
||
}
|
||
|
||
.flex-1 {
|
||
flex: 1;
|
||
}
|
||
|
||
.jus-x {
|
||
justify-content: center;
|
||
}
|
||
|
||
.al-item {
|
||
align-items: center;
|
||
}
|
||
|
||
.jus-bet {
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.pd-15 {
|
||
padding: 15px;
|
||
}
|
||
|
||
.mg-r-25 {
|
||
margin-right: 25px;
|
||
}
|
||
|
||
.pos-r {
|
||
position: relative;
|
||
}
|
||
|
||
.pop-bg {
|
||
background: #fff;
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 0;
|
||
height: calc(100% - 50px);
|
||
background: #fff;
|
||
width: 100%;
|
||
}
|
||
|
||
.help-btn {
|
||
background: #fff;
|
||
color: #141e31;
|
||
height: 32px;
|
||
line-height: 30px;
|
||
padding: 0 20px;
|
||
border: 1px solid #d7d9dc;
|
||
border-radius: 3px;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
outline: none;
|
||
overflow: hidden;
|
||
position: relative;
|
||
text-align: center;
|
||
text-overflow: ellipsis;
|
||
cursor: pointer;
|
||
width: 120px;
|
||
}
|
||
|
||
.help-btn .text-mg {
|
||
margin-left: 5px;
|
||
}
|
||
|
||
.history-text {
|
||
color: #409eff;
|
||
color: #409eff;
|
||
cursor: pointer;
|
||
display: inline-block;
|
||
margin-left: 4px;
|
||
text-decoration: underline;
|
||
}
|
||
|
||
.business-type {
|
||
background: #e6e8ed;
|
||
border: 1px solid #e6e8ed;
|
||
border-radius: 12px;
|
||
color: #525967;
|
||
font-size: 13px;
|
||
line-height: 18px;
|
||
padding: 2px 6px;
|
||
margin: 0 4px 4px 0;
|
||
}
|
||
|
||
.related-details {
|
||
-webkit-box-align: start;
|
||
-ms-flex-align: start;
|
||
align-items: flex-start;
|
||
background: #f5f6f8;
|
||
border-radius: 4px;
|
||
display: -webkit-inline-box;
|
||
display: -ms-inline-flexbox;
|
||
display: inline-flex;
|
||
height: -webkit-fit-content;
|
||
height: -moz-fit-content;
|
||
height: fit-content;
|
||
padding: 20px;
|
||
color: #838892;
|
||
font-size: 12px;
|
||
font-weight: 400;
|
||
width: 100%;
|
||
}
|
||
|
||
.related-details .line {
|
||
height: 55px;
|
||
margin: 0 20px;
|
||
background: #ebecee;
|
||
width: 1px;
|
||
}
|
||
|
||
.related-details .text {
|
||
color: #141e31;
|
||
}
|
||
|
||
.related-details .box {
|
||
width: calc(25% - 1px);
|
||
}
|
||
|
||
.plugin-introduce {
|
||
white-space: pre-wrap;
|
||
color: #141e31;
|
||
font-family: -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
||
font-variant-numeric: tabular-nums;
|
||
font-size: 14px;
|
||
word-wrap: break-word;
|
||
max-width: 100%;
|
||
height: calc(100% - 315px);
|
||
overflow: hidden;
|
||
}
|
||
|
||
.info-video {
|
||
width: calc(50% - 20px);
|
||
max-height: 330px;
|
||
margin-bottom: 20px;
|
||
}
|
||
|
||
.plugin-tag-title {
|
||
color: #141e31;
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
height: 22px;
|
||
line-height: 22px;
|
||
margin-bottom: 10px;
|
||
margin-top: 30px;
|
||
font-family: -apple-system, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;
|
||
font-variant-numeric: tabular-nums;
|
||
}
|
||
|
||
.install-btn {
|
||
border: 1px solid;
|
||
border-radius: 3px;
|
||
cursor: pointer;
|
||
display: inline-block;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
outline: none;
|
||
overflow: hidden;
|
||
position: relative;
|
||
text-align: center;
|
||
text-overflow: ellipsis;
|
||
-webkit-user-select: none;
|
||
-moz-user-select: none;
|
||
-ms-user-select: none;
|
||
user-select: none;
|
||
white-space: nowrap;
|
||
background: #409eff;
|
||
border-color: #409eff;
|
||
color: #fff;
|
||
cursor: pointer;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
height: 36px;
|
||
padding: 0 20px;
|
||
max-width: 110px;
|
||
line-height: 34px;
|
||
}
|
||
|
||
.install-btn:hover {
|
||
background: #65affb;
|
||
}
|
||
|
||
.info-box {
|
||
flex-direction: column;
|
||
max-width: 1200px;
|
||
min-width: 375px;
|
||
width: 100%;
|
||
}
|
||
|
||
.info-box .title {
|
||
height: 60px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-bottom: 1px solid #ebecee;
|
||
font-size: 20px;
|
||
width: 100%;
|
||
}
|
||
|
||
.info-box .title .close {
|
||
position: absolute;
|
||
right: 30px;
|
||
cursor: pointer;
|
||
width: 20px;
|
||
height: 20px;
|
||
}
|
||
|
||
.info-box .title .close:hover {
|
||
background: #f0f1f4;
|
||
}
|
||
|
||
.info-data-box {
|
||
padding: 20px 40px;
|
||
flex: 1;
|
||
max-width: 1200px;
|
||
width: 100%;
|
||
overflow-y: auto;
|
||
}
|
||
|
||
.info-data-box .img {
|
||
width: 88px;
|
||
height: 88px;
|
||
border-radius: 10px;
|
||
margin-right: 16px;
|
||
}
|
||
|
||
.info-data-box .data-title {
|
||
color: #141e31;
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
line-height: 22px;
|
||
max-width: 100%;
|
||
word-wrap: break-word;
|
||
-webkit-box-orient: vertical;
|
||
display: -webkit-box;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
word-break: break-word;
|
||
}
|
||
|
||
.info-data-box .data-info-text {
|
||
word-wrap: break-word;
|
||
-webkit-line-clamp: 2;
|
||
-webkit-box-orient: vertical;
|
||
color: #838892;
|
||
display: -webkit-box;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
line-height: 20px;
|
||
margin-top: 6px;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
word-break: break-word;
|
||
}
|
||
|
||
.info-data-box .data-info-type {
|
||
background: #f0f1f4;
|
||
border: 1px solid #f0f1f4;
|
||
border-radius: 12px;
|
||
color: #525967;
|
||
font-size: 13px;
|
||
line-height: 18px;
|
||
padding: 2px 6px;
|
||
margin-top: 6px;
|
||
display: inline-block;
|
||
}
|
||
|
||
.info-data-box .data-info-type-m {
|
||
background-color: rgba(36, 138, 249, .15);
|
||
color: #2f7deb;
|
||
}
|
||
|
||
.plugin-box {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
}
|
||
|
||
@media screen and (max-width:960px) {
|
||
.info-data-box {
|
||
padding: 10px;
|
||
}
|
||
|
||
}
|
||
|
||
@media screen and (max-width:550px) {
|
||
.plugin-box {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
align-items: center;
|
||
}
|
||
|
||
|
||
.plugin-introduce {
|
||
height: calc(100% - 558px);
|
||
padding: 0 10px;
|
||
}
|
||
|
||
.info-video {
|
||
width: 100%;
|
||
}
|
||
|
||
.related-details {
|
||
flex-wrap: wrap;
|
||
}
|
||
|
||
.related-details .box {
|
||
width: 100%;
|
||
}
|
||
|
||
.related-details .line {
|
||
height: 1px;
|
||
margin: 20px 0;
|
||
width: 100%;
|
||
}
|
||
}
|
||
</style>
|