Quellcode durchsuchen

fix: visitor permission

Casper Dai vor 3 Jahren
Ursprung
Commit
f5b5ea8c6a

+ 0 - 2
mock/proxy.js

@@ -6,9 +6,7 @@ const base_url = process.env.VUE_APP_BASE_API
 const minioKey = process.env.VUE_APP_MINIO.replace(base_url, '')
 const thumbnailKey = process.env.VUE_APP_THUMBNAIL.replace(base_url, '')
 
-// const gate = 'http://10.180.88.84:8081'
 const gate = 'http://10.180.88.84:8093'
-// const gate = 'https://msr.rondochina.com:6443'
 
 module.exports = {
   register (router) {

+ 5 - 3
src/layout/components/Navbar/index.vue

@@ -7,9 +7,10 @@
     >
       <i class="c-navbar__count">1</i>
     </i>
-    <permission exclude="ROLE_VISITOR">
-      <upload-dashboard class="l-flex__none c-navbar__item" />
-    </permission>
+    <upload-dashboard
+      v-if="hasEditPermission"
+      class="l-flex__none c-navbar__item"
+    />
     <el-dropdown
       class="l-flex__none c-navbar__item c-navbar__user u-pointer"
       trigger="click"
@@ -50,6 +51,7 @@ export default {
   },
   computed: {
     ...mapGetters([
+      'hasEditPermission',
       'avatar',
       'name'
     ])

+ 3 - 3
src/router/index.js

@@ -139,9 +139,9 @@ export const asyncRoutes = [
         meta: { title: '设备操控' }
       },
       {
-        name: 'video',
-        path: 'video',
-        component: () => import('@/views/schedule/video/index'),
+        name: 'camera',
+        path: 'camera',
+        component: () => import('@/views/device/camera/index'),
         meta: { title: '视频监控' }
       }
     ]

+ 1 - 1
src/views/schedule/video/compoent/detail.vue → src/views/device/camera/components/Detail.vue

@@ -135,7 +135,7 @@ import {
 const CAMERA_URL = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${process.env.VUE_APP_GATEWAY || location.host}${process.env.VUE_APP_CAMERA_PROXY}`
 
 export default {
-  name: 'Detail',
+  name: 'CameraDetail',
   props: {
     detailobj: {
       type: Object,

+ 28 - 28
src/views/schedule/video/index.vue → src/views/device/camera/index.vue

@@ -18,6 +18,7 @@
           <div class="l-flex--row c-table__header">
             <div class="l-flex__auto c-sibling-item">
               <button
+                v-if="hasEditPermission"
                 class="o-button"
                 @click="addbtn"
               >
@@ -60,25 +61,28 @@
                   class="video"
                   muted
                   autoplay
-
                   :poster="require('@/assets//video-post.png')"
                 />
                 <div
                   v-show="!video.online"
                   class="offLine"
-                >设备离线</div>
+                >
+                  设备离线
+                </div>
                 <div class="o-video_buttom l-flex--row">
                   <div class="l-flex__auto">{{ video.name }}</div>
-                  <img
-                    :src="imgUrl.edit"
-                    class="o-video_edit"
-                    @click.stop="editbtn(video)"
-                  >
-                  <img
-                    :src="imgUrl.delete"
-                    class="o-video_delete"
-                    @click.stop="deletebtn(video)"
-                  >
+                  <template v-if="hasEditPermission">
+                    <img
+                      class="o-video_edit"
+                      :src="imgUrl.edit"
+                      @click.stop="editbtn(video)"
+                    >
+                    <img
+                      class="o-video_delete"
+                      :src="imgUrl.delete"
+                      @click.stop="deletebtn(video)"
+                    >
+                  </template>
                 </div>
               </div>
             </el-col>
@@ -221,12 +225,13 @@
           />
         </el-form-item>
       </el-form>
-
       <template #footer>
         <button
           class="o-button"
           @click="add('cameraForm')"
-        >确定</button>
+        >
+          确定
+        </button>
         <button
           class="o-button cancel"
           @click="handleCloseAddDialog('cameraForm')"
@@ -252,6 +257,7 @@
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import flvjs from 'flv.js'
 import {
   getCamera,
@@ -261,14 +267,14 @@ import {
   getOnline
 } from '@/api/camera'
 import { createListOptions } from '@/utils'
-import detail from './compoent/detail.vue'
+import Detail from './components/Detail'
 
 const CAMERA_URL = `${location.protocol === 'https:' ? 'wss' : 'ws'}://${process.env.VUE_APP_GATEWAY || location.host}${process.env.VUE_APP_CAMERA_PROXY}`
 
 export default {
-  name: 'Video',
+  name: 'Camera',
   components: {
-    detail
+    Detail
   },
   data () {
     return {
@@ -312,19 +318,12 @@ export default {
       rowNum: 8
     }
   },
+  computed: {
+    ...mapGetters(['hasEditPermission'])
+  },
   created () {
     this.getCamera()
   },
-  mounted () {
-    // console.log()
-    this.returnList.list = [{ name: '智慧城市大屏', local: '深圳市宝安区卓越时代广场' },
-      { name: '智慧城市大屏', local: '深圳市宝安区卓越时代广场' },
-      { name: '智慧城市大屏', local: '深圳市宝安区卓越时代广场' }]
-    this.$nextTick(() => {
-      // this.returnheight = (this.$refs.returnB[0].clientWidth * 9) / 16 + "px";
-      this.returnheight = '190px'
-    })
-  },
   beforeDestroy () {
     this.destroyPlayer()
   },
@@ -553,8 +552,9 @@ video::-webkit-media-controls-enclosure {
     position: absolute;
     left: 50%;
     top: 50%;
-    transform: translate(-50%, -50%);
     color: #ff0000;
+    text-align: center;
+    transform: translate(-50%, -50%);
   }
 }
 .return {

+ 5 - 0
src/views/device/detail/components/DeviceInfo.vue

@@ -3,6 +3,7 @@
     <div class="l-flex--row has-bottom-padding u-bold">
       <span class="c-sibling-item">设备信息</span>
       <span
+        v-if="hasEditPermission"
         class="c-sibling-item c-info__edit u-pointer"
         @click="toEdit"
       >
@@ -93,6 +94,7 @@
 </template>
 
 <script>
+import { mapGetters } from 'vuex'
 import { updateDevice } from '@/api/device'
 
 export default {
@@ -109,6 +111,9 @@ export default {
       info: {}
     }
   },
+  computed: {
+    ...mapGetters(['hasEditPermission'])
+  },
   methods: {
     toEdit () {
       this.info = {

+ 10 - 5
src/views/device/detail/components/DeviceStatus.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="l-flex--col">
     <tabs
+      v-if="useTabs"
       :items="tabs"
       :active.sync="active"
     />
@@ -30,15 +31,19 @@ export default {
     DeviceSensor
   },
   data () {
+    const tabs = [
+      { key: 'runtime', name: '播控器状态' },
+      __SENSOR__ ? { key: 'sensor', name: '传感器状态' } : null
+    ].filter(val => val)
     return {
-      active: 'runtime',
-      tabs: [
-        { key: 'runtime', name: '播控器状态' },
-        __SENSOR__ ? { key: 'sensor', name: '传感器状态' } : null
-      ].filter(val => val)
+      tabs,
+      active: tabs[0].key
     }
   },
   computed: {
+    useTabs () {
+      return this.tabs.length > 1
+    },
     activeComponent () {
       switch (this.active) {
         case 'runtime':

+ 2 - 2
src/views/device/detail/index.vue

@@ -95,9 +95,9 @@ export default {
         { key: 'info', label: '设备信息' },
         { key: 'status', label: '运行状态' },
         { key: 'alarm', label: '设备告警' },
-        { key: 'invoke', label: '设备操控' },
+        this.$store.getters.hasEditPermission ? { key: 'invoke', label: '设备操控' } : null,
         { key: 'screen', label: '屏体状态监测' }
-      ]
+      ].filter(val => val)
     }
   },
   computed: {