workbench.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="container">
  3. <swiper class="swiper square-dot" indicator-color="#D7E3FD" indicator-active-color="#3874F6" :indicator-dots="true"
  4. :circular="true" duration="500">
  5. <swiper-item class="swiper-item" v-for="(it, i) in apps" :key="i">
  6. <navigator :url="item.path" open-type="navigate" class="app" v-for="item in it" :key="item.label">
  7. <view class="icon" :style="{ backgroundColor: item.color }">
  8. <text class="iconfont" :class="item.icon" style="font-size: 6.400vw;" />
  9. </view>
  10. <view class="label u-line-1">
  11. {{ item.label }}
  12. </view>
  13. </navigator>
  14. </swiper-item>
  15. </swiper>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. name: 'workbench',
  21. data() {
  22. return {
  23. apps: []
  24. };
  25. },
  26. created() {
  27. this.rander();
  28. },
  29. methods: {
  30. rander() {
  31. const clist = ['#5487F7', '#F29C37', '#9A6FF8', '#5AB73F', '#5487F7']
  32. let authList = uni.getStorageSync('authList'),
  33. list = [{
  34. label: "巡检中心",
  35. icon: "icon-xunjianzhongxin"
  36. }, {
  37. label: "告警中心",
  38. icon: "icon-gaojingzhongxin",
  39. path: "/packageA/alerts/index"
  40. }, {
  41. label: "设备中心",
  42. icon: "icon-xunjianzhongxin",
  43. path: "/pages/facility/index?page=设备中心"
  44. }, {
  45. label: "取水系统",
  46. icon: "icon-xunjianzhongxin"
  47. }, {
  48. label: "雨洪系统",
  49. icon: "icon-xunjianzhongxin"
  50. }].filter(v => authList[v.label]),
  51. apps = [];
  52. for (let i = list.length / 5; i > 0; i--) {
  53. apps[apps.length] = list.splice(0, 5).map((v, i) => {
  54. v.color = clist[i]
  55. return v
  56. })
  57. };
  58. this.apps = apps;
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .container {
  65. width: 355px;
  66. margin: 0 auto;
  67. margin-top: 10px;
  68. background: #fff;
  69. border-radius: 4px;
  70. overflow: hidden;
  71. .swiper {
  72. height: 96px;
  73. .swiper-item {
  74. display: flex;
  75. margin-top: 5px;
  76. box-sizing: border-box;
  77. padding: 0 10px;
  78. .app {
  79. width: 68px;
  80. height: 69px;
  81. display: flex;
  82. flex-direction: column;
  83. align-items: center;
  84. padding: 5px 0;
  85. box-sizing: content-box;
  86. border-radius: 4px;
  87. .icon {
  88. display: flex;
  89. justify-content: center;
  90. align-items: center;
  91. width: 44px;
  92. height: 44px;
  93. border-radius: 4px;
  94. color: #fff;
  95. }
  96. .label {
  97. font-size: 12px;
  98. color: #333333;
  99. margin-top: 8px;
  100. width: 60px;
  101. text-align: center;
  102. }
  103. }
  104. }
  105. }
  106. }
  107. </style>