chore: establish V1.1 recovery baseline
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* LikersBadge 喜欢我的人计数徽标(规范 §22 / §107)
|
||||
*
|
||||
* 不变量(AGENTS.md 第 6 条):单向意向不泄露——
|
||||
* - 仅展示计数("3 人喜欢你"),不展示具体身份列表入口。
|
||||
* - 详情由用户主动进入"喜欢我的人"页查看,且后端对该列表做匿名化处理
|
||||
* (未 Mutual 前对方不会被告知你看过了谁)。
|
||||
*
|
||||
* 用法:
|
||||
* <ui-likers-badge count="{{likersCount}}" bind:tap="onViewLikers" />
|
||||
*/
|
||||
Component({
|
||||
options: { addGlobalClass: true },
|
||||
properties: {
|
||||
count: { type: Number, value: 0 },
|
||||
size: { type: String, value: 'md' }, // sm | md | lg
|
||||
},
|
||||
data: {
|
||||
displayText: '',
|
||||
},
|
||||
observers: {
|
||||
count(n) {
|
||||
let text;
|
||||
if (n <= 0) text = '还没有人喜欢你';
|
||||
else if (n === 1) text = '1 人喜欢你';
|
||||
else text = `${n} 人喜欢你`;
|
||||
this.setData({ displayText: text });
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onTap() {
|
||||
if (this.data.count <= 0) return;
|
||||
this.triggerEvent('tap', { count: this.data.count });
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<view
|
||||
class="ui-likers ui-likers--{{size}} {{count > 0 ? 'ui-likers--active' : ''}}"
|
||||
bindtap="onTap"
|
||||
>
|
||||
<view class="ui-likers__icon">
|
||||
<view class="ui-likers__heart"></view>
|
||||
</view>
|
||||
<text class="ui-likers__text">{{displayText}}</text>
|
||||
</view>
|
||||
@@ -0,0 +1,42 @@
|
||||
.ui-likers {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
background: var(--color-bg-card);
|
||||
border-radius: var(--radius-full);
|
||||
border: 1rpx solid var(--color-border);
|
||||
color: var(--color-text-tertiary);
|
||||
}
|
||||
.ui-likers--active {
|
||||
background: var(--color-primary-light);
|
||||
border-color: var(--color-primary-light);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
.ui-likers--sm {
|
||||
padding: 6rpx 14rpx;
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
.ui-likers--md {
|
||||
padding: 8rpx 18rpx;
|
||||
font-size: var(--font-size-sm);
|
||||
}
|
||||
.ui-likers--lg {
|
||||
padding: 12rpx 24rpx;
|
||||
font-size: var(--font-size-md);
|
||||
}
|
||||
.ui-likers__icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 8rpx;
|
||||
}
|
||||
.ui-likers__heart {
|
||||
width: 20rpx;
|
||||
height: 18rpx;
|
||||
background: currentColor;
|
||||
clip-path: polygon(50% 100%, 0 38%, 18% 8%, 50% 28%, 82% 8%, 100% 38%);
|
||||
}
|
||||
.ui-likers__text {
|
||||
font-size: inherit;
|
||||
}
|
||||
Reference in New Issue
Block a user