QuickFunctionBar.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="section">
  3. <view class="section-header">
  4. <text class="section-title">⚡ 快捷功能</text>
  5. <text class="section-more" @click="$emit('library')">应用库 ›</text>
  6. </view>
  7. <view class="quick-bar">
  8. <view class="quick-item" v-for="(app, idx) in apps" :key="app.key" @click="$emit('tap-app', app)">
  9. <view class="quick-icon" :style="getQuickIconStyle(idx)"><text>{{ app.icon }}</text></view>
  10. <text class="quick-label">{{ app.name }}</text>
  11. </view>
  12. <view class="quick-item" v-if="apps.length === 0" @click="$emit('library')">
  13. <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>+</text></view>
  14. <text class="quick-label">去添加</text>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. name: 'QuickFunctionBar',
  22. props: {
  23. apps: {
  24. type: Array,
  25. default: function() { return [] }
  26. }
  27. },
  28. methods: {
  29. getQuickIconStyle: function(idx) {
  30. var palette = [
  31. 'rgba(99,102,241,0.15)',
  32. 'rgba(16,185,129,0.15)',
  33. 'rgba(139,92,246,0.15)',
  34. 'rgba(245,158,11,0.15)',
  35. 'rgba(255,107,157,0.15)',
  36. 'rgba(249,115,22,0.15)'
  37. ]
  38. return { background: palette[idx % palette.length] }
  39. }
  40. }
  41. }
  42. </script>
  43. <style scoped lang="scss">
  44. /* ④ 内容区 — 快捷功能入口(动态渲染);样式与 pages/index-home/index.vue 原内联区块一致 */
  45. .section {
  46. margin: 20rpx $uni-space-lg;
  47. }
  48. .section-header {
  49. display: flex;
  50. justify-content: space-between;
  51. align-items: center;
  52. margin-bottom: 20rpx;
  53. }
  54. .section-title {
  55. font-size: calc(30rpx * var(--font-scale, 1));
  56. font-weight: bold;
  57. color: $facade-text-strong;
  58. }
  59. .section-more {
  60. font-size: calc(24rpx * var(--font-scale, 1));
  61. color: $brand-primary;
  62. }
  63. /* 快捷功能入口(单排,6个横向排列) */
  64. .quick-bar {
  65. display: flex;
  66. flex-direction: row;
  67. justify-content: space-between;
  68. align-items: center;
  69. background: $app-surface;
  70. border-radius: 24rpx;
  71. padding: 20rpx 10rpx;
  72. }
  73. .quick-item {
  74. flex: 1;
  75. display: flex;
  76. flex-direction: column;
  77. align-items: center;
  78. gap: 8rpx;
  79. }
  80. .quick-icon {
  81. width: 80rpx;
  82. height: 80rpx;
  83. border-radius: 24rpx;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. }
  88. .quick-icon text {
  89. font-size: calc(36rpx * var(--font-scale, 1));
  90. }
  91. .quick-item .quick-label {
  92. font-size: calc(26rpx * var(--font-scale, 1));
  93. color: $facade-text-body;
  94. }
  95. </style>