chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Empty 空状态(规范 §22 推荐为空时引导去 Discover / 申请红娘)
|
||||
*
|
||||
* 用法:
|
||||
* <ui-empty title="暂时没有符合条件的人"
|
||||
* description="可以去「找对象」看看更多符合条件的人"
|
||||
* actions="{{[{text:'去「找对象', event:'discover'}, {text:'申请公益红娘', event:'matchmaker'}]}}"
|
||||
* bind:action="onEmptyAction" />
|
||||
*/
|
||||
Component({
|
||||
options: { addGlobalClass: true, multipleSlots: true },
|
||||
properties: {
|
||||
title: { type: String, value: '暂无内容' },
|
||||
description: { type: String, value: '' },
|
||||
// [{text, event, variant?: 'primary'|'secondary'}]
|
||||
actions: { type: Array, value: [] },
|
||||
// 图标变体(不依赖外部图片资源,纯 CSS 绘制)
|
||||
illustration: { type: String, value: 'default' }, // default|search|heart|activity|message
|
||||
},
|
||||
methods: {
|
||||
onAction(e) {
|
||||
const { event } = e.currentTarget.dataset;
|
||||
this.triggerEvent('action', { event });
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<view class="ui-empty">
|
||||
<view class="ui-empty__illustration ui-empty__illustration--{{illustration}}">
|
||||
<view class="ui-empty__icon"></view>
|
||||
</view>
|
||||
<text class="ui-empty__title">{{title}}</text>
|
||||
<text wx:if="{{description}}" class="ui-empty__desc">{{description}}</text>
|
||||
<view class="ui-empty__actions">
|
||||
<view
|
||||
wx:for="{{actions}}"
|
||||
wx:key="event"
|
||||
class="ui-empty__action ui-empty__action--{{item.variant || 'secondary'}}"
|
||||
data-event="{{item.event}}"
|
||||
bindtap="onAction"
|
||||
>{{item.text}}</view>
|
||||
</view>
|
||||
<slot></slot>
|
||||
</view>
|
||||
@@ -0,0 +1,80 @@
|
||||
.ui-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: var(--spacing-10) var(--spacing-page-x);
|
||||
text-align: center;
|
||||
}
|
||||
.ui-empty__illustration {
|
||||
width: 160rpx;
|
||||
height: 160rpx;
|
||||
border-radius: 50%;
|
||||
background: var(--color-bg-disabled);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: var(--spacing-4);
|
||||
}
|
||||
.ui-empty__icon {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
background: var(--color-text-disabled);
|
||||
opacity: 0.5;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.ui-empty__illustration--search .ui-empty__icon {
|
||||
border-radius: 50% 50% 50% 0;
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
.ui-empty__illustration--heart .ui-empty__icon {
|
||||
clip-path: polygon(50% 100%, 0 38%, 18% 18%, 50% 38%, 82% 18%, 100% 38%);
|
||||
border-radius: 0;
|
||||
}
|
||||
.ui-empty__illustration--activity .ui-empty__icon {
|
||||
border-radius: var(--radius-sm);
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
}
|
||||
.ui-empty__illustration--message .ui-empty__icon {
|
||||
border-radius: var(--radius-md);
|
||||
width: 80rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
.ui-empty__title {
|
||||
font-size: var(--font-size-lg);
|
||||
font-weight: var(--font-weight-medium);
|
||||
color: var(--color-text-primary);
|
||||
margin-bottom: var(--spacing-2);
|
||||
}
|
||||
.ui-empty__desc {
|
||||
font-size: var(--font-size-sm);
|
||||
color: var(--color-text-tertiary);
|
||||
line-height: var(--line-height-relaxed);
|
||||
max-width: 480rpx;
|
||||
}
|
||||
.ui-empty__actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--spacing-2);
|
||||
margin-top: var(--spacing-6);
|
||||
width: 100%;
|
||||
max-width: 480rpx;
|
||||
}
|
||||
.ui-empty__action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 80rpx;
|
||||
border-radius: var(--radius-full);
|
||||
font-size: var(--font-size-base);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
.ui-empty__action--primary {
|
||||
background: var(--color-primary);
|
||||
color: #FFFFFF;
|
||||
}
|
||||
.ui-empty__action--secondary {
|
||||
background: var(--color-bg-card);
|
||||
color: var(--color-primary);
|
||||
border: 1rpx solid var(--color-primary);
|
||||
}
|
||||
Reference in New Issue
Block a user