circle-info.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  1. <template>
  2. <view class="circle-info-box iPhone-bottom flex-common-css box-border-box bgc-f">
  3. <view class="nav-box bgc-f">
  4. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  5. <template>
  6. <view slot="custom" class="display-flex ">
  7. <image class="nav-img" @click="toBack()" src="@/static/img/takeout/bg-back.png" mode="scaleToFill"></image>
  8. <view class="info-nav display-flex">
  9. <image :src="obj.head_img" mode=""></image>
  10. <view class="">
  11. <view class="fs-32 fw-600 w348 text-overflow-ellipsis-one">{{obj.nickname||''}}</view>
  12. <view class="fs-24 fc-9 fw-400">{{obj.created_date||''}}</view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. </Nav>
  18. </view>
  19. <scroll-view scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  20. <view class="box-border-box mb-26" v-if="obj.image.length > 0">
  21. <swiper class="swiper mb-32 " circular indicator-dots indicator-active-color="#4FB3EF" :autoplay="true" :interval="3000" :duration="500">
  22. <swiper-item v-for="(item,i) in obj.image" :key="i">
  23. <image class="swiper-item" :src="item" mode="aspectFill"></image>
  24. </swiper-item>
  25. </swiper>
  26. </view>
  27. <view class="box-border-box bz-box bgc-f b-b-F9F9F9 mt-24">
  28. <view class="fs-30 fw-600 mb-32">{{obj.content||''}}</view>
  29. <view class="card-4 flex-wrap-wrap">
  30. <view class="">{{obj.school_name||''}}</view>
  31. <view class="">{{obj.topic_name||''}}</view>
  32. </view>
  33. </view>
  34. <view v-if="list.length == 0" class="scroll-view-css">
  35. <EnBlank :customSrc='true'>
  36. <template v-slot:blankImg>
  37. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  38. </template>
  39. </EnBlank>
  40. </view>
  41. <view v-else class="pop-box pop-msg box-border-box p-24">
  42. <view class=" box-border-box plr-24">
  43. <view class="list-box flex-justify-space" v-for="(item,i) in list" :key="i">
  44. <image class="list-box-img" src="@/static/img/my/bg.png" mode="scaleToFill"></image>
  45. <view class="flex-1 p-b-20">
  46. <view class=" flex-justify-space">
  47. <view class=" b-b-F9F9F9 mr-20">
  48. <view class="fs-28 fw-400 fc-9 mb-8 align-items-center">
  49. {{item.nickname}}
  50. <span v-if="item.is_author == 1" class='only-box text-align-center fs-24 fc-41ABF5 ml-10'>作者</span>
  51. <view class="ml-10" v-if="item.is_self == 1" @click="delInfo(item)">
  52. <uni-icons type="trash" size="18"></uni-icons>
  53. </view>
  54. </view>
  55. <view class="fs-30 fw-400 mb-8" @click.stop="openInput(1,item)">
  56. {{item.content}}
  57. </view>
  58. <view class="fs-24 fw-400 fc-9 mb-8">{{item.created_date}}</view>
  59. </view>
  60. <view class="display-flex" @click.stop="handUp(2,item)">
  61. <uni-icons type="hand-up" size="20" :color="item.is_like==1?'#FD5C02':'#999'"></uni-icons>
  62. <view class="fs-24 fw-400 mt-5" :class="item.is_like==1?'fc-FD5C02':'fc-9'">{{item.like}}</view>
  63. </view>
  64. </view>
  65. <view v-if="item.isOpen" class="fs-24 fc-6 text-align-center mb-12" @click="openReply(1,item)">展开更多评论</view>
  66. <!-- 回复 -->
  67. <view class="mb-16" v-if="item.replyList.length > 0">
  68. <view class="list-box flex-justify-space" v-for="(info,index) in item.replyList" :key="index">
  69. <image class="list-box-img" src="@/static/img/my/bg.png" mode="scaleToFill"></image>
  70. <view class="flex-1">
  71. <view class=" flex-justify-space">
  72. <view class=" b-b-F9F9F9 mr-20">
  73. <view class="fs-28 fw-400 fc-9 mb-8 align-items-center">
  74. {{info.nickname}}
  75. <span v-if="info.is_author == 1" class='only-box text-align-center fs-24 fc-41ABF5 ml-10'>作者</span>
  76. <view class="ml-10" v-if="info.is_self == 1" @click="delInfo(info)">
  77. <uni-icons type="trash" size="18"></uni-icons>
  78. </view>
  79. </view>
  80. <view class="fs-30 fw-400 mb-8" @click.stop="openInput(2,info)">
  81. {{info.content}}
  82. </view>
  83. <view class="fs-24 fw-400 fc-9 mb-8">{{info.created_date}}</view>
  84. </view>
  85. <view class="display-flex" @click.stop="handUp(2,info)">
  86. <uni-icons type="hand-up" size="20" :color="info.is_like==1?'#FD5C02':'#999'"></uni-icons>
  87. <view class="fs-24 fw-400 mt-5" :class="info.is_like==1?'fc-FD5C02':'fc-9'">{{info.like}}</view>
  88. </view>
  89. </view>
  90. </view>
  91. </view>
  92. <view v-if="item.replyList.length < item.count" class="fs-24 fc-6 text-align-center mb-12" @click="openReply(2,item)">展开更多评论</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </scroll-view>
  99. <view class="card-5 flex-justify-space box-border-box boder-b-t">
  100. <view class="input-box-box fs-28 fc-9 mr-20" @click.stop="openInput(0,'')">友善评论,文明发言</view>
  101. <view class="flex-1 display-flex">
  102. <view class="align-items-center mr-20" @click.stop="handUp(1,obj)">
  103. <uni-icons type="hand-up" size="22" :color="obj.is_like==1?'#FD5C02':'#999'"></uni-icons>
  104. <view class="fs-24 " :class="obj.is_like==1?'fc-FD5C02':'fc-9'">{{obj.like}}</view>
  105. </view>
  106. <view class="align-items-center" @click.stop="openRepot(obj)">
  107. <image src="@/static/img/school/info.png" mode=""></image>
  108. <view class="fs-24 fc-9">举报</view>
  109. </view>
  110. </view>
  111. </view>
  112. <uni-popup ref="popup" type="bottom">
  113. <view class="pop-input">
  114. <view class="head-pop flex-justify-space align-items-center mb-24 box-border-box p-24">
  115. <view class="fs-28 fw-600 fc-41ABF5"></view>
  116. <view class="fs-36 fc-0 fw-600">评论</view>
  117. <uni-icons @click="closeInput()" type="closeempty" size="24"></uni-icons>
  118. </view>
  119. <view class="scroll-view-css">
  120. <view class="bgc-f box-border-box p-32">
  121. <view class="fs-34 fw-600 mb-20">评论</view>
  122. <textarea v-model="msgData.content" maxlength="100" class=" fs-24" placeholder='友善评论,文明发言'></textarea>
  123. </view>
  124. </view>
  125. <view class="box-border-box p-24">
  126. <view class="save-box" @click.stop="save()">评论</view>
  127. </view>
  128. </view>
  129. </uni-popup>
  130. <uni-popup ref="popupRepot" type="bottom">
  131. <view class="pop-box pop-h-30 box-border-box p-24">
  132. <view class="head-pop flex-justify-space align-items-center mb-24">
  133. <uni-icons @click.stop="closePop(1)" type="closeempty" size="24"></uni-icons>
  134. <view class="fs-36 fc-0 fw-600">请输入举报内容</view>
  135. <view class="fs-28 fw-600 fc-41ABF5">确定</view>
  136. </view>
  137. <view class="scroll-view-css">
  138. <textarea style="height: 100%;" v-model="reportData.content" class=" fs-24" :maxlength='50' placeholder='请输入举报内容'></textarea>
  139. </view>
  140. <view @click.stop="closePop(2)" class="b-bottom text-align-center fs-32 fw-600 fc-f">确认举报</view>
  141. </view>
  142. </uni-popup>
  143. </view>
  144. </template>
  145. <script>
  146. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  147. import {alumnInfo,getRemarkList,setAlumniLike,delRemark,setCreateRemark,setRemarkLike,alumniReport} from '@/api/alumni.js';
  148. import tools from "@/service/tools";
  149. export default {
  150. components:{EnBlank},
  151. data(){
  152. return{
  153. isAJAX:false,
  154. news_id:'',
  155. obj:{
  156. image:[],
  157. },
  158. list:[],
  159. page:1,
  160. total:0,
  161. // 发起评论
  162. msgData:{
  163. news_id:'',
  164. remark_id:'',
  165. content:'',
  166. reply_id:'',
  167. },
  168. // 回复评论
  169. replyData:{
  170. page:1,
  171. },
  172. // 举报
  173. reportData:{
  174. news_id:'',
  175. content:'',
  176. },
  177. }
  178. },
  179. onLoad(e) {
  180. this.news_id = e.news_id;
  181. this.msgData.news_id = e.news_id;
  182. this.getInfo();
  183. this.getList();
  184. },
  185. methods:{
  186. toBack(){
  187. tools.leftClick()
  188. },
  189. getInfo(){
  190. alumnInfo({news_id:this.news_id}).then((res)=>{
  191. if(res.code === 1){
  192. this.obj = res.data;
  193. }
  194. })
  195. },
  196. scrolltolower(){
  197. if(this.list.length < this.total){
  198. this.page += 1;
  199. this.getList();
  200. }
  201. },
  202. getList(){
  203. getRemarkList({news_id:this.news_id,remark_id:0,page:this.page}).then((res)=>{
  204. if(res.code === 1){
  205. this.list = [...this.list,...res.data.items];
  206. this.total = res.data.total;
  207. this.list.forEach((v)=>{
  208. v.replyList = [];
  209. if(v.count > 0){
  210. v.isOpen = true;
  211. }
  212. })
  213. }
  214. })
  215. },
  216. // 获取回复列表
  217. openReply(type,item){
  218. // type 1获取其他 2加载更多
  219. if(this.isAJAX){
  220. return
  221. }
  222. this.isAJAX = true;
  223. if(type == 1){
  224. item.replyList = [];
  225. this.replyData.page = 1;
  226. }else{
  227. this.replyData.page += 1;
  228. }
  229. getRemarkList({news_id:item.news_id,remark_id:item.id,page:this.replyData.page}).then((res)=>{
  230. if(res.code === 1){
  231. this.isAJAX = false;
  232. item.replyList = [...item.replyList,...res.data.items];
  233. item.isOpen = false;
  234. }else{
  235. this.isAJAX = false;
  236. tools.error(res.msg)
  237. }
  238. })
  239. },
  240. // 点赞
  241. handUp(type,item){
  242. if(this.isAJAX){
  243. return
  244. }
  245. this.isAJAX = true;
  246. let is_like = item.is_like == 1?0:1;
  247. if(type == 1){
  248. // 点赞贴子
  249. setAlumniLike({news_id:item.news_id,is_like:is_like}).then((res)=>{
  250. this.handUpFun(res,item,is_like)
  251. })
  252. }else{
  253. // 点赞评论
  254. setRemarkLike({news_id:item.news_id,is_like:is_like,remark_id:item.id}).then((res)=>{
  255. this.handUpFun(res,item,is_like)
  256. })
  257. }
  258. },
  259. // 点赞公共回复
  260. handUpFun(res,item,is_like){
  261. if(res.code === 1){
  262. item.is_like = is_like;
  263. if(is_like == 0){
  264. item.like -= 1
  265. }else{
  266. item.like += 1
  267. }
  268. this.isAJAX = false;
  269. tools.success(res.msg);
  270. }else{
  271. this.isAJAX = false;
  272. tools.error(res.msg);
  273. }
  274. },
  275. openInput(type,item){
  276. if(type == 0){
  277. this.msgData.remark_id = 0;
  278. }else if(type == 1){
  279. this.msgData.remark_id = item.id;
  280. this.msgData.reply_id = item.m_id;
  281. }else{
  282. this.msgData.remark_id = item.remark_id;
  283. this.msgData.reply_id = item.m_id;
  284. }
  285. this.$refs.popup.open();
  286. },
  287. closeInput(){
  288. this.$refs.popup.close();
  289. this.msgData.remark_id = '';
  290. this.msgData.content = '';
  291. this.msgData.reply_id = '';
  292. },
  293. save(){
  294. if(this.isAJAX){
  295. return
  296. }
  297. this.isAJAX = true;
  298. setCreateRemark(this.msgData).then((res)=>{
  299. if(res.code == 1){
  300. tools.success('评论成功')
  301. setTimeout(()=>{
  302. this.isAJAX = false;
  303. this.closeInput()
  304. this.list = [];
  305. this.page = 1;
  306. this.getList();
  307. },1500)
  308. }else{
  309. this.isAJAX = false;
  310. tools.error(res.msg)
  311. }
  312. })
  313. },
  314. delInfo(item){
  315. if(this.isAJAX){
  316. return
  317. }
  318. this.isAJAX = true;
  319. delRemark({remark_id:item.id}).then((res)=>{
  320. if(res.code === 1){
  321. tools.success('删除成功')
  322. setTimeout(()=>{
  323. this.isAJAX = false;
  324. this.list = [];
  325. this.page = 1;
  326. this.getList();
  327. },1500)
  328. }else{
  329. this.isAJAX = false;
  330. tools.error(res.msg)
  331. }
  332. })
  333. },
  334. // 打开举报
  335. openRepot(item){
  336. this.reportData.news_id = item.news_id;
  337. this.$refs.popupRepot.open();
  338. },
  339. // 举报
  340. closePop(type){
  341. if(type === 1){
  342. this.reportData.news_id = '';
  343. this.reportData.content = '';
  344. this.$refs.popupRepot.close();
  345. }else{
  346. if(this.isAJAX){
  347. return
  348. }
  349. this.isAJAX = true;
  350. alumniReport(this.reportData).then((res)=>{
  351. if(res.code === 1){
  352. tools.success(res.msg)
  353. setTimeout(()=>{
  354. this.isAJAX = false;
  355. this.closePop(1);
  356. },1000)
  357. }else{
  358. tools.error(res.msg);
  359. this.isAJAX = false;;
  360. }
  361. })
  362. }
  363. },
  364. },
  365. }
  366. </script>
  367. <style scoped lang="scss">
  368. .circle-info-box{
  369. .boder-b-t{
  370. border-top: 1rpx solid #F2F2F2;
  371. }
  372. .card-5{
  373. padding: 20rpx 24rpx 0 24rpx;
  374. image{
  375. width: 40rpx;
  376. height: 40rpx;
  377. margin-right: 8rpx;
  378. }
  379. .input-box-box{
  380. width: 436rpx;
  381. height: 72rpx;
  382. line-height: 72rpx;
  383. background: #F2F2F2;
  384. border-radius: 200rpx;
  385. box-sizing: border-box;
  386. padding: 0 24rpx;
  387. }
  388. }
  389. .w348{
  390. width: 348rpx;
  391. }
  392. .nav-box{
  393. z-index: 99;
  394. padding-bottom: 10rpx;
  395. .nav-img{
  396. width: 56rpx;
  397. height: 56rpx;
  398. margin-right: 30rpx;
  399. }
  400. .info-nav{
  401. image{
  402. width: 64rpx;
  403. height: 64rpx;
  404. border-radius: 50%;
  405. margin-right: 20rpx;
  406. }
  407. }
  408. }
  409. .swiper{
  410. width: 100%rpx;
  411. height: 920rpx;
  412. .swiper-item{
  413. width: 100%;
  414. height: 920rpx;
  415. background-color: skyblue;
  416. }
  417. }
  418. .bz-box{
  419. padding: 0 32rpx 20rpx 32rpx;
  420. .card-4{
  421. view{
  422. padding: 4rpx 16rpx;
  423. background: #F2F2F2;
  424. border-radius: 200rpx;
  425. font-size: 24rpx;
  426. color: #999;
  427. margin-right: 20rpx;
  428. margin-bottom: 10rpx;
  429. }
  430. }
  431. }
  432. .pop-input{
  433. z-index: 100;
  434. width: 100%;
  435. height: 70vh;
  436. background-color: #fff;
  437. bottom: 0;
  438. left: 0;
  439. border-top: 1rpx solid #ccc;
  440. border-radius: 20rpx 20rpx 0 0;
  441. display: flex;
  442. flex-direction: column;
  443. .save-box{
  444. text-align: center;
  445. line-height: 88rpx;
  446. font-weight: 600;
  447. font-size: 32rpx;
  448. color: #FFFFFF;
  449. width: 100%;
  450. height: 80rpx;
  451. border-radius: 200rpx;
  452. background: linear-gradient( 105deg, #57CAFF 0%, #41ABF5 100%);
  453. }
  454. }
  455. .pop-box{
  456. width: 100%;
  457. height: 50vh;
  458. background-color: #fff;
  459. border-radius: 24rpx 24rpx 0rpx 0rpx;
  460. display: flex;
  461. flex-direction: column;
  462. .item-box{
  463. width: 100%;
  464. height: 92rpx;
  465. border-radius: 200rpx;
  466. line-height: 92rpx;
  467. text-align: center;
  468. margin-bottom: 24rpx;
  469. }
  470. }
  471. .pop-msg{
  472. // height: 70vh;
  473. .head-pop{
  474. padding-bottom: 34rpx !important;
  475. border-bottom: 1rpx solid #F2F2F2;
  476. }
  477. .list-box{
  478. .list-box-img{
  479. width: 80rpx;
  480. height: 80rpx;
  481. border-radius: 50%;
  482. margin-right: 16rpx;
  483. }
  484. .only-box{
  485. padding: 4rpx 16rpx;
  486. background: rgba(65,171,245,0.1);
  487. border-radius: 8rpx 8rpx 8rpx 8rpx;
  488. }
  489. .msg-img{
  490. width: 144rpx;
  491. height: 144rpx;
  492. border-radius: 12rpx;
  493. margin-right:5rpx;
  494. margin-bottom: 5rpx;
  495. }
  496. .msg-img:nth-child(3n){
  497. margin-right: 0rpx;
  498. }
  499. .msg-img-1{
  500. width: 100rpx !important;
  501. height: 100rpx !important;
  502. }
  503. }
  504. }
  505. }
  506. </style>