import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './global.less' // global style
import './assets/css/icon.css'
import './plugins/element.js'
import './plugins/use.js'
import { VueAxios } from './utils/request'
import echarts from '@/plugins/echarts'
import { Carousel, CarouselItem } from 'element-ui'

Vue.config.productionTip = false

Vue.use(Carousel)
Vue.use(CarouselItem)
Vue.use(VueAxios)

Vue.prototype.$echarts = echarts

// 注册播放音频事件到Vue实例上
Vue.prototype.playAudio = () => {
  const buttonAudio = document.getElementById('eventAudio')
  //从头开始播放提示音
  buttonAudio.currentTime = 0
  buttonAudio.play()
}

Vue.prototype.stopAudio = () => {
  const buttonAudio = document.getElementById('eventAudio')
  buttonAudio.pause()
  //从头开始播放提示音
  buttonAudio.currentTime = 0
}

store.dispatch('getClientCode')
store.dispatch('initMqtt')

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
