s-menu-grid.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <!-- 装修基础组件:宫格导航 -->
  2. <template>
  3. <view class="user-tools">
  4. <view class="tools-header">
  5. <text class="tools-title">常用工具</text>
  6. <view class="tools-grid">
  7. <view class="tools-item" @tap="sheep.$router.go(item.url)" v-for="(item, index) in data.list.slice(0, 4)"
  8. :key="index">
  9. <image class="tools-icon" :src="sheep.$url.cdn(item.iconUrl)" mode="aspectFit" />
  10. <text class="tools-text">{{ item.title }}</text>
  11. </view>
  12. </view>
  13. </view>
  14. </view>
  15. <div class="container">
  16. <div class="menu-list">
  17. <div class="menu-item" @tap="sheep.$router.go(item.url)" v-for="(item, index) in data.list.slice(4)" :key="index">
  18. <div class="menu-row">
  19. <div class="menu-title">
  20. <img class="icon" :src="sheep.$url.cdn(item.iconUrl)" />
  21. <text class="text">{{ item.title }}</text>
  22. </div>
  23. <img class="arrow"
  24. src="https://seal-img.nos-jd.163yun.com/obj/w5rCgMKVw6DCmGzCmsK-/60938800883/9099/a51c/4f35/ba4922804bc38ca1168b7b3577ddf938.png" />
  25. </div>
  26. <div class="divider" v-if="index !== data.list.slice(4).length - 1"></div>
  27. </div>
  28. </div>
  29. </div>
  30. <!-- <view :style="[bgStyle, { marginLeft: `${data.space}px` }]">
  31. <uni-grid :showBorder="Boolean(data.border)" :column="data.column">
  32. <uni-grid-item v-for="(item, index) in data.list" :key="index" @tap="sheep.$router.go(item.url)">
  33. <view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center">
  34. <view class="img-box">
  35. <view class="tag-box" v-if="item.badge.show"
  36. :style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">
  37. {{ item.badge.text }}
  38. </view>
  39. <image class="menu-image" :src="sheep.$url.cdn(item.iconUrl)"></image>
  40. </view>
  41. <view class="title-box ss-flex ss-flex-col ss-row-center ss-col-center">
  42. <view class="grid-text" :style="[{ color: item.titleColor }]">
  43. {{ item.title }}
  44. </view>
  45. <view class="grid-tip" :style="[{ color: item.subtitleColor }]">
  46. {{ item.subtitle }}
  47. </view>
  48. </view>
  49. </view>
  50. </uni-grid-item>
  51. </uni-grid>
  52. </view> -->
  53. </template>
  54. <script setup>
  55. import sheep from '@/sheep';
  56. import {
  57. computed
  58. } from 'vue';
  59. const props = defineProps({
  60. // 装修数据
  61. data: {
  62. type: Object,
  63. default: () => ({}),
  64. },
  65. // 装修样式
  66. styles: {
  67. type: Object,
  68. default: () => ({}),
  69. },
  70. });
  71. </script>
  72. <style lang="scss" scoped>
  73. .user-tools {
  74. width: calc(100% - 32px);
  75. padding: 24rpx;
  76. border-radius: 16rpx;
  77. background-color: #fff;
  78. box-sizing: border-box;
  79. margin: 16px;
  80. .tools-header {
  81. position: relative;
  82. width: 620rpx;
  83. height: 190rpx;
  84. }
  85. .tools-title {
  86. font-size: 32rpx;
  87. font-family: 'Source Han Sans';
  88. font-weight: 600;
  89. line-height: 46rpx;
  90. color: #333;
  91. }
  92. .tools-grid {
  93. position: absolute;
  94. left: 16rpx;
  95. bottom: 0;
  96. right: 0;
  97. display: flex;
  98. align-items: center;
  99. gap: 52rpx;
  100. }
  101. .tools-item {
  102. width: 112rpx;
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. gap: 8rpx;
  107. font-size: 28rpx;
  108. font-family: 'Source Han Sans';
  109. font-weight: 400;
  110. line-height: 40rpx;
  111. color: #333;
  112. }
  113. .tools-icon {
  114. width: 64rpx;
  115. height: 64rpx;
  116. }
  117. .tools-text {
  118. flex-shrink: 0;
  119. }
  120. }
  121. .container {
  122. display: flex;
  123. padding: 32rpx;
  124. border-radius: 16rpx;
  125. background-color: #ffffff;
  126. margin: 16px;
  127. .menu-list {
  128. display: flex;
  129. flex-direction: column;
  130. gap: 32rpx;
  131. width: 100%;
  132. .menu-item {
  133. display: flex;
  134. flex-direction: column;
  135. align-items: flex-end;
  136. gap: 32rpx;
  137. width: 622rpx;
  138. .menu-row {
  139. display: flex;
  140. justify-content: space-between;
  141. align-items: center;
  142. width: 100%;
  143. .menu-title {
  144. display: flex;
  145. align-items: center;
  146. gap: 16rpx;
  147. font-size: 28rpx;
  148. font-family: 'Source Han Sans';
  149. line-height: 40rpx;
  150. color: #333333;
  151. .icon {
  152. width: 48rpx;
  153. height: 48rpx;
  154. flex-shrink: 0;
  155. }
  156. .text {
  157. flex-shrink: 0;
  158. }
  159. }
  160. .arrow {
  161. width: 32rpx;
  162. height: 32rpx;
  163. flex-shrink: 0;
  164. }
  165. }
  166. .divider {
  167. width: 558rpx;
  168. height: 1rpx;
  169. background-color: #ebedf0;
  170. }
  171. }
  172. }
  173. }
  174. </style>