Commit b91b11740a57b7f0b280492fefd0d6187a243d79
1 parent
f110b4f4
fix: 修复hjwl公司菜单权限及接口地址更新
- hjwl公司隐藏智能灯菜单,访问时自动跳转能耗页 - 根路由重定向保留corpCode查询参数 - 更新生产环境及开发代理API地址
Showing
4 changed files
with
19 additions
and
5 deletions
| ... | ... | @@ -15,7 +15,7 @@ |
| 15 | 15 | text-color="#bfcbd9" |
| 16 | 16 | active-text-color="#409eff" |
| 17 | 17 | > |
| 18 | - <el-menu-item index="/smart-light" @click="navigateTo('/smart-light')"> | |
| 18 | + <el-menu-item v-if="!isHjwl" index="/smart-light" @click="navigateTo('/smart-light')"> | |
| 19 | 19 | <el-icon><Monitor /></el-icon> |
| 20 | 20 | <span>智能灯</span> |
| 21 | 21 | </el-menu-item> |
| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | </template> |
| 34 | 34 | |
| 35 | 35 | <script setup> |
| 36 | -import { computed, provide, watchEffect } from 'vue' | |
| 36 | +import { computed, provide, watch, watchEffect } from 'vue' | |
| 37 | 37 | import { useRoute, useRouter } from 'vue-router' |
| 38 | 38 | import { setCorpCode } from './config/api.js' |
| 39 | 39 | |
| ... | ... | @@ -57,6 +57,20 @@ function withCorpCode(path) { |
| 57 | 57 | return `${path}${sep}corpCode=${encodeURIComponent(corpCode.value)}` |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | +// hjwl 公司只展示能耗,不展示智能灯 | |
| 61 | +const isHjwl = computed(() => (corpCode.value || '').toLowerCase() === 'hjwl') | |
| 62 | + | |
| 63 | +// hjwl 访问智能灯时自动跳转到能耗页 | |
| 64 | +watch( | |
| 65 | + () => [isHjwl.value, route.path], | |
| 66 | + () => { | |
| 67 | + if (isHjwl.value && route.path.startsWith('/smart-light')) { | |
| 68 | + router.replace(withCorpCode('/energy')) | |
| 69 | + } | |
| 70 | + }, | |
| 71 | + { immediate: true } | |
| 72 | +) | |
| 73 | + | |
| 60 | 74 | // 菜单导航:保留corpCode参数 |
| 61 | 75 | function navigateTo(path) { |
| 62 | 76 | router.push(withCorpCode(path)) | ... | ... |