cu-custom.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. const app = getApp();
  2. Component({
  3. /**
  4. * 组件的一些选项
  5. */
  6. options: {
  7. addGlobalClass: true,
  8. multipleSlots: true
  9. },
  10. /**
  11. * 组件的对外属性
  12. */
  13. properties: {
  14. bgColor: {
  15. type: String,
  16. default: ''
  17. },
  18. isCustom: {
  19. type: [Boolean, String],
  20. default: false
  21. },
  22. isBack: {
  23. type: [Boolean, String],
  24. default: false
  25. },
  26. canGoHome: {
  27. type: [Boolean, String],
  28. default: false
  29. },
  30. is5G: {
  31. type: [Boolean, String],
  32. default: false
  33. },
  34. bgImage: {
  35. type: String,
  36. default: ''
  37. },
  38. title:{
  39. type:String,
  40. default:''
  41. },
  42. isSystem:{
  43. type:[Boolean,String],
  44. default:false,
  45. },
  46. isQuery:{
  47. type:[Boolean,String],
  48. default:false,
  49. },
  50. isToScan:{
  51. type:[Boolean,String],
  52. default:false,
  53. }
  54. },
  55. /**
  56. * 组件的初始数据
  57. */
  58. data: {
  59. StatusBar: app.globalData.StatusBar,
  60. CustomBar: app.globalData.CustomBar,
  61. Custom: app.globalData.Custom,
  62. setName:'管理'
  63. },
  64. /**
  65. * 组件的方法列表
  66. */
  67. methods: {
  68. BackPage() {
  69. wx.navigateBack({
  70. delta: 1
  71. });
  72. },
  73. to5G() {
  74. wx.navigateTo({
  75. url: '/pages/device/device',
  76. })
  77. },
  78. toHome(){
  79. wx.switchTab({
  80. url: '/pages/index/index',
  81. })
  82. },
  83. toQuery(){
  84. wx.switchTab({
  85. url: '/pages/query/query',
  86. })
  87. },
  88. toScan(){
  89. //获取用户信息,判断userInfo是否过期
  90. let userInfo = wx.getStorageSync('userInfo');
  91. const {loginRole,ifOverFlow,status} = userInfo;
  92. app.globalData.tabarData = {loginRole, ifOverFlow, status, path:'find'};
  93. wx.switchTab({
  94. url: '/pages/workbench/workbench',
  95. })
  96. },
  97. systemBut(){
  98. var flag = this.data.flag;
  99. let token = wx.getStorageSync('token');
  100. if(!token){
  101. wx.navigateTo({
  102. url: '/pages/login/login',
  103. })
  104. return;
  105. }
  106. if(flag){
  107. this.setData({
  108. flag : false,
  109. setName:'管理'
  110. })
  111. this.triggerEvent('myevent',{flag:'N' })
  112. }else{
  113. this.setData({
  114. flag : true,
  115. setName:'保存'
  116. })
  117. this.triggerEvent('myevent',{flag:'Y'})
  118. }
  119. }
  120. }
  121. })