| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <view class="user-quick-entry">
- <view class="user-info">
- <text class="user-info-text">
- 👤 当前用户:{{ userName }}({{ roleName }})
- </text>
- <view class="child-switcher" v-if="children && children.length > 0" @click="showChildPicker">
- <text class="child-switcher-text">
- 切换孩子:{{ currentChildName || '选择' }} ▼
- </text>
- </view>
- </view>
- <view class="quick-actions">
- <view class="quick-btn" @click="$emit('scrollTo', 'tasks')">
- <text class="quick-btn-icon">📋</text>
- <text class="quick-btn-label">今日任务</text>
- </view>
- <view class="quick-btn" @click="$emit('scrollTo', 'activities')">
- <text class="quick-btn-icon">🔥</text>
- <text class="quick-btn-label">相关活动</text>
- </view>
- <view class="quick-btn" @click="$emit('scrollTo', 'products')">
- <text class="quick-btn-icon">🛍️</text>
- <text class="quick-btn-label">推荐商品</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- userName: { type: String, default: '' },
- roleName: { type: String, default: '' },
- currentChildName: { type: String, default: '' },
- children: { type: Array, default: function() { return [] } }
- },
- methods: {
- showChildPicker: function() {
- var self = this
- var items = this.children.map(function(c) { return c.childName })
- uni.showActionSheet({
- itemList: items,
- success: function(res) {
- var child = self.children[res.tapIndex]
- if (child) {
- uni.setStorageSync('currentChildId', child.childId)
- self.$emit('childChanged', child)
- }
- }
- })
- }
- }
- }
- </script>
- <style scoped>
- .user-quick-entry {
- margin: 0 30rpx 20rpx;
- background: #fff;
- border-radius: 20rpx;
- padding: 20rpx 24rpx;
- box-shadow: 0 2rpx 12rpx rgba(0,0,0,0.04);
- }
- .user-info {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 16rpx;
- }
- .user-info-text { font-size: 26rpx; color: #666; }
- .child-switcher-text { font-size: 24rpx; color: #F97316; }
- .quick-actions {
- display: flex;
- flex-direction: row;
- }
- .quick-btn {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- padding: 16rpx 0;
- background: #FFF7ED;
- border-radius: 16rpx;
- margin-right: 16rpx;
- }
- .quick-btn:last-child { margin-right: 0; }
- .quick-btn:active { opacity: 0.7; }
- .quick-btn-icon { font-size: 36rpx; margin-bottom: 6rpx; }
- .quick-btn-label { font-size: 22rpx; color: #666; }
- </style>
|