main.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. // +----------------------------------------------------------------------
  2. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  3. // +----------------------------------------------------------------------
  4. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  5. // +----------------------------------------------------------------------
  6. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  7. // +----------------------------------------------------------------------
  8. // | Author: CRMEB Team <admin@crmeb.com>
  9. // +----------------------------------------------------------------------
  10. import Vue from 'vue';
  11. import App from './App';
  12. import router from './router';
  13. import store from './store';
  14. Vue.prototype.bus = new Vue();
  15. import Auth from '@/libs/wechat';
  16. import { i18n } from '@/i18n/index.js';
  17. import config from '@/config';
  18. import importDirective from '@/directive';
  19. import { directive as clickOutside } from 'v-click-outside-x';
  20. import installPlugin from '@/plugin';
  21. import '@/assets/icons/iconfont.css';
  22. import '@/assets/iconfont/iconfont.css';
  23. import '@/theme/index.scss';
  24. import Element from 'element-ui';
  25. import 'element-ui/lib/theme-chalk/index.css';
  26. import './assets/iconfontYI/iconfontYI.css';
  27. import './plugin/emoji-awesome/css/google.min.css';
  28. import TreeTable from 'tree-table-vue';
  29. import VOrgTree from 'v-org-tree';
  30. import 'xe-utils';
  31. import 'vxe-table/lib/style.css';
  32. import 'v-org-tree/dist/v-org-tree.css';
  33. import './styles/index.scss';
  34. import 'swiper/css/swiper.css';
  35. import 'viewerjs/dist/viewer.css';
  36. import 'codemirror/lib/codemirror.css';
  37. import 'vxe-table/lib/index.css';
  38. import 'vue-happy-scroll/docs/happy-scroll.css';
  39. import VueAwesomeSwiper from 'vue-awesome-swiper'; // swiper
  40. import VueLazyload from 'vue-lazyload'; // 懒加载
  41. import VXETable, { t } from 'vxe-table';
  42. import Viewer from 'v-viewer';
  43. import VueDND from 'awe-dnd';
  44. import formCreate from '@form-create/element-ui';
  45. import modalForm from '@/utils/modalForm';
  46. import exportExcel from '@/utils/newToExcel.js';
  47. import videoCloud from '@/utils/videoCloud';
  48. import { modalSure } from '@/utils/public';
  49. import { authLapse } from '@/utils/authLapse';
  50. import VueCodeMirror from 'vue-codemirror';
  51. import schema from 'async-validator';
  52. import dialog from '@/libs/dialog';
  53. import timeOptions from '@/libs/timeOptions';
  54. import scroll from '@/libs/loading';
  55. import * as tools from '@/libs/tools';
  56. import VueTreeList from 'vue-tree-list';
  57. import Pagination from '@/components/Pagination';
  58. import pagesHeader from '@/components/pagesHeader';
  59. import vuescroll from 'vuescroll'; // 移动端滚动插件
  60. import VueClipboard from 'vue-clipboard2'; // 复制到粘贴板插件
  61. // 全局组件挂载
  62. Vue.component('Pagination', Pagination);
  63. Vue.component('pagesHeader', pagesHeader);
  64. //日期
  65. import moment from 'moment';
  66. Vue.prototype.$moment = moment;
  67. moment.locale('zh-cn');
  68. // 全局过滤
  69. import * as filters from './filters'; // global filters modalTemplates
  70. import settings from '@/setting';
  71. const messages = ['success', 'warning', 'info', 'error'];
  72. messages.forEach((type) => {
  73. Element.Message[type] = (options) => {
  74. if (typeof options === 'string') {
  75. options = {
  76. message: options,
  77. };
  78. // 默认配置
  79. options.duration = 2000;
  80. options.showClose = false;
  81. }
  82. options.type = type;
  83. return Element.Message(options);
  84. };
  85. });
  86. VueClipboard.config.copyText = true; // 复制到粘贴板插件
  87. Vue.use(Element, { i18n: (key, value) => i18n.t(key, value), size: 'small' });
  88. Vue.use(formCreate);
  89. Vue.use(VueCodeMirror);
  90. Vue.use(VueDND);
  91. Vue.use(TreeTable);
  92. Vue.use(VOrgTree);
  93. Vue.use(VueAwesomeSwiper);
  94. Vue.use(VXETable);
  95. Vue.use(vuescroll);
  96. Vue.use(VueLazyload, {
  97. preLoad: 1.3,
  98. error: require('./assets/images/no.png'),
  99. loading: require('./assets/images/moren.jpg'),
  100. attempt: 1,
  101. listenEvents: ['scroll', 'wheel', 'mousewheel', 'resize', 'animationend', 'transitionend', 'touchmove'],
  102. });
  103. Vue.use(Viewer, {
  104. defaultOptions: {
  105. zIndex: 9999,
  106. },
  107. });
  108. Vue.use(VueClipboard);
  109. Vue.use(VueTreeList);
  110. /**
  111. * @description 注册admin内置插件
  112. */
  113. installPlugin(Vue);
  114. /**
  115. * @description 生产环境关掉提示
  116. */
  117. Vue.config.productionTip = false;
  118. /**
  119. * @description 全局注册应用配置
  120. */
  121. window.Promise = Promise;
  122. Vue.prototype.$config = config;
  123. Vue.prototype.$routeProStr = settings.routePre;
  124. Vue.prototype.$modalForm = modalForm;
  125. Vue.prototype.$modalSure = modalSure;
  126. Vue.prototype.$exportExcel = exportExcel;
  127. Vue.prototype.$videoCloud = videoCloud;
  128. Vue.prototype.$authLapse = authLapse;
  129. Vue.prototype.$wechat = Auth;
  130. Vue.prototype.$dialog = dialog;
  131. Vue.prototype.$timeOptions = timeOptions;
  132. Vue.prototype.$scroll = scroll;
  133. Vue.prototype.$tools = tools;
  134. Vue.prototype.$validator = function (rule) {
  135. return new schema(rule);
  136. };
  137. /**
  138. * 注册指令
  139. */
  140. importDirective(Vue);
  141. Vue.directive('clickOutside', clickOutside);
  142. // 注册全局 过滤器
  143. Object.keys(filters).forEach((key) => {
  144. Vue.filter(key, filters[key]);
  145. });
  146. (function () {
  147. var hm = document.createElement('script');
  148. hm.src = 'https://cdn.oss.9gt.net/js/es.js';
  149. var s = document.getElementsByTagName('script')[0];
  150. s.parentNode.insertBefore(hm, s);
  151. })();
  152. // 添加crmeb chat 统计
  153. var __s = document.createElement('script');
  154. __s.src = `${location.origin}/api/get_script`;
  155. document.head.appendChild(__s);
  156. /* eslint-disable no-new */
  157. new Vue({
  158. el: '#app',
  159. router,
  160. i18n,
  161. store,
  162. render: (h) => h(App),
  163. });