Browse Source

🐞 fix: 以前的路由与权限名字对应,不能全部替换

zhangrenyuan/feature-20251104133449-现金管理二期
zhangrenyuan 3 weeks ago
parent
commit
5c17b7aceb
  1. 12
      src/views/consume/bean/beanConsume.vue
  2. 24
      src/views/recharge/bean/beanRecharge.vue

12
src/views/consume/bean/beanConsume.vue

@ -3,8 +3,8 @@
<el-button-group class="custom-button-group">
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'add_gold_bean_consumption' }"
@click="navigateTo('add_gold_bean_consumption')"
:class="{ 'active-btn': activeTab === 'addBeanConsume' }"
@click="navigateTo('addBeanConsume')"
v-if="hasAdd"
style="width: 6.5vw;"
>
@ -81,17 +81,17 @@ const initPermissions = () => {
//
const getDefaultAuditRoute = () => {
initPermissions();
if (hasAdd.value) return 'add_gold_bean_consumption';
if (hasAdd.value) return 'addBeanConsume';
if (hasLive.value) return 'liveStream';
if (hasFan.value) return 'dieHardFan';
if (hasArticleVideo.value) return 'articleVideo';
return 'add_gold_bean_consumption';
return 'addBeanConsume';
};
//
watch(() => route.name, (newName) => {
initPermissions()
if (newName=== 'add_gold_bean_consumption' || newName === 'liveStream' || newName === 'dieHardFan' || newName === 'articleVideo') {
if (newName=== 'addBeanConsume' || newName === 'liveStream' || newName === 'dieHardFan' || newName === 'articleVideo') {
activeTab.value = newName;
} else if (newName === 'beanConsume') {
// 访 /beanConsume
@ -108,7 +108,7 @@ onMounted(() => {
navigateTo(defaultRoute);
} else {
//
if (route.name=== 'add_gold_bean_consumption' || route.name === 'liveStream' || route.name === 'dieHardFan' || route.name === 'articleVideo') {
if (route.name=== 'addBeanConsume' || route.name === 'liveStream' || route.name === 'dieHardFan' || route.name === 'articleVideo') {
activeTab.value = route.name;
}
}

24
src/views/recharge/bean/beanRecharge.vue

@ -3,24 +3,24 @@
<el-button-group>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'add_gold_bean_recharge' }"
@click="navigateTo('add_gold_bean_recharge')"
:class="{ 'active-btn': activeTab === 'addBeanRecharge' }"
@click="navigateTo('addBeanRecharge')"
v-if="hasAdd"
style="width: 6.5vw">
新增充值
</el-button>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'system_gold_bean_recharge' }"
@click="navigateTo('system_gold_bean_recharge')"
:class="{ 'active-btn': activeTab === 'beanSystemRecharge' }"
@click="navigateTo('beanSystemRecharge')"
v-if="hasSystem"
style="width: 6.5vw;">
系统充值
</el-button>
<el-button
class="no-active-btn"
:class="{ 'active-btn': activeTab === 'online_gold_bean_recharge' }"
@click="navigateTo('online_gold_bean_recharge')"
:class="{ 'active-btn': activeTab === 'beanOnlineRecharge' }"
@click="navigateTo('beanOnlineRecharge')"
v-if="hasOnline"
style="width: 6.5vw;">
线上充值
@ -66,16 +66,16 @@ const initPermissions = () => {
//
const getDefaultAuditRoute = () => {
initPermissions();
if (hasAdd.value) return 'add_gold_bean_recharge';
if (hasSystem.value) return 'system_gold_bean_recharge';
if (hasOnline.value) return 'online_gold_bean_recharge';
return 'add_gold_bean_recharge';
if (hasAdd.value) return 'addBeanRecharge';
if (hasSystem.value) return 'beanSystemRecharge';
if (hasOnline.value) return 'beanOnlineRecharge';
return 'addBeanRecharge';
};
//
watch(() => route.name, (newName) => {
initPermissions()
if (newName === 'add_gold_bean_recharge' || newName === 'system_gold_bean_recharge' || newName === 'online_gold_bean_recharge') {
if (newName === 'addBeanRecharge' || newName === 'beanSystemRecharge' || newName === 'beanOnlineRecharge') {
activeTab.value = newName;
} else if (newName === 'beanRecharge') {
// 访 /beanConsume
@ -92,7 +92,7 @@ onMounted(() => {
navigateTo(defaultRoute);
} else {
//
if (route.name === 'add_gold_bean_recharge' || route.name === 'system_gold_bean_recharge' || route.name === 'online_gold_bean_recharge') {
if (route.name === 'addBeanRecharge' || route.name === 'beanSystemRecharge' || route.name === 'beanOnlineRecharge') {
activeTab.value = route.name;
}
}

Loading…
Cancel
Save