Commit b91b11740a57b7f0b280492fefd0d6187a243d79

Authored by 杨鸣坤
1 parent f110b4f4

fix: 修复hjwl公司菜单权限及接口地址更新

- hjwl公司隐藏智能灯菜单,访问时自动跳转能耗页
- 根路由重定向保留corpCode查询参数
- 更新生产环境及开发代理API地址
1 1 # 生产环境API基础地址
2   -VITE_API_BASE=http://182.127.106.19:81/iot-scheduler
  2 +VITE_API_BASE=http://124.64.20.47:81/iot-scheduler
... ...
... ... @@ -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))
... ...
... ... @@ -3,7 +3,7 @@ import { createRouter, createWebHashHistory } from 'vue-router' // 改用 Hash
3 3 const routes = [
4 4 {
5 5 path: '/',
6   - redirect: '/smart-light'
  6 + redirect: to => ({ path: '/smart-light', query: to.query })
7 7 },
8 8 {
9 9 path: '/h5',
... ...
... ... @@ -12,7 +12,7 @@ export default defineConfig({
12 12 server: {
13 13 proxy: {
14 14 '/api': {
15   - target: 'http://182.127.106.19:81',
  15 + target: 'http://124.64.20.47:81',
16 16 changeOrigin: true,
17 17 rewrite: (path) => path.replace(/^\/api/, '/iot-scheduler'),
18 18 },
... ...