app.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. 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. import DilCommonUI from "@/components/DilCommonUI";
  23. Vue.use(DilCommonUI);
  24. import htmlToPdf from "@/components/exportPdf/exportPdf";
  25. Vue.use(htmlToPdf);
  26. import vuescroll from "vuescroll"; //引入vuescroll
  27. import "vuescroll/dist/vuescroll.css"; //引入vuescroll样式
  28. Vue.use(vuescroll); //使用
  29. // 导出Excel全局组件
  30. import tableToExcel from "@/components/exportExcel/exportExcel";
  31. Vue.use(tableToExcel);
  32. const apolloProvider = new VueApollo({
  33. defaultClient: apollo
  34. });
  35. // //禁止打开控制台
  36. // document.onkeydown = () => {
  37. // //禁用F12
  38. // if (window.event && window.event.keyCode == 123) {
  39. // return false;
  40. // //禁用ctrl+shift+i,
  41. // } else if (
  42. // window.event.ctrlKey &&
  43. // window.event.shiftKey &&
  44. // window.event.keyCode == 73
  45. // ) {
  46. // return false;
  47. // //屏蔽Shift+F10
  48. // } else if (window.event.shiftKey && window.event.keyCode == 121) {
  49. // return false;
  50. // }
  51. // };
  52. // console.log = function() {};
  53. // console.error = function() {};
  54. //把时间戳改为正常可读的时间
  55. export function renderTime(date) {
  56. if (date !== null) {
  57. let dateee = new Date(date).toJSON();
  58. return new Date(+new Date(dateee) + 8 * 3600 * 1000)
  59. .toISOString()
  60. .replace(/T/g, " ")
  61. .replace(/\.[\d]{3}Z/, "");
  62. }
  63. return null;
  64. }
  65. //把毫秒数转换分
  66. export function getDuration(my_time) {
  67. if (my_time !== null) {
  68. return Math.floor(my_time / 1000 / 60);
  69. }
  70. return null;
  71. }
  72. export function sjTime(orderPlanInTime) {
  73. var stringTime = renderTime(orderPlanInTime);
  74. var timestamp1 = stringTime.replace(/-/g, "/");
  75. return new Date(timestamp1).getTime();
  76. }
  77. //验证电话号码
  78. export function VerifyPhoneNumber(Phone) {
  79. 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}$/;
  80. if (!myreg.test(Phone)) {
  81. return false;
  82. } else {
  83. return true;
  84. }
  85. }
  86. export function isNumber(value) {
  87. //验证是否为数字
  88. var patrn = /^(-)?\d+(\.\d+)?$/;
  89. if (patrn.exec(value) == null || value == "") {
  90. return false;
  91. } else {
  92. return true;
  93. }
  94. }
  95. export function isIntegerNumber(value) {
  96. //验证是否为整数
  97. var patrn = /^\+?[1-9][0-9]*$/g;
  98. if (patrn.exec(value) == null || value == "") {
  99. return false;
  100. } else {
  101. return true;
  102. }
  103. }
  104. /* eslint-disable no-new */
  105. new Vue({
  106. el: "#app",
  107. router,
  108. store,
  109. components: { App },
  110. provide: apolloProvider.provide(),
  111. template: "<App/>"
  112. });