circle-info.vue 15 KB

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