11 changed files with 392 additions and 33 deletions
-
3.env.development
-
38src/router/index.js
-
69src/utils/menuTreePermission.js
-
9src/utils/menuUtils.js
-
28src/views/audit/rechargeAudit.vue
-
11src/views/consume/addBeanConsume.vue
-
11src/views/consume/articleVideo.vue
-
136src/views/consume/beanConsume.vue
-
11src/views/consume/dieHardFan.vue
-
11src/views/consume/liveStream.vue
-
68src/views/recharge/coinRechargeDetail.vue
@ -0,0 +1,69 @@ |
|||||
|
// 菜单权限映射(按 menu_type 排序)
|
||||
|
export const permissionMapping = { |
||||
|
System_Management: 1, // 系统管理
|
||||
|
|
||||
|
// menu_type 2: 主功能菜单
|
||||
|
Workbench: 2, // 工作台
|
||||
|
Financial_Audit: 3, // 财务审核
|
||||
|
Exchange_Rate_Management: 4, // 汇率管理
|
||||
|
Recharge_Management: 5, // 充值管理
|
||||
|
Consumption_Management: 6, // 消耗管理
|
||||
|
Refund_Management: 7, // 退款管理
|
||||
|
Customer_Account_Details: 8, // 客户账户明细
|
||||
|
Permission_Management: 9, // 权限管理
|
||||
|
|
||||
|
// menu_type 3: 子功能菜单
|
||||
|
Gold_Coin_Recharge: 34, // 金币充值
|
||||
|
Gold_Coin_Consumption: 35, // 金币消耗
|
||||
|
Gold_Coin_Refund: 37, // 金币退款
|
||||
|
Gold_Coin_Audit: 40, // 金币审核
|
||||
|
|
||||
|
Golden_Bean_Recharge: 41, // 金豆充值
|
||||
|
Golden_Bean_Consumption: 42, // 金豆消耗
|
||||
|
Golden_Bean_Audit: 43, // 金豆审核
|
||||
|
|
||||
|
Gold_Coin_Customer_Account_Details: 44, // 金币客户账户明细
|
||||
|
Golden_Bean_Customer_Account_Details: 45, // 金豆客户账户明细
|
||||
|
|
||||
|
// menu_type 4: 功能操作权限
|
||||
|
Workbench_Display: 10, // 工作台展示
|
||||
|
View_Recharge_Audit: 11, // 查看充值审核
|
||||
|
Recharge_Approval: 12, // 充值审批
|
||||
|
View_Refund_Audit: 13, // 查看退款审核
|
||||
|
Refund_Approval: 14, // 退款审批
|
||||
|
Exchange_Rate_View: 15, // 汇率查看
|
||||
|
Exchange_Rate_Modification: 16, // 汇率修改
|
||||
|
Submit_Gold_Coin_Recharge: 17, // 提交金币充值
|
||||
|
View_Gold_Coin_Recharge_Details: 18, // 查看金币充值明细
|
||||
|
Submit_Gold_Coin_Consumption: 19, // 提交金币消耗
|
||||
|
View_Gold_Coin_Consumption_Details: 20, // 查看金币消耗明细
|
||||
|
Submit_Gold_Coin_Refund: 21, // 提交金币退款
|
||||
|
View_Gold_Coin_Refund_Details: 22, // 查看金币退款明细
|
||||
|
View_Gold_Coin_Details: 23, // 查看金币明细
|
||||
|
View_Gold_Coin_Balance: 24, // 查看金币余额
|
||||
|
View_Permission: 25, // 查看权限
|
||||
|
Add_User: 26, // 新增用户
|
||||
|
Change_Status: 27, // 改变状态
|
||||
|
Modify_Permission: 28, // 修改权限
|
||||
|
Delete_User: 29, // 删除用户
|
||||
|
View_Role: 30, // 查看角色
|
||||
|
Edit_Role: 36, // 编辑角色
|
||||
|
|
||||
|
Recharge_Audit: 31, // 充值审核
|
||||
|
Refund_Audit: 32, // 退款审核
|
||||
|
}; |
||||
|
|
||||
|
// 递归查找菜单中是否存在目标id
|
||||
|
export const findMenuById = (menuList, targetId) => { |
||||
|
for (const menu of menuList) { |
||||
|
if (menu.id === targetId) { |
||||
|
return true; // 找到目标菜单
|
||||
|
} |
||||
|
// 如果有子菜单,递归查找
|
||||
|
if (menu.children && menu.children.length > 0) { |
||||
|
const found = findMenuById(menu.children, targetId); |
||||
|
if (found) return true; |
||||
|
} |
||||
|
} |
||||
|
return false; |
||||
|
}; |
@ -0,0 +1,11 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div>addBeanConsume</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,11 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div>article videos</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
@ -1,11 +1,137 @@ |
|||||
<script setup lang="ts"> |
|
||||
|
<template> |
||||
|
<div> |
||||
|
<!-- 这里放置标签切换的按钮 --> |
||||
|
<el-button-group> |
||||
|
<!-- 切换后状态显示 primary 样式否则是默认样式 --> |
||||
|
<el-button |
||||
|
:type="activeTab === 'add' ? 'primary' : 'default'" |
||||
|
@click="goToAdd" |
||||
|
class="uniform-btn" |
||||
|
> |
||||
|
新增消耗 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
:type="activeTab === 'live' ? 'primary' : 'default'" |
||||
|
@click="goToLive" |
||||
|
class="uniform-btn" |
||||
|
> |
||||
|
直播 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
:type="activeTab === 'fan' ? 'primary' : 'default'" |
||||
|
@click="goToFan" |
||||
|
class="uniform-btn" |
||||
|
> |
||||
|
铁粉 |
||||
|
</el-button> |
||||
|
<el-button |
||||
|
:type="activeTab === 'article' ? 'primary' : 'default'" |
||||
|
@click="goToArticle" |
||||
|
class="uniform-btn" |
||||
|
> |
||||
|
文章/视频 |
||||
|
</el-button> |
||||
|
</el-button-group> |
||||
|
<!-- 渲染子路由组件 --> |
||||
|
<router-view></router-view> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
</script> |
|
||||
|
<script setup> |
||||
|
import {onMounted, ref, watch} from 'vue'; |
||||
|
import {useRouter, useRoute} from 'vue-router'; |
||||
|
import {storeToRefs} from "pinia"; |
||||
|
import {useAdminStore} from "@/store/index.js"; |
||||
|
|
||||
<template> |
|
||||
|
const router = useRouter();// 获取路由实例 |
||||
|
const route = useRoute();// 获取当前路由信息 |
||||
|
// 定义响应式变量 activeTab 来跟踪当前激活的标签 |
||||
|
const activeTab = ref(route.name === 'liveStream' ? 'live' : 'add'); |
||||
|
//也就是说如果当前在coinConsumeDetail页面,那么就是detail,否则默认情况都展示add页面 |
||||
|
//此时获取到的路由信息是coinConsume,所以默认是add |
||||
|
const adminStore = useAdminStore(); |
||||
|
const {menuTree} = storeToRefs(adminStore); |
||||
|
|
||||
</template> |
|
||||
|
const goToAdd = () => { |
||||
|
// 点击按钮时更新 activeTab 为 add |
||||
|
activeTab.value = 'add'; |
||||
|
router.push({name: 'addBeanConsume'}); |
||||
|
}; |
||||
|
|
||||
<style scoped> |
|
||||
|
const goToLive = () => { |
||||
|
// 点击按钮时更新 activeTab 为 live |
||||
|
activeTab.value = 'live'; |
||||
|
router.push({name: 'liveStream'}); |
||||
|
}; |
||||
|
const goToFan = () => { |
||||
|
// 点击按钮时更新 activeTab 为 fan |
||||
|
activeTab.value = 'fan'; |
||||
|
router.push({name: 'dieHardFan'}); |
||||
|
}; |
||||
|
const goToArticle = () => { |
||||
|
// 点击按钮时更新 activeTab 为 article |
||||
|
activeTab.value = 'article'; |
||||
|
router.push({name: 'articleVideo'}); |
||||
|
}; |
||||
|
|
||||
|
// 导航方法 |
||||
|
const navigateTo = (name) => { |
||||
|
activeTab.value = name; |
||||
|
if (name === 'add') { |
||||
|
router.push({name: 'addBeanConsume'}); |
||||
|
} else if (name === 'live') { |
||||
|
router.push({name: 'liveStream'}); |
||||
|
} else if (name === 'fan') { |
||||
|
router.push({name: 'dieHardFan'}); |
||||
|
} else if (name === 'article') { |
||||
|
router.push({name: 'articleVideo'}); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
// 递归判断某个 menuName 是否存在 |
||||
|
const hasMenuPermission = (tree, targetName) => { |
||||
|
for (const node of tree) { |
||||
|
if (node.menuName === targetName) return true; |
||||
|
if (node.children && hasMenuPermission(node.children, targetName)) return true; |
||||
|
} |
||||
|
return false; |
||||
|
}; |
||||
|
|
||||
|
// 默认路由判断 |
||||
|
const getDefaultRoute = () => { |
||||
|
if (!menuTree.value) return 'add'; |
||||
|
const hasRecharge = hasMenuPermission(menuTree.value, '提交金豆消耗'); |
||||
|
return hasRecharge ? 'add' : 'live'; |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
// 监听路由变化更新标签状态 |
||||
|
watch(() => route.name, (newName) => { |
||||
|
if (newName === 'add' || newName === 'live') { |
||||
|
activeTab.value = newName; |
||||
|
} else if (newName === 'beanConsume') { |
||||
|
const defaultRoute = getDefaultRoute(); |
||||
|
navigateTo(defaultRoute); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 初始化逻辑 |
||||
|
onMounted(() => { |
||||
|
if (route.name === 'beanConsume') { |
||||
|
const defaultRoute = getDefaultRoute(); |
||||
|
navigateTo(defaultRoute); |
||||
|
} else { |
||||
|
// 非父路由初始化当前标签状态 |
||||
|
if (route.name === 'add' || route.name === 'live') { |
||||
|
activeTab.value = route.name; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
.uniform-btn { |
||||
|
width: 120px; |
||||
|
} |
||||
</style> |
</style> |
@ -0,0 +1,11 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div>die-hard fans</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,11 @@ |
|||||
|
<script setup lang="ts"> |
||||
|
|
||||
|
</script> |
||||
|
|
||||
|
<template> |
||||
|
<div>live stream</div> |
||||
|
</template> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue