瀏覽代碼

fix: adjust some operation and display

Casper Dai 2 年之前
父節點
當前提交
7e3f6b2c7c

+ 18 - 2
src/components/service/external/DevicePlayer/index.vue

@@ -1,7 +1,8 @@
 <template>
   <div
     class="o-video"
-    :class="{ offline: !online, mask: !isPlaying, controls }"
+    :class="{ offline: !online, mask: !isPlaying, controls, floating, fullscreen: isFullscreen }"
+    @mousemove="onMouseMove"
   >
     <template v-if="online">
       <video
@@ -122,7 +123,8 @@ export default {
       loadingQuality: false,
       showQualityMenu: false,
       quality: null,
-      recordConfig: null
+      recordConfig: null,
+      floating: true
     }
   },
   computed: {
@@ -142,18 +144,32 @@ export default {
         this.onVideoReset()
         this.destroyPlayer()
       }
+    },
+    isFullscreen () {
+      this.onMouseMove()
     }
   },
   created () {
+    this.$delayMoveTimer = -1
     this.$timer = -1
     if (this.online) {
       this.createPlayer()
     }
   },
   beforeDestroy () {
+    clearTimeout(this.$delayMoveTimer)
     this.hideQualityMenu()
   },
   methods: {
+    onMouseMove () {
+      clearTimeout(this.$delayMoveTimer)
+      this.floating = false
+      if (this.isFullscreen) {
+        this.$delayMoveTimer = setTimeout(() => {
+          this.floating = true
+        }, 3000)
+      }
+    },
     onVideoReset () {
       this.recordConfig = null
       this.$playerInfo = null

+ 6 - 8
src/components/service/external/player.js

@@ -23,7 +23,8 @@ export default {
       paused: true,
       loading: false,
       waiting: false,
-      needReset: true
+      needReset: true,
+      isFullscreen: false
     }
   },
   computed: {
@@ -127,7 +128,7 @@ export default {
       if (!video) {
         return
       }
-      if (this.$isFullScreen) {
+      if (this.isFullscreen) {
         if (document.exitFullscreen) {
           document.exitFullscreen()
         } else if (document.webkitCancelFullScreen) {
@@ -137,7 +138,7 @@ export default {
         } else if (document.msExitFullscreen) {
           document.msExitFullscreen()
         }
-        this.$isFullScreen = false
+        this.isFullscreen = false
       } else {
         const elm = video.parentNode
         if (elm.requestFullscreen) {
@@ -155,7 +156,7 @@ export default {
           })
           return
         }
-        this.$isFullScreen = true
+        this.isFullscreen = true
       }
     },
     onPlayOrPause () {
@@ -234,10 +235,7 @@ export default {
       if (this.retry) {
         this.createPlayer()
       } else if (message) {
-        this.$message({
-          type: 'warning',
-          message
-        })
+        console.log(message)
       }
     }
   }

+ 6 - 1
src/scss/bem/_object.scss

@@ -252,13 +252,18 @@
   background-color: #000;
   overflow: hidden;
 
-  &.controls:hover,
+  &.controls:not(.floating):hover,
   &.mask {
     .o-video__mask {
       display: inline-block;
     }
   }
 
+  &.fullscreen {
+    padding-top: 0;
+    border-radius: 0;
+  }
+
   &.offline {
     background: url("~@/assets/image_offline.svg") 0 0 / 100% 100% no-repeat;
 

+ 4 - 1
src/views/ad/applet/history/index.vue

@@ -46,6 +46,7 @@ export default {
           { prop: 'deviceName', label: '设备' },
           { prop: 'freq', label: '频率', 'min-width': 100 },
           { prop: 'price', label: '总价(元)', width: 100, align: 'right' },
+          { prop: 'phoneNumber', label: '提交人电话', width: 120, align: 'right' },
           { prop: 'createTime', label: '提交时间', width: 160, align: 'right' },
           { prop: 'auditTime', label: '审核时间', width: 160, align: 'right' },
           { type: 'invoke', render: [
@@ -70,13 +71,14 @@ export default {
     }
   },
   methods: {
-    transformOrder ({ id, price, status, expand, orders, assets, createTime, auditTime }) {
+    transformOrder ({ id, price, status, expand, orders, assets, phoneNumber, createTime, auditTime }) {
       if (!orders.length) {
         return {
           id,
           statusTag: this.getOrderTag(status, expand),
           startDate: '异常数据',
           price: (price / 100).toFixed(2),
+          phoneNumber,
           createTime,
           auditTime,
           assets
@@ -91,6 +93,7 @@ export default {
         range: `${startTime}-${endTime}`,
         freq: `${day}天 x ${duration}秒 x ${count}次`,
         price: (price / 100).toFixed(2),
+        phoneNumber,
         createTime,
         auditTime,
         assets

+ 4 - 1
src/views/ad/applet/review-order/index.vue

@@ -74,6 +74,7 @@ export default {
           { prop: 'deviceName', label: '设备' },
           { prop: 'freq', label: '频率' },
           { prop: 'price', label: '总价(元)', width: 100, align: 'right' },
+          { prop: 'phoneNumber', label: '提交人电话', width: 120, align: 'right' },
           { prop: 'createTime', label: '提交时间', width: 160, align: 'right' },
           { type: 'invoke', width: 180, render: [
             { label: '上播内容', on: this.onView },
@@ -108,12 +109,13 @@ export default {
     }
   },
   methods: {
-    transformOrder ({ id, price, createTime, orders, assets }) {
+    transformOrder ({ id, price, createTime, orders, assets, phoneNumber }) {
       if (!orders.length) {
         return {
           id,
           startDate: '异常数据',
           price: (price / 100).toFixed(2),
+          phoneNumber,
           createTime,
           assets,
           invalid: true
@@ -127,6 +129,7 @@ export default {
         range: `${startTime}-${endTime}`,
         price: (price / 100).toFixed(2),
         freq: `${day}天 x ${duration}秒 x ${count}次`,
+        phoneNumber,
         createTime,
         assets,
         invalid: assets.some(({ status }) => status !== State.RESOLVED)

+ 1 - 1
src/views/broadcast/history/index.vue

@@ -69,7 +69,7 @@ export default {
         condition: { releaseId: this.releaseId },
         list: getDeviceReleases,
         cols: [
-          { prop: 'deviceId', label: '设备id' },
+          { prop: 'deviceName', label: '设备名称' },
           { type: 'tag', render: ({ publishStatus }) => {
             return {
               type: ['warning', 'success'][publishStatus],

+ 11 - 3
src/views/dashboard/components/Device.vue

@@ -115,11 +115,15 @@ export default {
     },
     observer: {
       type: Function,
-      required: true
+      default: null
     },
     flag: {
       type: Number,
-      required: true
+      default: null
+    },
+    always: {
+      type: [Boolean, String],
+      default: false
     }
   },
   data () {
@@ -170,7 +174,11 @@ export default {
   },
   mounted () {
     if (this.isOnline) {
-      this.observer(this.$el)
+      if (this.always) {
+        this.intoView()
+      } else {
+        this.observer(this.$el)
+      }
     } else {
       ScreenshotCache.remove(this.device.id)
     }

+ 1 - 0
src/views/dashboard/map/index.vue

@@ -68,6 +68,7 @@
           :key="device.id"
           class="c-device-map__device"
           :device="device"
+          always
         />
       </div>
     </div>

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

@@ -252,6 +252,9 @@ export default {
       let hasRelay = false
       current_status_info.forEach(({ portIndex, connectIndex, updatePowerIndexStates }) => {
         updatePowerIndexStates.forEach(({ powerIndex, type, action }) => {
+          if (portIndex === RELAY_KEY) {
+            return
+          }
           const key = portIndex === RELAY_KEY ? RELAY_KEY : `${portIndex}_${connectIndex}_${type}`
           if (!map[key]) {
             map[key] = {

+ 8 - 1
src/views/device/detail/components/DeviceInfo/index.vue

@@ -76,7 +76,10 @@
         </div>
       </div>
     </div>
-    <div class="l-flex--row c-info__block">
+    <div
+      v-if="power"
+      class="l-flex--row c-info__block"
+    >
       <div class="l-flex__none c-info__title">电源</div>
       <power
         v-if="online"
@@ -129,6 +132,10 @@ export default {
     online: {
       type: [Boolean, String],
       default: false
+    },
+    power: {
+      type: [Boolean, String],
+      default: false
     }
   },
   computed: {

+ 8 - 9
src/views/device/detail/components/DeviceInvoke/MultifunctionCardPowerSwitch.vue

@@ -440,7 +440,7 @@ export default {
       const options = []
       let hasMulti = false
       let hasRelay = false
-      this.$powers = current_status_info.map(({ portIndex, connectIndex, updatePowerIndexStates }) => {
+      this.$powers = current_status_info.filter(({ portIndex }) => portIndex !== RELAY_KEY).map(({ portIndex, connectIndex, updatePowerIndexStates }) => {
         return {
           portIndex, connectIndex,
           powers: updatePowerIndexStates.map(({ powerIndex, type, action }) => {
@@ -555,8 +555,8 @@ export default {
               }
             }
         }),
-        ErrorMessage.TIMEOUT,
-        30000
+        this.getPowerStatus,
+        15000
       )
     },
     onSwitchPowerMulti (power) {
@@ -583,8 +583,8 @@ export default {
             }]
           }
         }),
-        ErrorMessage.TIMEOUT,
-        30000
+        this.getPowerStatus,
+        15000
       )
     },
     onSwitchOpen () {
@@ -622,8 +622,8 @@ export default {
               })
             }
           }),
-          ErrorMessage.TIMEOUT,
-          30000
+          this.getPowerStatus,
+          15000
         )
       })
     },
@@ -761,8 +761,7 @@ export default {
           sn: this.device.serialNumber,
           ...this.getSubmitInfo(key)
         }),
-        ErrorMessage.TIMEOUT,
-        30000
+        ErrorMessage.TIMEOUT
       )
     },
     getSetTaskKey () {

+ 8 - 4
src/views/device/detail/components/DeviceInvoke/index.vue

@@ -22,6 +22,10 @@ export default {
     online: {
       type: [Boolean, String],
       default: false
+    },
+    power: {
+      type: [Boolean, String],
+      default: false
     }
   },
   render (h) {
@@ -43,18 +47,18 @@ export default {
         ? [
           h('DeviceNetwork', { props: this.$attrs }),
           h('ScreenSwitch', { props: this.$attrs }),
-          h('MultifunctionCardPowerSwitch', { props: this.$attrs }),
+          this.power ? h('MultifunctionCardPowerSwitch', { props: this.$attrs }) : null,
           h('PLCSwitch', { props: this.$attrs }),
           h('ScreenLight', { props: this.$attrs }),
           h('ScreenVolume', { props: this.$attrs }),
           h('DeviceReboot', { props: this.$attrs })
-        ]
+        ].filter(Boolean)
         : [
           h('DeviceNetwork', { props: this.$attrs }),
-          h('MultifunctionCardPowerSwitch', { props: this.$attrs }),
+          this.power ? h('MultifunctionCardPowerSwitch', { props: this.$attrs }) : null,
           h('ScreenVolume', { props: this.$attrs }),
           h('DeviceReboot', { props: this.$attrs })
-        ]
+        ].filter(Boolean)
     )
   }
 }

+ 11 - 7
src/views/device/detail/components/DeviceInvoke/mixins/base.js

@@ -19,7 +19,7 @@ export default {
     this.closeAsyncLoading()
   },
   methods: {
-    sendTopic (invoke, inputs, aysncFailMessage, delay = 5000) {
+    sendTopic (invoke, inputs, aysncFail, delay = 5000) {
       console.log('invoke', invoke, inputs)
       this.closeAsyncLoading()
       const timestamp = `${Date.now()}`
@@ -34,18 +34,22 @@ export default {
         }
       ).then(
         () => {
-          if (aysncFailMessage) {
+          if (aysncFail) {
             this.$messageId = messageId
-            if (aysncFailMessage === true) {
+            if (aysncFail === true) {
               return
             }
             this.$asyncloadingDialog = this.$showLoading()
             this.$asyncTimer = setTimeout(() => {
               this.closeAsyncLoading()
-              this.$message({
-                type: 'warning',
-                message: aysncFailMessage
-              })
+              if (typeof aysncFail === 'string') {
+                this.$message({
+                  type: 'warning',
+                  message: aysncFail
+                })
+              } else {
+                aysncFail()
+              }
             }, delay)
           } else {
             this.$message({

+ 21 - 1
src/views/device/detail/index.vue

@@ -65,6 +65,7 @@
         class="c-detail__wrapper has-gap u-overflow-y--auto"
         :device="device"
         :online="isOnline"
+        :power="hasPower"
       />
     </div>
     <sensor-dashboard-dialog ref="sensorDashboardDialog" />
@@ -72,7 +73,9 @@
 </template>
 
 <script>
+import { ThirdPartyDevice } from '@/constant'
 import { getDevice } from '@/api/device'
+import { getThirdPartyDevicesByThirdPartyDevice } from '@/api/mesh'
 import {
   start,
   stop,
@@ -117,7 +120,8 @@ export default {
         { key: 'DeviceExternal', label: '全链路监测' },
         { key: 'DeviceAlarm', label: '设备告警' },
         __TAKEOVER__ && this.$store.getters.isGroupAdmin ? { key: 'DeviceTakeOver', label: '接管' } : null
-      ].filter(Boolean)
+      ].filter(Boolean),
+      hasPower: false
     }
   },
   computed: {
@@ -159,6 +163,7 @@ export default {
   },
   beforeDestroy () {
     stop()
+    this.device = null
   },
   methods: {
     onShowSensorTables () {
@@ -194,6 +199,7 @@ export default {
             if (this.isOnline) {
               send('/screen/ask')
             }
+            this.checkPower()
           } else {
             this.$message({
               type: 'warning',
@@ -208,6 +214,20 @@ export default {
         }
       })
     },
+    checkPower () {
+      getThirdPartyDevicesByThirdPartyDevice(this.deviceId, [
+        ThirdPartyDevice.MULTI_FUNCTION_CARD
+      ], { custom: true }).then(
+        ({ data }) => {
+          this.hasPower = !!data?.[0]
+        },
+        ({ isCancel }) => {
+          if (!isCancel && this.device) {
+            setTimeout(this.checkPower, 1000)
+          }
+        }
+      )
+    },
     onUpdateOnline (online) {
       this.isActivated = true
       this.isWaiting = false