my-publish.vue 14 KB

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