app.js 4.1 KB

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