index.vue 69 KB

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