app.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import Vue from 'vue'
  2. import App from './App.vue'
  3. import routes from './routes'
  4. import VueRouter from 'vue-router'
  5. import ViewUI from 'view-design';
  6. import Language from '../_modules/language'
  7. import '../common'
  8. import './main'
  9. Vue.use(VueRouter);
  10. Vue.use(ViewUI);
  11. Vue.use(Language);
  12. import Title from '../_components/Title.vue'
  13. import sreachTitle from '../_components/sreachTitle.vue'
  14. import UserInput from './components/UserInput'
  15. import UserView from './components/UserView'
  16. import WLoading from './components/WLoading'
  17. Vue.component('VTitle', Title);
  18. Vue.component('sreachTitle', sreachTitle);
  19. Vue.component('UserInput', UserInput);
  20. Vue.component('UserView', UserView);
  21. Vue.component('WLoading', WLoading);
  22. import TaskDetail from './components/project/task/detail'
  23. Vue.prototype.taskDetail = TaskDetail;
  24. import ReportDetail from './components/report/detail'
  25. Vue.prototype.reportDetail = ReportDetail;
  26. const originalPush = VueRouter.prototype.push
  27. VueRouter.prototype.push = function push(location) {
  28. return originalPush.call(this, location).catch(err => err)
  29. }
  30. const router = new VueRouter({
  31. mode: 'history',
  32. routes
  33. });
  34. //进度条配置
  35. ViewUI.LoadingBar.config({
  36. color: '#3fcc25',
  37. failedColor: '#ff0000'
  38. });
  39. router.beforeEach((to, from, next) => {
  40. ViewUI.LoadingBar.start();
  41. next();
  42. });
  43. router.afterEach((to, from, next) => {
  44. ViewUI.LoadingBar.finish();
  45. });
  46. //加载函数
  47. Vue.prototype.goForward = function(location, isReplace) {
  48. if (typeof location === 'string') location = {name: location};
  49. if (isReplace === true) {
  50. this.$router.replace(location);
  51. }else{
  52. this.$router.push(location);
  53. }
  54. };
  55. //返回函数
  56. Vue.prototype.goBack = function (number) {
  57. let history = $A.jsonParse(window.sessionStorage['__history__'] || '{}');
  58. if ($A.runNum(history['::count']) > 2) {
  59. this.$router.go(typeof number === 'number' ? number : -1);
  60. } else {
  61. this.$router.replace(typeof number === "object" ? number : {path: '/'});
  62. }
  63. };
  64. Vue.prototype.$A = $A;
  65. Vue.config.productionTip = false;
  66. const app = new Vue({
  67. el: '#app',
  68. router,
  69. template: '<App/>',
  70. components: { App }
  71. });
  72. $A.app = app;
  73. window.localStorage.setItem("__::WookTeam:check", "success")