feat(circle): 添加酒友圈社交模块
- 新增酒友圈、圈子详情、发布动态、好友列表、活动创建等页面配置 - 添加酒友圈相关API接口,包括动态、评论、好友、活动等功能 - 实现模拟数据用于前端开发和测试 - 创建评论项、空状态、活动卡片、动态卡片、好友项等组件 - 编写酒友圈模块详细的接口文档,定义数据结构和业务规则
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
<template>
|
||||
<view class="comment-item">
|
||||
<view class="comment-avatar-wrap">
|
||||
<image v-if="comment.avatar" class="comment-avatar" :src="comment.avatar" mode="aspectFill"></image>
|
||||
<view v-else class="comment-avatar comment-avatar-ph">
|
||||
<text class="comment-avatar-text">{{ comment.nickname ? comment.nickname[0] : '酒' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="comment-body">
|
||||
<view class="comment-top">
|
||||
<text class="comment-name">{{ comment.nickname }}</text>
|
||||
<text class="comment-time">{{ comment.time }}</text>
|
||||
</view>
|
||||
<text class="comment-content">{{ comment.content }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CommentItem',
|
||||
props: {
|
||||
comment: { type: Object, default: () => ({}) }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.comment-item {
|
||||
display: flex;
|
||||
gap: $sp-md;
|
||||
padding: $sp-lg 0;
|
||||
|
||||
&:not(:last-child) {
|
||||
border-bottom: 1rpx solid var(--divider-color, rgba(255,255,255,0.08));
|
||||
}
|
||||
}
|
||||
|
||||
.comment-avatar-wrap {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.comment-avatar {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.comment-avatar-ph {
|
||||
background: $bg-elevated;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.comment-avatar-text {
|
||||
font-size: $fs-sm;
|
||||
font-weight: $fw-bold;
|
||||
color: $lavender;
|
||||
}
|
||||
|
||||
.comment-body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.comment-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 8rpx;
|
||||
}
|
||||
|
||||
.comment-name {
|
||||
font-size: $fs-sm;
|
||||
font-weight: $fw-bold;
|
||||
color: $text-secondary;
|
||||
}
|
||||
|
||||
.comment-time {
|
||||
font-size: $fs-xs;
|
||||
color: $text-tertiary;
|
||||
}
|
||||
|
||||
.comment-content {
|
||||
font-size: $fs-base;
|
||||
color: $text-primary;
|
||||
line-height: $lh-normal;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,70 @@
|
||||
<template>
|
||||
<view class="empty-state">
|
||||
<text class="empty-icon">{{ icon }}</text>
|
||||
<text class="empty-title">{{ title }}</text>
|
||||
<text class="empty-desc" v-if="desc">{{ desc }}</text>
|
||||
<button v-if="actionText" class="empty-action" @click="$emit('action')">{{ actionText }}</button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EmptyState',
|
||||
props: {
|
||||
icon: { type: String, default: '🍻' },
|
||||
title: { type: String, default: '暂无内容' },
|
||||
desc: { type: String, default: '' },
|
||||
actionText: { type: String, default: '' }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.empty-state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 120rpx $sp-xl;
|
||||
}
|
||||
|
||||
.empty-icon {
|
||||
font-size: 96rpx;
|
||||
margin-bottom: $sp-lg;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.empty-title {
|
||||
font-size: $fs-base;
|
||||
font-weight: $fw-medium;
|
||||
color: $text-secondary;
|
||||
margin-bottom: $sp-sm;
|
||||
}
|
||||
|
||||
.empty-desc {
|
||||
font-size: $fs-sm;
|
||||
color: $text-tertiary;
|
||||
text-align: center;
|
||||
line-height: $lh-normal;
|
||||
}
|
||||
|
||||
.empty-action {
|
||||
margin-top: $sp-xl;
|
||||
padding: $sp-md $sp-2xl;
|
||||
background: linear-gradient(135deg, $amber, $amber-deep);
|
||||
color: $text-on-amber;
|
||||
font-size: $fs-base;
|
||||
font-weight: $fw-bold;
|
||||
border-radius: $radius-full;
|
||||
border: none;
|
||||
|
||||
&::after {
|
||||
border: none;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.85;
|
||||
transform: scale(0.96);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,179 @@
|
||||
<template>
|
||||
<view class="event-card" @click="$emit('tap', event)">
|
||||
<!-- 状态标签 -->
|
||||
<view class="event-status" :class="'status-' + event.status">
|
||||
<text class="event-status-text">{{ statusLabel }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 标题 -->
|
||||
<text class="event-title">{{ event.title }}</text>
|
||||
|
||||
<!-- 信息行 -->
|
||||
<view class="event-info">
|
||||
<view class="event-info-row">
|
||||
<text class="event-info-icon">🕐</text>
|
||||
<text class="event-info-text">{{ event.time }}</text>
|
||||
</view>
|
||||
<view class="event-info-row">
|
||||
<text class="event-info-icon">📍</text>
|
||||
<text class="event-info-text">{{ event.location }}</text>
|
||||
</view>
|
||||
<view class="event-info-row">
|
||||
<text class="event-info-icon">👥</text>
|
||||
<text class="event-info-text">{{ event.joined }}/{{ event.maxPeople }} 人已报名</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 底部:发起人 + 操作 -->
|
||||
<view class="event-footer">
|
||||
<view class="event-organizer">
|
||||
<view class="event-org-avatar">
|
||||
<text class="event-org-text">{{ event.organizer ? event.organizer.nickname[0] : '酒' }}</text>
|
||||
</view>
|
||||
<text class="event-org-name">{{ event.organizer ? event.organizer.nickname : '' }}</text>
|
||||
</view>
|
||||
<view class="event-action" v-if="event.status === 'open'">
|
||||
<text class="event-action-text" v-if="event.isJoined">✓ 已报名</text>
|
||||
<text class="event-action-text event-action-join" v-else>报名</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'EventCard',
|
||||
props: {
|
||||
event: { type: Object, default: () => ({}) }
|
||||
},
|
||||
computed: {
|
||||
statusLabel() {
|
||||
const map = { open: '报名中', ongoing: '进行中', ended: '已结束' }
|
||||
return map[this.event.status] || '报名中'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.event-card {
|
||||
background: $bg-card;
|
||||
border-radius: $radius-xl;
|
||||
border: 1rpx solid var(--border-faint, rgba(255,255,255,0.08));
|
||||
padding: $sp-xl;
|
||||
margin-bottom: $sp-md;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
&:active {
|
||||
background: $bg-card-alt;
|
||||
}
|
||||
}
|
||||
|
||||
.event-status {
|
||||
display: inline-flex;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: $radius-full;
|
||||
margin-bottom: $sp-md;
|
||||
|
||||
&.status-open {
|
||||
background: rgba(94,198,160,0.12);
|
||||
}
|
||||
&.status-ongoing {
|
||||
background: rgba(232,168,56,0.12);
|
||||
}
|
||||
&.status-ended {
|
||||
background: $bg-elevated;
|
||||
}
|
||||
}
|
||||
|
||||
.event-status-text {
|
||||
font-size: $fs-xs;
|
||||
font-weight: $fw-medium;
|
||||
|
||||
.status-open & { color: $mint; }
|
||||
.status-ongoing & { color: $amber; }
|
||||
.status-ended & { color: $text-tertiary; }
|
||||
}
|
||||
|
||||
.event-title {
|
||||
display: block;
|
||||
font-size: $fs-lg;
|
||||
font-weight: $fw-bold;
|
||||
color: $text-primary;
|
||||
margin-bottom: $sp-lg;
|
||||
}
|
||||
|
||||
.event-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: $sp-sm;
|
||||
margin-bottom: $sp-lg;
|
||||
}
|
||||
|
||||
.event-info-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-sm;
|
||||
}
|
||||
|
||||
.event-info-icon {
|
||||
font-size: $fs-sm;
|
||||
width: 36rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.event-info-text {
|
||||
font-size: $fs-sm;
|
||||
color: $text-secondary;
|
||||
}
|
||||
|
||||
.event-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-top: $sp-md;
|
||||
border-top: 1rpx solid var(--divider-color, rgba(255,255,255,0.08));
|
||||
}
|
||||
|
||||
.event-organizer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-sm;
|
||||
}
|
||||
|
||||
.event-org-avatar {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
background: $bg-elevated;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.event-org-text {
|
||||
font-size: $fs-xs;
|
||||
font-weight: $fw-bold;
|
||||
color: $lavender;
|
||||
}
|
||||
|
||||
.event-org-name {
|
||||
font-size: $fs-sm;
|
||||
color: $text-tertiary;
|
||||
}
|
||||
|
||||
.event-action-text {
|
||||
font-size: $fs-sm;
|
||||
color: $text-tertiary;
|
||||
padding: 8rpx 24rpx;
|
||||
border-radius: $radius-full;
|
||||
background: $bg-elevated;
|
||||
}
|
||||
|
||||
.event-action-join {
|
||||
color: $text-on-amber;
|
||||
background: linear-gradient(135deg, $amber, $amber-deep);
|
||||
font-weight: $fw-bold;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,239 @@
|
||||
<template>
|
||||
<view class="feed-card" @click="$emit('tap', feed)">
|
||||
<!-- 头部:头像+昵称+时间 -->
|
||||
<view class="feed-header">
|
||||
<view class="feed-avatar-wrap">
|
||||
<image v-if="feed.avatar" class="feed-avatar" :src="feed.avatar" mode="aspectFill"></image>
|
||||
<view v-else class="feed-avatar feed-avatar-ph">
|
||||
<text class="feed-avatar-text">{{ feed.nickname ? feed.nickname[0] : '酒' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="feed-meta">
|
||||
<text class="feed-name">{{ feed.nickname }}</text>
|
||||
<text class="feed-time">{{ feed.time }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 正文 -->
|
||||
<text class="feed-text">{{ feed.text }}</text>
|
||||
|
||||
<!-- 饮酒标签 -->
|
||||
<view class="feed-drinks" v-if="feed.drinks && feed.drinks.length">
|
||||
<view class="feed-drink-tag" v-for="(d, i) in feed.drinks" :key="i">
|
||||
<text class="feed-drink-emoji">{{ categoryEmoji(d.category) }}</text>
|
||||
<text class="feed-drink-name">{{ d.name }} {{ d.amount }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 感受标签 -->
|
||||
<view class="feed-feeling" v-if="feed.feeling">
|
||||
<text class="feed-feeling-text">{{ feelingLabel(feed.feeling) }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 图片 -->
|
||||
<view class="feed-images" v-if="feed.images && feed.images.length">
|
||||
<image
|
||||
v-for="(img, i) in feed.images"
|
||||
:key="i"
|
||||
class="feed-img"
|
||||
:class="'feed-img-' + Math.min(feed.images.length, 3)"
|
||||
:src="img"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
</view>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<view class="feed-actions">
|
||||
<view class="feed-action" :class="{ active: feed.liked }" @click.stop="$emit('like', feed)">
|
||||
<text class="feed-action-icon">{{ feed.liked ? '❤️' : '🤍' }}</text>
|
||||
<text class="feed-action-num">{{ feed.likes || '' }}</text>
|
||||
</view>
|
||||
<view class="feed-action" @click.stop="$emit('comment', feed)">
|
||||
<text class="feed-action-icon">💬</text>
|
||||
<text class="feed-action-num">{{ feed.comments || '' }}</text>
|
||||
</view>
|
||||
<view class="feed-action" @click.stop="$emit('share', feed)">
|
||||
<text class="feed-action-icon">↗</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FeedCard',
|
||||
props: {
|
||||
feed: { type: Object, default: () => ({}) }
|
||||
},
|
||||
methods: {
|
||||
categoryEmoji(cat) {
|
||||
const map = { baijiu: '🏺', beer: '🍺', wine: '🍷', whisky: '🥃', huangjiu: '🫖', sake: '🍶', fruit: '🍹', cocktail: '🍸' }
|
||||
return map[cat] || '🍻'
|
||||
},
|
||||
feelingLabel(f) {
|
||||
const map = { sober: '😌 清醒', buzzed: '😊 微醺', tipsy: '😄 小醉', drunk: '🥴 喝多了' }
|
||||
return map[f] || '🍻 喝了点'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.feed-card {
|
||||
background: $bg-card;
|
||||
border-radius: $radius-xl;
|
||||
border: 1rpx solid var(--border-faint, rgba(255,255,255,0.08));
|
||||
padding: $sp-xl;
|
||||
margin-bottom: $sp-md;
|
||||
}
|
||||
|
||||
.feed-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-md;
|
||||
margin-bottom: $sp-lg;
|
||||
}
|
||||
|
||||
.feed-avatar-wrap {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.feed-avatar {
|
||||
width: 80rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.feed-avatar-ph {
|
||||
background: linear-gradient(135deg, rgba(232,168,56,0.2), rgba(139,133,184,0.2));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.feed-avatar-text {
|
||||
font-size: $fs-lg;
|
||||
font-weight: $fw-bold;
|
||||
color: $amber;
|
||||
}
|
||||
|
||||
.feed-meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4rpx;
|
||||
}
|
||||
|
||||
.feed-name {
|
||||
font-size: $fs-base;
|
||||
font-weight: $fw-bold;
|
||||
color: $text-primary;
|
||||
}
|
||||
|
||||
.feed-time {
|
||||
font-size: $fs-xs;
|
||||
color: $text-tertiary;
|
||||
}
|
||||
|
||||
.feed-text {
|
||||
display: block;
|
||||
font-size: $fs-base;
|
||||
color: $text-primary;
|
||||
line-height: $lh-loose;
|
||||
margin-bottom: $sp-md;
|
||||
}
|
||||
|
||||
.feed-drinks {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $sp-sm;
|
||||
margin-bottom: $sp-md;
|
||||
}
|
||||
|
||||
.feed-drink-tag {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
padding: 8rpx 20rpx;
|
||||
background: $bg-elevated;
|
||||
border-radius: $radius-full;
|
||||
border: 1rpx solid var(--border-micro, rgba(255,255,255,0.05));
|
||||
}
|
||||
|
||||
.feed-drink-emoji {
|
||||
font-size: $fs-sm;
|
||||
}
|
||||
|
||||
.feed-drink-name {
|
||||
font-size: $fs-xs;
|
||||
color: $text-secondary;
|
||||
}
|
||||
|
||||
.feed-feeling {
|
||||
margin-bottom: $sp-md;
|
||||
}
|
||||
|
||||
.feed-feeling-text {
|
||||
font-size: $fs-xs;
|
||||
color: $text-tertiary;
|
||||
padding: 6rpx 16rpx;
|
||||
background: rgba(232,168,56,0.06);
|
||||
border-radius: $radius-full;
|
||||
}
|
||||
|
||||
.feed-images {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: $sp-sm;
|
||||
margin-bottom: $sp-md;
|
||||
}
|
||||
|
||||
.feed-img {
|
||||
border-radius: $radius-md;
|
||||
height: 200rpx;
|
||||
}
|
||||
|
||||
.feed-img-1 {
|
||||
width: 100%;
|
||||
height: 320rpx;
|
||||
}
|
||||
|
||||
.feed-img-2 {
|
||||
width: calc(50% - 8rpx);
|
||||
}
|
||||
|
||||
.feed-img-3 {
|
||||
width: calc(33.33% - 11rpx);
|
||||
}
|
||||
|
||||
.feed-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-xl;
|
||||
padding-top: $sp-md;
|
||||
border-top: 1rpx solid var(--divider-color, rgba(255,255,255,0.08));
|
||||
}
|
||||
|
||||
.feed-action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8rpx;
|
||||
padding: 8rpx 0;
|
||||
|
||||
&.active .feed-action-num {
|
||||
color: $coral;
|
||||
}
|
||||
|
||||
&:active {
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.feed-action-icon {
|
||||
font-size: $fs-base;
|
||||
}
|
||||
|
||||
.feed-action-num {
|
||||
font-size: $fs-sm;
|
||||
color: $text-tertiary;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<view class="friend-item" @click="$emit('tap', friend)">
|
||||
<view class="friend-avatar-wrap">
|
||||
<image v-if="friend.avatar" class="friend-avatar" :src="friend.avatar" mode="aspectFill"></image>
|
||||
<view v-else class="friend-avatar friend-avatar-ph">
|
||||
<text class="friend-avatar-text">{{ friend.nickname ? friend.nickname[0] : '酒' }}</text>
|
||||
</view>
|
||||
<view v-if="friend.online" class="friend-online"></view>
|
||||
</view>
|
||||
<view class="friend-info">
|
||||
<text class="friend-name">{{ friend.nickname }}</text>
|
||||
<text class="friend-last">{{ friend.lastDrink }} · {{ friend.lastDrinkTime }}</text>
|
||||
</view>
|
||||
<slot name="action"></slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'FriendItem',
|
||||
props: {
|
||||
friend: { type: Object, default: () => ({}) }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.friend-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: $sp-md;
|
||||
padding: $sp-lg;
|
||||
background: $bg-card;
|
||||
border-radius: $radius-lg;
|
||||
border: 1rpx solid var(--border-faint, rgba(255,255,255,0.08));
|
||||
margin-bottom: $sp-sm;
|
||||
|
||||
&:active {
|
||||
background: $bg-card-alt;
|
||||
}
|
||||
}
|
||||
|
||||
.friend-avatar-wrap {
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.friend-avatar {
|
||||
width: 88rpx;
|
||||
height: 88rpx;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.friend-avatar-ph {
|
||||
background: linear-gradient(135deg, rgba(232,168,56,0.15), rgba(139,133,184,0.15));
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.friend-avatar-text {
|
||||
font-size: $fs-lg;
|
||||
font-weight: $fw-bold;
|
||||
color: $amber;
|
||||
}
|
||||
|
||||
.friend-online {
|
||||
position: absolute;
|
||||
bottom: 4rpx;
|
||||
right: 4rpx;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
border-radius: 50%;
|
||||
background: $mint;
|
||||
border: 3rpx solid $bg-card;
|
||||
}
|
||||
|
||||
.friend-info {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
}
|
||||
|
||||
.friend-name {
|
||||
font-size: $fs-base;
|
||||
font-weight: $fw-bold;
|
||||
color: $text-primary;
|
||||
}
|
||||
|
||||
.friend-last {
|
||||
font-size: $fs-xs;
|
||||
color: $text-tertiary;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user