app.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // The Vue build version to load with the `import` command
  2. // (runtime-only or standalone) has been set in webpack.base.conf with an alias.
  3. import Vue from 'vue';
  4. import App from '@/components/App.vue';
  5. // include
  6. import '@/config/include.js';
  7. // 通用store
  8. import store from '@/store/index.js';
  9. // router
  10. import router from './router/index.js';
  11. import VueApollo from 'vue-apollo'
  12. import apollo from '@/config/apolloConfig.js'
  13. import 'xe-utils'
  14. import VXETable from 'vxe-table'
  15. import 'vxe-table/lib/style.css'
  16. Vue.use(VXETable)
  17. Vue.prototype.$XModal = VXETable.modal
  18. import AMap from 'vue-amap';
  19. Vue.use(AMap);
  20. AMap.initAMapApiLoader({
  21. key: 'eed46ea40bbcadbf8a9cdd5dc1a94642',
  22. plugin: [
  23. "AMap.Autocomplete", // 输入提示插件
  24. "AMap.PlaceSearch", // POI搜索插件
  25. "AMap.Scale", // 右下角缩略图插件 比例尺
  26. "AMap.OverView", // 地图鹰眼插件
  27. "AMap.ToolBar", // 地图工具条
  28. "AMap.MapType", // 类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
  29. "AMap.PolyEditor", // 编辑 折线多,边形
  30. "AMap.CircleEditor", // 圆形编辑器插件
  31. "AMap.Geolocation", // 定位控件,用来获取和展示用户主机所在的经纬度位置
  32. "AMap.ControlBar" // 缩放、尺寸控制器
  33. ],
  34. // 默认高德 sdk 版本为 1.4.4
  35. v: '1.4.15',
  36. uiVersion: '1.1.1'
  37. });
  38. import Share from 'vue-social-share'
  39. Vue.use(Share);
  40. import 'view-design/dist/styles/iview.css';
  41. import ViewUI from 'view-design';
  42. Vue.use(ViewUI);
  43. // import VueAMap from 'vue-amap'
  44. // Vue.use(VueAMap)
  45. // VueAMap.initAMapApiLoader({
  46. // key: 'eed46ea40bbcadbf8a9cdd5dc1a94642',
  47. // plugin: [//高德地图扩展插件(按需添加)
  48. // 'AMap.Autocomplete', // 输入提示插件
  49. // 'AMap.PlaceSearch', // POI搜索插件
  50. // 'AMap.Scale', // 右下角缩略图插件 比例尺
  51. // 'AMap.OverView', // 地图鹰眼插件
  52. // 'AMap.ToolBar', // 地图工具条
  53. // 'AMap.MapType', // 类别切换控件,实现默认图层与卫星图、实施交通图层之间切换的控制
  54. // 'AMap.PolyEditor', // 编辑 折线多,边形
  55. // 'AMap.CircleEditor', // 圆形编辑器插件
  56. // 'AMap.Geolocation' // 定位控件,用来获取和展示用户主机所在的经纬度位置
  57. // ],
  58. // uiVersion: '1.1', // ui库版本,不配置不加载,
  59. // v: '2.0'
  60. // })
  61. // 关闭生产模式下给出的提示
  62. Vue.config.productionTip = false;
  63. Vue.use(VueApollo)
  64. // 注册表格的全局组件
  65. import DilCommonUI from "@/components/DilCommonUI";
  66. Vue.use(DilCommonUI);
  67. const apolloProvider = new VueApollo({
  68. defaultClient: apollo
  69. })
  70. //把时间戳改为正常可读的时间
  71. export function renderTime(date) {
  72. if(date !== null){
  73. let dateee = new Date(date).toJSON();
  74. return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, " ").replace(/\.[\d]{3}Z/, "");
  75. }
  76. return null;
  77. }
  78. //把毫秒数转换分
  79. export function getDuration(my_time) { 
  80. if(my_time !== null){
  81. return Math.floor(my_time / 1000 / 60);
  82. }
  83. return null;
  84. }
  85. export function sjTime(orderPlanInTime) {
  86. var stringTime = renderTime(orderPlanInTime);
  87. var timestamp1 = stringTime.replace(/-/g, "/");
  88. return new Date(timestamp1).getTime();
  89. }
  90. //验证电话号码
  91. export function VerifyPhoneNumber(Phone) {
  92. var myreg=/^(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/;
  93. if (!myreg.test(Phone)) {
  94. return false;
  95. } else {
  96. return true;
  97. }
  98. }
  99. export function isNumber(value) {
  100. //验证是否为数字
  101. var patrn = /^(-)?\d+(\.\d+)?$/;
  102. if (patrn.exec(value) == null || value == "") {
  103. return false;
  104. } else {
  105. return true;
  106. }
  107. }
  108. export function isIntegerNumber(value) {
  109. //验证是否为整数
  110. var patrn = /^\+?[1-9][0-9]*$/g;
  111. if (patrn.exec(value) == null || value == "") {
  112. return false;
  113. } else {
  114. return true;
  115. }
  116. }
  117. /* eslint-disable no-new */
  118. new Vue({
  119. el: '#app',
  120. router,
  121. store,
  122. components: { App },
  123. provide: apolloProvider.provide(),
  124. template: '<App/>'
  125. });