app.js 2.2 KB

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