main.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. // The Vue build version to load with the `import` command
  2. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
  3. import Vue from 'vue'
  4. import App from './App'
  5. import router from './router'
  6. import 'font-awesome/css/font-awesome.css'
  7. import './style/main.scss'
  8. import {getAuthUrls, getCurrentUser, getRolesPermissions, storageGet, storageSave} from '@/js/index'
  9. import {notify} from '@/constants/index'
  10. import store from './store'
  11. import moment from 'moment'
  12. import vRegion from 'v-region'
  13. import echarts from "echarts";
  14. import {
  15. Avatar,
  16. Alert,
  17. Badge,
  18. Button,
  19. ButtonGroup,
  20. Card,
  21. Carousel,
  22. CarouselItem,
  23. Checkbox,
  24. CheckboxButton,
  25. CheckboxGroup,
  26. Col,
  27. Collapse,
  28. CollapseItem,
  29. DatePicker,
  30. Dialog,
  31. Dropdown,
  32. DropdownItem,
  33. DropdownMenu,
  34. Form,
  35. FormItem,
  36. Image,
  37. Input,
  38. InputNumber,
  39. Link,
  40. Loading,
  41. Menu,
  42. MenuItem,
  43. MenuItemGroup,
  44. Message,
  45. MessageBox,
  46. Notification,
  47. Option,
  48. Pagination,
  49. Popover,
  50. Radio,
  51. RadioButton,
  52. RadioGroup,
  53. Row,
  54. Select,
  55. Submenu,
  56. Switch,
  57. Table,
  58. TableColumn,
  59. TabPane,
  60. Tabs,
  61. Tag,
  62. TimePicker,
  63. TimeSelect,
  64. Tooltip,
  65. Upload,
  66. Progress,
  67. Step,
  68. Steps,
  69. Divider
  70. } from 'element-ui'
  71. Vue.prototype.$moment = moment
  72. Vue.prototype.$echarts = echarts;
  73. function getCurrentUserSuccess(res){
  74. }
  75. // var _hmt = _hmt || [];
  76. // (function() {
  77. // var hm = document.createElement("script");
  78. // hm.src = "https://hm.baidu.com/hm.js?0e3bd98236bd62558926fc433751d60c";
  79. // var s = document.getElementsByTagName("script")[0];
  80. // s.parentNode.insertBefore(hm, s);
  81. // })();
  82. // router.beforeEach((to, from, next) => {
  83. // // if (_hmt) {
  84. // // if (to.path) {
  85. // // _hmt.push(['_trackPageview', '/#' + to.fullPath]);
  86. // // }
  87. // // }
  88. // const urls = getAuthUrls()
  89. // if (storageGet('user') == null) {
  90. // getCurrentUser().then((res) => {
  91. // hstorageSave('user', res)
  92. // storageSave('rolesPermissions', getRolesPermissions(res.roleList))
  93. // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
  94. // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值
  95. // next()
  96. // } else {
  97. // next({
  98. // path: '/',
  99. // query: {
  100. // redirect: to.fullPath
  101. // } // 将跳转的路由path作为参数,登录成功后跳转到该路由
  102. // })
  103. // }
  104. // } else {
  105. // next()
  106. // }
  107. // }).catch((error) => {
  108. // // notify('warning', '请登录')
  109. // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
  110. // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值
  111. // next()
  112. // } else {
  113. // next({
  114. // path: '/',
  115. // query: {
  116. // redirect: to.fullPath
  117. // } // 将跳转的路由path作为参数,登录成功后跳转到该路由
  118. // })
  119. // }
  120. // } else {
  121. // next()
  122. // }
  123. // })
  124. // } else {
  125. // if (to.matched.some(record => record.meta.requireAuth)) { // 判断该路由是否需要登录权限
  126. // if (sessionStorage.userName === '2' && urls.includes(to.matched[0].path)) { // 判断缓存里面是否有 userName //在登录的时候设置它的值
  127. // next()
  128. // } else {
  129. // next({
  130. // path: '/',
  131. // query: {
  132. // redirect: to.fullPath
  133. // } // 将跳转的路由path作为参数,登录成功后跳转到该路由
  134. // })
  135. // }
  136. // } else {
  137. // next()
  138. // }
  139. // }
  140. // //console.log(to.matched[0].path)
  141. // //console.log(urls.includes(to.matched[0].path))
  142. //
  143. // })
  144. // require('./mock.js')
  145. Vue.use(Carousel)
  146. Vue.use(CarouselItem)
  147. Vue.use(Row)
  148. Vue.use(Col)
  149. Vue.use(Table)
  150. Vue.use(TableColumn)
  151. Vue.use(Form)
  152. Vue.use(FormItem)
  153. Vue.use(Button)
  154. Vue.use(ButtonGroup)
  155. Vue.use(Menu)
  156. Vue.use(Submenu)
  157. Vue.use(MenuItem)
  158. Vue.use(MenuItemGroup)
  159. Vue.use(Input)
  160. Vue.use(InputNumber)
  161. Vue.use(Radio)
  162. Vue.use(RadioGroup)
  163. Vue.use(RadioButton)
  164. Vue.use(Checkbox)
  165. Vue.use(CheckboxButton)
  166. Vue.use(CheckboxGroup)
  167. Vue.use(DatePicker)
  168. Vue.use(TimeSelect)
  169. Vue.use(TimePicker)
  170. Vue.use(Switch)
  171. Vue.use(Select)
  172. Vue.use(Option)
  173. Vue.use(Upload)
  174. Vue.use(Tabs)
  175. Vue.use(TabPane)
  176. Vue.use(Collapse)
  177. Vue.use(CollapseItem)
  178. Vue.use(Dialog)
  179. Vue.use(Card)
  180. Vue.use(Tag)
  181. Vue.use(Avatar)
  182. Vue.use(Pagination)
  183. Vue.use(Link)
  184. Vue.use(Loading)
  185. Vue.use(Tooltip)
  186. Vue.use(Dropdown)
  187. Vue.use(DropdownItem)
  188. Vue.use(DropdownMenu)
  189. Vue.use(Image)
  190. Vue.use(Badge)
  191. Vue.use(Popover)
  192. Vue.use(Progress)
  193. Vue.use(Steps)
  194. Vue.use(Step)
  195. Vue.use(Divider)
  196. Vue.use(Alert)
  197. Vue.prototype.$msgbox = MessageBox
  198. Vue.prototype.$alert = MessageBox.alert
  199. Vue.prototype.$confirm = MessageBox.confirm
  200. Vue.prototype.$prompt = MessageBox.prompt
  201. Vue.prototype.$notify = Notification
  202. Vue.prototype.$message = Message
  203. Vue.config.productionTip = false
  204. /* eslint-disable no-new */
  205. new Vue({
  206. el: '#app',
  207. router,
  208. data:{
  209. Bus:new Vue()
  210. },
  211. components: {App},
  212. template: '<App/>',
  213. store
  214. })