main.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import Vue from 'vue'
  2. import App from './App'
  3. import store from '@/store'
  4. Vue.config.productionTip = false
  5. App.mpType = 'app'
  6. import uView from "uview-ui"
  7. Vue.use(uView)
  8. let vuexStore = require("@/store/$u.mixin.js")
  9. Vue.mixin(vuexStore)
  10. /*
  11. * 提示信息
  12. */
  13. Vue.prototype.toashMsg = function (title) {
  14. title = title == undefined ? "系统繁忙" : title;
  15. uni.showToast({
  16. title:title,
  17. icon:'none',
  18. duration: 2000
  19. })
  20. }
  21. /**
  22. * 权限检查
  23. */
  24. Vue.prototype.$hasPermissions = function (value) {
  25. let isExist = false;
  26. let permissionsStr = store.state.vuex_userData.permCodes;
  27. // console.log(permissionsStr,'permissionsStr')
  28. if (permissionsStr == undefined || permissionsStr == null) {
  29. return false;
  30. }
  31. let has = permissionsStr.find(item => {
  32. return item == value
  33. })
  34. if (has) {
  35. isExist = true;
  36. }
  37. return isExist;
  38. }
  39. // 防止重复触发事件
  40. Vue.prototype.$bindClick = function (fun) {
  41. if(!store.state.vuex_isClick){
  42. store.state.vuex_isClick = true
  43. fun()
  44. setTimeout(()=>{
  45. store.state.vuex_isClick = false
  46. },2000)
  47. }
  48. }
  49. const app = new Vue({
  50. store,
  51. ...App
  52. })
  53. app.$mount()