filesonicInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <template>
  2. <view>
  3. <u-navbar title="详情"></u-navbar>
  4. <!-- 分享内容 -->
  5. <view class="share-content">
  6. <view class="item" v-for="(item,i) in list" :key="i" @click="ckItem(item)">
  7. <view class="infos">
  8. <view class="person">
  9. <view class="photo">
  10. <img v-if="item.regUser&&item.regUser.headImg" :src="item.regUser.headImg" alt="">
  11. <u-avatar v-else size="64"></u-avatar>
  12. </view>
  13. <view class="name" v-if="item.regUser">
  14. {{item.regUser.name}}
  15. </view>
  16. </view>
  17. <view class="date">
  18. {{item.createTime}}
  19. </view>
  20. </view>
  21. <view class="share-text">
  22. <textarea placeholder="记录点滴生活..." disabled="disabled" :auto-height="true" style="width:auto"
  23. v-model="item.synopsis" readonly maxlength="200" name="" id=""></textarea>
  24. </view>
  25. <view class="pictures">
  26. <template v-for="(pic,i2) in item.listShareFiles" v-if="pic.url">
  27. <image class="img" v-if="pic.isPic" :key="i2" mode="aspectFill"
  28. @click="previewImage(item.listShareFiles,i2)" :src="pic.url" alt="">
  29. <video v-else :key="i2" :src="pic.url" :class="{videoplay:playurl==pic.url}"
  30. @play="playurl=pic.url" enable-danmu danmu-btn controls></video>
  31. </template>
  32. </view>
  33. <view class="tagMain">
  34. <view class="tag" v-if="!item.activityId" :class="item.activityId">
  35. <text class="status" style="color: red;"
  36. v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
  37. </view>
  38. <view class="tag" v-else :class="item.activityId" @click="issueMethod(item.activityId)">
  39. <text class="status" style="color: red;"
  40. v-if="item.status!=1">[{{item.status==0?'审核中':''}}{{item.status==2?'审核不通过':''}}]</text>
  41. <template>
  42. <text class="symbol">#</text>
  43. <text class="text">{{item.activityName}}</text>
  44. <text class="icon">
  45. <u-icon size="28" color="#cccccc" name="arrow-right"></u-icon>
  46. </text>
  47. </template>
  48. </view>
  49. <view class="likeMain">
  50. <view class="like" v-if="item.status==1" @click="changeLikes(item)" :class="{
  51. red:item.isLike
  52. }">
  53. <view class="icon">
  54. <u-icon name="thumb-up" size="38"></u-icon>
  55. </view>
  56. <view class="number">
  57. {{item.likesNum}}
  58. </view>
  59. </view>
  60. <view class="like" style="margin-left: 18rpx;"
  61. v-if="item.status==1" @click="showMessageBtn(item)" >
  62. <view class="icon">
  63. <img style="width: 40rpx; height: 48rpx;"
  64. src="../../assets/img/riLine-chat-4-line.svg"></img>
  65. </view>
  66. <view class="number"> 评论</view>
  67. </view>
  68. <view class="like" v-show="item.listShareLikes.length>20" style="margin-left: 18rpx;"
  69. @click="showlike=!showlike" >
  70. <view class="icon">
  71. <u-icon name="chat" size="38"></u-icon>
  72. </view>
  73. <view class="number"> {{showlike?'收起':'展开'}}点赞</view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="messageListMain" v-show="item.listShareLikes.length||item.listShareComment.length" >
  78. <view class="mLikeList" v-show="item.listShareLikes.length">
  79. <u-icon name="thumb-up" size="38"></u-icon>
  80. <span v-for="(itemlike,ilike) in item.listShareLikes" :key="ilike" v-show="showlike||ilike<=20">
  81. {{ilike==0?' ':', '}}{{itemlike.userName}}
  82. </span>
  83. <span v-show="item.listShareLikes.length>20&&!showlike">...</span>
  84. </view>
  85. <view class="messageList" v-show="item.listShareComment.length">
  86. <view class="messageItem" v-for="(itemcom,ico) in item.listShareComment" :key="ico" >
  87. <span class="mItemTitle">{{itemcom.userName}}
  88. <span class="mItemTitleColor" v-if="item.regUser&&userInfo&&(item.regUser.id==itemcom.userId)">[作者]</span>
  89. <span class="mItemTitleColor" v-else-if="item.regUser&&userInfo&&(itemcom.userId==userInfo.id)">[本人]</span>
  90. :</span>
  91. <span class="mItemBody">{{itemcom.content}}</span>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <u-popup v-model="showMessage" border-radius="34" mode="bottom" >
  98. <view class="showMessage">
  99. <view class="showMessage1"><h3>发表评论({{content.length}}/50)</h3></view>
  100. <view class="showMessage2">
  101. <textarea name="" id="" style=" width:100%"
  102. v-model="content" maxlength="50"
  103. cols="30" rows="5" placeholder="填写内容"></textarea>
  104. </view>
  105. <view class="showMessage3">
  106. <u-button type="primary" @click="submitMessage()">提交</u-button>
  107. </view>
  108. </view>
  109. </u-popup>
  110. </view>
  111. </template>
  112. <script>
  113. import * as API from '@/apis/pagejs/share.js'
  114. export default {
  115. data() {
  116. return {
  117. userInfo:null,
  118. id:'',
  119. info:{},
  120. list: [],
  121. showMessage:false,
  122. showMessageItem:{},
  123. showMessageId:'',
  124. content:"",
  125. showlike:false,
  126. }
  127. },
  128. onLoad(op){
  129. this.userInfo=this.carhelp.getPersonInfo()
  130. console.log(this.userInfo)
  131. if(op.id){
  132. this.id=op.id
  133. this.getInfo()
  134. }
  135. },
  136. methods: {
  137. ckItem(item) {
  138. },
  139. previewImage(img, i) {
  140. let imgs = [];
  141. img.forEach(it => {
  142. if (it.isPic) {
  143. imgs.push(it.url)
  144. }
  145. })
  146. uni.previewImage({
  147. //indicator:"default",
  148. indicator: "number",
  149. loop: true,
  150. urls: imgs,
  151. current: i
  152. })
  153. },
  154. submitMessage(){
  155. if(!this.content){
  156. uni.showToast({
  157. title: "请填写内容",
  158. icon: "none"
  159. })
  160. return
  161. }
  162. uni.showLoading({
  163. title: "加载中",
  164. mask: true,
  165. })
  166. API.createComment({
  167. shareId:this.showMessageId,
  168. content:this.content,
  169. }).then((res) => {
  170. uni.showToast({
  171. title: "提交成功",
  172. icon: "none"
  173. })
  174. this.showMessage=false
  175. //this.getInfo();
  176. var user=this.carhelp.getPersonInfo()
  177. this.showMessageItem.listShareComment.unshift({
  178. userName:user.name,
  179. content:this.content,
  180. userId:user.id
  181. })
  182. //this.getNewsCommentsList(true)
  183. }).catch(error => {
  184. uni.showToast({
  185. title: error,
  186. icon: "none"
  187. })
  188. })
  189. },
  190. showMessageBtn(item){
  191. this.showMessage=true;
  192. this.showMessageId=item.id;
  193. this.showMessageItem=item
  194. this.content=""
  195. },
  196. changeLikes(info) {
  197. var userInfo = this.carhelp.getPersonInfo()
  198. if (!userInfo) {
  199. return
  200. }
  201. if (!info.isLike) {
  202. uni.showLoading({
  203. title: "加载中",
  204. mask: true,
  205. })
  206. API.changeLikes({
  207. shareId: info.id
  208. }).then((res) => {
  209. info.isLike = true;
  210. info.likesNum++;
  211. var user=this.carhelp.getPersonInfo()
  212. info.listShareLikes.unshift({
  213. userName:user.name
  214. })
  215. uni.hideLoading();
  216. //this.getInfo(true)
  217. }).catch(error => {
  218. uni.showToast({
  219. title: error,
  220. icon: "none"
  221. })
  222. })
  223. } else {
  224. uni.showToast({
  225. title: "您已经点过赞了",
  226. icon: "none"
  227. })
  228. }
  229. },
  230. getInfo(){
  231. uni.showLoading({
  232. title: "加载中",
  233. mask: true,
  234. })
  235. API.details({
  236. id:this.id
  237. }).then((res) => {
  238. uni.hideLoading();
  239. var item=res.data.share
  240. item.listShareLikes=res.data.likesList.data
  241. item.listShareComment=res.data.commentList.data
  242. item.likesNum=res.data.likesList.data.length
  243. item.commentNum=res.data.commentList.data.length
  244. // var share=res.data.share;
  245. // this.likesList=res.data.likesList;
  246. // this.commentList=res.data.commentList;
  247. this.list=[item]
  248. }).catch(error => {
  249. uni.showToast({
  250. title: error,
  251. icon: "none"
  252. })
  253. })
  254. },
  255. }
  256. }
  257. </script>
  258. <style lang="scss" scoped>
  259. .showMessage{
  260. padding: 60rpx 50rpx ;
  261. .showMessage2{
  262. background-color: #E5E7EA;
  263. margin: 40rpx 0;
  264. textarea{
  265. padding: 8rpx;
  266. border-radius:34px;
  267. }
  268. }
  269. }
  270. .messageListMain{
  271. border-radius: 4px;
  272. background-color: rgba(240, 240, 240, 1);
  273. color: #224466 ;
  274. .mLikeList{
  275. padding:16rpx;
  276. border-bottom: 1px solid rgba(222, 222, 222, 1);
  277. }
  278. .messageList{
  279. padding:16rpx;
  280. .messageItem{
  281. // display: flex;
  282. // flex-wrap: wrap;
  283. .mItemTitleColor{
  284. color:#03a9f4;
  285. margin-left: 8rpx;
  286. }
  287. .mItemBody{
  288. color: #101010;
  289. }
  290. }
  291. .messageItemEnd{
  292. text-align: center;
  293. color: #9E9E9E;
  294. }
  295. }
  296. }
  297. .red {
  298. color: red !important;
  299. }
  300. .like {
  301. margin-top: 16rpx;
  302. line-height: 24px;
  303. display: flex;
  304. color:#224466 ;
  305. .number {
  306. margin-left: 16rpx;
  307. }
  308. }
  309. page {
  310. background-color: #fff;
  311. padding-bottom: 100px;
  312. }
  313. .image {
  314. padding: 0 32rpx;
  315. margin: 24rpx 0;
  316. }
  317. .tabs {
  318. background-color: rgba(255, 255, 255, 1);
  319. padding: 0 32rpx;
  320. /deep/.u-tab-item {
  321. flex: none !important;
  322. margin-right: 32rpx;
  323. }
  324. /deep/.u-tabs-scorll-flex {
  325. justify-content: start;
  326. }
  327. }
  328. // 分享内容
  329. .share-content {
  330. margin: 48rpx 32rpx 0 32rpx;
  331. background: #fff;
  332. .item {
  333. padding-bottom: 32rpx;
  334. border-bottom: 1px solid rgba(232, 232, 232, 1);
  335. margin-top: 48rpx;
  336. font-family: 'Regular';
  337. .infos {
  338. display: flex;
  339. justify-content: space-between;
  340. align-items: center;
  341. .person {
  342. display: flex;
  343. align-items: center;
  344. .photo {
  345. img {
  346. width: 64rpx;
  347. height: 64rpx;
  348. border-radius: 50px;
  349. }
  350. }
  351. .name {
  352. color: rgba(51, 51, 51, 1);
  353. font-size: 16px;
  354. margin-left: 24rpx;
  355. font-family: 'Medium';
  356. }
  357. }
  358. }
  359. .share-text {
  360. margin-top: 24rpx;
  361. color: #101010;
  362. font-size: 16px;
  363. line-height: 22px;
  364. }
  365. .pictures {
  366. display: flex;
  367. justify-content: start;
  368. flex-wrap: wrap;
  369. margin-top: 16rpx;
  370. .videoplay {
  371. height: 400rpx;
  372. }
  373. video {
  374. width: 100%;
  375. height: 200rpx;
  376. border-radius: 16rpx;
  377. margin-bottom: 16rpx;
  378. margin-left: 16rpx;
  379. }
  380. .img {
  381. width: 31%;
  382. height: 216rpx;
  383. border-radius: 16rpx;
  384. margin-bottom: 16rpx;
  385. margin-left: 16rpx;
  386. }
  387. img {
  388. width: 31%;
  389. height: 216rpx;
  390. border-radius: 16rpx;
  391. margin-bottom: 16rpx;
  392. margin-left: 16rpx;
  393. }
  394. }
  395. .video {
  396. margin-top: 16rpx;
  397. uni-video {
  398. width: 100%;
  399. height: 380rpx;
  400. border-radius: 8px;
  401. }
  402. }
  403. .tagMain {
  404. display: flex;
  405. justify-content: space-between;
  406. .likeMain{
  407. display: flex;
  408. }
  409. .tag {
  410. margin-top: 16rpx;
  411. line-height: 24px;
  412. .symbol {
  413. color: rgba(31, 74, 153, 100);
  414. font-size: 16px
  415. }
  416. .text {
  417. color: rgba(31, 74, 153, 1);
  418. margin-left: 14rpx;
  419. }
  420. }
  421. }
  422. }
  423. }
  424. .item:last-of-type {
  425. border: none;
  426. margin-bottom: 26rpx;
  427. }
  428. .bottom {
  429. z-index: 999;
  430. background: linear-gradient(223.81deg, rgba(0, 90, 217, 1) 14.24%, rgba(0, 52, 148, 1) 86.67%);
  431. width: 104rpx;
  432. height: 104rpx;
  433. border-radius: 50px;
  434. display: flex;
  435. justify-content: center;
  436. align-items: center;
  437. position: fixed;
  438. right: 72rpx;
  439. bottom: 72rpx;
  440. img {
  441. width: 56rpx;
  442. height: 56rpx;
  443. }
  444. }
  445. </style>