app.js 2.3 KB

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