seiminFooterNav.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <!--
  2. * @Author: 廖明明
  3. * @Date: 2022-04-11 17:58:25
  4. * @LastEditors: 廖明明
  5. * @LastEditTime: 2022-04-12 13:56:55
  6. * @Description: 底部菜单
  7. -->
  8. <template>
  9. <view class="seiminFooterNav">
  10. <view class="seiminFooterNav_item" :class="{
  11. otherStyle: menu.otherStyle,
  12. active: menu.otherStyle ? false : menu.active,
  13. }" v-for="menu in menus" :key="menu.link" @click="goto(menu)">
  14. <text class="pda seiminFooterNav_item_icon" :class="menu.icon"></text>
  15. <text class="seiminFooterNav_item_text">{{ menu.name }}</text>
  16. </view>
  17. <seiminModel ref="seiminModel"></seiminModel>
  18. </view>
  19. </template>
  20. <script>
  21. import {
  22. getCurrentPagesSeimin
  23. } from "../../utils/index.js";
  24. export default {
  25. name: "seiminFooterNav",
  26. data() {
  27. return {
  28. // 当前路由地址
  29. curRoute: "",
  30. //底部菜单
  31. menus: [{
  32. name: "首页",
  33. link: "/pages/index/index",
  34. icon: "pda-shouye2",
  35. otherStyle: false,
  36. active: false,
  37. },
  38. {
  39. name: "工单",
  40. link: "/pages/orderList/orderList",
  41. icon: "pda-gongdan",
  42. otherStyle: false,
  43. active: false,
  44. },
  45. {
  46. name: "二维码",
  47. link: "/pages/qrcode/qrcode",
  48. icon: "pda-ziyuan91",
  49. otherStyle: true,
  50. active: false,
  51. },
  52. {
  53. name: "患者",
  54. link: "/pages/patientList/patientList",
  55. icon: "pda-wodehuanzhe",
  56. otherStyle: false,
  57. active: false,
  58. },
  59. {
  60. name: "我的",
  61. link: "/pages/personalCenter/personalCenter",
  62. icon: "pda-shouye3",
  63. otherStyle: false,
  64. active: false,
  65. },
  66. ],
  67. };
  68. },
  69. methods: {
  70. /**
  71. * @description: 路由跳转或展示动态二维码
  72. * @param {object} menu 菜单
  73. * @author: 廖明明
  74. */
  75. goto(menu) {
  76. if (menu.name === "二维码") {
  77. this.$refs.seiminModel.show({
  78. title: '科室二维码',
  79. skin: 'qrcode',
  80. btns: [{
  81. name: "知道了",
  82. textColor: "#49B856",
  83. }, ]
  84. });
  85. } else {
  86. if (this.curRoute === menu.link) {
  87. uni.redirectTo({
  88. url: menu.link,
  89. });
  90. } else {
  91. uni.navigateTo({
  92. url: menu.link,
  93. });
  94. }
  95. }
  96. },
  97. // 高亮当前菜单
  98. activeCurrentMenu() {
  99. this.curRoute = `/${getCurrentPagesSeimin()}`;
  100. this.menus.forEach((v) => (v.active = v.link === this.curRoute));
  101. },
  102. },
  103. mounted() {
  104. this.activeCurrentMenu();
  105. },
  106. };
  107. </script>
  108. <style lang="scss" scoped>
  109. .seiminFooterNav {
  110. position: fixed;
  111. left: 0;
  112. bottom: 0;
  113. width: 100%;
  114. height: 100rpx;
  115. z-index: 9;
  116. background-color: #fff;
  117. padding: 0 60rpx;
  118. @include border(top, rgba(0, 0, 0, 0.1));
  119. @include flex(space-between, center);
  120. .seiminFooterNav_item {
  121. color: #333;
  122. font-weight: bold;
  123. @include flex(center, center, column);
  124. &.otherStyle {
  125. width: 120rpx;
  126. height: 120rpx;
  127. background: linear-gradient(180deg, #74c271 0%, #39b199 100%);
  128. border-radius: 50%;
  129. position: relative;
  130. top: -16rpx;
  131. color: #fff;
  132. }
  133. &.active {
  134. color: $defaultColor;
  135. }
  136. .seiminFooterNav_item_icon {
  137. font-size: 50rpx;
  138. }
  139. .seiminFooterNav_item_text {
  140. font-size: 28rpx;
  141. }
  142. }
  143. }
  144. </style>