diff --git a/src/utils/menu-utils.ts b/src/utils/menu-utils.ts deleted file mode 100644 index 84212a0..0000000 --- a/src/utils/menu-utils.ts +++ /dev/null @@ -1,105 +0,0 @@ -// 菜单树过滤 -export function filterMenu(menuList) { - return menuList - // 过滤不是4级的 123 为菜单 - .filter(menu => menu.menuType !== 4) - .map(menu => ({ - ...menu, - children: menu.children ? filterMenu(menu.children) : [] - })) - .sort((a, b) => a.priority - b.priority); // 按 id 升序 -} - -// 辅助函数:查找第一个可访问的菜单项 -export function findFirstAccessibleMenu(menuList) { - if (!menuList || menuList.length === 0) return null - - for (const menu of menuList) { - if (menu.menuType === 1) { // 根 - const childResult = findFirstAccessibleMenu(menu.children) - if (childResult) return childResult - } else if (menu.menuType === 2) { // 目录 - return menu - } else if (menu.menuType === 3) { // 菜单 - return menu - } - } - return null -} - -// 路由映射 -export const getRoutePath = (menu) => { - // 路由映射表:key为接口menuName,value为对应路由路径 - const routeMap = { - '工作台': '/workspace', - - '审核页面': '/audit', - '财务审核': '/audit', - - '汇率管理': '/rate', - - '消耗管理': '/coinConsume', - '消耗页面': '/coinConsume', - - '权限管理': '/permissions', - - '充值管理': '/coinRecharge', - '充值页面': '/coinRecharge', - - '退款管理': '/coinRefund', - '退款页面': '/coinRefund', - - '客户账户明细': '/usergold', - }; - - // 未匹配的菜单默认使用id作为路由(可根据实际需求调整) - return routeMap[menu.menuName] || '/noPermissionPage' - -} - - -// 这是获取用户信息的接口 -const adminData = ref({ - name: '' -}) - -import API from "@/util/http.js"; -import {ref} from "vue"; - -export const getAdminData = async function () { - try { - const result = await API({url: '/admin/userinfo', data: {}}) - adminData.value = result - console.log('请求成功', result) - console.log('用户信息', adminData.value) - return result - } catch (error) { - console.log('请求失败', error) - } -} - - -// 权限检查函数 -export const hasPermission = (to, menuList) => { - if (!menuList || menuList.length === 0) return false; - - // 转换路由路径为菜单名称 - const routePath = to.path; - const menuName = Object.keys(getRoutePath).find(key => getRoutePath[key] === routePath); - - if (!menuName) return false; - - // 扁平化菜单树以便查找 - const flattenMenu = (menus) => { - return menus.reduce((acc, menu) => { - acc.push(menu); - if (menu.children) { - acc = acc.concat(flattenMenu(menu.children)); - } - return acc; - }, []); - }; - - const flatMenuList = flattenMenu(menuList); - return flatMenuList.some(menu => menu.menuName === menuName); -}; \ No newline at end of file diff --git a/src/utils/menuUtils.js b/src/utils/menuUtils.js index 971ba33..451dda5 100644 --- a/src/utils/menuUtils.js +++ b/src/utils/menuUtils.js @@ -47,6 +47,7 @@ export const getRoutePath = (menu) => { '权限管理': '/permissions', '充值管理': '/coinRecharge', + '充值页面': '/coinRecharge', '退款管理': '/coinRefund', diff --git a/src/views/audit/audit.vue b/src/views/audit/audit.vue index b631b87..3df670e 100644 --- a/src/views/audit/audit.vue +++ b/src/views/audit/audit.vue @@ -1,117 +1,66 @@ - \ No newline at end of file + + diff --git a/src/views/recharge/coinRecharge.vue b/src/views/recharge/coinRecharge.vue index 7e1e6c5..4b8ac1f 100644 --- a/src/views/recharge/coinRecharge.vue +++ b/src/views/recharge/coinRecharge.vue @@ -1,119 +1,61 @@ \ No newline at end of file +// 当进入父路由时,默认跳转到新增消耗页面 +// if (route.name === 'coinConsume') { +// router.push({ name: 'addCoinConsume' }); +// } + diff --git a/src/views/refund/coinRefund.vue b/src/views/refund/coinRefund.vue index 7cfdcca..d15988e 100644 --- a/src/views/refund/coinRefund.vue +++ b/src/views/refund/coinRefund.vue @@ -1,119 +1,61 @@ \ No newline at end of file +// 当进入父路由时,默认跳转到新增消耗页面 +// if (route.name === 'coinRefund') { +// router.push({ name: 'addCoinRefund' }); +// } + diff --git a/src/views/usergold/clientCount.vue b/src/views/usergold/clientCount.vue index cd11c32..b5c5ac5 100644 --- a/src/views/usergold/clientCount.vue +++ b/src/views/usergold/clientCount.vue @@ -1,104 +1,61 @@ \ No newline at end of file +// 当进入父路由时,默认跳转到金币明细页面 +// if (route.name === 'usergold') { +// router.push({ name: 'clientCountDetail' }); +// } + diff --git a/src/views/workspace/index.vue b/src/views/workspace/index.vue index 815e28a..b1977c4 100644 --- a/src/views/workspace/index.vue +++ b/src/views/workspace/index.vue @@ -123,7 +123,7 @@ @@ -249,6 +249,7 @@ const yearlyRechargeNum = ref(0) const sumWow = ref(0) const sumDaily = ref(0) const rechargeNum = ref(0) +const ydayRechargeNum = ref(0) const firstRecharge = ref(0) const length = ref(0) // 加载状态 @@ -364,6 +365,7 @@ const processData = (data) => { yearlyRefund: 0, yearlyReduce: 0, rechargeNum: 0, + ydayRechargeNum: 0, firstRecharge: 0, sumWow: 0, sumDaily: 0, @@ -415,7 +417,8 @@ const processData = (data) => { // // 日环比 // sumDaily.value = (marketCards.sumDaily / length.value).toFixed(2) - rechargeNum.value = summary.rechargeNum + // rechargeNum.value = summary.rechargeNum + ydayRechargeNum.value = summary.ydayRechargeNum firstRecharge.value = summary.firstRecharge } diff --git a/stats.html b/stats.html index 12cd9ca..f50a128 100644 --- a/stats.html +++ b/stats.html @@ -4929,7 +4929,7 @@ var drawChart = (function (exports) {