main.js 5.1 KB

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