index.vue 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352
  1. <template>
  2. <div class="dynamic-management-container">
  3. <!-- 头部:Tabs和发布按钮 -->
  4. <div class="header-section">
  5. <el-tabs v-model="activeTab" @tab-click="handleTabClick">
  6. <el-tab-pane label="推荐" name="recommend" />
  7. <el-tab-pane label="关注" name="follow" />
  8. </el-tabs>
  9. <div class="action-buttons">
  10. <el-button type="primary" @click="handlePublish"> 发布动态 </el-button>
  11. </div>
  12. </div>
  13. <!-- 动态列表(推荐和关注共用) -->
  14. <div v-if="dynamicList.length > 0" class="content-section">
  15. <div class="dynamic-grid">
  16. <div v-for="item in paginatedList" :key="item.id" class="dynamic-card" @click="handleCardClick(item)">
  17. <!-- 图片/视频区域 -->
  18. <div class="dynamic-image-wrapper">
  19. <!-- 视频 -->
  20. <video v-if="item.isVideo && item.imageUrl" :src="item.imageUrl" class="dynamic-image" controls preload="metadata" />
  21. <!-- 图片 -->
  22. <img v-else-if="item.imageUrl" :src="item.imageUrl" :alt="item.title" class="dynamic-image" />
  23. <!-- 占位符 -->
  24. <div v-else class="image-placeholder">
  25. <el-icon :size="48" color="#999">
  26. <Picture />
  27. </el-icon>
  28. </div>
  29. </div>
  30. <!-- 动态内容 -->
  31. <div class="dynamic-content">
  32. <div class="dynamic-text">
  33. {{ item.title }}
  34. </div>
  35. <!-- 用户信息和点赞 -->
  36. <div class="dynamic-footer">
  37. <div class="user-info">
  38. <div class="user-avatar">
  39. <img v-if="item.userAvatar" :src="item.userAvatar" :alt="item.userName" />
  40. <el-icon v-else :size="24">
  41. <Avatar />
  42. </el-icon>
  43. </div>
  44. <span class="user-name">{{ item.userName }}</span>
  45. </div>
  46. <div class="like-section" @click.stop="handleLike(item)">
  47. <i class="iconfont icon-dianzanb" :style="{ fontSize: '18px', color: item.isLike == '1' ? '#f56c6c' : '#999' }" />
  48. <span class="like-count">{{ item.dianzanCount }}</span>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <!-- 空状态 -->
  56. <div v-else class="empty-section">
  57. <el-empty :description="activeTab === 'follow' ? '暂无关注的动态' : '暂无动态数据'" />
  58. </div>
  59. <!-- 分页 -->
  60. <div v-if="dynamicList.length > 0" class="pagination-section">
  61. <el-pagination
  62. v-model:current-page="pagination.page"
  63. v-model:page-size="pagination.pageSize"
  64. :page-sizes="[10, 20, 30, 50]"
  65. :total="pagination.total"
  66. layout="total, sizes, prev, pager, next, jumper"
  67. @size-change="handleSizeChange"
  68. @current-change="handleCurrentChange"
  69. />
  70. </div>
  71. <!-- 动态详情 Drawer -->
  72. <el-drawer
  73. v-model="detailDrawerVisible"
  74. direction="rtl"
  75. size="90%"
  76. :show-close="false"
  77. destroy-on-close
  78. class="detail-drawer"
  79. >
  80. <template #header>
  81. <div class="drawer-header">
  82. <el-button class="close-btn" text @click="handleCloseDetail">
  83. <el-icon :size="24">
  84. <Close />
  85. </el-icon>
  86. </el-button>
  87. </div>
  88. </template>
  89. <div v-if="currentDetail" class="detail-content">
  90. <!-- 主内容区域 -->
  91. <div class="detail-main">
  92. <!-- 图片/视频轮播展示 -->
  93. <div class="media-container">
  94. <!-- 多媒体轮播 -->
  95. <el-carousel
  96. v-if="currentDetail.mediaList && currentDetail.mediaList.length > 0"
  97. :autoplay="false"
  98. :loop="false"
  99. indicator-position="outside"
  100. arrow="always"
  101. height="100%"
  102. class="media-carousel"
  103. @change="handleCarouselChange"
  104. >
  105. <el-carousel-item v-for="(media, index) in currentDetail.mediaList" :key="index">
  106. <!-- 视频 -->
  107. <video
  108. v-if="media.type === 'video'"
  109. :ref="el => setVideoRef(el, index)"
  110. :src="media.url"
  111. class="detail-media detail-video"
  112. controls
  113. preload="metadata"
  114. @play="handleVideoPlay(index)"
  115. />
  116. <!-- 图片 -->
  117. <img v-else :src="media.url" :alt="currentDetail.title" class="detail-media detail-image" />
  118. </el-carousel-item>
  119. </el-carousel>
  120. <!-- 占位符 -->
  121. <div v-else class="media-placeholder">
  122. <el-icon :size="80" color="#dcdfe6">
  123. <Picture />
  124. </el-icon>
  125. </div>
  126. <!-- 媒体计数指示器 -->
  127. <div v-if="currentDetail.mediaList && currentDetail.mediaList.length > 1" class="media-counter">
  128. {{ currentCarouselIndex + 1 }} / {{ currentDetail.mediaList.length }}
  129. </div>
  130. </div>
  131. <!-- 底部信息 -->
  132. <div class="detail-info">
  133. <div class="author-info">
  134. <div class="author-avatar">
  135. <img
  136. v-if="currentDetail.author?.avatar || currentDetail.userAvatar"
  137. :src="currentDetail.author?.avatar || currentDetail.userAvatar"
  138. :alt="currentDetail.author?.name || currentDetail.userName"
  139. />
  140. <el-icon v-else :size="32">
  141. <Avatar />
  142. </el-icon>
  143. </div>
  144. <div class="author-details">
  145. <div class="author-name">@{{ currentDetail.author?.name || currentDetail.userName }}</div>
  146. <div class="publish-time">
  147. {{ currentDetail.createdTime }}
  148. </div>
  149. </div>
  150. </div>
  151. <div class="detail-description">
  152. <p :class="{ 'text-ellipsis': !isDescriptionExpanded }">
  153. {{ currentDetail.context }}
  154. </p>
  155. <span
  156. v-if="currentDetail.context && currentDetail.context.length > 100"
  157. class="expand-btn"
  158. @click="toggleDescription"
  159. >
  160. {{ isDescriptionExpanded ? "收起" : "展开" }}
  161. </span>
  162. </div>
  163. </div>
  164. </div>
  165. <!-- 右侧操作栏 -->
  166. <div class="action-bar">
  167. <!-- 作者头像 -->
  168. <div class="action-item author-action">
  169. <div class="action-avatar" @click="handleViewUserProfile">
  170. <img
  171. v-if="currentDetail.author?.avatar || currentDetail.userAvatar"
  172. :src="currentDetail.author?.avatar || currentDetail.userAvatar"
  173. :alt="currentDetail.author?.name || currentDetail.userName"
  174. />
  175. <el-icon v-else :size="40" color="#fff">
  176. <Avatar />
  177. </el-icon>
  178. <!-- 关注按钮 (定位在头像右下角) -->
  179. <div v-if="currentDetail.isFollowThis == 0 && !isMyDynamic" class="follow-badge" @click.stop="handleFollowInDetail">
  180. <el-icon :size="16" color="#fff">
  181. <Plus />
  182. </el-icon>
  183. </div>
  184. </div>
  185. </div>
  186. <!-- 点赞 -->
  187. <div class="action-item" @click="handleDetailLike">
  188. <div class="action-icon">
  189. <i
  190. class="iconfont icon-dianzanb"
  191. :style="{ fontSize: '28px', color: currentDetail.isLike == '1' ? '#f56c6c' : '#fff' }"
  192. />
  193. </div>
  194. <div class="action-count">
  195. {{ currentDetail.dianzanCount }}
  196. </div>
  197. </div>
  198. <!-- 评论 -->
  199. <div class="action-item" @click="handleShowComments">
  200. <div class="action-icon">
  201. <el-icon :size="28" color="#fff">
  202. <ChatDotRound />
  203. </el-icon>
  204. </div>
  205. <div class="action-count">
  206. {{ currentDetail.commentCount }}
  207. </div>
  208. </div>
  209. <!-- 分享 -->
  210. <div class="action-item" @click="handleShare">
  211. <div class="action-icon">
  212. <el-icon :size="28" color="#fff">
  213. <Share />
  214. </el-icon>
  215. </div>
  216. <div class="action-count">分享</div>
  217. </div>
  218. <!-- 更多 -->
  219. <el-popover placement="left" :width="120" trigger="click" popper-class="more-actions-popover">
  220. <template #reference>
  221. <div class="action-item">
  222. <div class="action-icon">
  223. <el-icon :size="28" color="#fff">
  224. <MoreFilled />
  225. </el-icon>
  226. </div>
  227. </div>
  228. </template>
  229. <div class="more-actions-menu">
  230. <!-- 如果是当前用户的动态,显示编辑和删除 -->
  231. <template v-if="isMyDynamic">
  232. <div class="menu-item" style="display: flex; align-items: center; cursor: pointer" @click="handleDeleteDynamic">
  233. <el-icon :size="18">
  234. <Delete /> </el-icon
  235. >&nbsp;&nbsp;
  236. <span>删除</span>
  237. </div>
  238. </template>
  239. <!-- 如果不是当前用户的动态,显示举报和拉黑 -->
  240. <template v-else>
  241. <div
  242. class="menu-item"
  243. style="display: flex; align-items: center; padding-bottom: 10px; cursor: pointer"
  244. @click="handleReportDynamic"
  245. >
  246. <el-icon :size="18">
  247. <Warning /> </el-icon
  248. >&nbsp;&nbsp;
  249. <span>举报</span>
  250. </div>
  251. <div class="menu-item" style="display: flex; align-items: center; cursor: pointer" @click="handleBlockUserClick">
  252. <el-icon :size="18">
  253. <CircleClose /> </el-icon
  254. >&nbsp;&nbsp;
  255. <span>拉黑</span>
  256. </div>
  257. </template>
  258. </div>
  259. </el-popover>
  260. </div>
  261. </div>
  262. </el-drawer>
  263. <!-- 评论侧边栏 -->
  264. <el-drawer v-model="commentDrawerVisible" title="评论" direction="rtl" size="400px" destroy-on-close>
  265. <!-- 评论列表 -->
  266. <div class="comment-list-container">
  267. <div v-if="commentListData.length > 0" class="comment-list">
  268. <div v-for="comment in commentListData" :key="comment.id" class="comment-item">
  269. <div class="comment-avatar">
  270. <img v-if="comment.userAvatar" :src="comment.userAvatar" :alt="comment.userName" />
  271. <el-icon v-else :size="32">
  272. <Avatar />
  273. </el-icon>
  274. </div>
  275. <div class="comment-content-wrapper">
  276. <div class="comment-header">
  277. <span class="comment-user-name">{{ comment.userName }}</span>
  278. </div>
  279. <div class="comment-text">
  280. {{ comment.commentContent }}
  281. </div>
  282. <div class="comment-actions">
  283. <span class="comment-action-item" @click="handleLikeComment(comment)">
  284. <i class="iconfont icon-dianzanb" :style="{ fontSize: '16px', color: comment.isLiked ? '#f56c6c' : '#999' }" />
  285. <span>{{ comment.likeCount || 0 }}</span>
  286. </span>
  287. <span class="comment-action-item" @click="handleReplyComment(comment)">
  288. <el-icon :size="16">
  289. <ChatDotRound />
  290. </el-icon>
  291. <span>回复</span>
  292. </span>
  293. </div>
  294. <!-- 商家回复 -->
  295. <div v-for="item in comment.storeComment" :key="item.id" class="store-comment-wrapper">
  296. <div class="store-comment-item">
  297. <div class="store-comment-avatar">
  298. <img v-if="item.userImage" :src="item.userImage" :alt="item.userName" />
  299. <el-icon v-else :size="24">
  300. <Avatar />
  301. </el-icon>
  302. </div>
  303. <div class="store-comment-content">
  304. <div class="store-comment-header">
  305. <span class="store-comment-user-name">{{ item.userName || "商家" }}</span>
  306. <span class="store-comment-time">{{ item.createdTime || item.createDate }}</span>
  307. </div>
  308. <div class="store-comment-text">
  309. {{ item.commentContent }}
  310. <span
  311. class="comment-action-item"
  312. @click="handleLikeComment(item)"
  313. style="display: flex; align-items: center"
  314. >
  315. <i
  316. class="iconfont icon-dianzanb"
  317. :style="{ fontSize: '16px', color: item.isLiked ? '#f56c6c' : '#999' }"
  318. />&nbsp;
  319. <span>{{ item.likeCount || 0 }}</span>
  320. </span>
  321. </div>
  322. </div>
  323. </div>
  324. </div>
  325. </div>
  326. </div>
  327. </div>
  328. <el-empty v-else description="暂无评论" />
  329. </div>
  330. <!-- 评论输入框 -->
  331. <div class="comment-input-wrapper">
  332. <!-- 回复提示 -->
  333. <div v-if="replyingComment" class="reply-hint">
  334. <span class="reply-text">回复 @{{ replyingComment.userName }}</span>
  335. <el-icon class="cancel-reply" @click="handleCancelReply">
  336. <Close />
  337. </el-icon>
  338. </div>
  339. <el-input
  340. v-model="commentInput"
  341. type="textarea"
  342. :rows="3"
  343. :placeholder="replyingComment ? '输入回复内容...' : '你要评论点什么呢~'"
  344. maxlength="500"
  345. show-word-limit
  346. />
  347. <el-button type="primary" :loading="commentSubmitting" @click="handleSubmitComment">
  348. {{ replyingComment ? "回复" : "发送" }}
  349. </el-button>
  350. </div>
  351. </el-drawer>
  352. <!-- 举报对话框 -->
  353. <el-dialog v-model="reportDialogVisible" title="举报理由" width="500px" destroy-on-close @close="handleCloseReportDialog">
  354. <div class="report-dialog-content">
  355. <div class="report-tip">请选择最符合的原因,以便于我们进行的处理</div>
  356. <!-- 举报原因选项 -->
  357. <div class="report-reasons">
  358. <el-radio-group v-model="reportForm.reason">
  359. <el-radio label="用户违规"> 用户违规 </el-radio>
  360. <el-radio label="色情低俗"> 色情低俗 </el-radio>
  361. <el-radio label="违法违规"> 违法违规 </el-radio>
  362. <el-radio label="侮辱谩骂、煽动对立"> 侮辱谩骂、煽动对立 </el-radio>
  363. <el-radio label="涉嫌诈骗"> 涉嫌诈骗 </el-radio>
  364. <el-radio label="人身攻击"> 人身攻击 </el-radio>
  365. <el-radio label="种族歧视"> 种族歧视 </el-radio>
  366. <el-radio label="政治敏感"> 政治敏感 </el-radio>
  367. <el-radio label="虚假、不实内容"> 虚假、不实内容 </el-radio>
  368. <el-radio label="违反公德秩序"> 违反公德秩序 </el-radio>
  369. <el-radio label="危害人身安全"> 危害人身安全 </el-radio>
  370. <el-radio label="网络暴力"> 网络暴力 </el-radio>
  371. <el-radio label="其他原因"> 其他原因 </el-radio>
  372. </el-radio-group>
  373. </div>
  374. <!-- 详细描述(仅"其他举报"时显示) -->
  375. <div v-if="reportForm.reason === '其他原因'" class="report-description">
  376. <el-input
  377. v-model="reportForm.description"
  378. type="textarea"
  379. :rows="4"
  380. placeholder="请您在此处填写具体原因,我们会在第一时间为您处理!(必填)"
  381. maxlength="300"
  382. show-word-limit
  383. />
  384. </div>
  385. <!-- 上传凭证 -->
  386. <div class="report-upload">
  387. <div class="upload-title">上传凭证</div>
  388. <el-upload
  389. v-model:file-list="reportForm.fileList"
  390. list-type="picture-card"
  391. :limit="9"
  392. :on-preview="handleReportPreview"
  393. :on-remove="handleReportRemove"
  394. :before-upload="beforeReportUpload"
  395. :http-request="handleReportUpload"
  396. accept="image/*"
  397. multiple
  398. >
  399. <el-icon :size="24">
  400. <Plus />
  401. </el-icon>
  402. </el-upload>
  403. </div>
  404. <!-- 同意协议 -->
  405. <div class="report-agreement">
  406. <el-checkbox v-model="reportForm.agreed"> 同时拉黑该用户 </el-checkbox>
  407. </div>
  408. </div>
  409. <template #footer>
  410. <div class="dialog-footer">
  411. <el-button @click="reportDialogVisible = false"> 取消 </el-button>
  412. <el-button type="primary" :loading="reportSubmitting" @click="handleSubmitReport"> 提交 </el-button>
  413. </div>
  414. </template>
  415. </el-dialog>
  416. <!-- 分享对话框 -->
  417. <el-dialog v-model="shareDialogVisible" title="分享给好友" width="500px" destroy-on-close @close="handleCloseShareDialog">
  418. <div class="share-dialog-content">
  419. <!-- 好友列表 -->
  420. <div class="share-friend-list">
  421. <div v-if="filteredShareFriendList.length > 0">
  422. <div
  423. v-for="friend in filteredShareFriendList"
  424. :key="friend.id"
  425. class="share-friend-item"
  426. @click="handleSelectFriend(friend)"
  427. >
  428. <div class="friend-info">
  429. <div class="friend-avatar">
  430. <img v-if="friend.avatar" :src="friend.avatar" :alt="friend.name" />
  431. <el-icon v-else :size="40">
  432. <Avatar />
  433. </el-icon>
  434. </div>
  435. <div class="friend-name">
  436. {{ friend.name }}
  437. </div>
  438. </div>
  439. <el-icon v-if="selectedFriends.includes(friend.id)" :size="20" color="#409eff">
  440. <CircleCheck />
  441. </el-icon>
  442. </div>
  443. </div>
  444. <el-empty v-else description="暂无好友" />
  445. </div>
  446. <!-- 已选择的好友 -->
  447. <div v-if="selectedFriends.length > 0" class="selected-friends">
  448. <div class="selected-title">已选择 {{ selectedFriends.length }} 位好友</div>
  449. <div class="selected-list">
  450. <el-tag v-for="friendId in selectedFriends" :key="friendId" closable @close="handleRemoveFriend(friendId)">
  451. {{ shareFriendList.find(f => f.id === friendId)?.name }}
  452. </el-tag>
  453. </div>
  454. </div>
  455. </div>
  456. <template #footer>
  457. <div class="dialog-footer">
  458. <el-button @click="shareDialogVisible = false"> 取消 </el-button>
  459. <el-button
  460. type="primary"
  461. :loading="shareSubmitting"
  462. :disabled="selectedFriends.length === 0"
  463. @click="handleConfirmShare"
  464. >
  465. 确认分享
  466. </el-button>
  467. </div>
  468. </template>
  469. </el-dialog>
  470. </div>
  471. </template>
  472. <script setup lang="ts" name="dynamicManagementIndex">
  473. import { ref, reactive, computed, onMounted, watch } from "vue";
  474. import { useRouter } from "vue-router";
  475. import { ElMessage, ElMessageBox } from "element-plus";
  476. import {
  477. Picture,
  478. Avatar,
  479. Close,
  480. ChatDotRound,
  481. Share,
  482. MoreFilled,
  483. Edit,
  484. Delete,
  485. Warning,
  486. CircleClose,
  487. Plus,
  488. Search,
  489. CircleCheck
  490. } from "@element-plus/icons-vue";
  491. import {
  492. toggleFollowUser,
  493. blockUser,
  494. uploadImg,
  495. saveComment,
  496. commentList,
  497. getMutualAttention,
  498. addTransferCount,
  499. deleteDynamicsById,
  500. getUserDynamics,
  501. likeDynamicNew,
  502. unlikeDynamicNew,
  503. getUserByPhone,
  504. reportUserViolation
  505. } from "@/api/modules/newLoginApi";
  506. // import { uploadImg } from "@/api/modules/upload";
  507. import { useUserStore } from "@/stores/modules/user";
  508. const router = useRouter();
  509. const userStore = useUserStore();
  510. // 举报原因到违规类型的映射
  511. const violationTypeMap: Record<string, number> = {
  512. 用户头像: 1,
  513. "名称/昵称": 2,
  514. 违法违规: 3,
  515. "低俗色情、暴力恐怖、政治谣言": 4,
  516. 涉嫌诈骗: 5,
  517. 人身攻击: 6,
  518. 侵犯版权: 7,
  519. 恶意骚扰: 8,
  520. "虚假/过度宣传": 9,
  521. 诱导点赞分享: 10,
  522. 传播人身安全: 11,
  523. 侵权举报: 12,
  524. 其他举报: 13
  525. };
  526. // 接口定义
  527. // 媒体项类型
  528. interface MediaItem {
  529. url: string;
  530. type: "image" | "video";
  531. }
  532. interface DynamicItem {
  533. isLike: any;
  534. dianzanCount: any;
  535. createdTime: any;
  536. context: string;
  537. id: number;
  538. title: string;
  539. content: string;
  540. imageUrl: string;
  541. userName: string;
  542. userAvatar: string;
  543. likeCount: number;
  544. isLiked: boolean;
  545. createTime: string;
  546. userId?: string | number; // 发布者ID
  547. phoneId?: string; // 发布者店铺ID
  548. storeUserId?: string | number; // 小店用户ID(用于举报)
  549. userType?: number; // 发布者用户类型:1商家,2用户
  550. phone?: string; // 发布者手机号
  551. isFollowed?: number; // 是否已关注:0未关注,1已关注
  552. isFollowThis?: number; // 是否已关注:0未关注,1已关注(用于判断关注按钮显示)
  553. isVideo?: boolean; // 是否为视频
  554. mediaType?: string; // 媒体类型:image 或 video
  555. mediaList?: MediaItem[]; // 媒体列表(支持多张图片和视频)
  556. }
  557. interface DetailItem extends DynamicItem {
  558. author?: {
  559. id: number;
  560. name: string;
  561. avatar: string;
  562. };
  563. context: string;
  564. commentCount: number;
  565. isFollowThis?: number; // 是否已关注:0未关注,1已关注(用于判断关注按钮显示)
  566. }
  567. // 响应式数据
  568. const activeTab = ref("recommend");
  569. const dynamicList = ref<DynamicItem[]>([]);
  570. const isfollowed = ref(0); // 0: 推荐, 1: 关注
  571. // 详情 Drawer 相关
  572. const detailDrawerVisible = ref(false);
  573. const currentDetail = ref<DetailItem | null>(null);
  574. // 描述展开/收起状态
  575. const isDescriptionExpanded = ref(false);
  576. // 轮播相关
  577. const currentCarouselIndex = ref(0);
  578. const videoRefs = ref<Map<number, HTMLVideoElement>>(new Map());
  579. // 设置视频引用
  580. const setVideoRef = (el: any, index: number) => {
  581. if (el) {
  582. videoRefs.value.set(index, el as HTMLVideoElement);
  583. }
  584. };
  585. // 轮播切换时暂停所有视频
  586. const handleCarouselChange = (newIndex: number) => {
  587. // 暂停所有视频
  588. videoRefs.value.forEach(video => {
  589. if (video && !video.paused) {
  590. video.pause();
  591. }
  592. });
  593. currentCarouselIndex.value = newIndex;
  594. };
  595. // 视频播放时暂停其他视频
  596. const handleVideoPlay = (currentIndex: number) => {
  597. videoRefs.value.forEach((video, index) => {
  598. if (index !== currentIndex && video && !video.paused) {
  599. video.pause();
  600. }
  601. });
  602. };
  603. // 举报对话框相关
  604. const reportDialogVisible = ref(false);
  605. const reportSubmitting = ref(false);
  606. const reportForm = reactive({
  607. reason: "用户头像", // 默认选择第一个选项
  608. description: "",
  609. fileList: [] as any[],
  610. agreed: false
  611. });
  612. // 分享对话框相关
  613. interface ShareFriend {
  614. id: number;
  615. name: string;
  616. avatar: string;
  617. phoneId?: string;
  618. }
  619. const shareDialogVisible = ref(false);
  620. const shareSubmitting = ref(false);
  621. const shareSearch = ref("");
  622. const shareFriendList = ref<ShareFriend[]>([]);
  623. const selectedFriends = ref<number[]>([]);
  624. // 过滤后的好友列表
  625. const filteredShareFriendList = computed(() => {
  626. if (!shareSearch.value) {
  627. return shareFriendList.value;
  628. }
  629. const keyword = shareSearch.value.toLowerCase();
  630. return shareFriendList.value.filter(friend => friend.name.toLowerCase().includes(keyword));
  631. });
  632. // 分页
  633. const pagination = reactive({
  634. page: 1,
  635. pageSize: 10,
  636. total: 0
  637. });
  638. // 直接使用动态列表(后端已完成分页)
  639. const paginatedList = computed(() => {
  640. return dynamicList.value;
  641. });
  642. // 判断当前详情是否是当前用户的动态
  643. const isMyDynamic = computed(() => {
  644. const currentUserStoreId = userStore.userInfo?.storeId;
  645. const dynamicStoreUserId = currentDetail.value?.storeUserId; // ✅ 添加可选链操作符
  646. // 通过 storeId 和 storeUserId 判断是否是当前用户的动态
  647. const result = currentUserStoreId == dynamicStoreUserId;
  648. console.log("是否是自己发布的作品:", result);
  649. return result;
  650. });
  651. // 标签切换
  652. const handleTabClick = (tab: any) => {
  653. // 根据切换的 tab 更新 isfollowed 的值
  654. // 使用传入的 tab.props.name 获取当前点击的 tab,而不是 activeTab.value
  655. const tabName = tab?.props?.name || tab?.paneName || activeTab.value;
  656. if (tabName === "recommend") {
  657. isfollowed.value = 0; // 推荐
  658. } else if (tabName === "follow") {
  659. isfollowed.value = 1; // 关注
  660. }
  661. pagination.page = 1;
  662. loadDynamicList();
  663. };
  664. // 发布动态
  665. const handlePublish = () => {
  666. // 校验是否已入驻店铺
  667. if (!userStore.userInfo?.storeId) {
  668. ElMessage.warning("请先入驻店铺");
  669. return;
  670. }
  671. router.push("/dynamicManagement/publishDynamic");
  672. };
  673. // 分页大小改变
  674. const handleSizeChange = (val: number) => {
  675. pagination.pageSize = val;
  676. pagination.page = 1;
  677. loadDynamicList();
  678. };
  679. // 当前页改变
  680. const handleCurrentChange = (val: number) => {
  681. pagination.page = val;
  682. loadDynamicList();
  683. };
  684. // 根据 phoneId 判断用户类型
  685. const getUserTypeFromPhoneId = (phoneId: string | undefined): number => {
  686. if (!phoneId) return 1; // 默认商家
  687. const prefix = phoneId.split("_")[0]; // 截取 "_" 之前的文字
  688. return prefix === "store" ? 1 : 2; // store = 商家(1), 其他 = 用户(2)
  689. };
  690. // 加载动态列表
  691. const loadDynamicList = async () => {
  692. try {
  693. // 获取店铺ID(从 userStore 中获取,如果没有则使用默认值)
  694. const phoneId = userStore.userInfo?.phoneId;
  695. const res = await getUserDynamics({
  696. type: 2, // 固定值,表示动态类型
  697. isfollowed: isfollowed.value, // 0 推荐, 1 关注(使用全局变量)
  698. myself: 0, // 0 表示他人的动态
  699. page: pagination.page,
  700. size: pagination.pageSize,
  701. phoneId: `store_${userStore.userInfo?.phone}`
  702. });
  703. // 处理返回的数据
  704. if (res.data) {
  705. // 根据实际返回的数据结构进行映射
  706. const responseData = res.data as any;
  707. const list = responseData.records;
  708. dynamicList.value = list.map((item: any) => {
  709. const phoneId = item.phoneId || item.storeId;
  710. const userType = getUserTypeFromPhoneId(phoneId); // 根据 phoneId 判断用户类型
  711. // 从 phoneId 中提取手机号("_" 之后的部分)
  712. let phone = item.phone || item.userPhone || item.mobile || "";
  713. if (!phone && phoneId && phoneId.includes("_")) {
  714. phone = phoneId.split("_")[1]; // 截取 "_" 之后的文字作为手机号
  715. }
  716. // 输出关注状态(仅第一条)
  717. if (item.id === list[0].id) {
  718. console.log("接口返回的isFollowThis:", item.isFollowThis, "(0=未关注, 1=已关注)");
  719. }
  720. // 解析媒体列表(支持多张图片和视频)
  721. const mediaUrl = item.imagePath || "";
  722. const mediaUrls = mediaUrl
  723. .split(",")
  724. .map((url: string) => url.trim())
  725. .filter((url: string) => url);
  726. const mediaList: MediaItem[] = mediaUrls.map((url: string) => ({
  727. url,
  728. type: url.toLowerCase().endsWith(".mp4") ? ("video" as const) : ("image" as const)
  729. }));
  730. const firstUrl = mediaUrls[0] || "";
  731. const isVideo = firstUrl.toLowerCase().endsWith(".mp4");
  732. const mediaType = isVideo ? "video" : "image";
  733. // 获取用户头像(优先使用 userImage 字段)
  734. const userAvatar = item.userImage || item.userAvatar || item.avatar || item.headImg || "";
  735. return {
  736. // 保留接口返回的所有原始字段
  737. ...item,
  738. // 额外添加的处理字段
  739. id: item.id || item.dynamicId,
  740. title: item.title || item.content || item.dynamicContent || "这家店超好吃....",
  741. content: item.content || item.dynamicContent || "",
  742. imageUrl: firstUrl, // 使用第一个URL(兼容旧逻辑)
  743. mediaList, // 完整媒体列表
  744. userName: item.userName || item.nickname || item.storeName || "用户",
  745. userAvatar: userAvatar,
  746. likeCount: item.likeCount || item.praiseCount || 0,
  747. isLiked: item.isLiked || item.isPraise || false,
  748. createTime: item.createTime || item.createDate || new Date().toISOString(),
  749. userId: item.userId || item.createUserId,
  750. phoneId: phoneId,
  751. storeUserId: item.storeUserId || item.userId || item.createUserId, // 小店用户ID
  752. userType: userType, // 用户类型:1商家,2用户
  753. phone: phone, // 手机号(从 phoneId 或其他字段获取)
  754. isFollowed: item.isFollowThis, // 使用isFollowThis字段:0未关注(显示按钮),1已关注(隐藏按钮)
  755. isFollowThis: item.isFollowThis, // 是否已关注:0未关注,1已关注(用于判断关注按钮显示)
  756. isVideo: isVideo, // 是否为视频
  757. mediaType: mediaType // 媒体类型
  758. };
  759. });
  760. pagination.total = responseData.total || responseData.totalCount || list.length;
  761. }
  762. } catch (error) {
  763. console.error("加载动态列表失败:", error);
  764. ElMessage.error("加载动态列表失败");
  765. // 失败时清空列表
  766. dynamicList.value = [];
  767. pagination.total = 0;
  768. }
  769. };
  770. // 点击卡片 - 查看详情(直接使用列表数据)
  771. const handleCardClick = async (item: DynamicItem) => {
  772. console.log("点击动态:", item);
  773. console.log("isFollowThis值:", item.isFollowThis, "(0=未关注显示按钮, 1=已关注隐藏按钮)");
  774. console.log("isMyDynamic:", isMyDynamic.value);
  775. // 重置描述展开状态
  776. isDescriptionExpanded.value = false;
  777. // 直接使用列表数据构建详情
  778. currentDetail.value = {
  779. ...item,
  780. author: {
  781. id: 0,
  782. name: item.userName,
  783. avatar: item.userAvatar
  784. },
  785. context: item.context,
  786. createdTime: item.createdTime,
  787. dianzanCount: item.dianzanCount,
  788. isLike: item.isLike,
  789. commentCount: 0,
  790. isFollowThis: item.isFollowThis // 使用item.isFollowThis而不是item.isFollowed
  791. };
  792. detailDrawerVisible.value = true;
  793. // 打开抽屉时加载评论列表
  794. await loadCommentList();
  795. };
  796. // 列表点赞/取消点赞
  797. const handleLike = async (item: DynamicItem) => {
  798. try {
  799. // 获取当前用户的手机号,并在前面拼接 "store_"
  800. const phone = userStore.userInfo?.phone || "";
  801. const currentUserPhoneId = phone.startsWith("store_") ? phone : `store_${phone}`;
  802. const params = {
  803. userId: currentUserPhoneId, // 当前用户phoneId
  804. huifuId: item.id, // 动态ID
  805. type: 2 // 2表示点赞
  806. };
  807. // 根据当前点赞状态调用不同的接口
  808. if (item.isLike == "1") {
  809. // 已点赞,调用取消点赞接口
  810. await unlikeDynamicNew(params);
  811. } else {
  812. // 未点赞,调用点赞接口
  813. await likeDynamicNew(params);
  814. }
  815. await loadDynamicList();
  816. // ElMessage.success(item.isLike != "1" ? "点赞成功" : "取消点赞");
  817. } catch (error) {
  818. console.error("列表点赞操作失败:", error);
  819. ElMessage.error("操作失败");
  820. }
  821. };
  822. // 关闭详情
  823. const handleCloseDetail = () => {
  824. detailDrawerVisible.value = false;
  825. // 暂停所有视频
  826. videoRefs.value.forEach(video => {
  827. if (video && !video.paused) {
  828. video.pause();
  829. }
  830. });
  831. setTimeout(() => {
  832. currentDetail.value = null;
  833. currentCarouselIndex.value = 0;
  834. videoRefs.value.clear();
  835. }, 300);
  836. };
  837. // 详情页点赞(表单方式提交)
  838. const handleDetailLike = async () => {
  839. if (!currentDetail.value) return;
  840. try {
  841. // 获取当前用户的手机号,并在前面拼接 "store_"
  842. const phone = userStore.userInfo?.phone || "";
  843. const currentUserPhoneId = phone.startsWith("store_") ? phone : `store_${phone}`;
  844. const params = {
  845. userId: currentUserPhoneId, // 当前用户phoneId
  846. huifuId: currentDetail.value.id, // 动态ID
  847. type: 2 // 2表示点赞
  848. };
  849. // 根据当前点赞状态调用不同的接口
  850. if (currentDetail.value.isLike == "1") {
  851. // 已点赞,调用取消点赞接口
  852. await unlikeDynamicNew(params);
  853. } else {
  854. // 未点赞,调用点赞接口
  855. await likeDynamicNew(params);
  856. }
  857. // 切换点赞状态
  858. currentDetail.value.isLike = !currentDetail.value.isLike;
  859. currentDetail.value.likeCount += currentDetail.value.isLike ? 1 : -1;
  860. // 同步更新列表中的数据
  861. const listItem = dynamicList.value.find(item => item.id === currentDetail.value?.id);
  862. if (listItem) {
  863. listItem.isLike = currentDetail.value.isLike;
  864. listItem.likeCount = currentDetail.value.likeCount;
  865. }
  866. } catch (error) {
  867. console.error("点赞操作失败:", error);
  868. ElMessage.error("操作失败");
  869. }
  870. };
  871. // 切换描述展开/收起
  872. const toggleDescription = () => {
  873. isDescriptionExpanded.value = !isDescriptionExpanded.value;
  874. };
  875. // 显示评论
  876. // 评论相关
  877. const commentDrawerVisible = ref(false);
  878. const commentListData = ref<any[]>([]);
  879. const commentInput = ref("");
  880. const commentSubmitting = ref(false);
  881. const currentCommentDynamicId = ref<number | string>("");
  882. const replyingComment = ref<any>(null); // 当前正在回复的评论
  883. const handleShowComments = () => {
  884. if (!currentDetail.value) return;
  885. commentDrawerVisible.value = true;
  886. currentCommentDynamicId.value = currentDetail.value.id;
  887. };
  888. // 加载评论列表
  889. const loadCommentList = async () => {
  890. if (!currentDetail.value) return;
  891. try {
  892. let params = {
  893. businessId: String(currentDetail.value.id),
  894. businessType: "2",
  895. replyStatus: 0,
  896. pageNum: 1,
  897. pageSize: 10,
  898. commentType: 0,
  899. days: "",
  900. phoneId: `store_${userStore.userInfo?.phone}`
  901. };
  902. const res: any = await commentList(params);
  903. if (res.code === 200) {
  904. commentListData.value = res.data.records || [];
  905. // 更新评论总数(包括回复数)
  906. if (currentDetail.value) {
  907. const baseCommentCount = res.data.total || 0;
  908. // 计算所有回复的总数
  909. const replyCount = commentListData.value.reduce((total, comment) => {
  910. return total + (comment.storeComment?.length || 0);
  911. }, 0);
  912. // 评论总数 = 评论数 + 回复数
  913. currentDetail.value.commentCount = baseCommentCount + replyCount;
  914. }
  915. console.log("评论列表:", commentListData.value);
  916. console.log("评论总数:", res.data.total);
  917. }
  918. } catch (error) {
  919. console.error("加载评论列表失败:", error);
  920. }
  921. };
  922. // 提交评论
  923. const handleSubmitComment = async () => {
  924. if (!commentInput.value.trim()) {
  925. ElMessage.warning("请输入评论内容");
  926. return;
  927. }
  928. if (!currentDetail.value) {
  929. ElMessage.error("动态信息不存在");
  930. return;
  931. }
  932. try {
  933. commentSubmitting.value = true;
  934. // 判断是回复评论还是评论动态
  935. const isReply = !!replyingComment.value;
  936. const params: any = {
  937. replyId: isReply ? replyingComment.value.id : "", // 回复评论时传评论ID,否则为空
  938. commentContent: commentInput.value,
  939. businessType: "2",
  940. businessId: String(currentDetail.value.id),
  941. storeId: userStore.userInfo?.storeId || userStore.userInfo?.createdId,
  942. commentStar: "",
  943. phoneId: `store_${userStore.userInfo?.phone}`
  944. };
  945. const res: any = await saveComment(params);
  946. if (res.code === 200) {
  947. ElMessage.success(isReply ? "回复成功" : "评论成功");
  948. commentInput.value = "";
  949. replyingComment.value = null; // 清空回复状态
  950. await loadCommentList();
  951. } else {
  952. ElMessage.error(res.message || (isReply ? "回复失败" : "评论失败"));
  953. }
  954. } catch (error) {
  955. console.error("提交评论失败:", error);
  956. ElMessage.error(replyingComment.value ? "回复失败" : "评论失败");
  957. } finally {
  958. commentSubmitting.value = false;
  959. }
  960. };
  961. // 点赞评论
  962. const handleLikeComment = async (comment: any) => {
  963. console.log(comment);
  964. try {
  965. // 获取当前用户的手机号,并在前面拼接 "store_"
  966. const phone = userStore.userInfo?.phone || "";
  967. const currentUserPhoneId = phone.startsWith("store_") ? phone : `store_${phone}`;
  968. const params = {
  969. userId: currentUserPhoneId, // 当前用户phoneId
  970. huifuId: comment.id, // 动态ID
  971. type: 1 // 2表示点赞
  972. };
  973. // 根据当前点赞状态调用不同的接口
  974. if (comment.isLiked) {
  975. // 已点赞,调用取消点赞接口
  976. await unlikeDynamicNew(params);
  977. } else {
  978. // 未点赞,调用点赞接口
  979. await likeDynamicNew(params);
  980. }
  981. // 切换点赞状态
  982. comment.isLiked = !comment.isLiked;
  983. comment.likeCount += comment.isLiked ? 1 : -1;
  984. } catch (error) {
  985. console.error("列表点赞操作失败:", error);
  986. ElMessage.error("操作失败");
  987. }
  988. };
  989. // 回复评论
  990. const handleReplyComment = (comment: any) => {
  991. replyingComment.value = comment;
  992. commentInput.value = ``;
  993. // 聚焦到输入框
  994. setTimeout(() => {
  995. const textarea = document.querySelector(".comment-input-wrapper textarea") as HTMLTextAreaElement;
  996. if (textarea) {
  997. textarea.focus();
  998. }
  999. }, 100);
  1000. };
  1001. // 取消回复
  1002. const handleCancelReply = () => {
  1003. replyingComment.value = null;
  1004. commentInput.value = "";
  1005. };
  1006. // 分享
  1007. const handleShare = async () => {
  1008. shareDialogVisible.value = true;
  1009. await loadShareFriendList();
  1010. };
  1011. // 加载好友列表
  1012. const loadShareFriendList = async () => {
  1013. try {
  1014. // 获取当前用户的手机号,并在前面拼接 "store_"
  1015. const phone = userStore.userInfo?.phone || "";
  1016. const fansId = phone.startsWith("store_") ? phone : `store_${phone}`;
  1017. const res: any = await getMutualAttention({
  1018. page: 1,
  1019. size: 1000,
  1020. fansId: fansId,
  1021. name: ""
  1022. });
  1023. if (res.code === 200) {
  1024. const dataList = res.data?.records || res.data?.list || res.data || [];
  1025. shareFriendList.value = dataList.map((item: any) => ({
  1026. id: item.id || item.userId,
  1027. name: item.userName || item.nickname || item.name || "用户",
  1028. avatar: item.userImage || item.avatar || item.headImg || "",
  1029. phoneId: item.phoneId || item.fansId || ""
  1030. }));
  1031. console.log("加载好友列表成功:", shareFriendList.value);
  1032. }
  1033. } catch (error) {
  1034. console.error("加载好友列表失败:", error);
  1035. ElMessage.error("加载好友列表失败");
  1036. shareFriendList.value = [];
  1037. }
  1038. };
  1039. // 搜索好友
  1040. const handleShareSearch = () => {
  1041. // 搜索由计算属性自动处理
  1042. };
  1043. // 选择好友
  1044. const handleSelectFriend = (friend: ShareFriend) => {
  1045. const index = selectedFriends.value.indexOf(friend.id);
  1046. if (index > -1) {
  1047. // 已选择,取消选择
  1048. selectedFriends.value.splice(index, 1);
  1049. } else {
  1050. // 未选择,添加选择
  1051. selectedFriends.value.push(friend.id);
  1052. }
  1053. };
  1054. // 移除已选择的好友
  1055. const handleRemoveFriend = (friendId: number) => {
  1056. const index = selectedFriends.value.indexOf(friendId);
  1057. if (index > -1) {
  1058. selectedFriends.value.splice(index, 1);
  1059. }
  1060. };
  1061. // 确认分享
  1062. const handleConfirmShare = async () => {
  1063. if (selectedFriends.value.length === 0) {
  1064. ElMessage.warning("请选择要分享的好友");
  1065. return;
  1066. }
  1067. if (!currentDetail.value) {
  1068. ElMessage.error("动态信息不存在");
  1069. return;
  1070. }
  1071. try {
  1072. shareSubmitting.value = true;
  1073. // 调用 addTransferCount 接口,传递动态 id
  1074. const res: any = await addTransferCount({
  1075. id: currentDetail.value.id
  1076. });
  1077. if (res.code === 200) {
  1078. ElMessage.success(`已分享给 ${selectedFriends.value.length} 位好友`);
  1079. shareDialogVisible.value = false;
  1080. // 可以在这里更新动态的分享数(如果需要的话)
  1081. console.log("分享成功,动态ID:", currentDetail.value.id);
  1082. } else {
  1083. ElMessage.error(res.message || "分享失败");
  1084. }
  1085. } catch (error) {
  1086. console.error("分享失败:", error);
  1087. ElMessage.error("分享失败");
  1088. } finally {
  1089. shareSubmitting.value = false;
  1090. }
  1091. };
  1092. // 关闭分享对话框
  1093. const handleCloseShareDialog = () => {
  1094. shareSearch.value = "";
  1095. selectedFriends.value = [];
  1096. shareFriendList.value = [];
  1097. };
  1098. // 查看用户主页
  1099. const handleViewUserProfile = () => {
  1100. if (!currentDetail.value) return;
  1101. // 跳转到他人动态主页,传递用户信息
  1102. router.push({
  1103. path: "/dynamicManagement/userDynamic",
  1104. query: {
  1105. userId: currentDetail.value.storeUserId || currentDetail.value.userId || "",
  1106. phoneId: currentDetail.value.phoneId || "",
  1107. userName: currentDetail.value.userName || "",
  1108. userAvatar: currentDetail.value.userAvatar || "",
  1109. phone: currentDetail.value.phone || ""
  1110. }
  1111. });
  1112. };
  1113. // 详情页关注(右侧操作栏)
  1114. const handleFollowInDetail = async () => {
  1115. if (!currentDetail.value) return;
  1116. try {
  1117. const phone = userStore.userInfo?.phone || "";
  1118. const currentUserPhoneId = phone.startsWith("store_") ? phone : `store_${phone}`;
  1119. await toggleFollowUser({
  1120. followedId: currentDetail.value.phoneId || "",
  1121. fansId: currentUserPhoneId,
  1122. fansType: 2
  1123. });
  1124. // 更新关注状态
  1125. if (currentDetail.value) {
  1126. currentDetail.value.isFollowed = 1;
  1127. currentDetail.value.isFollowThis = 1; // 同时更新isFollowThis字段
  1128. }
  1129. // 同步更新列表中的状态
  1130. const listItem = dynamicList.value.find(item => item.id === currentDetail.value?.id);
  1131. if (listItem) {
  1132. listItem.isFollowed = 1;
  1133. listItem.isFollowThis = 1; // 同时更新列表项的isFollowThis状态
  1134. }
  1135. ElMessage.success("关注成功");
  1136. } catch (error) {
  1137. console.error("关注操作失败:", error);
  1138. ElMessage.error("操作失败");
  1139. }
  1140. };
  1141. // 编辑动态
  1142. const handleEditDynamic = () => {
  1143. if (!currentDetail.value) return;
  1144. detailDrawerVisible.value = false;
  1145. router.push({
  1146. path: "/dynamicManagement/publishDynamic",
  1147. query: { id: currentDetail.value.id }
  1148. });
  1149. };
  1150. // 删除动态
  1151. const handleDeleteDynamic = async () => {
  1152. if (!currentDetail.value) return;
  1153. try {
  1154. await ElMessageBox.confirm("确定要删除这条动态吗?删除后将无法恢复。", "删除确认", {
  1155. confirmButtonText: "确定删除",
  1156. cancelButtonText: "取消",
  1157. type: "warning",
  1158. confirmButtonClass: "el-button--danger"
  1159. }).then(async () => {
  1160. if (!currentDetail.value) return;
  1161. const res: any = await deleteDynamicsById({ id: currentDetail.value.id });
  1162. if (res.code === 200) {
  1163. ElMessage.success("删除成功");
  1164. detailDrawerVisible.value = false;
  1165. const index = dynamicList.value.findIndex(item => item.id === currentDetail.value?.id);
  1166. if (index > -1) {
  1167. dynamicList.value.splice(index, 1);
  1168. }
  1169. }
  1170. });
  1171. } catch {
  1172. // 用户取消删除
  1173. }
  1174. };
  1175. // 举报动态
  1176. const handleReportDynamic = () => {
  1177. reportDialogVisible.value = true;
  1178. };
  1179. // 举报图片预览
  1180. const handleReportPreview = (uploadFile: any) => {
  1181. console.log("预览图片", uploadFile);
  1182. };
  1183. // 移除举报图片
  1184. const handleReportRemove = (uploadFile: any, uploadFiles: any[]) => {
  1185. // 已由 v-model:file-list 自动处理
  1186. };
  1187. // 举报图片上传前验证
  1188. const beforeReportUpload = (file: File) => {
  1189. const isImage = file.type.startsWith("image/");
  1190. const isLt5M = file.size / 1024 / 1024 < 5;
  1191. if (!isImage) {
  1192. ElMessage.error("只能上传图片文件!");
  1193. return false;
  1194. }
  1195. if (!isLt5M) {
  1196. ElMessage.error("图片大小不能超过 5MB!");
  1197. return false;
  1198. }
  1199. return true;
  1200. };
  1201. // 自定义举报图片上传
  1202. const handleReportUpload = async (options: any) => {
  1203. const { file, onSuccess, onError } = options;
  1204. try {
  1205. const uploadFormData = new FormData();
  1206. uploadFormData.append("file", file);
  1207. const response: any = await uploadImg(uploadFormData);
  1208. // 处理返回格式:{ code, success, data: string[], msg }
  1209. if (response && response.code === 200 && response.data && Array.isArray(response.data) && response.data.length > 0) {
  1210. // 上传成功,返回图片URL(取数组第一个元素)
  1211. onSuccess({
  1212. url: response.data[0]
  1213. });
  1214. } else {
  1215. ElMessage.error(response?.msg || "图片上传失败");
  1216. onError(new Error(response?.msg || "图片上传失败"));
  1217. }
  1218. } catch (error) {
  1219. console.error("图片上传失败:", error);
  1220. ElMessage.error("图片上传失败");
  1221. onError(error);
  1222. }
  1223. };
  1224. // 提交举报
  1225. const handleSubmitReport = async () => {
  1226. // 验证表单
  1227. if (!reportForm.reason) {
  1228. ElMessage.warning("请选择举报原因");
  1229. return;
  1230. }
  1231. // 只有选择"其他举报"时才验证详细描述
  1232. if (reportForm.reason === "其他举报" && !reportForm.description.trim()) {
  1233. ElMessage.warning("请填写详细描述");
  1234. return;
  1235. }
  1236. if (!currentDetail.value) {
  1237. ElMessage.warning("动态信息异常");
  1238. return;
  1239. }
  1240. reportSubmitting.value = true;
  1241. try {
  1242. // 获取违规类型编号
  1243. const violationType = violationTypeMap[reportForm.reason];
  1244. // 获取举报凭证图片(如果有多张,用逗号分隔)
  1245. const reportEvidenceImg = reportForm.fileList
  1246. .map((f: any) => f.url || f.response?.url)
  1247. .filter(Boolean)
  1248. .join(",");
  1249. // 获取当前用户信息
  1250. const currentUserId = userStore.userInfo?.id || userStore.userInfo?.userId || "";
  1251. const currentUserType = userStore.userInfo?.userType || userStore.userInfo?.type || 1; // 用户类型:1商家,2用户,默认1
  1252. // 获取被举报用户类型(从 phoneId 解析)
  1253. const reportedUserType = currentDetail.value.userType || 1;
  1254. // 根据手机号获取被举报人ID
  1255. let reportedUserId = currentDetail.value.storeUserId || currentDetail.value.userId || "";
  1256. if (currentDetail.value.phone) {
  1257. try {
  1258. const userRes = await getUserByPhone({ phone: currentDetail.value.phone });
  1259. const userData = userRes.data as any;
  1260. if (userData && userData.id) {
  1261. reportedUserId = userData.id;
  1262. console.log("通过手机号获取到被举报人ID:", reportedUserId);
  1263. }
  1264. } catch (error) {
  1265. console.error("获取被举报人ID失败:", error);
  1266. // 如果获取失败,使用原有的 storeUserId
  1267. }
  1268. }
  1269. console.log("当前用户类型:", userStore.userInfo);
  1270. console.log("被举报用户类型:", reportedUserType);
  1271. console.log("被举报人ID:", reportedUserId);
  1272. console.log("动态详情:", currentDetail.value);
  1273. // 调用举报接口
  1274. await reportUserViolation({
  1275. dynamicsId: currentDetail.value.id, // 动态ID
  1276. reportContextType: "2", // 举报上下文类型:2表示动态
  1277. violationType: violationType, // 违规类型
  1278. otherReasonContent: reportForm.reason === "其他举报" ? reportForm.description : "", // 只有选择"其他举报"时才传详细描述
  1279. reportEvidenceImg: reportEvidenceImg, // 举报凭证图片
  1280. reportedUserId: reportedUserId, // 被举报用户ID(通过手机号获取)
  1281. reportedUserType: reportedUserType, // 被举报用户类型(从 phoneId 解析)
  1282. reportingUserId: currentUserId, // 举报人ID
  1283. reportingUserType: currentUserType // 举报人类型(当前登录用户类型)
  1284. });
  1285. // 如果同时拉黑该用户
  1286. if (reportForm.agreed) {
  1287. try {
  1288. // 调用拉黑接口(跳过确认对话框)
  1289. await handleBlockUser(true);
  1290. ElMessage.success("举报提交成功,已拉黑该用户");
  1291. } catch (blockError) {
  1292. console.error("拉黑失败:", blockError);
  1293. ElMessage.warning("举报提交成功,但拉黑失败");
  1294. }
  1295. } else {
  1296. ElMessage.success("举报提交成功,我们会尽快处理");
  1297. }
  1298. reportDialogVisible.value = false;
  1299. } catch (error) {
  1300. console.error("举报提交失败:", error);
  1301. ElMessage.error("举报提交失败");
  1302. } finally {
  1303. reportSubmitting.value = false;
  1304. }
  1305. };
  1306. // 关闭举报对话框
  1307. const handleCloseReportDialog = () => {
  1308. reportForm.reason = "用户头像"; // 重置为默认选项
  1309. reportForm.description = "";
  1310. reportForm.fileList = [];
  1311. reportForm.agreed = false;
  1312. };
  1313. // 监听举报原因变化,如果不是"其他举报"则清空详细描述
  1314. watch(
  1315. () => reportForm.reason,
  1316. newReason => {
  1317. if (newReason !== "其他举报") {
  1318. reportForm.description = "";
  1319. }
  1320. }
  1321. );
  1322. // 拉黑用户(点击菜单项)
  1323. const handleBlockUserClick = () => {
  1324. handleBlockUser(false);
  1325. };
  1326. // 拉黑用户
  1327. const handleBlockUser = async (skipConfirm: boolean = false) => {
  1328. if (!currentDetail.value) return;
  1329. try {
  1330. // 如果不跳过确认,显示确认对话框
  1331. if (!skipConfirm) {
  1332. await ElMessageBox.confirm("拉黑后将不再看到该用户的动态,确定要拉黑吗?", "拉黑确认", {
  1333. confirmButtonText: "确定拉黑",
  1334. cancelButtonText: "取消",
  1335. type: "warning"
  1336. });
  1337. }
  1338. // 获取当前用户信息
  1339. const currentUserId = userStore.userInfo?.id || userStore.userInfo?.userId || "";
  1340. const currentUserType = userStore.userInfo?.userType || userStore.userInfo?.type || 1; // 用户类型:1商家,2用户,默认1
  1341. // 获取被拉黑用户类型(从 phoneId 解析)
  1342. const blockedUserType = currentDetail.value.userType || 1;
  1343. console.log("当前用户信息:", userStore.userInfo);
  1344. console.log("当前用户类型:", currentUserType);
  1345. console.log("被拉黑用户类型:", blockedUserType);
  1346. console.log("动态详情:", currentDetail.value);
  1347. // 调用拉黑接口
  1348. await blockUser({
  1349. blockerType: currentUserType, // 拉黑者类型(当前登录用户类型)
  1350. blockedType: blockedUserType, // 被拉黑者类型(从 phoneId 解析)
  1351. blockerId: currentUserId, // 拉黑者ID(当前登录用户)
  1352. blockedId: currentDetail.value.storeUserId || currentDetail.value.userId || "" // 被拉黑者ID
  1353. });
  1354. if (!skipConfirm) {
  1355. ElMessage.success("已拉黑该用户");
  1356. }
  1357. detailDrawerVisible.value = false;
  1358. // 从列表中移除该用户的动态
  1359. const index = dynamicList.value.findIndex(item => item.id === currentDetail.value?.id);
  1360. if (index > -1) {
  1361. dynamicList.value.splice(index, 1);
  1362. pagination.total--;
  1363. }
  1364. } catch (error) {
  1365. if (!skipConfirm) {
  1366. // 单独拉黑时,用户取消操作或接口失败
  1367. console.error("拉黑失败:", error);
  1368. if (error !== "cancel") {
  1369. ElMessage.error("拉黑失败");
  1370. }
  1371. } else {
  1372. // 举报后自动拉黑失败,抛出错误
  1373. throw error;
  1374. }
  1375. }
  1376. };
  1377. // 初始化
  1378. onMounted(() => {
  1379. loadDynamicList();
  1380. });
  1381. </script>
  1382. <style scoped lang="scss">
  1383. @import "@/assets/dianzanFont/iconfont.css";
  1384. .dynamic-management-container {
  1385. min-height: calc(100vh - 120px);
  1386. padding: 20px;
  1387. background: #ffffff;
  1388. // 头部区域
  1389. .header-section {
  1390. display: flex;
  1391. align-items: center;
  1392. justify-content: space-between;
  1393. margin-bottom: 20px;
  1394. border-bottom: 1px solid #e4e7ed;
  1395. :deep(.el-tabs) {
  1396. flex: 1;
  1397. margin-bottom: -1px;
  1398. .el-tabs__header {
  1399. margin-bottom: 0;
  1400. }
  1401. .el-tabs__nav-wrap::after {
  1402. display: none;
  1403. }
  1404. }
  1405. .action-buttons {
  1406. padding-bottom: 10px;
  1407. margin-left: 20px;
  1408. }
  1409. }
  1410. // 内容区域
  1411. .content-section {
  1412. margin-top: 20px;
  1413. }
  1414. // 动态网格布局
  1415. .dynamic-grid {
  1416. display: grid;
  1417. grid-template-columns: repeat(3, 1fr);
  1418. gap: 20px;
  1419. margin-bottom: 20px;
  1420. @media (width <= 1400px) {
  1421. grid-template-columns: repeat(2, 1fr);
  1422. }
  1423. @media (width <= 768px) {
  1424. grid-template-columns: repeat(1, 1fr);
  1425. }
  1426. }
  1427. // 动态卡片
  1428. .dynamic-card {
  1429. overflow: hidden;
  1430. cursor: pointer;
  1431. background: #ffffff;
  1432. border: 1px solid #e4e7ed;
  1433. border-radius: 8px;
  1434. transition: all 0.3s;
  1435. &:hover {
  1436. box-shadow: 0 2px 12px rgb(0 0 0 / 10%);
  1437. transform: translateY(-2px);
  1438. }
  1439. // 图片区域
  1440. .dynamic-image-wrapper {
  1441. display: flex;
  1442. align-items: center;
  1443. justify-content: center;
  1444. width: 100%;
  1445. height: 220px;
  1446. overflow: hidden;
  1447. background: #f5f7fa;
  1448. .dynamic-image {
  1449. width: 100%;
  1450. height: 100%;
  1451. object-fit: cover;
  1452. }
  1453. .image-placeholder {
  1454. display: flex;
  1455. align-items: center;
  1456. justify-content: center;
  1457. width: 100%;
  1458. height: 100%;
  1459. background: #f5f7fa;
  1460. }
  1461. }
  1462. // 动态内容
  1463. .dynamic-content {
  1464. padding: 12px 16px;
  1465. .dynamic-text {
  1466. margin-bottom: 12px;
  1467. overflow: hidden;
  1468. font-size: 14px;
  1469. color: #333333;
  1470. text-overflow: ellipsis;
  1471. white-space: nowrap;
  1472. }
  1473. // 底部信息
  1474. .dynamic-footer {
  1475. display: flex;
  1476. align-items: center;
  1477. justify-content: space-between;
  1478. .user-info {
  1479. display: flex;
  1480. gap: 8px;
  1481. align-items: center;
  1482. .user-avatar {
  1483. display: flex;
  1484. align-items: center;
  1485. justify-content: center;
  1486. width: 24px;
  1487. height: 24px;
  1488. overflow: hidden;
  1489. background: #e4e7ed;
  1490. border-radius: 50%;
  1491. img {
  1492. width: 100%;
  1493. height: 100%;
  1494. object-fit: cover;
  1495. }
  1496. }
  1497. .user-name {
  1498. font-size: 13px;
  1499. color: #666666;
  1500. }
  1501. }
  1502. .like-section {
  1503. display: flex;
  1504. gap: 4px;
  1505. align-items: center;
  1506. .like-icon {
  1507. cursor: pointer;
  1508. transition: color 0.3s;
  1509. &:hover {
  1510. color: #f56c6c;
  1511. }
  1512. }
  1513. .like-count {
  1514. font-size: 13px;
  1515. color: #666666;
  1516. }
  1517. }
  1518. }
  1519. }
  1520. }
  1521. // 空状态
  1522. .empty-section {
  1523. padding: 80px 0;
  1524. text-align: center;
  1525. }
  1526. // 分页
  1527. .pagination-section {
  1528. display: flex;
  1529. justify-content: center;
  1530. padding: 20px 0;
  1531. margin-top: 30px;
  1532. }
  1533. // 详情 Drawer
  1534. :deep(.detail-drawer) {
  1535. .el-drawer__header {
  1536. position: absolute;
  1537. top: 0;
  1538. right: 0;
  1539. left: 0;
  1540. z-index: 10;
  1541. padding: 0;
  1542. margin: 0;
  1543. background: transparent;
  1544. }
  1545. .el-drawer__body {
  1546. padding: 0;
  1547. background: #000000;
  1548. }
  1549. .drawer-header {
  1550. padding: 20px;
  1551. .close-btn {
  1552. padding: 8px;
  1553. font-size: 24px;
  1554. color: #ffffff;
  1555. background: #ffffff;
  1556. }
  1557. }
  1558. .detail-content {
  1559. position: relative;
  1560. display: flex;
  1561. width: 100%;
  1562. height: 100%;
  1563. // 主内容区域
  1564. .detail-main {
  1565. display: flex;
  1566. flex: 1;
  1567. flex-direction: column;
  1568. align-items: center;
  1569. justify-content: center;
  1570. padding: 80px 120px 40px 40px;
  1571. .media-container {
  1572. position: relative;
  1573. display: flex;
  1574. flex: 1;
  1575. align-items: center;
  1576. justify-content: center;
  1577. width: 100%;
  1578. max-width: 800px;
  1579. min-height: 400px;
  1580. .media-carousel {
  1581. width: 100%;
  1582. height: 100%;
  1583. min-height: 400px;
  1584. max-height: 70vh;
  1585. :deep(.el-carousel__container) {
  1586. height: 100% !important;
  1587. min-height: 400px;
  1588. }
  1589. :deep(.el-carousel__item) {
  1590. display: flex;
  1591. align-items: center;
  1592. justify-content: center;
  1593. background: transparent;
  1594. }
  1595. :deep(.el-carousel__arrow) {
  1596. width: 48px;
  1597. height: 48px;
  1598. font-size: 24px;
  1599. color: #ffffff;
  1600. background-color: rgb(0 0 0 / 40%);
  1601. border: none;
  1602. &:hover {
  1603. background-color: rgb(0 0 0 / 60%);
  1604. }
  1605. }
  1606. :deep(.el-carousel__indicators) {
  1607. bottom: -30px;
  1608. .el-carousel__indicator {
  1609. .el-carousel__button {
  1610. width: 8px;
  1611. height: 8px;
  1612. background-color: rgb(255 255 255 / 40%);
  1613. border-radius: 50%;
  1614. }
  1615. &.is-active .el-carousel__button {
  1616. background-color: #409eff;
  1617. }
  1618. }
  1619. }
  1620. }
  1621. .detail-media {
  1622. max-width: 100%;
  1623. max-height: 65vh;
  1624. object-fit: contain;
  1625. border-radius: 8px;
  1626. }
  1627. .detail-image {
  1628. max-width: 100%;
  1629. max-height: 65vh;
  1630. object-fit: contain;
  1631. border-radius: 8px;
  1632. }
  1633. .detail-video {
  1634. width: 100%;
  1635. max-height: 65vh;
  1636. background: #000000;
  1637. border-radius: 8px;
  1638. }
  1639. .media-placeholder {
  1640. display: flex;
  1641. align-items: center;
  1642. justify-content: center;
  1643. width: 400px;
  1644. height: 400px;
  1645. background: rgb(255 255 255 / 5%);
  1646. border-radius: 8px;
  1647. }
  1648. .media-counter {
  1649. position: absolute;
  1650. right: 16px;
  1651. bottom: -24px;
  1652. padding: 4px 12px;
  1653. font-size: 14px;
  1654. color: #ffffff;
  1655. background: rgb(0 0 0 / 50%);
  1656. border-radius: 12px;
  1657. }
  1658. }
  1659. .detail-info {
  1660. width: 100%;
  1661. max-width: 800px;
  1662. padding: 20px 0;
  1663. .author-info {
  1664. display: flex;
  1665. gap: 12px;
  1666. align-items: center;
  1667. margin-bottom: 16px;
  1668. .author-avatar {
  1669. display: flex;
  1670. align-items: center;
  1671. justify-content: center;
  1672. width: 40px;
  1673. height: 40px;
  1674. overflow: hidden;
  1675. background: rgb(255 255 255 / 10%);
  1676. border-radius: 50%;
  1677. img {
  1678. width: 100%;
  1679. height: 100%;
  1680. object-fit: cover;
  1681. }
  1682. }
  1683. .author-details {
  1684. flex: 1;
  1685. .author-name {
  1686. margin-bottom: 4px;
  1687. font-size: 16px;
  1688. font-weight: 500;
  1689. color: #ffffff;
  1690. }
  1691. .publish-time {
  1692. font-size: 13px;
  1693. color: rgb(255 255 255 / 60%);
  1694. }
  1695. }
  1696. }
  1697. .detail-description {
  1698. position: relative;
  1699. font-size: 15px;
  1700. line-height: 1.6;
  1701. color: #ffffff;
  1702. p {
  1703. margin: 0;
  1704. word-break: break-word;
  1705. &.text-ellipsis {
  1706. display: -webkit-box;
  1707. overflow: hidden;
  1708. text-overflow: ellipsis;
  1709. -webkit-line-clamp: 2;
  1710. line-clamp: 2;
  1711. -webkit-box-orient: vertical;
  1712. }
  1713. }
  1714. .expand-btn {
  1715. display: inline-block;
  1716. margin-top: 8px;
  1717. font-size: 14px;
  1718. color: #409eff;
  1719. cursor: pointer;
  1720. user-select: none;
  1721. &:hover {
  1722. color: #66b1ff;
  1723. }
  1724. }
  1725. }
  1726. }
  1727. }
  1728. // 右侧操作栏
  1729. .action-bar {
  1730. position: fixed;
  1731. right: 40px;
  1732. bottom: 100px;
  1733. z-index: 10;
  1734. display: flex;
  1735. flex-direction: column;
  1736. gap: 24px;
  1737. .action-item {
  1738. display: flex;
  1739. flex-direction: column;
  1740. gap: 6px;
  1741. align-items: center;
  1742. cursor: pointer;
  1743. transition: transform 0.3s;
  1744. &:hover {
  1745. transform: scale(1.1);
  1746. }
  1747. &.author-action {
  1748. cursor: pointer;
  1749. &:hover {
  1750. transform: scale(1.1);
  1751. }
  1752. }
  1753. .action-avatar {
  1754. position: relative;
  1755. display: flex;
  1756. align-items: center;
  1757. justify-content: center;
  1758. width: 48px;
  1759. height: 48px;
  1760. overflow: visible;
  1761. cursor: pointer;
  1762. background: rgb(255 255 255 / 20%);
  1763. border: 2px solid #ffffff;
  1764. border-radius: 50%;
  1765. img {
  1766. width: 100%;
  1767. height: 100%;
  1768. object-fit: cover;
  1769. border-radius: 50%;
  1770. }
  1771. .follow-badge {
  1772. position: absolute;
  1773. right: -4px;
  1774. bottom: -4px;
  1775. z-index: 2;
  1776. display: flex;
  1777. align-items: center;
  1778. justify-content: center;
  1779. width: 24px;
  1780. height: 24px;
  1781. cursor: pointer;
  1782. background: #409eff;
  1783. border: 2px solid #ffffff;
  1784. border-radius: 50%;
  1785. transition: transform 0.2s;
  1786. &:hover {
  1787. transform: scale(1.15);
  1788. }
  1789. }
  1790. }
  1791. .action-icon {
  1792. display: flex;
  1793. align-items: center;
  1794. justify-content: center;
  1795. width: 48px;
  1796. height: 48px;
  1797. background: rgb(0 0 0 / 50%);
  1798. backdrop-filter: blur(10px);
  1799. border-radius: 50%;
  1800. &.follow-icon {
  1801. background: #409eff;
  1802. }
  1803. }
  1804. .action-count {
  1805. font-size: 13px;
  1806. color: #ffffff;
  1807. text-align: center;
  1808. text-shadow: 0 1px 3px rgb(0 0 0 / 50%);
  1809. }
  1810. }
  1811. }
  1812. }
  1813. }
  1814. // 更多操作 Popover
  1815. :deep(.more-actions-popover) {
  1816. min-width: 120px;
  1817. padding: 8px 0;
  1818. background: rgb(0 0 0 / 90%);
  1819. backdrop-filter: blur(10px);
  1820. border: 1px solid rgb(255 255 255 / 10%);
  1821. .el-popper__arrow::before {
  1822. background: rgb(0 0 0 / 90%);
  1823. border: 1px solid rgb(255 255 255 / 10%);
  1824. }
  1825. .more-actions-menu {
  1826. .menu-item {
  1827. display: flex;
  1828. gap: 10px;
  1829. align-items: center;
  1830. padding: 10px 16px;
  1831. font-size: 14px;
  1832. line-height: 20px;
  1833. color: #ffffff;
  1834. cursor: pointer;
  1835. transition: all 0.3s;
  1836. &:hover {
  1837. background: rgb(255 255 255 / 10%);
  1838. }
  1839. .el-icon {
  1840. display: inline-flex;
  1841. flex-shrink: 0;
  1842. align-items: center;
  1843. justify-content: center;
  1844. width: 18px;
  1845. height: 18px;
  1846. color: #ffffff;
  1847. vertical-align: middle;
  1848. }
  1849. span {
  1850. display: inline-block;
  1851. line-height: 20px;
  1852. vertical-align: middle;
  1853. }
  1854. }
  1855. }
  1856. }
  1857. // 举报对话框
  1858. :deep(.el-dialog) {
  1859. .report-dialog-content {
  1860. .report-tip {
  1861. margin-bottom: 20px;
  1862. font-size: 14px;
  1863. line-height: 1.6;
  1864. color: #606266;
  1865. }
  1866. .report-reasons {
  1867. margin-bottom: 20px;
  1868. .el-radio-group {
  1869. display: flex;
  1870. flex-wrap: wrap;
  1871. gap: 12px 16px;
  1872. .el-radio {
  1873. height: auto;
  1874. margin-right: 0;
  1875. white-space: nowrap;
  1876. .el-radio__label {
  1877. font-size: 14px;
  1878. color: #303133;
  1879. }
  1880. }
  1881. }
  1882. }
  1883. .report-description {
  1884. margin-bottom: 20px;
  1885. :deep(.el-textarea__inner) {
  1886. font-size: 14px;
  1887. }
  1888. }
  1889. .report-upload {
  1890. margin-bottom: 20px;
  1891. .upload-title {
  1892. margin-bottom: 12px;
  1893. font-size: 14px;
  1894. font-weight: 500;
  1895. color: #303133;
  1896. }
  1897. :deep(.el-upload-list) {
  1898. display: flex;
  1899. flex-wrap: wrap;
  1900. gap: 8px;
  1901. }
  1902. :deep(.el-upload--picture-card) {
  1903. width: 100px;
  1904. height: 100px;
  1905. border-radius: 4px;
  1906. }
  1907. :deep(.el-upload-list--picture-card .el-upload-list__item) {
  1908. width: 100px;
  1909. height: 100px;
  1910. margin: 0;
  1911. border-radius: 4px;
  1912. }
  1913. }
  1914. .report-agreement {
  1915. .el-checkbox {
  1916. .el-checkbox__label {
  1917. font-size: 14px;
  1918. color: #606266;
  1919. }
  1920. }
  1921. }
  1922. }
  1923. .dialog-footer {
  1924. display: flex;
  1925. gap: 12px;
  1926. justify-content: flex-end;
  1927. }
  1928. }
  1929. // 评论侧边栏样式
  1930. .comment-list-container {
  1931. flex: 1;
  1932. height: calc(100vh - 200px);
  1933. padding: 0 20px;
  1934. overflow-y: auto;
  1935. .comment-list {
  1936. .comment-item {
  1937. display: flex;
  1938. gap: 12px;
  1939. padding: 16px 0;
  1940. border-bottom: 1px solid #f0f0f0;
  1941. &:last-child {
  1942. border-bottom: none;
  1943. }
  1944. .comment-avatar {
  1945. display: flex;
  1946. flex-shrink: 0;
  1947. align-items: center;
  1948. justify-content: center;
  1949. width: 40px;
  1950. height: 40px;
  1951. overflow: hidden;
  1952. background: #f5f5f5;
  1953. border-radius: 50%;
  1954. img {
  1955. width: 100%;
  1956. height: 100%;
  1957. object-fit: cover;
  1958. }
  1959. }
  1960. .comment-content-wrapper {
  1961. flex: 1;
  1962. min-width: 0;
  1963. .comment-header,
  1964. .store-comment-header {
  1965. display: flex;
  1966. align-items: center;
  1967. justify-content: space-between;
  1968. margin-bottom: 8px;
  1969. .comment-user-name {
  1970. font-size: 14px;
  1971. font-weight: 500;
  1972. color: #303133;
  1973. }
  1974. .comment-time {
  1975. font-size: 12px;
  1976. color: #909399;
  1977. }
  1978. }
  1979. .comment-text {
  1980. margin-bottom: 8px;
  1981. font-size: 14px;
  1982. line-height: 1.6;
  1983. color: #606266;
  1984. word-break: break-all;
  1985. }
  1986. // 商家回复样式
  1987. .store-comment-wrapper {
  1988. padding: 12px;
  1989. margin-top: 12px;
  1990. background: #f5f7fa;
  1991. border-radius: 8px;
  1992. .store-comment-item {
  1993. display: flex;
  1994. gap: 10px;
  1995. .store-comment-avatar {
  1996. display: flex;
  1997. flex-shrink: 0;
  1998. align-items: center;
  1999. justify-content: center;
  2000. width: 32px;
  2001. height: 32px;
  2002. overflow: hidden;
  2003. background: #ffffff;
  2004. border-radius: 50%;
  2005. img {
  2006. width: 100%;
  2007. height: 100%;
  2008. object-fit: cover;
  2009. }
  2010. }
  2011. .store-comment-content {
  2012. flex: 1;
  2013. min-width: 0;
  2014. .store-comment-header {
  2015. display: flex;
  2016. align-items: center;
  2017. justify-content: space-between;
  2018. margin-bottom: 6px;
  2019. .store-comment-user-name {
  2020. font-size: 13px;
  2021. font-weight: 500;
  2022. color: #409eff;
  2023. }
  2024. .store-comment-time {
  2025. font-size: 11px;
  2026. color: #909399;
  2027. }
  2028. }
  2029. .store-comment-text {
  2030. display: flex;
  2031. align-items: center;
  2032. justify-content: space-between;
  2033. font-size: 13px;
  2034. line-height: 1.5;
  2035. color: #606266;
  2036. word-break: break-all;
  2037. }
  2038. }
  2039. }
  2040. }
  2041. .comment-actions {
  2042. display: flex;
  2043. gap: 20px;
  2044. .comment-action-item {
  2045. display: flex;
  2046. gap: 4px;
  2047. align-items: center;
  2048. font-size: 13px;
  2049. color: #909399;
  2050. cursor: pointer;
  2051. transition: color 0.3s;
  2052. &:hover {
  2053. color: #409eff;
  2054. }
  2055. span {
  2056. font-size: 13px;
  2057. }
  2058. }
  2059. }
  2060. }
  2061. }
  2062. }
  2063. }
  2064. .comment-input-wrapper {
  2065. position: absolute;
  2066. right: 0;
  2067. bottom: 0;
  2068. left: 0;
  2069. padding: 16px 20px;
  2070. background: #ffffff;
  2071. border-top: 1px solid #e4e7ed;
  2072. box-shadow: 0 -2px 8px rgb(0 0 0 / 5%);
  2073. .reply-hint {
  2074. display: flex;
  2075. align-items: center;
  2076. justify-content: space-between;
  2077. padding: 8px 12px;
  2078. margin-bottom: 8px;
  2079. background: #f5f7fa;
  2080. border-radius: 4px;
  2081. .reply-text {
  2082. font-size: 13px;
  2083. color: #409eff;
  2084. }
  2085. .cancel-reply {
  2086. font-size: 16px;
  2087. color: #909399;
  2088. cursor: pointer;
  2089. transition: color 0.3s;
  2090. &:hover {
  2091. color: #f56c6c;
  2092. }
  2093. }
  2094. }
  2095. :deep(.el-textarea) {
  2096. margin-bottom: 12px;
  2097. }
  2098. .el-button {
  2099. width: 100%;
  2100. }
  2101. }
  2102. // 分享对话框
  2103. .share-dialog-content {
  2104. .search-box {
  2105. margin-bottom: 16px;
  2106. }
  2107. .share-friend-list {
  2108. max-height: 400px;
  2109. margin-bottom: 16px;
  2110. overflow-y: auto;
  2111. .share-friend-item {
  2112. display: flex;
  2113. align-items: center;
  2114. justify-content: space-between;
  2115. padding: 12px;
  2116. cursor: pointer;
  2117. border-radius: 8px;
  2118. transition: background-color 0.3s;
  2119. &:hover {
  2120. background-color: #f5f7fa;
  2121. }
  2122. .friend-info {
  2123. display: flex;
  2124. gap: 12px;
  2125. align-items: center;
  2126. .friend-avatar {
  2127. display: flex;
  2128. flex-shrink: 0;
  2129. align-items: center;
  2130. justify-content: center;
  2131. width: 40px;
  2132. height: 40px;
  2133. overflow: hidden;
  2134. background: #f5f5f5;
  2135. border-radius: 50%;
  2136. img {
  2137. width: 100%;
  2138. height: 100%;
  2139. object-fit: cover;
  2140. }
  2141. }
  2142. .friend-name {
  2143. font-size: 14px;
  2144. font-weight: 500;
  2145. color: #303133;
  2146. }
  2147. }
  2148. }
  2149. }
  2150. .selected-friends {
  2151. padding: 12px;
  2152. background: #f5f7fa;
  2153. border-radius: 8px;
  2154. .selected-title {
  2155. margin-bottom: 8px;
  2156. font-size: 13px;
  2157. color: #606266;
  2158. }
  2159. .selected-list {
  2160. display: flex;
  2161. flex-wrap: wrap;
  2162. gap: 8px;
  2163. .el-tag {
  2164. max-width: 120px;
  2165. overflow: hidden;
  2166. text-overflow: ellipsis;
  2167. white-space: nowrap;
  2168. }
  2169. }
  2170. }
  2171. }
  2172. }
  2173. </style>