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