no message

This commit is contained in:
小陌 2023-09-08 23:29:56 +08:00
parent 7f87963448
commit 6a9321c849
8 changed files with 90 additions and 44 deletions

View File

@ -35,7 +35,7 @@
}, },
created() { created() {
var menu = this.$router.sc_getMenu() var menu = this.$router.x_getMenu()
this.menu = this.filterUrl(menu) this.menu = this.filterUrl(menu)
}, },

View File

@ -79,7 +79,7 @@
} }
}, },
created() { created() {
var menu = this.$router.sc_getMenu() var menu = this.$router.x_getMenu()
var dashboardRoute = this.treeFind(menu, node => node.path==this.$config.DASHBOARD_URL) var dashboardRoute = this.treeFind(menu, node => node.path==this.$config.DASHBOARD_URL)
if(dashboardRoute){ if(dashboardRoute){
dashboardRoute.fullPath = dashboardRoute.path dashboardRoute.fullPath = dashboardRoute.path

View File

@ -242,7 +242,7 @@
this.appLogo = this.$tool.data.get("appLogo") || (this.$config.APP_LOGO || logo); this.appLogo = this.$tool.data.get("appLogo") || (this.$config.APP_LOGO || logo);
this.onLayoutResize(); this.onLayoutResize();
window.addEventListener('resize', this.onLayoutResize); window.addEventListener('resize', this.onLayoutResize);
var menu = this.$router.sc_getMenu(); var menu = this.$router.x_getMenu();
this.menu = this.filterUrl(menu); this.menu = this.filterUrl(menu);
this.showThis() this.showThis()
}, },

View File

@ -78,7 +78,7 @@ router.beforeEach(async (to, from, next) => {
store.commit("SET_layout", response.data[key]) store.commit("SET_layout", response.data[key])
} }
} }
var menu = router.sc_getMenu(); var menu = router.x_getMenu();
var menuRouter = filterAsyncRouter(menu) var menuRouter = filterAsyncRouter(menu)
menuRouter = flatAsyncRoutes(menuRouter) menuRouter = flatAsyncRoutes(menuRouter)
menuRouter.forEach(item => { menuRouter.forEach(item => {
@ -109,7 +109,7 @@ router.onError((error) => {
}); });
}); });
//入侵追加自定义方法、对象 //入侵追加自定义方法、对象
router.sc_getMenu = () => { router.x_getMenu = () => {
var apiMenu = tool.data.get("menu") || [] var apiMenu = tool.data.get("menu") || []
let userInfo = tool.data.get("user") || {} let userInfo = tool.data.get("user") || {}
let userMenu = treeFilter(userRoutes, node => { let userMenu = treeFilter(userRoutes, node => {
@ -155,8 +155,7 @@ function loadComponent(component) {
function flatAsyncRoutes(routes, breadcrumb = []) { function flatAsyncRoutes(routes, breadcrumb = []) {
let res = [] let res = []
routes.forEach(route => { routes.forEach(route => {
const tmp = { ...route const tmp = { ...route }
}
if (tmp.children) { if (tmp.children) {
let childrenBreadcrumb = [...breadcrumb] let childrenBreadcrumb = [...breadcrumb]
childrenBreadcrumb.push(route) childrenBreadcrumb.push(route)

View File

@ -60,7 +60,9 @@
var data = { var data = {
account: this.form.account, account: this.form.account,
password: this.$tool.crypto.BASE64.encrypt( this.$tool.crypto.BASE64.encrypt( this.form.password ) + this.$tool.crypto.BASE64.encrypt( this.form.account ) ) password: this.$tool.crypto.BASE64.encrypt(
this.$tool.crypto.BASE64.encrypt( this.form.password ) + this.$tool.crypto.BASE64.encrypt( this.form.account )
)
} }
//token //token

View File

@ -4,7 +4,7 @@
<el-table-column label=""> <el-table-column label="">
<template #default="scope"> <template #default="scope">
<div class="tab-box dis-f al-item"> <div class="tab-box dis-f al-item">
<img :src="scope.row.icon" class="img" alt=""> <img :src="scope.row.icon" v-if="scope.row.icon" class="img" alt="">
<div class="info-box"> <div class="info-box">
<div class="title"> <div class="title">
{{ scope.row.name }} {{ scope.row.name }}
@ -21,19 +21,19 @@
<span>{{ scope.row.version }}</span> <span>{{ scope.row.version }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="目录" width="100"> <el-table-column label="目录" width="120">
<template #default="scope"> <template #default="scope">
<code>{{ scope.row.app }}</code> <code>{{ scope.row.app }}</code>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="安装时间" width="160"> <el-table-column label="安装时间" width="180">
<template #default="scope"> <template #default="scope">
<span v-time="scope.row.timestamp"></span> <span v-time="scope.row.timestamp"></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" width="80"> <el-table-column label="状态" width="80">
<template #default="scope"> <template #default="scope">
<el-switch v-model="scope.row.status" :before-change="changeStatus(scope.row)" :loading="scope.row.changeStatusloading||false" /> <el-switch v-model="scope.row.status" :before-change="()=>changeStatus(scope.row)" :loading="scope.row.changeStatusloading||false" />
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" width="120" fixed="right" align="center"> <el-table-column label="操作" width="120" fixed="right" align="center">
@ -51,7 +51,7 @@
</el-table> </el-table>
</div> </div>
<div class="pop-box" v-show="popShow"> <div class="pop-box" v-if="popShow">
<pop-info :showPop="closePlugin" :item="info"></pop-info> <pop-info :showPop="closePlugin" :item="info"></pop-info>
</div> </div>
</template> </template>
@ -83,6 +83,12 @@ export default {
this.popShow = false; this.popShow = false;
if (refresh===true) { if (refresh===true) {
this.loaddata(); this.loaddata();
// //
// this.$api.system.index.get().then((response) => {
// this.$tool.data.set('menu', response.data.menu);
// });
// this.$router.x_getMenu();
} }
}, },
loaddata(){ loaddata(){
@ -96,15 +102,22 @@ export default {
}, },
changeStatus(o){ changeStatus(o){
// o.changeStatusloading = true; return ElMessageBox.confirm((o.status?'关闭应用会导致相关调用失效':'打开应用('+ o.name +')') + ', 确认执行?', '正在'+ (o.status?'关闭':'打开') + '应用', {
console.log(o) type: 'error',
// this.$http.get('admin/application/installedApplist').then((res) => { closeOnClickModal: false,
// this.changeStatusloading = false; confirmButtonText: '确认操作',
// if (res.code == 200) { }).then(() => {
// this.data = res.data; o.changeStatusloading = true;
// } return this.$http.post('admin/application/status', {app:o.app, status:o.status?0:1}).then((res) => {
// }); o.changeStatusloading = false;
if (res.code == 200) {
this.$message.success(res.message || "操作成功")
return true;
}
this.$alert(res.message, "提示", {type: 'error'});
return false;
});
}).catch(() => {})
}, },
uninstall(item, index) { uninstall(item, index) {
@ -115,7 +128,14 @@ export default {
}).then(() => { }).then(() => {
this.$http.post('admin/application/uninstall', {app:item.app}).then((res) => { this.$http.post('admin/application/uninstall', {app:item.app}).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.data.splice(index, 1) this.data.splice(index, 1)
// //
// this.$api.system.index.get().then((response) => {
// this.$tool.data.set('menu', response.data.menu);
// });
// this.$router.x_getMenu();
this.$message.success(res.message || "操作成功") this.$message.success(res.message || "操作成功")
return true; return true;
} }

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="dis-f warp pd-15 pos-r" ref="tabBox" v-loading="loading"> <div class="dis-f warp pd-15 pos-r" ref="tabBox" v-loading="loading">
<div class="pop-box" v-show="popShow"> <div class="pop-box" v-if="popShow">
<pop-info :showPop="closePlugin" :item="info"></pop-info> <pop-info :showPop="closePlugin" :item="info"></pop-info>
</div> </div>
<plugin-box @click="installPlugin(item)" :windowType="windowType" :tabI="i" :item="item" v-for="(item, i) in list" :key="i"></plugin-box> <plugin-box @click="installPlugin(item)" :windowType="windowType" :tabI="i" :item="item" v-for="(item, i) in list" :key="i"></plugin-box>
@ -48,6 +48,11 @@ export default {
this.popShow = false; this.popShow = false;
if (refresh===true) { if (refresh===true) {
this.loaddata(); this.loaddata();
// //
// this.$api.system.index.get().then((response) => {
// this.$tool.data.set('menu', response.data.menu);
// });
// this.$router.x_getMenu();
} }
}, },
unObserve() { unObserve() {

View File

@ -2,7 +2,7 @@
<div class="dis-f jus-x pop-bg"> <div class="dis-f jus-x pop-bg">
<div class="info-box dis-f jus-x al-item text-f pos-r"> <div class="info-box dis-f jus-x al-item text-f pos-r">
<div class="title"> <div class="title">
{{ item.name }} {{ info.name }}
<div class="close" @click="closePop"> <div class="close" @click="closePop">
<el-icon><el-icon-close-bold /></el-icon> <el-icon><el-icon-close-bold /></el-icon>
</div> </div>
@ -10,12 +10,12 @@
<div class="info-data-box"> <div class="info-data-box">
<div class="dis-f al-item jus-bet"> <div class="dis-f al-item jus-bet">
<div class="dis-f al-item" style="flex:0.75;"> <div class="dis-f al-item" style="flex:0.75;">
<img :src="item.icon" class="img" alt=""> <img :src="info.icon" class="img" alt="">
<div style="flex:1;"> <div style="flex:1;">
<div class="data-title">{{ item.name }}</div> <div class="data-title">{{ info.name }}</div>
<div class="data-info-text">目录<code>{{ item.app }}</code></div> <div class="data-info-text">目录<code>{{ info.app }}</code></div>
<span class="data-info-type data-info-type-m jus-x"> <span class="data-info-type data-info-type-m jus-x">
{{ item.islocal ? '本地插件' : '线上插件' }} {{ info.islocal ? '本地插件' : '线上插件' }}
</span> </span>
<span class="data-info-type data-info-type-m jus-x" style="margin-left: 5px; color: #fff; background-color: #67c23a;"> <span class="data-info-type data-info-type-m jus-x" style="margin-left: 5px; color: #fff; background-color: #67c23a;">
@ -23,7 +23,7 @@
</span> </span>
</div> </div>
</div> </div>
<div class="install-btn" @click="install" style="flex:0.2;" v-if="!item.installed"> <div class="install-btn" @click="install" style="flex:0.2;" v-if="!info.installed">
安装 安装
</div> </div>
<div v-else class="install-btn" @click="uninstall" style="flex:0.2;background: #9E9E9E; border-color: #9E9E9E;"> <div v-else class="install-btn" @click="uninstall" style="flex:0.2;background: #9E9E9E; border-color: #9E9E9E;">
@ -34,7 +34,7 @@
插件详情 插件详情
</div> </div>
<div class="plugin-introduce"> <div class="plugin-introduce">
{{ item.description }} {{ info.description }}
</div> </div>
<div class="plugin-tag-title"> <div class="plugin-tag-title">
相关详情 相关详情
@ -45,21 +45,21 @@
版本 版本
</div> </div>
<div class="text"> <div class="text">
{{ item.version }} <span class="history-text">版本历史</span> {{ info.version }} <span class="history-text">版本历史</span>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
<div class="box"> <div class="box">
<div style="margin-bottom:8px;">开发者</div> <div style="margin-bottom:8px;">开发者</div>
<div class="text"> <div class="text">
{{ item.author }} {{ info.author }}
</div> </div>
</div> </div>
<div class="line" v-if="item.tables"></div> <div class="line" v-if="info.tables"></div>
<div class="box" v-if="item.tables"> <div class="box" v-if="info.tables">
<div style="margin-bottom:8px;">数据表</div> <div style="margin-bottom:8px;">数据表</div>
<div class="dis-f" style="flex-wrap: wrap;"> <div class="dis-f" style="flex-wrap: wrap;">
<div class="business-type">{{ item.tables }}</div> <div class="business-type">{{ info.tables }}</div>
</div> </div>
</div> </div>
<div class="line"></div> <div class="line"></div>
@ -93,10 +93,19 @@ export default {
required: true required: true
} }
}, },
data() {
return {
info:this.item,
isupdate:false,
}
},
mounted() {
this.info = this.item;
},
methods: { methods: {
// //
closePop() { closePop() {
this.showPop() this.showPop(this.isupdate)
}, },
// //
uninstall(){ uninstall(){
@ -107,9 +116,11 @@ export default {
confirmButtonText: '确认卸载', confirmButtonText: '确认卸载',
}).then(() => { }).then(() => {
this.$http.post('admin/application/uninstall', {app:this.item.app}).then((res) => { this.$http.post('admin/application/uninstall', {app:this.info.app}).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.showPop(true) this.info.installed = false;
this.isupdate = true;
// this.showPop(true)
this.$message.success(res.message || "操作成功") this.$message.success(res.message || "操作成功")
return true; return true;
} }
@ -123,22 +134,31 @@ export default {
install(){ install(){
ElMessageBox.confirm(this.item.islocal?'在安装插件之前,请阅读插件的使用说明。':'此插件为远程应用, 如安装失败请确认是否有写入权限.或前往应用中心下载至本地再进行安装', '安装应用', { ElMessageBox.confirm(this.info.islocal?'在安装插件之前,请阅读插件的使用说明。':'此插件为远程应用, 如安装失败请确认是否有写入权限.或前往应用中心下载至本地再进行安装', '安装应用', {
type: 'warning', type: 'warning',
closeOnClickModal: false, closeOnClickModal: false,
confirmButtonText: '确认安装', confirmButtonText: '确认安装',
}).then(() => { }).then(() => {
this.$http.post('admin/application/install', {app:this.item.app}).then((res) => { this.$http.post('admin/application/install', {app:this.info.app}).then((res) => {
// //
if (res.code == 205) { if (res.code == 205) {
alert(1);
this.$message.warning(res.message || "请前往在线升级频道登录X-PHP后进行安装");
if (res.url) {
this.$router.replace({
path: res.url
})
}
return false;
} }
if (res.code == 200) { if (res.code == 200) {
console.log(res) //
this.info.installed = true;
this.isupdate = true;
this.$message.success(res.message || "操作成功") this.$message.success(res.message || "操作成功")
return true; return true;
} }