detail.vue 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205
  1. <template>
  2. <view class="detail-page">
  3. <!-- 自定义导航栏 -->
  4. <view class="custom-navbar">
  5. <view class="navbar-background">
  6. <view class="feather feather-small">🪶</view>
  7. </view>
  8. <view class="navbar-left" @click="goBack">
  9. <text class="back-icon">←</text>
  10. </view>
  11. <view class="navbar-title">
  12. <text class="main-title">💕 爱的故事</text>
  13. <text class="sub-title">两只羽毛的浪漫时光</text>
  14. </view>
  15. <view class="navbar-right" @click="showMoreMenu">
  16. <text class="more-icon">⋯</text>
  17. </view>
  18. </view>
  19. <!-- 内容区域 -->
  20. <scroll-view
  21. class="content-scroll"
  22. scroll-y
  23. :scroll-into-view="scrollIntoView"
  24. >
  25. <!-- 动态内容 -->
  26. <view v-if="dynamic" class="dynamic-detail">
  27. <!-- 用户信息 -->
  28. <view class="user-section">
  29. <image
  30. :src="getAvatar(dynamic)"
  31. class="avatar"
  32. mode="aspectFill"
  33. ></image>
  34. <view class="user-info">
  35. <text class="nickname">{{ getNickname(dynamic) }}</text>
  36. <text class="time">{{ formatTime(dynamic.createdAt) }}</text>
  37. </view>
  38. </view>
  39. <!-- 动态内容 -->
  40. <view class="content-section">
  41. <text class="content-text">{{ dynamic.content }}</text>
  42. </view>
  43. <!-- 媒体内容 -->
  44. <view v-if="dynamic.mediaUrls && dynamic.mediaUrls.length > 0" class="media-section">
  45. <view class="image-grid">
  46. <image
  47. v-for="(url, index) in dynamic.mediaUrls"
  48. :key="index"
  49. :src="url"
  50. class="media-image"
  51. mode="aspectFill"
  52. @click="previewImage(dynamic.mediaUrls, index)"
  53. ></image>
  54. </view>
  55. </view>
  56. <!-- 互动数据 -->
  57. <view class="stats-section">
  58. <text class="stat-item">{{ dynamic.likeCount || 0 }} 点赞</text>
  59. <text class="stat-item">{{ dynamic.commentCount || 0 }} 评论</text>
  60. <text class="stat-item">{{ dynamic.favoriteCount || 0 }} 收藏</text>
  61. <text class="stat-item">{{ dynamic.viewCount || 0 }} 浏览</text>
  62. </view>
  63. </view>
  64. <!-- 评论区域 -->
  65. <view class="comment-section">
  66. <view class="section-title">
  67. <text class="title-text">评论区</text>
  68. <text class="title-count">{{ dynamic ? dynamic.commentCount || 0 : commentList.length }}</text>
  69. </view>
  70. <!-- 评论列表 -->
  71. <view v-if="commentList.length > 0" class="comment-list">
  72. <view
  73. v-for="comment in commentList"
  74. :key="comment.commentId"
  75. class="comment-item"
  76. >
  77. <image
  78. :src="getCommentAvatar(comment)"
  79. class="comment-avatar"
  80. ></image>
  81. <view class="comment-content">
  82. <text class="comment-nickname">{{ getCommentNickname(comment) }}</text>
  83. <text class="comment-text">{{ comment.content }}</text>
  84. <!-- 评论图片 -->
  85. <view v-if="getCommentImages(comment).length > 0" class="comment-images">
  86. <image
  87. v-for="(imgUrl, imgIndex) in getCommentImages(comment)"
  88. :key="imgIndex"
  89. :src="imgUrl"
  90. class="comment-image"
  91. mode="aspectFill"
  92. @click="previewCommentImage(getCommentImages(comment), imgIndex)"
  93. />
  94. </view>
  95. <view class="comment-footer">
  96. <text class="comment-time">{{ formatTime(comment.createdAt) }}</text>
  97. <view class="comment-actions">
  98. <text class="action" @click="toggleCommentLike(comment)">{{ (comment.isLiked ? '❤️' : '🤍') + ' ' + (comment.likeCount || 0) }}</text>
  99. <text class="action" @click="openReply(comment)">回复</text>
  100. </view>
  101. </view>
  102. <!-- 子回复(一级展示) -->
  103. <view class="reply-list" v-if="comment.replies && comment.replies.length">
  104. <view class="reply-item" v-for="reply in comment.replies" :key="'r-'+reply.commentId">
  105. <text class="reply-nickname">{{ getCommentNickname(reply) }}:</text>
  106. <text class="reply-text">{{ reply.content }}</text>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 暂无评论 -->
  113. <view v-else class="empty-comment">
  114. <view class="feather-decoration">
  115. <text class="feather-small">🪶</text>
  116. <text class="feather-small">🪶</text>
  117. </view>
  118. <text class="empty-icon">💕</text>
  119. <text class="empty-text">还没有人留下爱的足迹</text>
  120. <text class="empty-hint">成为第一个点赞这份美好的人吧~</text>
  121. </view>
  122. </view>
  123. </scroll-view>
  124. <!-- 底部操作栏 -->
  125. <view class="bottom-bar">
  126. <view class="input-area" @click="showCommentInput">
  127. <text class="love-prefix">💕</text>
  128. <text class="input-placeholder">留下你的爱意表达...</text>
  129. </view>
  130. <view class="action-buttons">
  131. <view class="action-btn" @click="handleLike">
  132. <text :class="['action-icon', dynamic && dynamic.isLiked ? 'active' : '']">
  133. {{ dynamic && dynamic.isLiked ? '❤️' : '🤍' }}
  134. </text>
  135. <text class="action-label">{{ (dynamic && dynamic.likeCount) ? dynamic.likeCount : 0 }}</text>
  136. </view>
  137. <view class="action-btn" @click="handleFavorite">
  138. <text :class="['action-icon', dynamic && dynamic.isFavorited ? 'active' : '']">
  139. {{ dynamic && dynamic.isFavorited ? '⭐' : '☆' }}
  140. </text>
  141. <text class="action-label">{{ (dynamic && dynamic.favoriteCount) ? dynamic.favoriteCount : 0 }}</text>
  142. </view>
  143. <!-- 精简:移除不必要的分享按钮 -->
  144. </view>
  145. </view>
  146. <!-- 更多菜单弹窗 -->
  147. <view v-if="showMenu" class="menu-popup">
  148. <view class="menu-mask" @click="hideMoreMenu"></view>
  149. <view class="menu-content">
  150. <view class="menu-item" @click="handleReport">
  151. <text class="menu-icon">🚩</text>
  152. <text class="menu-text">举报</text>
  153. </view>
  154. <view class="menu-item cancel" @click="hideMoreMenu">
  155. <text class="menu-text">取消</text>
  156. </view>
  157. </view>
  158. </view>
  159. <!-- 评论输入弹窗 -->
  160. <view v-if="showInput" class="comment-popup">
  161. <view class="popup-mask" @click="hideCommentInput"></view>
  162. <view class="popup-content">
  163. <textarea
  164. v-model="commentText"
  165. placeholder="输入评论内容..."
  166. class="comment-textarea"
  167. :focus="showInput"
  168. maxlength="500"
  169. />
  170. <!-- 图片选择区域 -->
  171. <view class="image-section">
  172. <view class="image-list">
  173. <view v-for="(img, index) in commentImages" :key="index" class="image-item">
  174. <image :src="img" mode="aspectFill" class="preview-image"/>
  175. <text class="remove-image" @click="removeCommentImage(index)">×</text>
  176. </view>
  177. <view v-if="commentImages.length < 3" class="add-image" @click="chooseCommentImage">
  178. <text class="add-icon">📷</text>
  179. <text class="add-text">添加图片</text>
  180. </view>
  181. </view>
  182. </view>
  183. <view class="popup-footer">
  184. <text class="char-count">{{ commentText.length }}/500</text>
  185. <button class="submit-btn" @click="submitComment">发送</button>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </template>
  191. <script>
  192. import api from '@/utils/api.js'
  193. export default {
  194. data() {
  195. return {
  196. dynamicId: null,
  197. dynamic: null,
  198. commentList: [],
  199. showInput: false,
  200. showMenu: false, // 显示更多菜单
  201. commentText: '',
  202. commentImages: [],
  203. scrollIntoView: '',
  204. currentUserId: 1,
  205. defaultAvatar: '/static/default-avatar.png',
  206. isLiking: false, // 正在点赞中,防止重复点击
  207. isFavoriting: false // 正在收藏中,防止重复点击
  208. }
  209. },
  210. onLoad(options) {
  211. if (options.id) {
  212. this.dynamicId = options.id
  213. this.loadDynamicDetail()
  214. this.loadComments()
  215. }
  216. },
  217. methods: {
  218. // 兼容WXML:获取头像
  219. getAvatar(item) {
  220. if (item && item.user && item.user.avatarUrl) {
  221. return item.user.avatarUrl
  222. }
  223. return this.defaultAvatar
  224. },
  225. // 兼容WXML:获取昵称
  226. getNickname(item) {
  227. if (item && item.user && item.user.nickname) {
  228. return item.user.nickname
  229. }
  230. return '匿名用户'
  231. },
  232. // 评论头像
  233. getCommentAvatar(comment) {
  234. if (comment && comment.user && comment.user.avatarUrl) {
  235. return comment.user.avatarUrl
  236. }
  237. if (comment && comment.$orig && comment.$orig.user && comment.$orig.user.avatarUrl) {
  238. return comment.$orig.user.avatarUrl
  239. }
  240. return this.defaultAvatar
  241. },
  242. // 评论昵称
  243. getCommentNickname(comment) {
  244. if (comment && comment.user && comment.user.nickname) {
  245. return comment.user.nickname
  246. }
  247. if (comment && comment.$orig && comment.$orig.user && comment.$orig.user.nickname) {
  248. return comment.$orig.user.nickname
  249. }
  250. return '匿名用户'
  251. },
  252. // 获取评论图片列表(兼容字符串JSON、逗号分隔、数组等多种格式)
  253. getCommentImages(comment) {
  254. if (!comment) return []
  255. const pickFirstAvailable = (obj) => {
  256. if (!obj) return null
  257. return obj.imageUrls || obj.images || obj.image_list || obj.imageList || null
  258. }
  259. const raw = pickFirstAvailable(comment)
  260. if (!raw) return []
  261. const isLikelyImage = (u) => {
  262. if (typeof u !== 'string' || !u.trim()) return false
  263. const url = u.trim()
  264. const hasExt = /(\.png|\.jpg|\.jpeg|\.gif|\.webp|\.bmp)(\?|$)/i.test(url)
  265. const isHttp = /^https?:\/\//i.test(url)
  266. const isMinio = url.includes('dynamic-comments/')
  267. return hasExt || (isHttp && isMinio)
  268. }
  269. try {
  270. if (Array.isArray(raw)) {
  271. return raw.filter(isLikelyImage)
  272. }
  273. if (typeof raw === 'string') {
  274. const s = raw.trim()
  275. // JSON数组字符串: ["url1", "url2"]
  276. if (s.startsWith('[')) {
  277. const arr = JSON.parse(s)
  278. return Array.isArray(arr) ? arr.filter(isLikelyImage) : []
  279. }
  280. // 逗号分隔或带引号
  281. return s.split(',')
  282. .map(x => x.trim().replace(/^\[|\]$/g, '').replace(/^['\"]|['\"]$/g, ''))
  283. .filter(isLikelyImage)
  284. }
  285. } catch (e) {
  286. // ignore parse error
  287. }
  288. return []
  289. },
  290. // 预览评论图片
  291. previewCommentImage(urls, current) {
  292. uni.previewImage({
  293. urls: urls,
  294. current: current
  295. })
  296. },
  297. // 加载动态详情
  298. async loadDynamicDetail() {
  299. uni.showLoading({ title: '加载中...' })
  300. try {
  301. const res = await api.dynamic.getDetail(this.dynamicId, this.currentUserId)
  302. if (res) {
  303. this.dynamic = res
  304. }
  305. } catch (error) {
  306. console.error('加载详情失败:', error)
  307. uni.showToast({
  308. title: '加载失败',
  309. icon: 'none'
  310. })
  311. } finally {
  312. uni.hideLoading()
  313. }
  314. },
  315. // 处理点赞
  316. async handleLike() {
  317. if (!this.dynamic) return
  318. // 防止重复点击
  319. if (this.isLiking) return
  320. try {
  321. this.isLiking = true
  322. const isLiked = this.dynamic.isLiked
  323. const originalCount = this.dynamic.likeCount || 0
  324. // 立即更新UI(乐观更新)
  325. this.dynamic.isLiked = !isLiked
  326. this.dynamic.likeCount = isLiked ? Math.max(0, originalCount - 1) : originalCount + 1
  327. // 发送请求
  328. if (isLiked) {
  329. await api.dynamic.unlike(this.dynamic.dynamicId)
  330. } else {
  331. await api.dynamic.like(this.dynamic.dynamicId)
  332. }
  333. // 通知列表页同步状态
  334. uni.$emit('dynamic-updated', {
  335. dynamicId: this.dynamic.dynamicId,
  336. isLiked: this.dynamic.isLiked,
  337. likeCount: this.dynamic.likeCount
  338. })
  339. } catch (error) {
  340. console.error('点赞失败:', error)
  341. // 请求失败,恢复原状态
  342. this.dynamic.isLiked = !this.dynamic.isLiked
  343. this.dynamic.likeCount = this.dynamic.isLiked ? (this.dynamic.likeCount || 0) + 1 : Math.max(0, (this.dynamic.likeCount || 0) - 1)
  344. uni.showToast({
  345. title: '操作失败,请重试',
  346. icon: 'none'
  347. })
  348. } finally {
  349. // 延迟300毫秒后释放锁,防止快速点击
  350. setTimeout(() => {
  351. this.isLiking = false
  352. }, 300)
  353. }
  354. },
  355. // 处理收藏
  356. async handleFavorite() {
  357. if (!this.dynamic) return
  358. // 防止重复点击
  359. if (this.isFavoriting) return
  360. try {
  361. this.isFavoriting = true
  362. const isFavorited = this.dynamic.isFavorited
  363. const originalCount = this.dynamic.favoriteCount || 0
  364. // 立即更新UI(乐观更新)
  365. this.dynamic.isFavorited = !isFavorited
  366. this.dynamic.favoriteCount = isFavorited ? Math.max(0, originalCount - 1) : originalCount + 1
  367. if (isFavorited) {
  368. await api.dynamic.unfavorite(this.dynamic.dynamicId)
  369. } else {
  370. await api.dynamic.favorite(this.dynamic.dynamicId)
  371. uni.showToast({
  372. title: '收藏成功',
  373. icon: 'success'
  374. })
  375. }
  376. // 通知列表页同步状态
  377. uni.$emit('dynamic-updated', {
  378. dynamicId: this.dynamic.dynamicId,
  379. isFavorited: this.dynamic.isFavorited,
  380. favoriteCount: this.dynamic.favoriteCount
  381. })
  382. } catch (error) {
  383. console.error('收藏失败:', error)
  384. // 请求失败,恢复原状态
  385. this.dynamic.isFavorited = !this.dynamic.isFavorited
  386. this.dynamic.favoriteCount = this.dynamic.isFavorited ? (this.dynamic.favoriteCount || 0) + 1 : Math.max(0, (this.dynamic.favoriteCount || 0) - 1)
  387. uni.showToast({
  388. title: '操作失败,请重试',
  389. icon: 'none'
  390. })
  391. } finally {
  392. // 延迟300毫秒后释放锁,防止快速点击
  393. setTimeout(() => {
  394. this.isFavoriting = false
  395. }, 300)
  396. }
  397. },
  398. // 处理分享
  399. handleShare() {
  400. uni.showToast({
  401. title: '分享功能开发中',
  402. icon: 'none'
  403. })
  404. },
  405. // 显示评论输入
  406. showCommentInput() {
  407. this.showInput = true
  408. },
  409. // 隐藏评论输入
  410. hideCommentInput() {
  411. this.showInput = false
  412. this.commentText = ''
  413. this.commentImages = []
  414. },
  415. // 选择评论图片
  416. async chooseCommentImage() {
  417. uni.chooseImage({
  418. count: 3 - this.commentImages.length, // 最多3张
  419. sizeType: ['compressed'],
  420. success: async (res) => {
  421. const filePaths = res.tempFilePaths || []
  422. if (filePaths.length === 0) return
  423. // 立即显示预览
  424. this.commentImages.push(...filePaths)
  425. // 显示上传进度
  426. uni.showLoading({ title: `正在上传图片...` })
  427. try {
  428. // 逐个上传图片
  429. for (let i = 0; i < filePaths.length; i++) {
  430. const filePath = filePaths[i]
  431. try {
  432. const url = await api.dynamic.uploadSingle(filePath)
  433. // 替换本地路径为在线URL
  434. const localIndex = this.commentImages.indexOf(filePath)
  435. if (localIndex !== -1) {
  436. this.commentImages.splice(localIndex, 1, url)
  437. }
  438. } catch(error) {
  439. // 上传失败,移除这张图片
  440. const localIndex = this.commentImages.indexOf(filePath)
  441. if (localIndex !== -1) {
  442. this.commentImages.splice(localIndex, 1)
  443. }
  444. }
  445. }
  446. uni.hideLoading()
  447. } catch(e) {
  448. uni.hideLoading()
  449. uni.showToast({ title: '图片上传失败', icon: 'none' })
  450. }
  451. },
  452. fail: () => {
  453. uni.showToast({ title: '选择图片失败', icon: 'none' })
  454. }
  455. })
  456. },
  457. // 移除评论图片
  458. removeCommentImage(index) {
  459. this.commentImages.splice(index, 1)
  460. },
  461. // 加载评论
  462. async loadComments() {
  463. try {
  464. const res = await api.dynamic.getComments(this.dynamicId, 1, 20)
  465. this.commentList = res.records || []
  466. } catch (e) {
  467. console.error('加载评论失败', e)
  468. }
  469. },
  470. // 提交评论
  471. async submitComment() {
  472. if (!this.commentText.trim()) {
  473. uni.showToast({
  474. title: '请输入评论内容',
  475. icon: 'none'
  476. })
  477. return
  478. }
  479. try {
  480. // 构造图片URL字符串
  481. const imageUrls = this.commentImages.length > 0 ? this.commentImages.join(',') : ''
  482. await api.dynamic.addComment(this.dynamicId, this.commentText, imageUrls)
  483. this.commentText = ''
  484. this.commentImages = []
  485. this.hideCommentInput()
  486. this.loadComments()
  487. // 更新评论数量
  488. if (this.dynamic) {
  489. this.dynamic.commentCount = (this.dynamic.commentCount || 0) + 1
  490. }
  491. uni.showToast({ title: '已发布', icon: 'success' })
  492. } catch (e) {
  493. uni.showToast({ title: '发布失败', icon: 'none' })
  494. }
  495. },
  496. // 评论点赞/取消
  497. async toggleCommentLike(comment) {
  498. try {
  499. if (comment.isLiked) {
  500. await api.dynamic.unlikeComment(comment.commentId)
  501. comment.isLiked = false
  502. comment.likeCount = Math.max(0, (comment.likeCount || 0) - 1)
  503. } else {
  504. await api.dynamic.likeComment(comment.commentId)
  505. comment.isLiked = true
  506. comment.likeCount = (comment.likeCount || 0) + 1
  507. }
  508. } catch (e) {
  509. // ignore
  510. }
  511. },
  512. // 打开回复框(设置parentCommentId)
  513. openReply(comment) {
  514. this.showInput = true
  515. this.scrollIntoView = ''
  516. // 简化:当前接口不区分parent,作为后续扩展
  517. },
  518. // 显示更多菜单
  519. showMoreMenu() {
  520. this.showMenu = true
  521. },
  522. // 隐藏更多菜单
  523. hideMoreMenu() {
  524. this.showMenu = false
  525. },
  526. // 处理举报
  527. handleReport() {
  528. this.hideMoreMenu()
  529. if (!this.dynamicId) {
  530. uni.showToast({
  531. title: '动态ID不存在',
  532. icon: 'none'
  533. })
  534. return
  535. }
  536. // 跳转到举报页面
  537. uni.navigateTo({
  538. url: `/pages/plaza/report?id=${this.dynamicId}`
  539. })
  540. },
  541. // 预览图片
  542. previewImage(urls, current) {
  543. uni.previewImage({
  544. urls: urls,
  545. current: current
  546. })
  547. },
  548. // 格式化时间
  549. formatTime(timeStr) {
  550. if (!timeStr) return ''
  551. const time = new Date(timeStr)
  552. const now = new Date()
  553. const diff = now - time
  554. if (diff < 60000) return '刚刚'
  555. if (diff < 3600000) return Math.floor(diff / 60000) + '分钟前'
  556. if (diff < 86400000) return Math.floor(diff / 3600000) + '小时前'
  557. if (diff < 604800000) return Math.floor(diff / 86400000) + '天前'
  558. const year = time.getFullYear()
  559. const month = String(time.getMonth() + 1).padStart(2, '0')
  560. const day = String(time.getDate()).padStart(2, '0')
  561. const hour = String(time.getHours()).padStart(2, '0')
  562. const minute = String(time.getMinutes()).padStart(2, '0')
  563. if (year === now.getFullYear()) {
  564. return `${month}-${day} ${hour}:${minute}`
  565. }
  566. return `${year}-${month}-${day}`
  567. },
  568. // 返回
  569. goBack() {
  570. uni.navigateBack()
  571. }
  572. }
  573. }
  574. </script>
  575. <style lang="scss" scoped>
  576. .detail-page {
  577. min-height: 100vh;
  578. background: #FFF0F5; // 与广场、发布页统一淡粉
  579. // 自定义导航栏
  580. .custom-navbar {
  581. position: fixed;
  582. top: 0;
  583. left: 0;
  584. right: 0;
  585. height: 88rpx; // 更紧凑
  586. background: transparent; // 轻盈
  587. display: flex;
  588. align-items: center;
  589. padding: 0 30rpx;
  590. padding-top: 0;
  591. z-index: 1000;
  592. box-shadow: none;
  593. overflow: visible;
  594. position: relative;
  595. .navbar-background {
  596. position: absolute;
  597. top: 0;
  598. left: 0;
  599. right: 0;
  600. bottom: 0;
  601. .feather-small {
  602. position: absolute;
  603. font-size: 40rpx;
  604. opacity: 0.15;
  605. top: 50%;
  606. left: 50%;
  607. transform: translate(-50%, -50%) rotate(25deg);
  608. animation: float 4s ease-in-out infinite;
  609. }
  610. }
  611. .navbar-left,
  612. .navbar-right {
  613. width: 100rpx;
  614. z-index: 1;
  615. }
  616. .navbar-left {
  617. .back-icon {
  618. font-size: 40rpx;
  619. color: #E91E63;
  620. text-shadow: none;
  621. }
  622. }
  623. .navbar-title {
  624. flex: 1;
  625. text-align: center;
  626. z-index: 1;
  627. .main-title {
  628. display: block;
  629. font-size: 30rpx;
  630. font-weight: 700;
  631. color: #D81B60;
  632. text-shadow: none;
  633. margin-bottom: 2rpx;
  634. }
  635. .sub-title {
  636. display: block;
  637. font-size: 20rpx;
  638. color: #AD1457;
  639. letter-spacing: 1rpx;
  640. }
  641. }
  642. .navbar-right {
  643. display: flex;
  644. justify-content: flex-end;
  645. align-items: center;
  646. .more-icon {
  647. font-size: 48rpx;
  648. color: #E91E63;
  649. font-weight: bold;
  650. line-height: 1;
  651. transform: rotate(90deg);
  652. }
  653. }
  654. }
  655. // 内容滚动区域
  656. .content-scroll {
  657. margin-top: 88rpx;
  658. height: calc(100vh - 88rpx - 128rpx);
  659. padding-bottom: 16rpx;
  660. // 动态详情
  661. .dynamic-detail {
  662. background: #FFFFFF;
  663. padding: 24rpx;
  664. margin: 12rpx 12rpx 10rpx 12rpx;
  665. border-radius: 20rpx;
  666. box-shadow: 0 6rpx 18rpx rgba(233, 30, 99, 0.08);
  667. border: 2rpx solid rgba(255, 182, 193, 0.25);
  668. position: relative;
  669. overflow: hidden;
  670. .user-section {
  671. display: flex;
  672. align-items: center;
  673. margin-bottom: 30rpx;
  674. .avatar {
  675. width: 80rpx;
  676. height: 80rpx;
  677. border-radius: 50%;
  678. margin-right: 20rpx;
  679. }
  680. .user-info {
  681. flex: 1;
  682. .nickname {
  683. display: block;
  684. font-size: 30rpx;
  685. font-weight: bold;
  686. color: #333333;
  687. margin-bottom: 8rpx;
  688. }
  689. .time {
  690. font-size: 24rpx;
  691. color: #999999;
  692. }
  693. }
  694. }
  695. .content-section {
  696. margin-bottom: 30rpx;
  697. .content-text {
  698. font-size: 30rpx;
  699. line-height: 1.8;
  700. color: #333333;
  701. word-wrap: break-word;
  702. }
  703. }
  704. .media-section {
  705. margin-bottom: 16rpx;
  706. .image-grid {
  707. display: grid;
  708. grid-template-columns: repeat(3, 1fr);
  709. gap: 10rpx;
  710. .media-image {
  711. width: 100%;
  712. height: 200rpx;
  713. border-radius: 12rpx;
  714. }
  715. }
  716. }
  717. .stats-section {
  718. display: flex;
  719. padding-top: 30rpx;
  720. border-top: 1rpx solid #F0F0F0;
  721. .stat-item {
  722. flex: 1;
  723. text-align: center;
  724. font-size: 26rpx;
  725. color: #666666;
  726. }
  727. }
  728. }
  729. // 评论区域
  730. .comment-section {
  731. background: #FFFFFF;
  732. padding: 24rpx;
  733. margin: 0 12rpx 12rpx 12rpx;
  734. border-radius: 20rpx;
  735. box-shadow: 0 6rpx 18rpx rgba(233, 30, 99, 0.08);
  736. border: 2rpx solid rgba(255, 182, 193, 0.25);
  737. position: relative;
  738. .section-title {
  739. display: flex;
  740. align-items: center;
  741. margin-bottom: 16rpx;
  742. .title-text {
  743. font-size: 32rpx;
  744. font-weight: bold;
  745. color: #333333;
  746. margin-right: 10rpx;
  747. }
  748. .title-count {
  749. font-size: 24rpx;
  750. color: #999999;
  751. }
  752. }
  753. .comment-list {
  754. .comment-item {
  755. display: flex;
  756. margin-bottom: 18rpx;
  757. .comment-avatar {
  758. width: 60rpx;
  759. height: 60rpx;
  760. border-radius: 50%;
  761. margin-right: 20rpx;
  762. }
  763. .comment-content {
  764. flex: 1;
  765. .comment-nickname {
  766. display: block;
  767. font-size: 26rpx;
  768. color: #666666;
  769. margin-bottom: 6rpx;
  770. }
  771. .comment-text {
  772. display: block;
  773. font-size: 28rpx;
  774. line-height: 1.55;
  775. color: #333333;
  776. margin-bottom: 8rpx;
  777. }
  778. .comment-images {
  779. display: flex;
  780. flex-wrap: wrap;
  781. gap: 10rpx;
  782. margin: 12rpx 0;
  783. .comment-image {
  784. width: 150rpx;
  785. height: 150rpx;
  786. border-radius: 12rpx;
  787. overflow: hidden;
  788. }
  789. }
  790. .comment-footer {
  791. display: flex;
  792. justify-content: space-between;
  793. .comment-time,
  794. .comment-like {
  795. font-size: 22rpx;
  796. color: #999999;
  797. }
  798. }
  799. }
  800. }
  801. }
  802. .empty-comment {
  803. display: flex;
  804. flex-direction: column;
  805. align-items: center;
  806. padding: 100rpx 0;
  807. .empty-icon {
  808. font-size: 100rpx;
  809. margin-bottom: 20rpx;
  810. }
  811. .empty-text {
  812. font-size: 26rpx;
  813. color: #999999;
  814. }
  815. }
  816. }
  817. }
  818. // 更多菜单弹窗
  819. .menu-popup {
  820. position: fixed;
  821. top: 0;
  822. left: 0;
  823. right: 0;
  824. bottom: 0;
  825. z-index: 9998;
  826. .menu-mask {
  827. position: absolute;
  828. top: 0;
  829. left: 0;
  830. right: 0;
  831. bottom: 0;
  832. background-color: rgba(0, 0, 0, 0.5);
  833. }
  834. .menu-content {
  835. position: absolute;
  836. bottom: 0;
  837. left: 0;
  838. right: 0;
  839. background-color: #FFFFFF;
  840. border-radius: 30rpx 30rpx 0 0;
  841. padding: 20rpx 30rpx;
  842. padding-bottom: calc(20rpx + constant(safe-area-inset-bottom));
  843. padding-bottom: calc(20rpx + env(safe-area-inset-bottom));
  844. animation: slideUp 0.3s ease;
  845. .menu-item {
  846. height: 100rpx;
  847. display: flex;
  848. align-items: center;
  849. justify-content: center;
  850. border-radius: 12rpx;
  851. margin-bottom: 16rpx;
  852. transition: background-color 0.3s ease;
  853. &:not(.cancel) {
  854. background: #FFF5F7;
  855. &:active {
  856. background: #FFE8EC;
  857. }
  858. }
  859. &.cancel {
  860. background: #F5F5F5;
  861. margin-top: 8rpx;
  862. &:active {
  863. background: #EEEEEE;
  864. }
  865. }
  866. .menu-icon {
  867. font-size: 36rpx;
  868. margin-right: 12rpx;
  869. }
  870. .menu-text {
  871. font-size: 30rpx;
  872. color: #333333;
  873. font-weight: 500;
  874. }
  875. }
  876. }
  877. }
  878. // 底部操作栏
  879. .bottom-bar {
  880. position: fixed;
  881. bottom: 0;
  882. left: 0;
  883. right: 0;
  884. background-color: #FFFFFF;
  885. padding: 20rpx 30rpx;
  886. display: flex;
  887. align-items: center;
  888. box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);
  889. padding-bottom: constant(safe-area-inset-bottom);
  890. padding-bottom: env(safe-area-inset-bottom);
  891. .input-area {
  892. flex: 1;
  893. height: 70rpx;
  894. background-color: #F5F5F5;
  895. border-radius: 35rpx;
  896. padding: 0 30rpx;
  897. display: flex;
  898. align-items: center;
  899. margin-right: 20rpx;
  900. .input-placeholder {
  901. font-size: 26rpx;
  902. color: #999999;
  903. }
  904. }
  905. .action-buttons {
  906. display: flex;
  907. gap: 20rpx;
  908. .action-btn {
  909. display: flex;
  910. flex-direction: column;
  911. align-items: center;
  912. padding: 12rpx 16rpx;
  913. border-radius: 24rpx;
  914. background: rgba(255, 182, 193, 0.1);
  915. transition: all 0.3s ease;
  916. &:active {
  917. transform: scale(0.95);
  918. background: rgba(233, 30, 99, 0.2);
  919. }
  920. .action-icon {
  921. font-size: 48rpx;
  922. margin-bottom: 6rpx;
  923. &.active {
  924. animation: heartbeat 0.6s ease-in-out;
  925. }
  926. }
  927. .action-label {
  928. font-size: 22rpx;
  929. color: #8B5A96;
  930. font-weight: 500;
  931. }
  932. }
  933. }
  934. }
  935. // 评论输入弹窗
  936. .comment-popup {
  937. position: fixed;
  938. top: 0;
  939. left: 0;
  940. right: 0;
  941. bottom: 0;
  942. z-index: 9999;
  943. .popup-mask {
  944. position: absolute;
  945. top: 0;
  946. left: 0;
  947. right: 0;
  948. bottom: 0;
  949. background-color: rgba(0, 0, 0, 0.5);
  950. }
  951. .popup-content {
  952. position: absolute;
  953. bottom: 0;
  954. left: 0;
  955. right: 0;
  956. background-color: #FFFFFF;
  957. border-radius: 30rpx 30rpx 0 0;
  958. padding: 30rpx;
  959. padding-bottom: calc(30rpx + constant(safe-area-inset-bottom));
  960. padding-bottom: calc(30rpx + env(safe-area-inset-bottom));
  961. .comment-textarea {
  962. width: 100%;
  963. min-height: 200rpx;
  964. max-height: 400rpx;
  965. padding: 20rpx;
  966. background-color: #F5F5F5;
  967. border-radius: 12rpx;
  968. font-size: 28rpx;
  969. line-height: 1.6;
  970. margin-bottom: 20rpx;
  971. }
  972. .image-section {
  973. margin-bottom: 20rpx;
  974. .image-list {
  975. display: flex;
  976. flex-wrap: wrap;
  977. gap: 16rpx;
  978. }
  979. .image-item {
  980. position: relative;
  981. width: 120rpx;
  982. height: 120rpx;
  983. border-radius: 12rpx;
  984. overflow: hidden;
  985. .preview-image {
  986. width: 100%;
  987. height: 100%;
  988. }
  989. .remove-image {
  990. position: absolute;
  991. top: 8rpx;
  992. right: 8rpx;
  993. width: 32rpx;
  994. height: 32rpx;
  995. background: rgba(0,0,0,0.6);
  996. color: white;
  997. border-radius: 50%;
  998. display: flex;
  999. align-items: center;
  1000. justify-content: center;
  1001. font-size: 24rpx;
  1002. font-weight: bold;
  1003. }
  1004. }
  1005. .add-image {
  1006. width: 120rpx;
  1007. height: 120rpx;
  1008. background: #F5F5F5;
  1009. border: 2rpx dashed #CCCCCC;
  1010. border-radius: 12rpx;
  1011. display: flex;
  1012. flex-direction: column;
  1013. align-items: center;
  1014. justify-content: center;
  1015. .add-icon {
  1016. font-size: 32rpx;
  1017. margin-bottom: 8rpx;
  1018. }
  1019. .add-text {
  1020. font-size: 20rpx;
  1021. color: #999999;
  1022. }
  1023. }
  1024. }
  1025. .popup-footer {
  1026. display: flex;
  1027. justify-content: space-between;
  1028. align-items: center;
  1029. .char-count {
  1030. font-size: 24rpx;
  1031. color: #999999;
  1032. }
  1033. .submit-btn {
  1034. padding: 15rpx 50rpx;
  1035. background: linear-gradient(135deg, #E91E63 0%, #FF6B9D 100%);
  1036. color: #FFFFFF;
  1037. border: none;
  1038. border-radius: 50rpx;
  1039. font-size: 28rpx;
  1040. }
  1041. }
  1042. }
  1043. }
  1044. }
  1045. @keyframes pulse {
  1046. 0%, 100% {
  1047. transform: scale(1);
  1048. }
  1049. 50% {
  1050. transform: scale(1.2);
  1051. }
  1052. }
  1053. @keyframes slideUp {
  1054. from {
  1055. transform: translateY(100%);
  1056. }
  1057. to {
  1058. transform: translateY(0);
  1059. }
  1060. }
  1061. </style>