workbench.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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-xunjianzhongxin"
  39. }, {
  40. label: "设备中心",
  41. icon: "icon-xunjianzhongxin",
  42. path: "/packageA/facility/index"
  43. }, {
  44. label: "取水系统",
  45. icon: "icon-xunjianzhongxin"
  46. }, {
  47. label: "雨洪系统",
  48. icon: "icon-xunjianzhongxin"
  49. }].filter(v => authList[v.label]),
  50. apps = [];
  51. for (let i = list.length / 5; i > 0; i--) {
  52. apps[apps.length] = list.splice(0, 5).map((v, i) => {
  53. v.color = clist[i]
  54. return v
  55. })
  56. };
  57. this.apps = apps;
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .container {
  64. width: 355px;
  65. margin: 0 auto;
  66. margin-top: 10px;
  67. background: #fff;
  68. border-radius: 4px;
  69. overflow: hidden;
  70. .swiper {
  71. height: 96px;
  72. .swiper-item {
  73. display: flex;
  74. margin-top: 5px;
  75. box-sizing: border-box;
  76. padding: 0 10px;
  77. .app {
  78. width: 68px;
  79. height: 69px;
  80. display: flex;
  81. flex-direction: column;
  82. align-items: center;
  83. padding: 5px 0;
  84. box-sizing: content-box;
  85. border-radius: 4px;
  86. .icon {
  87. display: flex;
  88. justify-content: center;
  89. align-items: center;
  90. width: 44px;
  91. height: 44px;
  92. border-radius: 4px;
  93. color: #fff;
  94. }
  95. .label {
  96. font-size: 12px;
  97. color: #333333;
  98. margin-top: 8px;
  99. width: 60px;
  100. text-align: center;
  101. }
  102. }
  103. }
  104. }
  105. }
  106. </style>