main.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import Vue from 'vue'
  2. import App from './App'
  3. import uView from "uview-ui"
  4. Vue.use(uView)
  5. import {myRequest} from './util/api.js'
  6. Vue.prototype.$myRequest=myRequest
  7. Vue.config.productionTip = false
  8. App.mpType = 'app'
  9. Vue.prototype.$imghost = 'http://www.hnyfwlw.com:8006/projectimg' // 线上图片服务器路径常量
  10. // http://www.hnyfwlw.com:8006/bigdata_app/image/10ca93e17420371a82826073c8425c0.png
  11. Vue.prototype.$appimghost = 'http://www.hnyfwlw.com:8006/bigdata_app'
  12. import config from "./util/neutral.js"
  13. Vue.prototype.$isneutral = config.isneutral
  14. // 设置全局变量
  15. Vue.prototype.$globalVar = {}
  16. import {QueryPermission} from './util/QueryPermission.js'
  17. // Vue.use(QueryPermission)
  18. Vue.prototype.$QueryPermission = QueryPermission;
  19. Vue.filter('timeFormat',function(time){
  20. function fun(a){
  21. return String(a).length==1?'0'+a: a
  22. }
  23. let date= new Date(time*1000)
  24. let y=date.getFullYear()
  25. let m=date.getMonth()+1
  26. let d=date.getDate()
  27. let h=date.getHours()
  28. let min=date.getMinutes()
  29. let sec=date.getSeconds()
  30. return `${y}-${fun(m)}-${fun(d)} ${fun(h)}:${fun(min)}:${fun(sec)}`
  31. })
  32. Vue.prototype.formatTime = function (thistime,fmt = 'yyyy-MM-dd hh:mm:ss') {
  33. let $this = new Date(thistime)
  34. let o = {
  35. 'M+': $this.getMonth() + 1,
  36. 'd+': $this.getDate(),
  37. 'h+': $this.getHours(),
  38. 'm+': $this.getMinutes(),
  39. 's+': $this.getSeconds(),
  40. 'q+': Math.floor(($this.getMonth() + 3) / 3),
  41. 'S': $this.getMilliseconds()
  42. }
  43. if (/(y+)/.test(fmt)) {
  44. fmt = fmt.replace(RegExp.$1, ($this.getFullYear() + '').substr(4 - RegExp.$1.length))
  45. }
  46. for (var k in o) {
  47. if (new RegExp('(' + k + ')').test(fmt)) {
  48. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
  49. }
  50. }
  51. return fmt
  52. }
  53. const app = new Vue({
  54. ...App
  55. })
  56. app.$mount()