/*
 * @Date: 2022-01-19 10:08:26
 * @LastEditors: JinxChen
 * @LastEditTime: 2023-10-11 15:36:55
 * @FilePath: \TelpoH5FrontendWeb\src\main.js
 * @description:
 */
import Vue from "vue";
import 'amfe-flexible/index.js';
import App from "./App.vue";
import router from "./router";
import store from "./store";
import '@/assets/css/reset.scss';
import dayjs from 'dayjs';
// ui库按需引入
import 'vant/lib/index.css';
import { replaceAll } from '@/utils';
// 引入echarts
import * as echarts from 'echarts';
import { BaiduStatisticsModel} from '@/config/models';
import {
    Button,
    Calendar,
    Cell,
    CellGroup,
    Checkbox,
    CheckboxGroup,
    Col,
    DatetimePicker,
    Dialog,
    Divider,
    Empty,
    Field,
    Form,
    Icon,
    Image,
    Lazyload,
    List,
    Loading,
    NavBar,
    NoticeBar,
    Notify,
    Overlay,
    Picker,
    Popup,
    PullRefresh,
    Radio,
    RadioGroup,
    Row,
    Slider,
    Swipe,
    SwipeCell,
    SwipeItem,
    Switch,
    Tab,
    Tabbar,
    TabbarItem,
    Tabs,
    Toast,
    ActionSheet,
    Progress,
    DropdownMenu,
    DropdownItem,
    TreeSelect,
} from 'vant'; //按需加载vant组件

Vue
.use(Button)
.use(Calendar)
.use(Checkbox)
.use(CheckboxGroup)
.use(Cell)
.use(CellGroup)
.use(Col)
.use(DatetimePicker)
.use(Dialog)
.use(Divider)
.use(Empty)
.use(Icon)
.use(Image)
.use(Form)
.use(Field)
.use(Lazyload)
.use(List)
.use(Loading)
.use(NavBar)
.use(NoticeBar)
.use(Notify)
.use(Overlay)
.use(Picker)
.use(Popup)
.use(PullRefresh)
.use(Radio)
.use(RadioGroup)
.use(Row)
.use(Slider)
.use(Swipe)
.use(SwipeCell)
.use(SwipeItem)
.use(Switch)
.use(Tab)
.use(Tabbar)
.use(TabbarItem)
.use(Tabs)
.use(Toast)
.use(ActionSheet)
.use(Progress)
.use(DropdownMenu)
.use(DropdownItem )
.use(TreeSelect)

Vue.config.productionTip = false;
Vue.config.devtools = true;

// 全局配置 loading
Toast.setDefaultOptions('success', {
    duration: 1500,
    forbidClick: true,
});
Toast.setDefaultOptions('loading', {
    duration: 1500,
    forbidClick: true,
});
Dialog.setDefaultOptions({
    confirmButtonColor: "#3296fa",
    showCancelButton: false,
});
Vue.config.productionTip = false;
Vue.prototype.$dayjs = dayjs;
Vue.prototype.$echarts = echarts;
Vue.prototype.$bus =  new Vue();
Vue.prototype.$replaceAll = replaceAll;
router.afterEach((to, from, next) => {
    // 创建百度统计js
   setTimeout(()=>{
     var _hmt = _hmt || [];
     (function() {
       var hm = document.createElement("script");
       hm.src = BaiduStatisticsModel[ process.env.NODE_ENV ];
       var s = document.getElementsByTagName("script")[0];
       s.parentNode.insertBefore(hm, s);
     })();
   },0);
 });
new Vue({
  router,
  store,
  render: (h) => h(App),
}).$mount("#app");
