tweetDetail.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. <template>
  2. <view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')" v-if="info">
  3. <!-- 作者信息区域 -->
  4. <view class="author">
  5. <img mode="aspectFill" :src="info.userPhoto" @click="handleGoMyHome(info.userId)" />
  6. <view class="author_name">{{ info.userName }}</view>
  7. <view class="author_btn" v-if="info.isFollow !== 2" @click="handleFollow">{{ info.isFollow === 0 ? '关注' : '已关注' }}</view>
  8. </view>
  9. <!-- 轮播图区域 -->
  10. <swiper indicator-color="#ccc" indicator-active-color="#096562" indicator-dots autoplay circular class="swiper" v-if="info.images">
  11. <swiper-item class="swiper_item" v-for="(item, current) in info.images" :key="current" @click="handleClickSwiper(info.images, current)">
  12. <img mode="aspectFill" class="img" :src="item" />
  13. </swiper-item>
  14. </swiper>
  15. <video
  16. v-if="info.video"
  17. class="swiper"
  18. :src="info.video"
  19. id="myVideo"
  20. :show-fullscreen-btn="false"
  21. :direction="0"
  22. @fullscreenchange="fullscreenchange"
  23. @click="handleClickVideo('myVideo')"
  24. ></video>
  25. <!-- 推文信息区域 -->
  26. <view class="tweet">
  27. <view class="tweet_title">{{ info.title }}</view>
  28. <text class="tweet_msg">{{ info.content }}</text>
  29. <view class="tweet_info">{{ info.dateStr }} {{ info.townName }}</view>
  30. </view>
  31. <!-- 关联民宿区域 -->
  32. <view class="and">
  33. <!-- 每一个关联民宿区域 -->
  34. <view class="and_box" v-for="item in info.hotels" :key="item.id" @click="goHotelDetail(item)">
  35. <img mode="aspectFill" :src="item.coverImg" />
  36. <view class="box_detail">
  37. <view class="detail_name">
  38. {{ item.name }}
  39. <img class="img" :src="item.isCollect === 0 ? '../../static/index/like.png' : '../../static/index/like-active.png'" @click.stop="handleLikeHotel(item)" />
  40. </view>
  41. <view class="detail_leave" v-if="item.type === 1">银宿级</view>
  42. <view class="detail_leave" v-if="item.type === 2">金宿级</view>
  43. <view class="detail_leave" v-if="item.type === 3">白金级</view>
  44. <view class="detail_num">
  45. <view class="num_rate" v-if="item.score">{{ item.score.toFixed(1) }}分</view>
  46. <view class="num_comment">{{ item.comment }}条评论</view>
  47. <view class="num_price">
  48. ¥{{ item.price ? item.price : 0 }}
  49. <text>起</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 关联民宿查看全部区域 -->
  55. <view class="and_all" @click="handleClickALL">查看全部 >></view>
  56. </view>
  57. <!-- 点赞人数区域 -->
  58. <view class="like" v-if="info.likes.length !== 0">
  59. <uv-avatar-group mode="aspectFill" :urls="info.likes" size="30" gap="0.3" maxCount="10"></uv-avatar-group>
  60. <view class="like_text" @click="handleGoPageLike">{{ info.likeNum }}人已赞</view>
  61. </view>
  62. <!-- 评论总条数区域 -->
  63. <view class="total" v-if="info.commentNum">共{{ info.commentNum }}条评论</view>
  64. <!-- 评论输入框区域 -->
  65. <view class="input_box">
  66. <input type="text" confirm-type="send" placeholder="爱评论的人运气都不差" v-model="commentsValue" @confirm="handleInput" />
  67. </view>
  68. <!-- 评论列表区域 -->
  69. <view class="comment_list" v-if="info.comments">
  70. <!-- 每一个评论区域 -->
  71. <view class="comment_box" v-for="item in info.comments" :key="item.id">
  72. <view class="box_left">
  73. <img mode="aspectFill" :src="item.image" @click="handleGoMyHome(item.userId)" />
  74. </view>
  75. <view class="box_right">
  76. <view class="right_name">{{ item.userName }}</view>
  77. <view class="right_content">{{ item.content }}</view>
  78. <view class="right_time">{{ item.date.slice(0, 19) }}</view>
  79. </view>
  80. </view>
  81. <!-- 查看全部评论区域 -->
  82. <view class="comment_all" @click="handleClickComment">查看全部评论 >></view>
  83. </view>
  84. <!-- 相关推文区域 -->
  85. <view class="related" v-if="bindTweetList.length !== 0">
  86. <view class="related_title">相关推文</view>
  87. <!-- 相关推文列表区域 -->
  88. <view class="related_list">
  89. <!-- 每一个推文区域 -->
  90. <view class="related_box" v-for="item in bindTweetList" :key="item.id" @click="handleGoBind(item)">
  91. <img class="box_cover" v-if="item.image" mode="aspectFill" :src="item.image[0] || item.image" />
  92. <video class="box_cover" v-if="item.video" :src="item.video" :show-center-play-btn="false" :show-fullscreen-btn="false" :show-play-btn="false"></video>
  93. <view class="box_content">{{ item.title }}</view>
  94. <view class="box_info">
  95. <img class="img" mode="aspectFill" :src="item.userPhoto" />
  96. <view class="info_name">{{ item.userName }}</view>
  97. <img
  98. class="img2"
  99. mode="aspectFill"
  100. :src="item.isCollect === 0 ? '../../static/index/like.png' : '../../static/index/like-active.png'"
  101. @click.stop="handleClickLike(item)"
  102. />
  103. <view class="info_count">{{ item.collectNum }}</view>
  104. </view>
  105. <!-- 乡镇信息区域 -->
  106. <view class="box_town">{{ item.townName }}</view>
  107. <!-- 视频图标 -->
  108. <img v-if="item.video" class="box_play" src="../../static/index/video.png" />
  109. </view>
  110. </view>
  111. </view>
  112. <!-- 底部点赞 评论 收藏区域 -->
  113. <view class="tab">
  114. <!-- 点赞 -->
  115. <view class="tab_box">
  116. <img class="img" :src="info.isLike === 0 ? '../../static/index/upvote.png' : '../../static/index/upvote-active.png'" @click="clickBtnLike" />
  117. {{ info.likeNum }}
  118. </view>
  119. <!-- 评论 -->
  120. <view class="tab_box" @click="handleClickComment">
  121. <img class="img2" src="../../static/index/comment.png" />
  122. {{ info.commentNum }}
  123. </view>
  124. <!-- 收藏 -->
  125. <view class="tab_box">
  126. <img class="img" :src="info.isCollect === 0 ? '../../static/index/like.png' : '../../static/index/like-active.png'" @click="handleClickLike(info)" />
  127. {{ info.collectNum }}
  128. </view>
  129. </view>
  130. <!-- 点击评论弹窗区域 -->
  131. <uv-popup ref="popup" bgColor="none" :safeAreaInsetBottom="false" :closeOnClickOverlay="false">
  132. <view class="body_pop" v-if="commentList.length">
  133. <!-- 评论总数区域 -->
  134. <view class="pop_title">
  135. 共{{ totalComment }}条评论
  136. <img class="pop_icon" src="../../static/index/close3.png" @click="handleClosePop" />
  137. </view>
  138. <!-- 评论列表区域 -->
  139. <scroll-view class="pop_list" scroll-y @scrolltolower="handleTolowerComment">
  140. <!-- 每一条评论区域 -->
  141. <view class="pop_item" v-for="item in commentList" :key="item.id">
  142. <!-- 用户区域 -->
  143. <view class="item_user" @click="handleComment(item)">
  144. <img mode="aspectFill" :src="item.image" @click.stop="handleGoMyHome(item.userId)" />
  145. <view class="user_info">
  146. {{ item.userName }}
  147. </view>
  148. </view>
  149. <!-- 评价内容区域 -->
  150. <view class="item_content" @click="handleComment(item)">
  151. <view class="content_top">
  152. {{ item.content }}
  153. </view>
  154. <view class="content_bottom">
  155. {{ item.date.slice(0, 19) }}
  156. </view>
  157. </view>
  158. <!-- 二级评论区域 -->
  159. <view class="item_child">
  160. <CommentChild3 v-if="item.childrens" :list="item.childrens" :commentParentId="tweetId" />
  161. </view>
  162. </view>
  163. </scroll-view>
  164. </view>
  165. <!-- 评论输入框区域 -->
  166. <view class="body_input" v-if="commentList.length">
  167. <view class="input_box">
  168. <input type="text" confirm-type="send" placeholder="说点什么呢~" v-model="popInputValue" @confirm="handleInputPop" />
  169. </view>
  170. </view>
  171. </uv-popup>
  172. <!-- 点击关联民宿弹窗区域 -->
  173. <uv-popup ref="popup_bind" bgColor="none" :safeAreaInsetBottom="false" :closeOnClickOverlay="false">
  174. <view class="body_pop">
  175. <!-- 评论总数区域 -->
  176. <view class="pop_title">
  177. 全部
  178. <img class="pop_icon" src="../../static/index/close3.png" @click="handleClosePopBind" />
  179. </view>
  180. <!-- 关联民宿列表区域 -->
  181. <scroll-view class="pop_list" v-if="bindList.length" scroll-y @scrolltolower="handleTolower">
  182. <!-- 每一个民宿区域 -->
  183. <view class="pop_item_bind" v-for="item in bindList" :key="item.id" @click="goHotelDetail(item)">
  184. <img mode="aspectFill" :src="item.coverImg" />
  185. <view class="box_detail">
  186. <view class="detail_name">
  187. {{ item.name }}
  188. <img
  189. class="img"
  190. :src="item.isCollect === 0 ? '../../static/index/like.png' : '../../static/index/like-active.png'"
  191. @click.stop="handleLikeHotel(item)"
  192. />
  193. </view>
  194. <view class="detail_leave" v-if="item.type === 1">银宿级</view>
  195. <view class="detail_leave" v-if="item.type === 2">金宿级</view>
  196. <view class="detail_leave" v-if="item.type === 3">白金级</view>
  197. <view class="detail_num">
  198. <view class="num_rate" v-if="item.score">{{ item.score.toFixed(1) }}分</view>
  199. <view class="num_comment">{{ item.comment }}条评论</view>
  200. <view class="num_price">
  201. ¥{{ item.price }}
  202. <text>起</text>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. </scroll-view>
  208. </view>
  209. </uv-popup>
  210. </view>
  211. </template>
  212. <script>
  213. import CommentChild3 from '@/components/commentChild3.vue'
  214. export default {
  215. components: { CommentChild3 },
  216. data() {
  217. return {
  218. // 滚动穿透控制
  219. showPage: false,
  220. // 推文id
  221. tweetId: '',
  222. // 乡镇id
  223. townId: '',
  224. // 用户id
  225. userId: '',
  226. // 推文信息
  227. info: null,
  228. // 相关推文列表数组
  229. bindTweetList: [],
  230. // 弹窗评论列表当前页
  231. pageComment: 1,
  232. // 弹窗评论列表每页多少条
  233. rowsComment: 10,
  234. // 弹窗评论列表总条数
  235. totalComment: null,
  236. // 弹窗评论列表
  237. commentList: [],
  238. // 弹窗关联民宿列表
  239. bindList: [],
  240. // 弹窗关联民宿当前页
  241. pageBind: 1,
  242. // 弹窗关联民宿每页多少条
  243. rowsBind: 10,
  244. // 弹窗关联民宿总条数
  245. totalBind: null,
  246. // 一级评论框绑定数值
  247. commentsValue: '',
  248. // 评论弹窗评论框绑定数值
  249. popInputValue: '',
  250. // 相关推文当前页
  251. pageTweet: 1,
  252. // 相关推文每页多少条
  253. rowsTweet: 10,
  254. // 相关推文总条数
  255. totalTweet: null,
  256. // video 上下文 videoContext 对象
  257. videoContext: null,
  258. // 是否是全屏状态
  259. isFullScreen: false
  260. }
  261. },
  262. mounted() {
  263. // 开启转发功能
  264. uni.showShareMenu({
  265. withShareTicket: true,
  266. menus: ['shareAppMessage', 'shareTimeline']
  267. })
  268. },
  269. onShow() {
  270. let flag = uni.getStorageSync('openid')
  271. let tokenId = uni.getStorageSync('tokenId')
  272. if (tokenId && flag) {
  273. this.userId = uni.getStorageSync('userInfo').id
  274. this.getTweetInfo()
  275. this.getBindTweet()
  276. } else {
  277. uni.navigateTo({
  278. url: '/pages/login/login'
  279. })
  280. }
  281. },
  282. onLoad(options) {
  283. this.tweetId = options.id
  284. this.townId = options.townId
  285. uni.$on('getReset', this.getReset)
  286. },
  287. onReachBottom() {
  288. if (this.bindTweetList.length < this.totalTweet) {
  289. this.pageTweet++
  290. this.getBindTweet()
  291. } else {
  292. uni.showToast({
  293. title: '没有更多数据了',
  294. icon: 'none'
  295. })
  296. }
  297. },
  298. methods: {
  299. // 获取推文详细信息
  300. async getTweetInfo(id) {
  301. const res = await this.$myRequest({
  302. url: '/mhotel/articlequeryDetail.action',
  303. data: {
  304. id: id ? id : this.tweetId,
  305. userId: this.userId
  306. }
  307. })
  308. // console.log(res)
  309. if (res.code === 200) {
  310. this.info = res.data
  311. // console.log(this.info.content)
  312. // 处理管理端发布的攻略不换行的问题
  313. this.info.content = this.replaceHtmlTags(this.info.content)
  314. // console.log(this.info.content)
  315. }
  316. },
  317. // 获取相关推文数组
  318. async getBindTweet() {
  319. const res = await this.$myRequest({
  320. url: '/mhotel/articlerelatedTweets.action',
  321. data: {
  322. id: this.tweetId,
  323. townId: this.townId,
  324. userId: this.userId,
  325. page: this.pageTweet,
  326. rows: this.rowsTweet
  327. }
  328. })
  329. // console.log(res)
  330. if (res.code === 200) {
  331. this.bindTweetList = res.data.pageList
  332. this.totalTweet = res.data.total
  333. }
  334. },
  335. // 关注或者取消关注请求
  336. async handleFollow() {
  337. const res = await this.$myRequest({
  338. url: '/mhotel/articlefollowAuthor.action',
  339. data: {
  340. authorId: this.info.userId,
  341. userId: this.userId
  342. }
  343. })
  344. // console.log(res)
  345. if (res.code === 200) {
  346. this.info.isFollow === 0 ? (this.info.isFollow = 1) : (this.info.isFollow = 0)
  347. }
  348. },
  349. // 点击关联民宿爱心图标回调
  350. async handleLikeHotel(item) {
  351. const res = await this.$myRequest({
  352. url: item.isCollect === 0 ? '/mhotel/ahpcollectHotel.action' : '/mhotel/ahpdelCollectHotel.action',
  353. data: {
  354. hotelId: item.id,
  355. userId: this.userId
  356. }
  357. })
  358. // console.log(res)
  359. if (res.code === 200) {
  360. item.isCollect === 0 ? (item.isCollect = 1) : (item.isCollect = 0)
  361. this.getTweetInfo()
  362. }
  363. },
  364. // 点击民宿前往民宿详情回调
  365. goHotelDetail(item) {
  366. this.showPage = false
  367. this.$refs.popup_bind.close()
  368. uni.navigateTo({
  369. url: `/pages/detail/detail?id=${item.id}&town=${this.info.townName}`
  370. })
  371. },
  372. // 点击轮播图图片回调
  373. handleClickSwiper(urls, current) {
  374. uni.previewImage({
  375. urls,
  376. current
  377. })
  378. },
  379. // 一级评论框确定输入回调
  380. async handleInput(e) {
  381. const res = await this.$myRequest({
  382. url: '/mhotel/articlecommentArticle.action',
  383. method: 'post',
  384. data: {
  385. articleId: this.tweetId,
  386. parentId: 0,
  387. userId: this.userId,
  388. content: e.detail.value
  389. }
  390. })
  391. // console.log(res)
  392. if (res.code === 200) {
  393. this.commentsValue = ''
  394. this.getTweetInfo()
  395. }
  396. },
  397. // 评论弹窗输入框回调
  398. async handleInputPop(e) {
  399. const res = await this.$myRequest({
  400. url: '/mhotel/articlecommentArticle.action',
  401. method: 'post',
  402. data: {
  403. articleId: this.tweetId,
  404. parentId: 0,
  405. userId: this.userId,
  406. content: e.detail.value
  407. }
  408. })
  409. // console.log(res)
  410. if (res.code === 200) {
  411. this.popInputValue = ''
  412. this.commentList = []
  413. this.pageComment = 1
  414. this.handleClickCommentReq()
  415. this.getTweetInfo()
  416. }
  417. },
  418. // 点击底部tab评论按钮回调
  419. handleClickComment() {
  420. if (this.info.comments) {
  421. this.commentList = []
  422. this.showPage = true
  423. this.$refs.popup.open('bottom')
  424. this.handleClickCommentReq()
  425. } else {
  426. uni.showToast({
  427. title: '暂无评论',
  428. icon: 'none'
  429. })
  430. }
  431. },
  432. async handleClickCommentReq() {
  433. const res = await this.$myRequest({
  434. url: '/mhotel/articlequeryCommentList.action',
  435. data: {
  436. id: this.tweetId,
  437. page: this.pageComment,
  438. rows: this.rowsComment
  439. }
  440. })
  441. // console.log(res)
  442. if (res.code === 200) {
  443. this.commentList = [...this.commentList, ...res.data.pageList]
  444. this.totalComment = res.data.total
  445. }
  446. },
  447. // 点击评论弹窗关闭图标回调
  448. handleClosePop() {
  449. this.showPage = false
  450. this.$refs.popup.close()
  451. },
  452. // 点击关联民宿查看全部按钮回调
  453. handleClickALL() {
  454. this.bindList = []
  455. this.showPage = true
  456. this.$refs.popup_bind.open('bottom')
  457. this.handleClickALLReq()
  458. },
  459. async handleClickALLReq() {
  460. const res = await this.$myRequest({
  461. url: '/mhotel/articlequeryHotelList.action',
  462. data: {
  463. id: this.tweetId,
  464. userId: this.userId,
  465. page: this.pageBind,
  466. rows: this.rowsBind
  467. }
  468. })
  469. // console.log(res)
  470. if (res.code === 200) {
  471. this.bindList = [...this.bindList, ...res.data.pageList]
  472. this.totalBind = res.data.total
  473. }
  474. },
  475. // 点击关联民宿弹窗关闭图标回调
  476. handleClosePopBind() {
  477. this.showPage = false
  478. this.$refs.popup_bind.close()
  479. },
  480. handleGoPageLike() {
  481. uni.navigateTo({
  482. url: `/pagesSub/likeList/likeList?id=${this.info.id}`
  483. })
  484. },
  485. // 相关推文点击爱心回调
  486. async handleClickLike(item) {
  487. const res = await this.$myRequest({
  488. url: '/mhotel/articlecollectArticle.action',
  489. data: {
  490. id: item.id,
  491. userId: this.userId
  492. }
  493. })
  494. // console.log(res)
  495. if (res.code === 200) {
  496. item.isCollect === 1 ? ((item.isCollect = 0), (item.collectNum -= 1)) : ((item.isCollect = 1), (item.collectNum += 1))
  497. }
  498. },
  499. // 点击底部点赞按钮回调
  500. async clickBtnLike() {
  501. const res = await this.$myRequest({
  502. url: '/mhotel/articlelikeArticle.action',
  503. data: {
  504. id: this.tweetId,
  505. userId: this.userId
  506. }
  507. })
  508. // console.log(res)
  509. if (res.code === 200) {
  510. this.getTweetInfo()
  511. }
  512. },
  513. handleGoBind(item) {
  514. this.tweetId = item.id
  515. this.townId = item.townId
  516. this.bindTweetList = []
  517. this.info = null
  518. this.getTweetInfo()
  519. this.getBindTweet()
  520. },
  521. handleComment(item) {
  522. uni.showModal({
  523. title: '请输入评论',
  524. editable: true,
  525. success: async (res) => {
  526. if (res.confirm) {
  527. const result = res.content
  528. if (!res.content) {
  529. uni.showToast({
  530. title: '评论内容不能为空',
  531. icon: 'none',
  532. mask: true
  533. })
  534. setTimeout(() => {
  535. this.handleComment()
  536. }, 1500)
  537. } else {
  538. const res = await this.$myRequest({
  539. url: '/mhotel/articlecommentArticle.action',
  540. method: 'post',
  541. data: {
  542. articleId: this.tweetId,
  543. parentId: item.id,
  544. userId: this.userId,
  545. content: result
  546. }
  547. })
  548. // console.log(res);
  549. if (res.code === 200) {
  550. this.getReset()
  551. }
  552. }
  553. }
  554. }
  555. })
  556. },
  557. getReset() {
  558. this.commentList = []
  559. this.pageComment = 1
  560. this.handleClickCommentReq()
  561. },
  562. handleTolower() {
  563. if (this.bindList.length < this.totalBind) {
  564. this.pageBind++
  565. this.handleClickALLReq()
  566. } else {
  567. uni.showToast({
  568. title: '没有更多数据了',
  569. icon: 'none'
  570. })
  571. }
  572. },
  573. handleTolowerComment() {
  574. if (this.commentList.length < this.totalComment) {
  575. this.pageComment++
  576. this.handleClickCommentReq()
  577. } else {
  578. uni.showToast({
  579. title: '没有更多数据了',
  580. icon: 'none'
  581. })
  582. }
  583. },
  584. // 进入全屏和退出全屏时触发的回调
  585. fullscreenchange(e) {
  586. this.isFullScreen = e.detail.fullScreen
  587. },
  588. // 点击视频控件时触发的回调
  589. handleClickVideo(id) {
  590. this.videoContext = uni.createVideoContext(id)
  591. if (this.isFullScreen) {
  592. this.videoContext.pause()
  593. this.videoContext.exitFullScreen()
  594. } else {
  595. this.videoContext.requestFullScreen()
  596. this.videoContext.play()
  597. }
  598. },
  599. handleGoMyHome(userId) {
  600. uni.navigateTo({
  601. url: `/pagesSub/myHome/myHome?userId=${userId}`
  602. })
  603. },
  604. // 把html标签替换的函数
  605. replaceHtmlTags(text) {
  606. text = text.replace(/<\/(p|h[1-6]|div|li|section|article|blockquote|pre)>/gi, '\n')
  607. text = text.replace(/<(p|h[1-6]|div|li|section|article|blockquote|pre)[^>]*>/gi, '\n')
  608. text = text.replace(/&nbsp;/gi, ' ')
  609. text = text.replace(/<[^>]*>/g, '')
  610. return text
  611. }
  612. }
  613. }
  614. </script>
  615. <style lang="scss" scoped>
  616. .container {
  617. padding-bottom: 130rpx;
  618. min-height: 100vh;
  619. background-color: #fff;
  620. .author {
  621. display: flex;
  622. align-items: center;
  623. padding: 0 20rpx;
  624. height: 100rpx;
  625. img {
  626. width: 50rpx;
  627. height: 50rpx;
  628. border-radius: 50%;
  629. }
  630. .author_name {
  631. margin-left: 15rpx;
  632. font-size: 28rpx;
  633. font-weight: bold;
  634. }
  635. .author_btn {
  636. display: flex;
  637. justify-content: center;
  638. align-items: center;
  639. margin-left: auto;
  640. width: 107rpx;
  641. height: 50rpx;
  642. color: #096562;
  643. font-size: 24rpx;
  644. border-radius: 69rpx;
  645. border: 1rpx solid #096562;
  646. }
  647. }
  648. .swiper {
  649. width: 100%;
  650. height: 495rpx;
  651. .swiper_item {
  652. width: 100%;
  653. height: 100%;
  654. .img {
  655. width: 100%;
  656. height: 440rpx;
  657. }
  658. }
  659. }
  660. .tweet {
  661. margin: auto;
  662. width: 710rpx;
  663. border-bottom: 1rpx solid #e6e6e6;
  664. .tweet_title {
  665. line-height: 50rpx;
  666. font-size: 32rpx;
  667. font-weight: bold;
  668. }
  669. .tweet_msg {
  670. margin-top: 10rpx;
  671. line-height: 40rpx;
  672. font-size: 28rpx;
  673. }
  674. .tweet_info {
  675. margin-top: 20rpx;
  676. height: 55rpx;
  677. color: #999999;
  678. font-size: 24rpx;
  679. }
  680. }
  681. .and {
  682. padding: 20rpx 0;
  683. margin: auto;
  684. width: 710rpx;
  685. border-bottom: 1rpx solid #e6e6e6;
  686. .and_box {
  687. display: flex;
  688. margin-bottom: 20rpx;
  689. width: 710rpx;
  690. height: 150rpx;
  691. background-color: #f2f2f2;
  692. img {
  693. width: 126rpx;
  694. height: 150rpx;
  695. }
  696. .box_detail {
  697. flex: 1;
  698. display: flex;
  699. flex-direction: column;
  700. justify-content: space-evenly;
  701. padding: 0 23rpx;
  702. overflow: hidden;
  703. .detail_name {
  704. display: flex;
  705. justify-content: space-between;
  706. align-items: center;
  707. font-size: 28rpx;
  708. font-weight: bold;
  709. overflow: hidden;
  710. text-overflow: ellipsis;
  711. white-space: nowrap;
  712. .img {
  713. width: 40rpx;
  714. height: 40rpx;
  715. }
  716. }
  717. .detail_leave {
  718. color: #808080;
  719. font-size: 24rpx;
  720. }
  721. .detail_num {
  722. display: flex;
  723. align-items: center;
  724. font-size: 24rpx;
  725. .num_rate {
  726. color: #ff5733;
  727. }
  728. .num_comment {
  729. margin-left: 15rpx;
  730. color: #a6a6a6;
  731. }
  732. .num_price {
  733. margin-left: auto;
  734. font-size: 28rpx;
  735. color: #ff5733;
  736. text {
  737. margin-left: 5rpx;
  738. font-size: 20rpx;
  739. color: #a6a6a6;
  740. }
  741. }
  742. }
  743. }
  744. }
  745. .and_all {
  746. display: flex;
  747. justify-content: center;
  748. align-items: center;
  749. width: 710rpx;
  750. height: 80rpx;
  751. color: #096562;
  752. font-size: 28rpx;
  753. background-color: #f2f2f2;
  754. }
  755. }
  756. .like {
  757. display: flex;
  758. align-items: center;
  759. padding: 0 20rpx;
  760. height: 108rpx;
  761. color: #808080;
  762. font-size: 28rpx;
  763. .like_text {
  764. margin-left: 18rpx;
  765. }
  766. }
  767. .total {
  768. margin: auto;
  769. width: 710rpx;
  770. height: 60rpx;
  771. line-height: 60rpx;
  772. font-size: 28rpx;
  773. color: #808080;
  774. }
  775. .input_box {
  776. margin: 10rpx auto 0;
  777. width: 710rpx;
  778. height: 66rpx;
  779. font-size: 24rpx;
  780. border-radius: 47rpx;
  781. background-color: #f2f2f2;
  782. input {
  783. box-sizing: border-box;
  784. padding: 0 33rpx;
  785. width: 100%;
  786. height: 100%;
  787. }
  788. }
  789. .comment_list {
  790. margin: auto;
  791. width: 710rpx;
  792. .comment_box {
  793. display: flex;
  794. box-sizing: border-box;
  795. padding-top: 30rpx;
  796. .box_left {
  797. width: 75rpx;
  798. img {
  799. width: 60rpx;
  800. height: 60rpx;
  801. border-radius: 50%;
  802. }
  803. }
  804. .box_right {
  805. flex: 1;
  806. flex-wrap: wrap;
  807. font-size: 24rpx;
  808. border-bottom: 1rpx solid #e6e6e6;
  809. .right_name {
  810. color: #808080;
  811. }
  812. .right_content {
  813. margin-top: 12rpx;
  814. word-break: break-all;
  815. }
  816. .right_time {
  817. margin: 12rpx 0 20rpx;
  818. color: #808080;
  819. }
  820. }
  821. }
  822. .comment_all {
  823. display: flex;
  824. justify-content: center;
  825. align-items: center;
  826. width: 710rpx;
  827. height: 80rpx;
  828. color: #096562;
  829. font-size: 28rpx;
  830. background-color: #f2f2f2;
  831. }
  832. }
  833. .related {
  834. margin: auto;
  835. width: 710rpx;
  836. .related_title {
  837. line-height: 105rpx;
  838. font-size: 32rpx;
  839. font-weight: bold;
  840. }
  841. .related_list {
  842. display: grid;
  843. grid-template-columns: 1fr 1fr;
  844. grid-auto-rows: auto;
  845. gap: 40rpx;
  846. .related_box {
  847. position: relative;
  848. width: 335rpx;
  849. background-color: #f7f7f7;
  850. .box_cover {
  851. width: 335rpx;
  852. height: 463rpx;
  853. border-radius: 10rpx 10rpx 0 0;
  854. }
  855. .box_content {
  856. padding: 10rpx 60rpx 10rpx 20rpx;
  857. font-size: 28rpx;
  858. font-weight: bold;
  859. word-break: break-all;
  860. overflow: hidden;
  861. text-overflow: ellipsis;
  862. white-space: nowrap;
  863. }
  864. .box_info {
  865. padding: 0 20rpx;
  866. display: flex;
  867. align-items: center;
  868. height: 50rpx;
  869. font-size: 20rpx;
  870. color: #666666;
  871. .img {
  872. width: 30rpx;
  873. height: 30rpx;
  874. border-radius: 50%;
  875. }
  876. .info_name {
  877. margin-left: 10rpx;
  878. }
  879. .img2 {
  880. margin-left: auto;
  881. width: 28rpx;
  882. height: 28rpx;
  883. }
  884. .info_count {
  885. margin-left: 5rpx;
  886. }
  887. }
  888. .box_town {
  889. position: absolute;
  890. top: 405rpx;
  891. left: 22rpx;
  892. padding: 0 20rpx;
  893. display: flex;
  894. justify-content: center;
  895. align-items: center;
  896. height: 43rpx;
  897. color: #fff;
  898. font-size: 20rpx;
  899. border-radius: 42rpx;
  900. background-color: rgba(0, 0, 0, 0.3);
  901. }
  902. .box_play {
  903. position: absolute;
  904. top: 20rpx;
  905. right: 20rpx;
  906. width: 50rpx;
  907. height: 50rpx;
  908. }
  909. }
  910. }
  911. }
  912. .tab {
  913. position: fixed;
  914. bottom: 0;
  915. left: 0;
  916. z-index: 999;
  917. display: flex;
  918. justify-content: space-evenly;
  919. align-items: center;
  920. width: 100%;
  921. height: 110rpx;
  922. border-top: 1rpx solid #e6e6e6;
  923. background-color: #fff;
  924. .tab_box {
  925. display: flex;
  926. justify-content: center;
  927. align-items: center;
  928. width: 200rpx;
  929. .img {
  930. margin-right: 10rpx;
  931. width: 45rpx;
  932. height: 45rpx;
  933. }
  934. .img2 {
  935. margin-right: 10rpx;
  936. width: 35rpx;
  937. height: 35rpx;
  938. }
  939. }
  940. }
  941. .body_pop {
  942. position: relative;
  943. height: 955rpx;
  944. border-radius: 22rpx 22rpx 0 0;
  945. background-color: #fff;
  946. .pop_title {
  947. position: fixed;
  948. top: 0;
  949. left: 0;
  950. right: 0;
  951. display: flex;
  952. justify-content: center;
  953. align-items: center;
  954. height: 110rpx;
  955. font-size: 28rpx;
  956. background-color: #fff;
  957. .pop_icon {
  958. position: absolute;
  959. top: 35rpx;
  960. right: 35rpx;
  961. width: 36rpx;
  962. height: 36rpx;
  963. }
  964. }
  965. .pop_list {
  966. box-sizing: border-box;
  967. padding: 110rpx 20rpx 30rpx;
  968. height: 955rpx;
  969. .pop_item {
  970. margin-bottom: 10rpx;
  971. padding-bottom: 10rpx;
  972. border-bottom: 1rpx solid #e6e6e6;
  973. .item_user {
  974. display: flex;
  975. align-items: center;
  976. height: 70rpx;
  977. img {
  978. width: 60rpx;
  979. height: 60rpx;
  980. border-radius: 50%;
  981. }
  982. .user_info {
  983. display: flex;
  984. align-items: center;
  985. margin-left: 18rpx;
  986. height: 70rpx;
  987. color: #808080;
  988. font-size: 24rpx;
  989. }
  990. }
  991. .item_content {
  992. margin-left: 80rpx;
  993. font-size: 24rpx;
  994. .content_top {
  995. }
  996. .content_bottom {
  997. margin: 10rpx 0;
  998. color: #808080;
  999. }
  1000. .content_key {
  1001. color: #808080;
  1002. }
  1003. }
  1004. .item_child {
  1005. margin-left: 50rpx;
  1006. }
  1007. }
  1008. .pop_item_bind {
  1009. display: flex;
  1010. margin-bottom: 20rpx;
  1011. width: 710rpx;
  1012. height: 150rpx;
  1013. background-color: #f2f2f2;
  1014. img {
  1015. width: 126rpx;
  1016. height: 150rpx;
  1017. }
  1018. .box_detail {
  1019. flex: 1;
  1020. display: flex;
  1021. flex-direction: column;
  1022. justify-content: space-evenly;
  1023. padding: 0 23rpx;
  1024. overflow: hidden;
  1025. .detail_name {
  1026. display: flex;
  1027. justify-content: space-between;
  1028. align-items: center;
  1029. font-size: 28rpx;
  1030. font-weight: bold;
  1031. overflow: hidden;
  1032. text-overflow: ellipsis;
  1033. white-space: nowrap;
  1034. .img {
  1035. width: 40rpx;
  1036. height: 40rpx;
  1037. }
  1038. }
  1039. .detail_leave {
  1040. color: #808080;
  1041. font-size: 24rpx;
  1042. }
  1043. .detail_num {
  1044. display: flex;
  1045. align-items: center;
  1046. font-size: 24rpx;
  1047. .num_rate {
  1048. color: #ff5733;
  1049. }
  1050. .num_comment {
  1051. margin-left: 15rpx;
  1052. color: #a6a6a6;
  1053. }
  1054. .num_price {
  1055. margin-left: auto;
  1056. font-size: 28rpx;
  1057. color: #ff5733;
  1058. text {
  1059. margin-left: 5rpx;
  1060. font-size: 20rpx;
  1061. color: #a6a6a6;
  1062. }
  1063. }
  1064. }
  1065. }
  1066. }
  1067. }
  1068. }
  1069. .body_input {
  1070. display: flex;
  1071. justify-content: center;
  1072. align-items: center;
  1073. height: 118rpx;
  1074. border-top: 1rpx solid #cccccc;
  1075. background-color: #fff;
  1076. .input_box {
  1077. width: 710rpx;
  1078. border-radius: 77rpx;
  1079. font-size: 24rpx;
  1080. background-color: #f2f2f2;
  1081. input {
  1082. box-sizing: border-box;
  1083. padding: 0 30rpx;
  1084. width: 100%;
  1085. height: 100%;
  1086. }
  1087. }
  1088. }
  1089. }
  1090. </style>