filesonicInfo.vue 12 KB

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