| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013 |
- <template>
- <view class="plaza-page">
- <!-- 顶部标题栏 -->
- <view class="header">
- <view class="header-background">
- <view class="feather feather-left">🪶</view>
- <view class="feather feather-right">🪶</view>
- </view>
- <view class="header-content">
- <text class="header-title">💕 缘分广场</text>
- <text class="header-desc">两只羽毛相遇,编织爱情故事</text>
- </view>
- </view>
-
- <!-- 动态列表 -->
- <scroll-view
- class="dynamic-list"
- scroll-y
- :scroll-top="scrollTopValue"
- :scroll-with-animation="false"
- @scroll="onScroll"
- @scrolltolower="loadMore"
- refresher-enabled
- :refresher-triggered="refreshing"
- @refresherrefresh="onRefresh"
- >
- <!-- 列表内容 -->
- <view class="list-content">
- <!-- 动态卡片 -->
- <view
- v-for="item in dynamicList"
- :key="item.dynamicId"
- class="dynamic-card"
- @click="goToDetail(item.dynamicId)"
- @longpress="showReportMenu(item)"
- >
- <!-- 用户信息 -->
- <view class="user-info">
- <image
- :src="getAvatar(item)"
- class="avatar"
- mode="aspectFill"
- ></image>
- <view class="user-details">
- <text class="nickname">{{ getNickname(item) }}</text>
- <text class="time">{{ formatTime(item.createdAt) }}</text>
- </view>
- </view>
-
- <!-- 动态内容 -->
- <view class="dynamic-content">
- <text class="content-text">{{ item.content }}</text>
- </view>
-
- <!-- 媒体内容(图片) -->
- <view v-if="item.mediaUrls && item.mediaUrls.length > 0" class="media-container">
- <view
- :class="['image-grid', getGridClass(item)]"
- >
- <image
- v-for="(url, index) in item.mediaUrls.slice(0, 9)"
- :key="index"
- :src="url"
- class="media-image"
- mode="aspectFill"
- @click.stop="previewImage(item.mediaUrls, index)"
- ></image>
- </view>
- </view>
-
- <!-- 互动栏 -->
- <view class="action-bar">
- <view class="action-item" @click.stop="handleLike(item)">
- <text :class="['icon', !!item.isLiked ? 'icon-liked' : '']">
- {{ !!item.isLiked ? '❤️' : '🤍' }}
- </text>
- <text class="action-text">{{ item.likeCount || 0 }}</text>
- </view>
-
- <view class="action-item">
- <text class="icon">💬</text>
- <text class="action-text">{{ item.commentCount || 0 }}</text>
- </view>
-
- <view class="action-item" @click.stop="handleFavorite(item)">
- <text :class="['icon', !!item.isFavorited ? 'icon-favorited' : '']">
- {{ !!item.isFavorited ? '⭐' : '☆' }}
- </text>
- <text class="action-text">{{ item.favoriteCount || 0 }}</text>
- </view>
- </view>
- </view>
-
- <!-- 加载提示 -->
- <view class="loading-tip" v-if="loading">
- <text>加载中...</text>
- </view>
-
- <!-- 没有更多数据 -->
- <view class="loading-tip" v-if="noMore && dynamicList.length > 0">
- <text>没有更多了~</text>
- </view>
-
- <!-- 空状态 -->
- <view class="empty-state" v-if="!loading && dynamicList.length === 0">
- <view class="empty-feathers">
- <text class="feather-icon">🪶</text>
- <text class="feather-icon">🪶</text>
- </view>
- <text class="empty-text">还没有缘分动态</text>
- <text class="empty-hint">快来分享你的美好时光,遇见有趣的灵魂吧~</text>
- <view class="empty-action" @click="goToPublish">
- <text>💕 发布第一条动态</text>
- </view>
- </view>
- </view>
- </scroll-view>
-
- <!-- 发布按钮 -->
- <view class="publish-btn" @click="goToPublish">
- <view class="publish-bg">
- <text class="publish-icon">💕</text>
- <text class="publish-text">分享心动</text>
- </view>
- </view>
-
- <!-- 举报菜单弹窗 -->
- <view v-if="showMenu" class="report-menu-popup">
- <view class="menu-mask" @click="hideReportMenu"></view>
- <view class="menu-content">
- <view class="menu-item" @click="handleReport">
- <text class="menu-icon">🚩</text>
- <text class="menu-text">举报此动态</text>
- </view>
- <view class="menu-item cancel" @click="hideReportMenu">
- <text class="menu-text">取消</text>
- </view>
- </view>
- </view>
-
- <!-- 底部导航栏 -->
- <view class="tabbar">
- <view class="tabbar-item" @click="switchTab('index')">
- <text class="tabbar-icon">🏠</text>
- <text class="tabbar-text">首页</text>
- </view>
- <view class="tabbar-item active" @click="switchTab('plaza')">
- <text class="tabbar-icon">💕</text>
- <text class="tabbar-text">动态</text>
- </view>
- <view class="tabbar-item" @click="switchTab('recommend')">
- <text class="tabbar-icon">👍</text>
- <text class="tabbar-text">推荐</text>
- </view>
- <!-- <view class="tabbar-item" @click="switchTab('message')">
- <text class="tabbar-icon">💬</text>
- <text class="tabbar-text">消息</text>
- <view v-if="unreadCount > 0" class="tabbar-badge">{{ unreadCount }}</view>
- </view> -->
- <view class="tabbar-item" @click="switchTab('mine')">
- <text class="tabbar-icon">👤</text>
- <text class="tabbar-text">我的</text>
- </view>
- </view>
- </view>
- </template>
- <script>
- import api from '@/utils/api.js'
- import userStatusCheck from '@/utils/userStatusCheck.js'
- export default {
- data() {
- return {
- dynamicList: [],
- pageNum: 1,
- pageSize: 10,
- loading: false,
- refreshing: false,
- noMore: false,
- showMenu: false, // 显示举报菜单
- selectedDynamic: null, // 选中的动态
- currentUserId: uni.getStorageInfoSync("userId"), // 当前用户ID,实际应从存储获取
- defaultAvatar: 'http://via.placeholder.com/100x100.png?text=头像',
- likingMap: {}, // 记录正在点赞的动态ID,防止重复点击
- favoritingMap: {}, // 记录正在收藏的动态ID,防止重复点击
- scrollTopValue: 0, // 用于设置滚动位置
- savedScrollTop: 0, // 保存的滚动位置
- isFirstLoad: true // 是否首次加载
- }
- },
- computed: {
- unreadCount() {
- return this.$store.getters.getTotalUnread || 0;
- }
- },
- onLoad() {
- // 从存储中获取当前用户ID
- const storedUserId = uni.getStorageSync('userId')
- if (storedUserId !== null && storedUserId !== undefined && storedUserId !== '') {
- this.currentUserId = parseInt(storedUserId)
- } else {
- // 尝试从 userInfo 中获取
- const userInfo = uni.getStorageSync('userInfo')
- if (userInfo && (userInfo.userId || userInfo.id || userInfo.user_id)) {
- this.currentUserId = parseInt(userInfo.userId || userInfo.id || userInfo.user_id)
- } else {
- // 未登录,设置为 null
- this.currentUserId = null
- }
- }
- this.loadDynamicList()
- // 监听详情页更新事件,实时同步点赞/收藏状态
- uni.$on('dynamic-updated', (payload) => {
- if (!payload || !payload.dynamicId) return
- const idx = this.dynamicList.findIndex(x => x.dynamicId === payload.dynamicId)
- if (idx !== -1) {
- const item = this.dynamicList[idx]
- // 使用 hasOwnProperty 严格检查属性是否存在,只更新事件中明确包含的字段
- // 这样可以避免误更新不相关的字段(如点赞时误更新收藏状态)
- // 根据 dynamic_likes 表判断:有记录显示 ❤️,无记录显示 🤍
- if (payload.hasOwnProperty('isLiked') && payload.isLiked !== undefined && payload.isLiked !== null) {
- this.$set(item, 'isLiked', payload.isLiked === true || payload.isLiked === 1 || payload.isLiked === 'true' || payload.isLiked === '1')
- }
- if (payload.hasOwnProperty('likeCount') && payload.likeCount !== undefined && payload.likeCount !== null) {
- this.$set(item, 'likeCount', Number(payload.likeCount) || 0)
- }
- // 只有当 isFavorited 明确存在于 payload 中时才更新(避免误更新)
- // 根据 dynamic_favorites 表判断:有记录显示 ⭐,无记录显示 ☆
- if (payload.hasOwnProperty('isFavorited') && payload.isFavorited !== undefined && payload.isFavorited !== null) {
- this.$set(item, 'isFavorited', payload.isFavorited === true || payload.isFavorited === 1 || payload.isFavorited === 'true' || payload.isFavorited === '1')
- }
- if (payload.hasOwnProperty('favoriteCount') && payload.favoriteCount !== undefined && payload.favoriteCount !== null) {
- this.$set(item, 'favoriteCount', Number(payload.favoriteCount) || 0)
- }
- }
- })
- // 监听发布页插入新动态
- uni.$on('dynamic-insert', (d) => {
- if (!d) return
- // 仅在第一页顶部插入
- this.dynamicList = [d, ...this.dynamicList]
- })
- },
-
- onShow() {
- // 重新获取当前用户ID(可能在其他页面登录/登出)
- const storedUserId = uni.getStorageSync('userId')
- if (storedUserId !== null && storedUserId !== undefined && storedUserId !== '') {
- this.currentUserId = parseInt(storedUserId)
- } else {
- // 尝试从 userInfo 中获取
- const userInfo = uni.getStorageSync('userInfo')
- if (userInfo && (userInfo.userId || userInfo.id || userInfo.user_id)) {
- this.currentUserId = parseInt(userInfo.userId || userInfo.id || userInfo.user_id)
- } else {
- // 未登录,设置为 null
- this.currentUserId = null
- }
- }
-
- // 首次加载时不需要恢复滚动位置
- if (this.isFirstLoad) {
- this.isFirstLoad = false
- return
- }
-
- // 从详情页返回时,恢复滚动位置,不重新加载数据
- if (this.savedScrollTop > 0) {
- setTimeout(() => {
- this.scrollTopValue = this.savedScrollTop
- }, 100)
- }
- },
-
- methods: {
- // 监听滚动事件,保存滚动位置
- onScroll(e) {
- this.savedScrollTop = e.detail.scrollTop
- },
- // 兼容WXML:获取头像
- getAvatar(item) {
- if (item && item.user && item.user.avatarUrl) {
- return item.user.avatarUrl
- }
- return this.defaultAvatar
- },
- // 兼容WXML:获取昵称
- getNickname(item) {
- if (item && item.user && item.user.nickname) {
- return item.user.nickname
- }
- return '匿名用户'
- },
- // 兼容WXML:图片栅格class
- getGridClass(item) {
- const len = (item && item.mediaUrls && item.mediaUrls.length) ? item.mediaUrls.length : 0
- const n = Math.min(len, 3)
- return 'grid-' + n
- },
- // 加载动态列表
- async loadDynamicList() {
- if (this.loading || this.noMore) return
-
- this.loading = true
-
- try {
- const res = await api.dynamic.getRecommendList({
- pageNum: this.pageNum,
- pageSize: this.pageSize,
- userId: this.currentUserId
- })
-
- if (res && res.records) {
- // 处理数据,确保布尔值正确转换(根据 dynamic_likes 和 dynamic_favorites 表判断)
- // 后端返回的 isLiked 和 isFavorited 应该已经是 Boolean,但为了兼容性,确保正确转换
- const newData = res.records.map(item => ({
- ...item,
- // 如果 dynamic_likes 表中有记录,显示 ❤️,否则显示 🤍
- isLiked: item.isLiked === true || item.isLiked === 1 || item.isLiked === 'true' || item.isLiked === '1',
- // 如果 dynamic_favorites 表中有记录,显示 ⭐,否则显示 ☆
- isFavorited: item.isFavorited === true || item.isFavorited === 1 || item.isFavorited === 'true' || item.isFavorited === '1'
- }))
-
- if (this.pageNum === 1) {
- this.dynamicList = newData
- } else {
- this.dynamicList = [...this.dynamicList, ...newData]
- }
-
- // 判断是否还有更多数据
- if (res.current >= res.pages) {
- this.noMore = true
- } else {
- this.pageNum++
- }
- }
- } catch (error) {
- console.error('加载动态列表失败:', error)
- uni.showToast({
- title: '加载失败',
- icon: 'none'
- })
- } finally {
- this.loading = false
- this.refreshing = false
- }
- },
-
- // 下拉刷新
- onRefresh() {
- this.refreshing = true
- this.pageNum = 1
- this.noMore = false
- this.dynamicList = []
- this.loadDynamicList()
- },
-
- // 上拉加载更多
- loadMore() {
- if (!this.noMore && !this.loading) {
- this.loadDynamicList()
- }
- },
-
- // 处理点赞
- async handleLike(item) {
- // 检查用户是否被禁用
- const canOperate = await userStatusCheck.checkAndTip()
- if (!canOperate) return
-
- // 防止重复点击:如果正在处理该动态的点赞请求,直接返回
- if (this.likingMap[item.dynamicId]) {
- return
- }
-
- try {
- // 标记为正在处理
- this.$set(this.likingMap, item.dynamicId, true)
-
- // 根据 dynamic_likes 表判断是否点赞(有记录显示 ❤️,无记录显示 🤍)
- const isLiked = item.isLiked === true || item.isLiked === 1 || item.isLiked === 'true' || item.isLiked === '1'
- const originalCount = item.likeCount || 0
- const newIsLiked = !isLiked
- const newLikeCount = isLiked ? Math.max(0, originalCount - 1) : originalCount + 1
-
- // 立即更新UI(乐观更新),使用 $set 确保响应式更新
- this.$set(item, 'isLiked', newIsLiked)
- this.$set(item, 'likeCount', newLikeCount)
-
- // 发送请求
- if (isLiked) {
- // 取消点赞
- await api.dynamic.unlike(item.dynamicId)
- } else {
- // 点赞
- await api.dynamic.like(item.dynamicId)
- }
- } catch (error) {
- console.error('点赞操作失败:', error)
- // 请求失败,恢复原状态
- const currentIsLiked = item.isLiked === true || item.isLiked === 1 || item.isLiked === 'true' || item.isLiked === '1'
- this.$set(item, 'isLiked', !currentIsLiked)
- this.$set(item, 'likeCount', !currentIsLiked ? (item.likeCount || 0) + 1 : Math.max(0, (item.likeCount || 0) - 1))
- uni.showToast({
- title: '操作失败,请重试',
- icon: 'none'
- })
- } finally {
- // 延迟300毫秒后释放锁,防止快速点击
- setTimeout(() => {
- this.$set(this.likingMap, item.dynamicId, false)
- }, 300)
- }
- },
-
- // 处理收藏
- async handleFavorite(item) {
- // 检查用户是否被禁用
- const canOperate = await userStatusCheck.checkAndTip()
- if (!canOperate) return
-
- // 防止重复点击:如果正在处理该动态的收藏请求,直接返回
- if (this.favoritingMap[item.dynamicId]) {
- return
- }
-
- try {
- // 标记为正在处理
- this.$set(this.favoritingMap, item.dynamicId, true)
-
- // 根据 dynamic_favorites 表判断是否收藏(有记录显示 ⭐,无记录显示 ☆)
- const isFavorited = item.isFavorited === true || item.isFavorited === 1 || item.isFavorited === 'true' || item.isFavorited === '1'
- const originalCount = item.favoriteCount || 0
- const newIsFavorited = !isFavorited
- const newFavoriteCount = isFavorited ? Math.max(0, originalCount - 1) : originalCount + 1
-
- // 立即更新UI(乐观更新),使用 $set 确保响应式更新
- this.$set(item, 'isFavorited', newIsFavorited)
- this.$set(item, 'favoriteCount', newFavoriteCount)
-
- if (isFavorited) {
- // 取消收藏
- await api.dynamic.unfavorite(item.dynamicId)
- } else {
- // 收藏
- await api.dynamic.favorite(item.dynamicId)
- uni.showToast({
- title: '收藏成功',
- icon: 'success'
- })
- }
- } catch (error) {
- console.error('收藏操作失败:', error)
- // 请求失败,恢复原状态
- const currentIsFavorited = item.isFavorited === true || item.isFavorited === 1 || item.isFavorited === 'true' || item.isFavorited === '1'
- this.$set(item, 'isFavorited', !currentIsFavorited)
- this.$set(item, 'favoriteCount', !currentIsFavorited ? (item.favoriteCount || 0) + 1 : Math.max(0, (item.favoriteCount || 0) - 1))
- uni.showToast({
- title: '操作失败,请重试',
- icon: 'none'
- })
- } finally {
- // 延迟300毫秒后释放锁,防止快速点击
- setTimeout(() => {
- this.$set(this.favoritingMap, item.dynamicId, false)
- }, 300)
- }
- },
-
- // 预览图片
- previewImage(urls, current) {
- uni.previewImage({
- urls: urls,
- current: current
- })
- },
-
- // 跳转到详情页
- goToDetail(dynamicId) {
- uni.navigateTo({
- url: `/pages/plaza/detail?id=${dynamicId}`
- })
- },
-
- // 跳转到发布页
- async goToPublish() {
- // 检查用户是否被禁用
- const canOperate = await userStatusCheck.checkAndTip()
- if (!canOperate) return
-
- console.log('点击了发布按钮');
- uni.navigateTo({
- url: '/pages/plaza/publish',
- fail: (err) => {
- console.error('跳转失败:', err);
- }
- })
- },
-
- // 显示举报菜单
- showReportMenu(item) {
- // 震动反馈
- uni.vibrateShort({
- type: 'light'
- })
- this.selectedDynamic = item
- this.showMenu = true
- },
-
- // 隐藏举报菜单
- hideReportMenu() {
- this.showMenu = false
- this.selectedDynamic = null
- },
-
- // 处理举报
- handleReport() {
- this.hideReportMenu()
- if (!this.selectedDynamic || !this.selectedDynamic.dynamicId) {
- uni.showToast({
- title: '动态ID不存在',
- icon: 'none'
- })
- return
- }
- // 跳转到举报页面
- uni.navigateTo({
- url: `/pages/plaza/report?id=${this.selectedDynamic.dynamicId}`
- })
- },
-
- // 格式化时间
- formatTime(timeStr) {
- if (!timeStr) return ''
-
- const time = new Date(timeStr)
- const now = new Date()
- const diff = now - time
-
- // 1分钟内
- if (diff < 60000) {
- return '刚刚'
- }
- // 1小时内
- if (diff < 3600000) {
- return Math.floor(diff / 60000) + '分钟前'
- }
- // 24小时内
- if (diff < 86400000) {
- return Math.floor(diff / 3600000) + '小时前'
- }
- // 7天内
- if (diff < 604800000) {
- return Math.floor(diff / 86400000) + '天前'
- }
-
- // 超过7天显示日期
- const year = time.getFullYear()
- const month = String(time.getMonth() + 1).padStart(2, '0')
- const day = String(time.getDate()).padStart(2, '0')
-
- if (year === now.getFullYear()) {
- return `${month}-${day}`
- }
- return `${year}-${month}-${day}`
- },
-
- // 切换Tab
- switchTab(tab) {
- if (tab === 'plaza') return
-
- const tabPages = {
- index: '/pages/index/index',
- recommend: '/pages/recommend/index',
- message: '/subpkg-message/index/index',
- mine: '/pages/mine/index'
- }
-
- if (tabPages[tab]) {
- uni.redirectTo({
- url: tabPages[tab]
- })
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .plaza-page {
- padding-top: 60px;
- min-height: 100vh;
- background: #FFF0F5; // 淡淡粉色背景
-
-
- // 顶部标题栏
- .header {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- height: 88rpx; // 更紧凑,减小头部占用
- background: transparent; // 移除重色背景,突出可爱风淡粉
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding-top: 0; // 移除顶部安全区额外留白
- z-index: 999;
- box-shadow: none;
- overflow: visible;
- position: relative;
-
-
- .header-background { display: none; }
-
- .header-content {
- text-align: center;
- z-index: 1;
-
- .header-subtitle {
- font-size: 22rpx;
- color: #E91E63;
- display: block;
- margin-bottom: 8rpx;
- letter-spacing: 2rpx;
- }
-
- .header-title {
- font-size: 36rpx;
- font-weight: 700;
- color: #D81B60;
- text-shadow: none;
- display: block;
- margin-bottom: 2rpx; // 缩小标题与描述间距
- }
-
- .header-desc {
- font-size: 20rpx;
- color: #AD1457;
- display: block;
- letter-spacing: 1rpx;
- }
- }
- }
-
- // 动态列表
- .dynamic-list {
- margin-top: 88rpx; // 同步减少顶部外边距
- padding-bottom: 120rpx;
- height: calc(100vh - 88rpx);
-
- .list-content {
- padding: 12rpx; // 再收紧列表内边距
- }
-
- // 动态卡片
- .dynamic-card {
- background: #FFFFFF; // 纯白卡片
- border-radius: 20rpx;
- padding: 24rpx; // 收紧卡片内边距
- margin-bottom: 14rpx; // 卡片之间更紧凑
- box-shadow: 0 4rpx 12rpx rgba(233, 30, 99, 0.07);
- border: 1rpx solid rgba(255, 182, 193, 0.22);
- transition: all 0.3s ease;
- position: relative;
- overflow: hidden;
-
- // 用户信息
- .user-info {
- display: flex;
- align-items: center;
- margin-bottom: 24rpx;
-
- .avatar {
- width: 88rpx;
- height: 88rpx;
- border-radius: 50%;
- margin-right: 24rpx;
- border: 3rpx solid #FFB3BA;
- box-shadow: 0 4rpx 12rpx rgba(233, 30, 99, 0.2);
- }
-
- .user-details {
- flex: 1;
-
- .nickname {
- display: block;
- font-size: 30rpx;
- font-weight: 600;
- color: #2D1B69;
- margin-bottom: 8rpx;
- }
-
- .time {
- font-size: 24rpx;
- color: #8B5A96;
- opacity: 0.8;
- }
- }
- }
-
- // 动态内容
- .dynamic-content {
- margin-bottom: 20rpx;
-
- .content-text {
- font-size: 28rpx;
- line-height: 1.6;
- color: #333333;
- word-wrap: break-word;
- }
- }
-
- // 媒体容器
- .media-container {
- margin-bottom: 16rpx;
-
- .image-grid {
- display: grid;
- gap: 10rpx;
-
- &.grid-1 {
- grid-template-columns: 1fr;
-
- .media-image {
- height: 400rpx;
- border-radius: 12rpx;
- }
- }
-
- &.grid-2,
- &.grid-3 {
- grid-template-columns: repeat(3, 1fr);
-
- .media-image {
- height: 180rpx;
- border-radius: 12rpx;
- }
- }
-
- .media-image {
- width: 100%;
- background-color: #F5F5F5;
- }
- }
- }
-
- // 互动栏
- .action-bar {
- display: flex;
- align-items: center;
- padding-top: 20rpx;
- border-top: 1rpx solid #F5F5F5;
-
- .action-item {
- flex: 1;
- display: flex;
- align-items: center;
- justify-content: center;
-
- .icon {
- font-size: 40rpx;
- margin-right: 8rpx;
-
- &.icon-liked {
- animation: heartBeat 0.3s ease-in-out;
- }
-
- &.icon-favorited {
- animation: starShine 0.3s ease-in-out;
- }
- }
-
- .action-text {
- font-size: 24rpx;
- color: #666666;
- }
- }
- }
- }
-
- // 加载提示
- .loading-tip {
- text-align: center;
- padding: 40rpx 0;
- font-size: 24rpx;
- color: #999999;
- }
-
- // 空状态
- .empty-state {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 200rpx 60rpx;
-
- .empty-icon {
- font-size: 120rpx;
- margin-bottom: 30rpx;
- }
-
- .empty-text {
- font-size: 32rpx;
- color: #333333;
- margin-bottom: 16rpx;
- }
-
- .empty-hint {
- font-size: 24rpx;
- color: #999999;
- }
- }
- }
-
- // 发布按钮
- .publish-btn {
- position: fixed;
- bottom: 200rpx;
- right: 40rpx;
- z-index: 998;
-
- .publish-bg {
- width: 140rpx;
- height: 140rpx;
- background: linear-gradient(135deg, #FF6B9D 0%, #E91E63 25%, #C2185B 50%, #FF8A95 75%, #FFB3BA 100%);
- border-radius: 50%;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- box-shadow: 0 12rpx 36rpx rgba(233, 30, 99, 0.5);
- transition: all 0.3s ease;
- border: 4rpx solid rgba(255, 255, 255, 0.8);
- animation: pulse-love 3s ease-in-out infinite;
-
- &:active {
- transform: scale(0.9);
- }
-
- .publish-icon {
- font-size: 42rpx;
- margin-bottom: 4rpx;
- }
-
- .publish-text {
- font-size: 18rpx;
- color: rgba(255, 255, 255, 0.9);
- font-weight: 500;
- letter-spacing: 1rpx;
- }
- }
- }
-
- // 举报菜单弹窗
- .report-menu-popup {
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- z-index: 9998;
-
- .menu-mask {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: rgba(0, 0, 0, 0.5);
- }
-
- .menu-content {
- position: absolute;
- bottom: 0;
- left: 0;
- right: 0;
- background-color: #FFFFFF;
- border-radius: 30rpx 30rpx 0 0;
- padding: 20rpx 30rpx;
- padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
- padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
- animation: slideUp 0.3s ease;
-
- .menu-item {
- height: 100rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- border-radius: 12rpx;
- margin-bottom: 16rpx;
- transition: background-color 0.3s ease;
-
- &:not(.cancel) {
- background: #FFF5F7;
-
- &:active {
- background: #FFE8EC;
- }
- }
-
- &.cancel {
- background: #F5F5F5;
- margin-top: 8rpx;
-
- &:active {
- background: #EEEEEE;
- }
- }
-
- .menu-icon {
- font-size: 36rpx;
- margin-right: 12rpx;
- }
-
- .menu-text {
- font-size: 30rpx;
- color: #333333;
- font-weight: 500;
- }
- }
- }
- }
-
- // 底部导航栏
- .tabbar {
- position: fixed;
- bottom: 0;
- left: 0;
- right: 0;
- display: flex;
- background-color: #FFFFFF;
- border-top: 1rpx solid #F0F0F0;
- padding-bottom: constant(safe-area-inset-bottom);
- padding-bottom: env(safe-area-inset-bottom);
- z-index: 999;
- box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
-
- .tabbar-item {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding: 15rpx 0;
- position: relative;
-
- .tabbar-icon {
- font-size: 44rpx;
- margin-bottom: 5rpx;
- }
-
- .tabbar-text {
- font-size: 22rpx;
- color: #666666;
- }
-
- &.active {
- .tabbar-text {
- color: #E91E63;
- font-weight: bold;
- }
- }
- }
- }
- }
- // 动画
- @keyframes heartBeat {
- 0%, 100% {
- transform: scale(1);
- }
- 50% {
- transform: scale(1.2);
- }
- }
- @keyframes starShine {
- 0%, 100% {
- transform: scale(1) rotate(0deg);
- }
- 50% {
- transform: scale(1.2) rotate(15deg);
- }
- }
- @keyframes slideUp {
- from {
- transform: translateY(100%);
- }
- to {
- transform: translateY(0);
- }
- }
- .tabbar-badge {
- position: absolute;
- top: 8rpx;
- right: 50%;
- margin-right: -40rpx;
- min-width: 32rpx;
- height: 32rpx;
- line-height: 32rpx;
- padding: 0 6rpx;
- background-color: #FA5151;
- border-radius: 16rpx;
- font-size: 20rpx;
- color: #FFFFFF;
- text-align: center;
- }
- </style>
|