menu.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <template>
  2. <div class="menu-container">
  3. <top-bar></top-bar>
  4. <div class="menu-list">
  5. <div class="menu-list-item" v-for="(v, i) in menuList" :key="i">
  6. <p @click="onclick">{{ v.meta.title }}</p>
  7. <van-grid border :column-num="3">
  8. <van-grid-item
  9. v-for="(item, index) in v.children"
  10. :key="index"
  11. :icon="item.meta.icon"
  12. :text="item.meta.title"
  13. :to="item.path"
  14. />
  15. </van-grid>
  16. </div>
  17. </div>
  18. <van-dialog v-model="show" title="标题" confirmButtonText="关闭">
  19. <p class="text">
  20. {{ info }}
  21. </p>
  22. </van-dialog>
  23. </div>
  24. </template>
  25. <script>
  26. import TopBar from '@/components/TopBar'
  27. import { mapGetters } from 'vuex'
  28. import { getMenu, getTheAreaWeather } from '@/api/public'
  29. export default {
  30. name: 'menus',
  31. components: { TopBar },
  32. data() {
  33. return {
  34. menuList: [],
  35. list: [],
  36. show: false,
  37. info: ''
  38. }
  39. },
  40. computed: {
  41. ...mapGetters(['userName', 'orgId'])
  42. },
  43. mounted() {
  44. this.getMenuList()
  45. },
  46. methods: {
  47. getMenuList() {
  48. getMenu().then(res => {
  49. this.menuList = res.data
  50. })
  51. },
  52. clickHandler(item) {
  53. this.info = item.alarmContent
  54. this.show = true
  55. },
  56. //获取天气数据
  57. getTheWeather() {
  58. getTheAreaWeather(this.orgId).then(res => {
  59. this.list = res.data||[]
  60. this.list.forEach(item => {
  61. if (item.alarmLevel == '橙色') {
  62. item.bgc = '#fa8e00'
  63. } else if (item.alarmLevel == '红色') {
  64. item.bgc = '#fa0008'
  65. } else if (item.alarmLevel == '蓝色') {
  66. item.bgc = '#3788fa'
  67. } else if (item.alarmLevel == '黄色') {
  68. item.bgc = '#e9fa00'
  69. }
  70. })
  71. })
  72. },
  73. onclick() {
  74. this.$router.push('/workTime')
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss" scoped>
  80. .text{
  81. padding: 20px;
  82. }
  83. .color {
  84. width: 100%;
  85. height: 100%;
  86. line-height: 120px;
  87. // background-color: red;
  88. }
  89. .custom-indicator {
  90. position: absolute;
  91. right: 5px;
  92. bottom: 5px;
  93. padding: 2px 5px;
  94. font-size: 12px;
  95. background: rgba(0, 0, 0, 0.1);
  96. }
  97. .menu-container {
  98. background-color: rgba(237, 252, 255, 1);
  99. }
  100. .menu-list {
  101. padding: 30px 0;
  102. height: calc(100vh - 400px);
  103. overflow: auto;
  104. }
  105. .menu-list-item {
  106. background-color: #fff;
  107. border-radius: 10px;
  108. box-shadow: 0 10px 20px #eee;
  109. margin: 20px;
  110. > p {
  111. font-size: 30px;
  112. padding: 10px 10px 10px 20px;
  113. }
  114. > ul {
  115. display: flex;
  116. flex-wrap: wrap;
  117. font-size: 20px;
  118. > li {
  119. padding: 30px;
  120. display: flex;
  121. flex-direction: column;
  122. align-items: center;
  123. > div {
  124. width: 60px;
  125. height: 60px;
  126. background-color: #42b983;
  127. margin-bottom: 20px;
  128. }
  129. }
  130. }
  131. }
  132. </style>