circle-info.vue 17 KB

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