menus.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <template>
  2. <view :style="'padding-top:' +mbConfig+'rpx;'" v-if="menus.length">
  3. <view class='nav acea-row acea-row' :style="'background:'+bgColor[0].item+';margin: 0 '+prConfig+'rpx;border-radius:'+bgStyle+'rpx;'">
  4. <block v-if="rowStyle == 0">
  5. <scroll-view scroll-x="true" style="white-space: nowrap; display: flex" show-scrollbar="false">
  6. <view v-for="(item,index) in menus" :key="index" class='item' :style="'color:'+titleColor" @click="menusTap(item.info[1].value)">
  7. <view class='pictrue skeleton-rect'>
  8. <image :src='item.img' :style="'border-radius:'+menuStyle"></image>
  9. </view>
  10. <view class="menu-txt" :style="'color:'+titleColor">{{item.info[0].value}}</view>
  11. </view>
  12. </scroll-view>
  13. </block>
  14. <block v-else v-for="(item,index) in menus" :key="index">
  15. <view class='item' :style="'color:'+titleColor+';width:'+number" @click="menusTap(item.info[1].value)">
  16. <view class='pictrue skeleton-rect'>
  17. <image :src='item.img' :style="'border-radius:'+menuStyle"></image>
  18. </view>
  19. <view class="menu-txt" :style="'color:'+titleColor">{{item.info[0].value}}</view>
  20. </view>
  21. </block>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. // +----------------------------------------------------------------------
  27. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  28. // +----------------------------------------------------------------------
  29. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  30. // +----------------------------------------------------------------------
  31. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  32. // +----------------------------------------------------------------------
  33. // | Author: CRMEB Team <admin@crmeb.com>
  34. // +----------------------------------------------------------------------
  35. import {merPath} from "@/utils/index"
  36. export default {
  37. name: 'menus',
  38. props: {
  39. dataConfig: {
  40. type: Object,
  41. default: () => {}
  42. },
  43. merId:{}
  44. },
  45. data() {
  46. return {
  47. menus: this.dataConfig.menuConfig.list,
  48. bgColor: this.dataConfig.bgColor.color,
  49. menuStyle: this.dataConfig.menuStyle.type ? '50%' : 0,
  50. rowStyle: this.dataConfig.tabConfig.tabVal, //0单行1多行
  51. bgStyle: this.dataConfig.bgStyle.type ? '16' : '0',
  52. titleColor: this.dataConfig.titleColor.color[0].item,
  53. mbConfig: this.dataConfig.mbConfig.val*2,
  54. prConfig: this.dataConfig.prConfig.val*2,
  55. rowNum: this.dataConfig.rowsNum.type,//0两行,1三行,2四行
  56. number: this.dataConfig.number.type == 0 ? '33.33%' : this.dataConfig.number.type == 1 ? '25%' : '20%', //三个四个五个
  57. };
  58. },
  59. created() {},
  60. mounted() {},
  61. methods: {
  62. menusTap(url) {
  63. let data = this.$util.stringIntercept(url, 1, '\?');
  64. data = this.$util.stringIntercept(data, 1, '\=');
  65. uni.setStorageSync('storeIndex', data);
  66. url = merPath(url, this.merId)
  67. this.$util.JumpPath(url);
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss" scoped>
  73. .nav {
  74. padding: 30rpx 0 0;
  75. .item {
  76. width: 20%;
  77. text-align: center;
  78. font-size: 24rpx;
  79. display: inline-block;
  80. margin-bottom: 20rpx;
  81. .pictrue,/deep/.pictrue image,/deep/.pictrue .easy-loadimage,/deep/.pictrue uni-image {
  82. width: 82rpx;
  83. height: 82rpx;
  84. margin: 0 auto;
  85. }
  86. .menu-txt {
  87. font-size: 24rpx;
  88. color: #454545;
  89. margin-top: 15rpx;
  90. }
  91. &.four {
  92. width: 25%;
  93. .pictrue {
  94. width: 90rpx;
  95. height: 90rpx;
  96. }
  97. }
  98. }
  99. }
  100. </style>