Przeglądaj źródła

feat:菜单栏支持打开链接

lvkun996 2 lat temu
rodzic
commit
e9b7abe5fd

+ 9 - 8
src/layout/components/Sidebar/SidebarItem.vue

@@ -4,17 +4,13 @@
       v-if="hasOneShowingChild(item.children, item)"
     >
       <a-menu-item :key="item.path" @click="changeRoute(item)" >
-        <Icon :name="item.icon"   />
-        <span style="font-size: 16px;" >{{item.name}}</span>
+        <Title :title="item.name" :icon="item.icon" ></Title>
       </a-menu-item>
     </template>
 
       <a-sub-menu v-else :key="item.path" >
         <template #title>
-          <Icon :name="item.icon"   />
-          <span style="font-size: 16px;" >
-            {{item.name}}
-          </span>
+          <Title :title="item.name" :icon="item.icon" ></Title>
         </template>
         <sidebar-item
           v-for="child in item.children"
@@ -32,6 +28,7 @@ import { reactive, toRefs } from 'vue'
 import { useRouter } from 'vue-router'
 import { useAppRouter } from '@/store/router'
 import Icon from './Icon'
+import Title from './title'
 
 const appRouter = useAppRouter()
 const RootRouter = useRouter()
@@ -49,8 +46,12 @@ const props = defineProps({
 })
 
 const changeRoute = (route: ROUTER.RoutesProps) => {
-  RootRouter.push(route.path)
-  appRouter.setCurrentRoute(route.path)
+  if (route.link) {
+    window.open(route.path)
+  } else {
+    RootRouter.push(route.path)
+    appRouter.setCurrentRoute(route.path)
+  }
 }
 
 const state = reactive({

+ 12 - 0
src/layout/components/Sidebar/title.tsx

@@ -0,0 +1,12 @@
+import Icon from './Icon'
+
+export default ({ title, icon }: {title: string, icon: string}) => {
+  console.log('title:', title, icon)
+
+  return (
+    <div >
+      <Icon name={icon} />
+      <span style="font-size: 16px" >{title}</span>
+    </div>
+  )
+}

+ 3 - 2
src/pages/rts/stream/index.vue

@@ -28,7 +28,8 @@
     @ok="state.visible = false"
     destroyOnClose
   >
-    <video-player-tsx :video-url="useFlvUrl(state.detail.Path!)" />
+  <!-- :video-url="useFlvUrl(state.detail.Path!)" -->
+    <video-player-tsx  />
   </modal-pro>
 </template>
 
@@ -93,7 +94,7 @@ const state = reactive<{
   loading: false,
   dataSource: [],
   detail: {},
-  visible: false
+  visible: true
 })
 
 const openLive = (record: RTS.STREAM.Detail) => {

+ 6 - 0
src/router/index.ts

@@ -139,6 +139,12 @@ export const routes: Array<ROUTER.RoutesProps> = [
         name: '数据服务文档',
         component: () => import('@/pages/iot/doc/dataDoc.vue'),
         icon: 'CoffeeOutlined'
+      },
+      {
+        path: 'http://cloudview.jiaolongcloud.com/',
+        name: '云图文档',
+        link: true,
+        icon: 'LinkOutlined'
       }
     ]
   },

+ 2 - 1
src/typeing.d.ts

@@ -1,7 +1,8 @@
 declare namespace ROUTER {
 
   type RoutesProps = RouteRecordRaw & {
-    title: string
+    title: string,
+    link: boolean
   }
 
   type RouterRecords = {