import "babel-polyfill"; // 解决Ie9
import Vue from "vue";
import App from "./App.vue";
import router from "./router/index";
import store from "./store/index";
import "./element";
import * as filters from "./filtres/index"; // 全局过滤器
import "./role"; // 权限
import allTools from "./plugin/allTools";
// import "./mock"; // 模拟数据

import "./assets/icons/iconfont";
import IconSvg from "./components/common/IconSvg.vue"; // svg组件
import axios from "axios";
import "../public/config.json";
import myReq from "./utils/axios";
import myReq2 from "./utils/axios2";
import {addDateRange, selectDictLabel} from '@/utils/tools';
// 注册全局组件（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.prototype.addDateRange = addDateRange;
Vue.prototype.selectDictLabel = selectDictLabel;
Vue.config.productionTip = false;
let getUrl = "";
let startApp = function () {
    axios.get("./config.json").then(res => {
        // 基础地址
        getUrl = res.data.BASE_URL;
        myReq.defaults.baseURL = getUrl;
        myReq2.defaults.baseURL = res.data.BASE_URL;
        new Vue({
            router,
            store,
            render: h => h(App)
        }).$mount("#app");
    });
};

startApp();
