// The Vue build version to load with the `import` command // (runtime-only or standalone) has been set in webpack.base.conf with an alias. import Vue from 'vue' import App from './App' import router from './router' import 'font-awesome/css/font-awesome.css' import './style/main.scss' import {getAuthUrls, getCurrentUser, getRolesPermissions, storageGet, storageSave} from '@/js/index' import {notify} from '@/constants/index' import store from './store' import moment from 'moment' import vRegion from 'v-region' import echarts from "echarts"; import Http from '@/js/http.js' import {configToJson} from './utils/filters' import { Avatar, Alert, Badge, Button, ButtonGroup, Card, Carousel, CarouselItem, Checkbox, CheckboxButton, CheckboxGroup, Col, Collapse, CollapseItem, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Image, Input, InputNumber, Link, Loading, Menu, MenuItem, MenuItemGroup, Message, MessageBox, Notification, Option, Pagination, Popover, Radio, RadioButton, RadioGroup, Row, Select, Submenu, Switch, Table, TableColumn, TabPane, Tabs, Tag, TimePicker, TimeSelect, Tooltip, Upload, Progress, Step, Steps, Divider } from 'element-ui' import {setConfig} from "./config"; Vue.prototype.$moment = moment Vue.prototype.$echarts = echarts; function getCurrentUserSuccess(res){ } // var _hmt = _hmt || []; // (function() { // var hm = document.createElement("script"); // hm.src = "https://hm.baidu.com/hm.js?0e3bd98236bd62558926fc433751d60c"; // var s = document.getElementsByTagName("script")[0]; // s.parentNode.insertBefore(hm, s); // })(); // router.beforeEach((to, from, next) => { // // if (_hmt) { // // if (to.path) { // // _hmt.push(['_trackPageview', '/#' + to.fullPath]); // // } // // } // const urls = getAuthUrls() // if (storageGet('user') == null) { // getCurrentUser().then((res) => { // hstorageSave('user', res) // storageSave('rolesPermissions', getRolesPermissions(res.roleList)) // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限 // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值 // next() // } else { // next({ // path: '/', // query: { // redirect: to.fullPath // } // 将跳转的路由path作为参数,登录成功后跳转到该路由 // }) // } // } else { // next() // } // }).catch((error) => { // // notify('warning', '请登录') // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限 // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值 // next() // } else { // next({ // path: '/', // query: { // redirect: to.fullPath // } // 将跳转的路由path作为参数,登录成功后跳转到该路由 // }) // } // } else { // next() // } // }) // } else { // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限 // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值 // next() // } else { // next({ // path: '/', // query: { // redirect: to.fullPath // } // 将跳转的路由path作为参数,登录成功后跳转到该路由 // }) // } // } else { // next() // } // } // //console.log(to.matched[0].path) // //console.log(urls.includes(to.matched[0].path)) // // }) // require('./mock.js') Vue.use(Carousel) Vue.use(CarouselItem) Vue.use(Row) Vue.use(Col) Vue.use(Table) Vue.use(TableColumn) Vue.use(Form) Vue.use(FormItem) Vue.use(Button) Vue.use(ButtonGroup) Vue.use(Menu) Vue.use(Submenu) Vue.use(MenuItem) Vue.use(MenuItemGroup) Vue.use(Input) Vue.use(InputNumber) Vue.use(Radio) Vue.use(RadioGroup) Vue.use(RadioButton) Vue.use(Checkbox) Vue.use(CheckboxButton) Vue.use(CheckboxGroup) Vue.use(DatePicker) Vue.use(TimeSelect) Vue.use(TimePicker) Vue.use(Switch) Vue.use(Select) Vue.use(Option) Vue.use(Upload) Vue.use(Tabs) Vue.use(TabPane) Vue.use(Collapse) Vue.use(CollapseItem) Vue.use(Dialog) Vue.use(Card) Vue.use(Tag) Vue.use(Avatar) Vue.use(Pagination) Vue.use(Link) Vue.use(Loading) Vue.use(Tooltip) Vue.use(Dropdown) Vue.use(DropdownItem) Vue.use(DropdownMenu) Vue.use(Image) Vue.use(Badge) Vue.use(Popover) Vue.use(Progress) Vue.use(Steps) Vue.use(Step) Vue.use(Divider) Vue.use(Alert) Vue.prototype.$msgbox = MessageBox Vue.prototype.$alert = MessageBox.alert Vue.prototype.$confirm = MessageBox.confirm Vue.prototype.$prompt = MessageBox.prompt Vue.prototype.$notify = Notification Vue.prototype.$message = Message Vue.config.productionTip = false Http.get('/api/common/configuration').then((res) => { let config = res.data&&res.data.configurationList; let configData = configToJson(config); this.homeDataNoCache = configData; setConfig(configData); storageSave('config', configData); new Vue({ el: '#app', router, data: { Bus: new Vue() }, components: {App}, template: '', store }) }).catch((error) => { console.log(error) notify('error', error.data) }) /* eslint-disable no-new */