main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import Vue from 'vue'
  2. import App from './App'
  3. //store
  4. import store from '@/store';
  5. let vuexStore = require("@/store/$u.mixin.js");
  6. Vue.mixin(vuexStore);
  7. //uView
  8. import uView from "uview-ui";
  9. Vue.use(uView);
  10. //mescroll
  11. import MescrollBody from "@/components/mescroll-body/mescroll-body.vue"
  12. Vue.component('MescrollBody', MescrollBody)
  13. //封装api
  14. import { api } from 'assets/http/api.js'
  15. Vue.prototype.$api = api
  16. //缓存
  17. import simpleCache from "@/utils/cache.js"
  18. Vue.prototype.$cache = simpleCache
  19. //封装日期时间工具类
  20. import dateTime from 'utils/dateTime.js'
  21. Vue.prototype.$dateTime = dateTime
  22. //封装提示工具
  23. import dialog from 'utils/dialog.js'
  24. Vue.prototype.$dialog = dialog
  25. //全局变量
  26. import Global from './utils/global'
  27. Vue.prototype.$global = Global
  28. //数字处理
  29. import digital from './utils/digital.js'
  30. Vue.prototype.$digital = digital
  31. // 全局注入
  32. import Mixin from './utils/mixin'
  33. Vue.mixin(Mixin)
  34. // 微信函数封装
  35. import Mpi from './utils/mpi'
  36. Vue.prototype.$mpi = Mpi
  37. //引入工具类
  38. import util from 'utils/util.js'
  39. Vue.prototype.$util = util
  40. //校验文件
  41. import verify from 'utils/verify.js'
  42. Vue.prototype.$verify = verify
  43. //跳转
  44. Vue.prototype.$jump=function(url){
  45. uni.navigateTo({
  46. url
  47. })
  48. }
  49. Vue.prototype.$back=function(){
  50. uni.navigateBack({
  51. delta:1
  52. })
  53. }
  54. //判空函数
  55. Vue.prototype.$isEmpty=function(value){
  56. switch (typeof value) {
  57. case 'undefined':
  58. return true;
  59. case 'string':
  60. if(value=='undefined') return true
  61. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return true;
  62. break;
  63. case 'boolean':
  64. if (!value) return true;
  65. break;
  66. case 'number':
  67. if (0 === value || isNaN(value)) return true;
  68. break;
  69. case 'object':
  70. if (null === value || value.length === 0) return true;
  71. for (var i in value) {
  72. return false;
  73. }
  74. return true;
  75. }
  76. return false;
  77. }
  78. Vue.prototype.$isNotEmpty=function(value){
  79. switch (typeof value) {
  80. case 'undefined':
  81. return false;
  82. case 'string':
  83. if(value=='undefined') return false
  84. if (value.replace(/(^[ \t\n\r]*)|([ \t\n\r]*$)/g, '').length == 0) return false;
  85. break;
  86. case 'boolean':
  87. if (!value) return false;
  88. break;
  89. case 'number':
  90. if (0 === value || isNaN(value)) return false;
  91. break;
  92. case 'object':
  93. if (null === value || value.length === 0) return false;
  94. for (var i in value) {
  95. return true;
  96. }
  97. return false;
  98. }
  99. return true;
  100. }
  101. Vue.prototype.$tmplIds=[
  102. //设备告警通知
  103. 'yAtQ6AY8zBHDT1PxXHv7x7gS-qiN1DnSedN4MWLbHwk',
  104. ]
  105. Vue.config.productionTip = false
  106. App.mpType = 'app'
  107. const app = new Vue({
  108. store,
  109. ...App
  110. })
  111. app.$mount()