This commit is contained in:
xiaofajia 2024-10-24 22:39:21 +08:00
commit 89c2467bb5
3 changed files with 71 additions and 20 deletions

View File

@ -56,7 +56,7 @@ export function exportOrderInfoExcel(params) {
export function toPay(params) {
return request({
url: '/admin-api/pay/toPay',
url: '/admin-api/pay/toPayCode',
method: 'get',
params
})

View File

@ -37,8 +37,9 @@ const permission = {
// 将 menus 菜单,转换为 route 路由数组
const sdata = JSON.parse(JSON.stringify(menus)) // 【重要】用于菜单中的数据
const rdata = JSON.parse(JSON.stringify(menus)) // 用于最后添加到 Router 中的数据
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
const sss = JSON.parse(JSON.stringify(menus))
const sidebarRoutes = filterAsyncRouter(sdata,sss)
const rewriteRoutes = filterAsyncRouter(rdata,sss, false, true)
rewriteRoutes.push({path: '*', redirect: '/404', hidden: true})
commit('SET_ROUTES', rewriteRoutes)
commit('SET_SIDEBAR_ROUTERS', constantRoutes.concat(sidebarRoutes))
@ -51,13 +52,12 @@ const permission = {
}
// 遍历后台传来的路由字符串,转换为组件对象
function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
function filterAsyncRouter(asyncRouterMap,sdata, lastRouter = false, type = false) {
return asyncRouterMap.filter(function(route,index) {
// 将 ruoyi 后端原有耦合前端的逻辑,迁移到此处
// 处理 meta 属性
route.meta = {
title:dealMenuText(index) +' '+ route.name,
icon: route.icon,
title:dealMenuText(index,route,sdata) +' '+ route.name,
noCache: !route.keepAlive,
}
route.hidden = !route.visible
@ -89,23 +89,56 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
route.children = filterChildren(route.children)
}
if (route.children != null && route.children && route.children.length) {
route.children = filterAsyncRouter(route.children, route, type)
route.children = filterAsyncRouter(route.children,sdata, route, type)
route.alwaysShow = route.alwaysShow !== undefined ? route.alwaysShow : true
} else {
delete route['children']
delete route['alwaysShow'] // 如果没有子菜单,就不需要考虑 alwaysShow 字段
}
console.log(route,989898)
return true
})
}
function dealMenuText(num){
let tempData =['(一)','(二)','(三)','(四)','(五)','(六)','(七)','(八)','(九)','(十)'
,'(十一)','(十二)','(十三)','(十四)','(十五)','(十六)','(十七)','(十八)','(十九)','(二十)','(二十一)','(二十二)','(二十三)']
function dealMenuText(num,data,list){
if (data.parentId==0){
let tempData =['一','二','三','四','五','六','七','八','九','十'
,'十一','十二','十三','十四','十五','十六','十七','十八','十九','二十','二十一','二十二','二十三']
if (num>tempData.length){
return "";
}
return tempData[num]
return tempData[num] +'、'
}else {
let level =1;
let parData ={};
for (const item of list) {
if ( data.parentId == item.id){
parData = item
level++
break;
}
}
for (const item of list) {
if ( parData.parentId == 0){
parData = item
level++
break;
}
}
if (level==2){
let tempData2 =['(一)','(二)','(三)','(四)','(五)','(六)','(七)','(八)','(九)','(十)'
,'(十一)','(十二)','(十三)','(十四)','(十五)','(十六)','(十七)','(十八)','(十九)','(二十)','(二十一)','(二十二)','(二十三)']
if (num>tempData2.length){
return "";
}
return tempData2[num]
}else if (level == 3){
return (num+1)+'.'
}else {
return ""
}
}
}
function filterChildren(childrenMap, lastRouter = false) {
let children = [];

View File

@ -1,14 +1,15 @@
<template>
<div class="container_">
<el-row>
<el-col v-for="item in serviceList" :span="4">
<div class="top-list">
<div class="list-box" v-for="item in serviceList" :span="4">
<div @click="goRoute(item.id)">
<image-preview :width="300" :height="300" :src="item.coverImg"></image-preview>
{{ item.name }}
<img :src=" imgUrl + item.coverImg" style="width: 300px; height: 300px;">
<!-- <image-preview :width="300" :height="300" :src="item.coverImg"></image-preview>-->
<div style="font-weight: bold;text-align: center;font-size: 25px">{{ item.name }}</div>
</div>
</el-col>
</el-row>
</div>
</div>
<div class="container-box">
<div class="flex-box">
@ -117,6 +118,7 @@ export default {
},
data() {
return {
imgUrl:'',
lineChartData: lineChartData.newVisitis,
serviceList: [],
warnList: [],
@ -137,6 +139,8 @@ export default {
this.getServiceList()
this.getNotifyMessage()
this.getWarnList()
this.imgUrl = process.env.VUE_APP_IMAGE_URL
console.log( this.imgUrl + '1111111' )
},
methods: {
handleSetLineChartData(type) {
@ -179,6 +183,20 @@ export default {
box-sizing: border-box;
padding: 15px;
}
.top-list{
width: 100%;
display: flex;
justify-content: space-between;
margin-bottom: 25px;
}
.list-box{
background: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-radius: 4px;
box-sizing: border-box;
padding: 15px;
border-radius: 8px;
}
.container-box{
width: 100%;
display: flex;