| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view class="section">
- <view class="section-header">
- <text class="section-title">⚡ 快捷功能</text>
- <text class="section-more" @click="$emit('library')">应用库 ›</text>
- </view>
- <view class="quick-bar">
- <view class="quick-item" v-for="(app, idx) in apps" :key="app.key" @click="$emit('tap-app', app)">
- <view class="quick-icon" :style="getQuickIconStyle(idx)"><text>{{ app.icon }}</text></view>
- <text class="quick-label">{{ app.name }}</text>
- </view>
- <view class="quick-item" v-if="apps.length === 0" @click="$emit('library')">
- <view class="quick-icon" style="background:rgba(99,102,241,0.15)"><text>+</text></view>
- <text class="quick-label">去添加</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'QuickFunctionBar',
- props: {
- apps: {
- type: Array,
- default: function() { return [] }
- }
- },
- methods: {
- getQuickIconStyle: function(idx) {
- var palette = [
- 'rgba(99,102,241,0.15)',
- 'rgba(16,185,129,0.15)',
- 'rgba(139,92,246,0.15)',
- 'rgba(245,158,11,0.15)',
- 'rgba(255,107,157,0.15)',
- 'rgba(249,115,22,0.15)'
- ]
- return { background: palette[idx % palette.length] }
- }
- }
- }
- </script>
- <style scoped lang="scss">
- /* ④ 内容区 — 快捷功能入口(动态渲染);样式与 pages/index-home/index.vue 原内联区块一致 */
- .section {
- margin: 20rpx $uni-space-lg;
- }
- .section-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 20rpx;
- }
- .section-title {
- font-size: calc(30rpx * var(--font-scale, 1));
- font-weight: bold;
- color: $facade-text-strong;
- }
- .section-more {
- font-size: calc(24rpx * var(--font-scale, 1));
- color: $brand-primary;
- }
- /* 快捷功能入口(单排,6个横向排列) */
- .quick-bar {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- background: $app-surface;
- border-radius: 24rpx;
- padding: 20rpx 10rpx;
- }
- .quick-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 8rpx;
- }
- .quick-icon {
- width: 80rpx;
- height: 80rpx;
- border-radius: 24rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .quick-icon text {
- font-size: calc(36rpx * var(--font-scale, 1));
- }
- .quick-item .quick-label {
- font-size: calc(26rpx * var(--font-scale, 1));
- color: $facade-text-body;
- }
- </style>
|