app.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. // 关闭生产模式下给出的提示
  14. Vue.config.productionTip = false;
  15. Vue.use(VueApollo)
  16. // 注册表格的全局组件
  17. import DilCommonUI from "@/components/DilCommonUI";
  18. Vue.use(DilCommonUI);
  19. import htmlToPdf from '@/components/exportPdf/exportPdf'
  20. Vue.use(htmlToPdf)
  21. import vuescroll from "vuescroll";//引入vuescroll
  22. import "vuescroll/dist/vuescroll.css";//引入vuescroll样式
  23. Vue.use(vuescroll);//使用
  24. // 导出Excel全局组件
  25. import tableToExcel from '@/components/exportExcel/exportExcel'
  26. Vue.use(tableToExcel)
  27. const apolloProvider = new VueApollo({
  28. defaultClient: apollo
  29. })
  30. //把时间戳改为正常可读的时间
  31. export function renderTime(date) {
  32. if(date !== null){
  33. let dateee = new Date(date).toJSON();
  34. return new Date(+new Date(dateee) + 8 * 3600 * 1000).toISOString().replace(/T/g, " ").replace(/\.[\d]{3}Z/, "");
  35. }
  36. return null;
  37. }
  38. //把毫秒数转换分
  39. export function getDuration(my_time) { 
  40. if(my_time !== null){
  41. return Math.floor(my_time / 1000 / 60);
  42. }
  43. return null;
  44. }
  45. export function sjTime(orderPlanInTime) {
  46. var stringTime = renderTime(orderPlanInTime);
  47. var timestamp1 = stringTime.replace(/-/g, "/");
  48. return new Date(timestamp1).getTime();
  49. }
  50. //验证电话号码
  51. export function VerifyPhoneNumber(Phone) {
  52. 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}$/;
  53. if (!myreg.test(Phone)) {
  54. return false;
  55. } else {
  56. return true;
  57. }
  58. }
  59. export function isNumber(value) {
  60. //验证是否为数字
  61. var patrn = /^(-)?\d+(\.\d+)?$/;
  62. if (patrn.exec(value) == null || value == "") {
  63. return false;
  64. } else {
  65. return true;
  66. }
  67. }
  68. export function isIntegerNumber(value) {
  69. //验证是否为整数
  70. var patrn = /^\+?[1-9][0-9]*$/g;
  71. if (patrn.exec(value) == null || value == "") {
  72. return false;
  73. } else {
  74. return true;
  75. }
  76. }
  77. /* eslint-disable no-new */
  78. new Vue({
  79. el: '#app',
  80. router,
  81. store,
  82. components: { App },
  83. provide: apolloProvider.provide(),
  84. template: '<App/>'
  85. });