import Vue from 'vue'
import App from './App.vue'
import store from '@/store'
import { pcRouter } from '@/router'
import { Loading } from 'element-ui'

import Invite from '@/components/popup/invite'
import Avatar from '@/components/popup/avatar'
import Info from '@/components/popup/userInfo'
import otherInfo from '@/components/popup/otherInfo'
import imgPreview from '@/components/popup/imgPreview'
import packetGet from '@/components/popup/packetGet'
import packetSend from '@/components/popup/packetSend'
import pswSetting from '@/components/popup/pswSetting'
import Toast from '@/components/popup/toast'
import groupTypeSetting from '@/components/popup/groupTypeSetting'
import VueClipboard from 'vue-clipboard2'

import i18n from '@/util/lang/lang'
// 全局自定义插件
import '@/plugins/directive'
// 引用公共模块
import '../common'

Vue.use(Invite, store, pcRouter)
Vue.use(Avatar, store, i18n)
Vue.use(Info, store, i18n)
Vue.use(otherInfo, store, pcRouter)
Vue.use(packetGet, store)
Vue.use(packetSend, store)
Vue.use(pswSetting, store)
Vue.use(Toast)
Vue.use(groupTypeSetting, store)
Vue.use(VueClipboard)
Vue.use(imgPreview)

Vue.use(Loading)
Vue.config.productionTip = false

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

if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
  location.replace('/h5.html' + location.search + location.hash)
}
