util.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. const globalData = {
  2. version:'3.0.17',
  3. publicUrl: 'https://sqdx.jiaxintech.com'//测试地址
  4. // publicUrl: 'https://sqpx.jiaxintech.com'//正式地址
  5. // publicUrl:'http://10.16.10.139'//ly
  6. // publicUrl:'http://10.16.4.19:80'//hyb
  7. // publicUrl:'http://10.16.4.26:80'//zxq
  8. // publicUrl:'http://10.20.1.207:80'//dailin
  9. };
  10. const formatTime = date => {
  11. const year = date.getFullYear()
  12. const month = date.getMonth() + 1
  13. const day = date.getDate()
  14. const hour = date.getHours()
  15. const minute = date.getMinutes()
  16. const second = date.getSeconds()
  17. return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
  18. }
  19. const formatNumber = n => {
  20. n = n.toString()
  21. return n[1] ? n : '0' + n
  22. }
  23. const dateFilter=function(date){
  24. return date.replace(/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/g,function(){
  25. return arguments[1]+"年"+(arguments[2].length>1&&arguments[2][0]=="0"?arguments[2][1]:arguments[2])+"月"+(arguments[3].length>1&&arguments[3][0]=="0"?arguments[3][1]:arguments[3])+"日";
  26. })
  27. }
  28. module.exports = {
  29. globalData,
  30. formatTime,
  31. dateFilter
  32. }