main.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' // directive
  11. import plugins from './plugins' // plugins
  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 { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
  18. // 分页组件
  19. import Pagination from "@/components/Pagination"
  20. // 自定义表格工具组件
  21. import RightToolbar from "@/components/RightToolbar"
  22. // 富文本组件
  23. import Editor from "@/components/Editor"
  24. // 文件上传组件
  25. import FileUpload from "@/components/FileUpload"
  26. // 图片上传组件
  27. import ImageUpload from "@/components/ImageUpload"
  28. // 图片预览组件
  29. import ImagePreview from "@/components/ImagePreview"
  30. // 字典标签组件
  31. import DictTag from '@/components/DictTag'
  32. // 头部标签组件
  33. import VueMeta from 'vue-meta'
  34. // 字典数据组件
  35. import DictData from '@/components/DictData'
  36. // 地图组件
  37. import VueAMap from 'vue-amap';
  38. import * as echarts from 'echarts'
  39. Vue.use(VueAMap)
  40. Vue.prototype.$echarts = echarts
  41. VueAMap.initAMapApiLoader({
  42. key: 'bee95ab1796ad6803492c1bf9da311ab',
  43. plugin: [
  44. 'AMap.Autocomplete', // 输入提示插件
  45. 'AMap.PlaceSearch', // POI搜索插件
  46. 'AMap.Scale', // 右下角缩略图插件 比例尺
  47. 'AMap.OverView', // 地图鹰眼插件
  48. 'AMap.ToolBar', // 地图工具条
  49. 'AMap.MapType', // 类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
  50. 'AMap.PolyEditor', // 编辑 折线、多边形
  51. 'AMap.CircleEditor', // 圆形编辑器插件
  52. 'MarkerClusterer', // 点聚合
  53. 'AMap.Geolocation', // 定位控件,用来获取和展示用户主机所在的经纬度位置,
  54. 'AMap.DistrictSearch',
  55. 'AMap.MouseTool',
  56. 'Geocoder',
  57. 'AMap.HeatMap' // 添加这一行
  58. ],
  59. v: '2.0', // 默认高德 sdk 版本为 1.4.4
  60. uiVersion: '2.0'
  61. })
  62. // 添加全局调试信息
  63. console.log('VueAMap 初始化完成')
  64. window.addEventListener('load', () => {
  65. console.log('页面完全加载,AMap状态:', typeof AMap)
  66. })
  67. // 全局方法挂载
  68. Vue.prototype.getDicts = getDicts
  69. Vue.prototype.getConfigKey = getConfigKey
  70. Vue.prototype.parseTime = parseTime
  71. Vue.prototype.resetForm = resetForm
  72. Vue.prototype.addDateRange = addDateRange
  73. Vue.prototype.selectDictLabel = selectDictLabel
  74. Vue.prototype.selectDictLabels = selectDictLabels
  75. Vue.prototype.download = download
  76. Vue.prototype.handleTree = handleTree
  77. // 全局组件挂载
  78. Vue.component('DictTag', DictTag)
  79. Vue.component('Pagination', Pagination)
  80. Vue.component('RightToolbar', RightToolbar)
  81. Vue.component('Editor', Editor)
  82. Vue.component('FileUpload', FileUpload)
  83. Vue.component('ImageUpload', ImageUpload)
  84. Vue.component('ImagePreview', ImagePreview)
  85. Vue.use(directive)
  86. Vue.use(plugins)
  87. Vue.use(VueMeta)
  88. DictData.install()
  89. /**
  90. * If you don't want to use mock-server
  91. * you want to use MockJs for mock api
  92. * you can execute: mockXHR()
  93. *
  94. * Currently MockJs will be used in the production environment,
  95. * please remove it before going online! ! !
  96. */
  97. Vue.use(Element, {
  98. size: Cookies.get('size') || 'medium' // set element-ui default size
  99. })
  100. Vue.config.productionTip = false
  101. new Vue({
  102. el: '#app',
  103. router,
  104. store,
  105. render: h => h(App)
  106. })