main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import Vue from 'vue';
  2. import Cookies from 'js-cookie';
  3. import Element from 'element-ui';
  4. import './assets/styles/element-variables.scss';
  5. import '@/assets/styles/index.scss'; // global css
  6. import '@/assets/styles/ruoyi.scss'; // ruoyi css
  7. import '@/assets/styles/cust-global.scss'; // 定制全局样式
  8. import App from './App';
  9. import store from './store';
  10. import router from './router';
  11. import permission from './directive/permission';
  12. import { download } from '@/utils/request';
  13. import './assets/icons'; // icon
  14. import './permission'; // permission control
  15. import { getDicts } from "@/api/system/dict/data";
  16. import { getConfigKey } from "@/api/system/config";
  17. import { getToken } from "@/utils/auth";
  18. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  19. import { handleOpenLoading, handleCloseLoading, imgViewerOnerror } from "@/utils/rockeryutil";
  20. // 分页组件
  21. import Pagination from "@/components/Pagination";
  22. // 自定义表格工具扩展
  23. import RightToolbar from "@/components/RightToolbar";
  24. // 全局方法挂载
  25. Vue.prototype.getDicts = getDicts;
  26. Vue.prototype.getConfigKey = getConfigKey;
  27. Vue.prototype.parseTime = parseTime;
  28. Vue.prototype.resetForm = resetForm;
  29. Vue.prototype.addDateRange = addDateRange;
  30. Vue.prototype.selectDictLabel = selectDictLabel;
  31. Vue.prototype.selectDictLabels = selectDictLabels;
  32. Vue.prototype.download = download;
  33. Vue.prototype.handleTree = handleTree;
  34. Vue.prototype.getToken = getToken;
  35. Vue.prototype.baseApiUrl = process.env.VUE_APP_BASE_API;
  36. Vue.prototype.handleOpenLoading = handleOpenLoading;
  37. Vue.prototype.handleCloseLoading = handleCloseLoading;
  38. Vue.prototype.imgViewerOnerror = imgViewerOnerror;
  39. // 成功消息提示框
  40. Vue.prototype.msgSuccess = function (msg) {
  41. this.$message({ showClose: true, message: msg, type: "success" });
  42. };
  43. // 警告消息提示框
  44. Vue.prototype.msgWarning = function (msg) {
  45. this.$message({ showClose: true, message: msg, type: "warning" });
  46. };
  47. // 错误消息提示框
  48. Vue.prototype.msgError = function (msg) {
  49. this.$message({ showClose: true, message: msg, type: "error" });
  50. };
  51. // 默认消息提示框
  52. Vue.prototype.msgInfo = function (msg) {
  53. this.$message.info(msg);
  54. };
  55. // 全局组件挂载
  56. Vue.component('Pagination', Pagination);
  57. Vue.component('RightToolbar', RightToolbar);
  58. Vue.use(permission);
  59. /**
  60. * If you don't want to use mock-server
  61. * you want to use MockJs for mock api
  62. * you can execute: mockXHR()
  63. *
  64. * Currently MockJs will be used in the production environment,
  65. * please remove it before going online! ! !
  66. */
  67. Vue.use(Element, {
  68. size: Cookies.get(process.env.VUE_APP_PROJECT_KEY + '-size') || 'medium' // set element-ui default size
  69. });
  70. Vue.config.productionTip = false;
  71. new Vue({
  72. el: '#app',
  73. router,
  74. store,
  75. render: h => h(App)
  76. });