feat: 使用 path 进行跳转

This commit is contained in:
xingyu4j
2025-10-20 15:42:23 +08:00
parent dd70dc0012
commit 03644613f3
5 changed files with 29 additions and 31 deletions

View File

@@ -16,56 +16,55 @@ const menuList = [
name: '用户管理',
icon: 'ep:user-filled',
bgColor: 'bg-red-400',
routerName: 'MemberUser',
routerPath: '/member/user',
},
{
name: '商品管理',
icon: 'fluent-mdl2:product',
bgColor: 'bg-orange-400',
routerName: 'ProductSpu',
routerPath: '/mall/product/spu',
},
{
name: '订单管理',
icon: 'ep:list',
bgColor: 'bg-yellow-500',
routerName: 'TradeOrder',
routerPath: '/mall/trade/order',
},
{
name: '售后管理',
icon: 'ri:refund-2-line',
bgColor: 'bg-green-600',
routerName: 'TradeAfterSale',
routerPath: '/mall/trade/after-sale',
},
{
name: '分销管理',
icon: 'fa-solid:project-diagram',
bgColor: 'bg-cyan-500',
routerName: 'TradeBrokerageUser',
routerPath: '/mall/trade/brokerage/brokerage-user',
},
{
name: '优惠券',
icon: 'ep:ticket',
bgColor: 'bg-blue-500',
routerName: 'PromotionCoupon',
routerPath: '/mall/promotion/coupon/template',
},
{
name: '拼团活动',
icon: 'fa:group',
bgColor: 'bg-purple-500',
routerName: 'PromotionBargainActivity',
routerPath: '/mall/promotion/combination/acitivity',
},
{
name: '佣金提现',
icon: 'vaadin:money-withdraw',
bgColor: 'bg-rose-500',
routerName: 'TradeBrokerageWithdraw',
routerPath: '/mall/trade/brokerage/brokerage-withdraw',
},
];
/** 跳转到菜单对应页面 */
// TODO @xingyu貌似通过 name 的方式,都无法跳转,找不到路由?
function handleMenuClick(routerName: string) {
router.push({ name: routerName });
function handleMenuClick(routerPath: string) {
router.push({ path: routerPath });
}
</script>
@@ -79,7 +78,7 @@ function handleMenuClick(routerName: string) {
v-for="menu in menuList"
:key="menu.name"
class="flex h-20 w-[20%] cursor-pointer flex-col items-center justify-center gap-2"
@click="handleMenuClick(menu.routerName)"
@click="handleMenuClick(menu.routerPath)"
>
<div
:class="menu.bgColor"

View File

@@ -8,8 +8,8 @@ import { onMounted, ref } from 'vue';
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
import { fenToYuan } from '@vben/utils';
import { ElCard, ElRadio, ElRadioGroup } from 'element-plus';
import dayjs from 'dayjs';
import { ElCard, ElRadio, ElRadioGroup } from 'element-plus';
import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
@@ -46,7 +46,7 @@ const timeRangeConfig = {
const timeRangeType = ref(TimeRangeTypeEnum.DAY30); // 日期快捷选择按钮, 默认 30 天
/** 时间范围类型单选按钮选中 */
const handleTimeRangeTypeChange = async () => {
async function handleTimeRangeTypeChange() {
// 设置时间范围
let beginTime: Dayjs;
let endTime: Dayjs;
@@ -77,7 +77,7 @@ const handleTimeRangeTypeChange = async () => {
}
// 发送时间范围选中事件
await getOrderCountTrendComparison(beginTime, endTime);
};
}
/** 查询订单数量趋势对照数据 */
async function getOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) {