import "babel-polyfill"; // 解决Ie9
import "./assets/icons/iconfont";
import IconSvg from "./components/common/IconSvg.vue"; // svg组件
import "./element";
import Vue from "vue";
import App from "./App.vue";
import router from "./router/index";
import store from "./store/index";

import * as filters from "./filtres/index"; // 全局过滤器
import "./role"; // 权限
import allTools from "./plugin/allTools";
// import "./mock"; // 模拟数据
import { BASE_URL } from "./config/app"
import axios from "axios";
import "../public/config.json";
import myReq from "./utils/axios";
// 注册全局组件（register global）
Vue.component("icon-svg", IconSvg);
Vue.use(allTools);
// 注册全局实用程序过滤器（register global utility filters）.
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key]);
});

Vue.config.productionTip = false;
let getUrl = "";
let url = process.env.VUE_APP_API_BASE;
let startApp = function() {
    console.log(window.global_config.BASE_URL);
//    axios.get("./config.json").then(res => {
        // 基础地址
        getUrl = url;
        myReq.defaults.baseURL = getUrl;
        // mySock.ws_url =  res.data.BASE_URL2;
//        console.log( res.data.BASE_URL+"\n"+ res.data.BASE_URL2)
        new Vue({
            router,
            store,
            render: h => h(App)
        }).$mount("#app");
//    });
};

startApp();
