import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import Vant from 'vant';
import 'vant/lib/index.css';
import './css/index.css';
import 'lib-flexible';
// import VueAMap from 'vue-amap';
import VueResource from 'vue-resource';
import x2js from 'x2js'
import navBar from "@/components/navBar.vue";
import VueBarcode from 'vue-barcode';

Vue.prototype.$x2js = new x2js();
Vue.use(Vant);
// Vue.use(VueAMap);
Vue.use(VueResource);
Vue.component('nav-bar',navBar);
Vue.component('barcode', VueBarcode);


// VueAMap.initAMapApiLoader({
//   key: 'your amap key',
//   plugin: ['AMap.Autocomplete', 'AMap.PlaceSearch', 'AMap.Scale', 'AMap.OverView', 'AMap.ToolBar', 'AMap.MapType', 'AMap.PolyEditor', 'AMap.CircleEditor'],
//   // 默认高德 sdk 版本为 1.4.4
//   v: '1.4.4'
// });
// 全局Vue对象

//设置网页字体不随系统改变
(function () {
  if (
      typeof WeixinJSBridge == "object" &&
      typeof WeixinJSBridge.invoke == "function"
  ) {
      handleFontSize()
  } else {
      if (document.addEventListener) {
          document.addEventListener(
              "WeixinJSBridgeReady",
              handleFontSize,
              false
          )
      } else if (document.attachEvent) {
          document.attachEvent("onWeixinJSBridgeReady", handleFontSize)
      }
  }
  function handleFontSize() {
      // 设置网页字体为默认大小
      WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 })
      // 重写设置网页字体大小的事件
      WeixinJSBridge.on("menu:setfont", function () {
          WeixinJSBridge.invoke("setFontSizeCallback", { fontSize: 0 })
      })
  }
})()

Vue.config.productionTip = false
// Vue.prototype.httpurl = "http://guahao.hzyqtkj.com:9081"
//Vue.prototype.httpurl = "http://gzh.btlsoln.com:9081/WGZH/"
Vue.prototype.httpurl = "https://nxwj.btlsoln.com/nxgzh"
// Vue.prototype.httpurl = "http://192.168.111.93:8089"

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


router.beforeEach((to, from, next) => {
  // 从from跳转到to
  //document.title = to.matched[0].meta.title // 修改title
  // console.log(to);
  // console.log('++++');
  next()
})