vue2 获取XixunPlayer设备亮度,调节亮度

vue yekong 879℃

使用vue开发实现XixunPlayer的功能.

获取XixunPlayer设备亮度,调节亮度

/**
* @Author: 858834013@qq.com
* @Name: setBrightness
* @Date: 2022-04-26
* @Desc: XixunPlayer 获取设备亮度并修改亮度
*/
<template>
  <div class="setBrightness">
    <el-button class="mb20" type="primary" @click="getShow" size="mini">亮度调节</el-button>
    <el-dialog
      title="亮度调节"
      :visible.sync="dialogVisible"
      width="50%">
      <div class="list">
        <el-slider
          v-model="num"
          :max="255"
          show-input>
        </el-slider>
      </div>
      <span slot="footer" class="dialog-footer">
    <el-button type="primary" @click="changeBrightNess">更改</el-button>
     <el-button type="danger" @click="dialogVisible = false">取消</el-button>
  </span>
    </el-dialog>
  </div>
</template>

<script>
import { getdata } from '@/api/led/led'

export default {
  name: 'setBrightness',
  components: {},
  props: {
    id: {
      type: String | Number,
      default () {
        return {}
      }
    }
  },
  mounted: function () {
  },
  data () {
    return {
      num: 0,
      dialogVisible: false
    }
  },
  watch: {
    dialogVisible () {
      if (this.dialogVisible) {
        this.getData()
      }
    }
  },
  methods: {
    // 修改亮度
    changeBrightNess () {
      var that = this
      getdata(that.id, {
        type: 'callCardService',
        fn: 'setBrightness',
        arg1: that.num,
      }).then(function (res) {
        if (res.result) {
          that.$message({
            message: '修改成功',
            type: 'success'
          })
          that.dialogVisible = false
        }
      })
    },
    getShow () {
      this.dialogVisible = true
    },
    // 获取亮度
    getData () {
      var that = this
      getdata(that.id, {
        type: 'callCardService',
        fn: 'getBrightness'
      }).then(function (res) {
        that.num = res.result
      })
    },
  }
}
</script>
喜欢 (0)