app.js 2.3 KB

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