my-praise.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <view class="my-praise-box">
  3. <view class="" v-show="false">
  4. <view class="publish-box" v-show="publishBoxOff">
  5. <image class="publish-img sys-radius-12" src="/static/img/circle/1.png" mode=""></image>
  6. <view class="publish-text">
  7. <view class="publish-title sys-color-black-0 sys-weight-400 sys-size-34">
  8. 不太正经的机车照片
  9. </view>
  10. <view class="sys-size-28 sys-weight-400 sys-color-gray-9">
  11. 记录在自由路.上的轰鸣瞬间
  12. </view>
  13. </view>
  14. <view class="publish-button sys-background-FF9F14 sys-radius-200 sys-size-28 sys-color-white">
  15. 去发布
  16. </view>
  17. <view class="off-button sys-background-F2F2F2 sys-radius-round-left-80" @click="publishOff">
  18. <image class="off-img" src="/static/img/circle/off.png" mode=""></image>
  19. </view>
  20. </view>
  21. </view>
  22. <scroll-view class="recommended-box" scroll-x="true" v-show="false">
  23. <view class="recommended-list" v-for="(item,i) in listTwo" :key="i" @click="goRecommended">
  24. <image class="recommended-list-img sys-radius-16" :src="item.img" mode=""></image>
  25. <view class="recommended-list-name">
  26. <image class="list-name-img" src="/static/dgex-tantan/like.png" mode=""></image>
  27. <view class="sys-color-white sys-size-28">
  28. {{item.text}}
  29. </view>
  30. </view>
  31. <view class="recommended-list-text">
  32. <view class="recommended-list-text-left">
  33. <!-- <image v-for="imgs in item.icon" class="list-text-left-img sys-radius-8" :src="imgs" mode=""></image> -->
  34. <image v-for="imgs in item.icon" class="list-text-left-img sys-radius-8" src="/static/img/temporary/1.png"
  35. mode=""></image>
  36. </view>
  37. <view class="recommended-list-text-right">
  38. <view class="sys-size-24 sys-color-white">
  39. {{item.num}}人在这里
  40. </view>
  41. <uni-icons type="forward" size="12" color="#fff"></uni-icons>
  42. </view>
  43. </view>
  44. </view>
  45. </scroll-view>
  46. <view class="praise-item" @click="goToDetails" v-for="(item,itemIndex) in list">
  47. <view class="praise-left">
  48. <image class="praise-head" :src="item.avatar" mode="aspectFill"></image>
  49. </view>
  50. <view class="praise-right">
  51. <view class="praise-top-data">
  52. <view class="praise-top-left">
  53. <view class="praise-top-left-title">
  54. <view class="left-title-text sys-height-44 sys-color-black sys-weight-600">{{item.nickname}}</view>
  55. <view class="left-title-vip">
  56. <image class="left-title-vip-img" src="/static/img/my/vip.png" mode="heightFix"></image>
  57. </view>
  58. </view>
  59. <view class="left-title-time sys-color-gray-9">{{item.createdAt}}发布</view>
  60. </view>
  61. <view class="praise-top-right">
  62. <call :user-id="item.userId"></call>
  63. </view>
  64. </view>
  65. <view class="right-text sys-color-black sys-weight-400">
  66. {{item.content}}
  67. </view>
  68. <view class="right-img">
  69. <view class="one-img" v-if="item.galleryUrls.length===1">
  70. <img-one :file-list="item.galleryUrls"></img-one>
  71. </view>
  72. <view class="two-img" v-else-if="item.galleryUrls.length===2 || item.galleryUrls.length===4">
  73. <img-two :file-list="item.galleryUrls"></img-two>
  74. </view>
  75. <view class="three-img" v-else>
  76. <img-three :type="2" :file-list="item.galleryUrls"></img-three>
  77. </view>
  78. </view>
  79. <view class="right-tag-list" v-if="false">
  80. <dynamic-tag :list="item.tag" :tag-bg="tagBg" :tag-color="tagColor"></dynamic-tag>
  81. </view>
  82. <view class="right-operation-list">
  83. <view class="operation-share">
  84. <view class="operation-item">
  85. <view class="operation-icon"><text class="iconfont" :style="{'color':operateColor}">&#xe624;</text></view>
  86. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">分享</view>
  87. </view>
  88. </view>
  89. <view class="operation-items">
  90. <view class="operation-item">
  91. <view class="operation-icon" @click="setLike(itemIndex)">
  92. <text class="iconfont icon-dianzan" v-if="!item.liked" :style="{'color':operateColor}"> &#xe8ad;</text>
  93. <text class="iconfont icon-dianzan1" v-else :style="{'color':'#ED301D'}"> &#xe8c3;</text>
  94. </view>
  95. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">
  96. {{item.likeCount>0?item.likeCount:'点赞'}}</view>
  97. </view>
  98. <view class="operation-item">
  99. <view class="operation-icon"><text class="iconfont icon-pinglun"
  100. :style="{'color':operateColor}">&#xe891;</text></view>
  101. <view class="operation-text sys-weight-400" :style="{'color':operateColor}">
  102. {{item.commentCount>0?item.commentCount:'评论'}}</view>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. </template>
  110. <script>
  111. import ImgOne from "@/pages/common/img/img-one";
  112. import ImgTwo from "@/pages/common/img/img-two";
  113. import ImgThree from "@/pages/common/img/img-three";
  114. import DynamicTag from "@/pages/common/tag/dynamic-tag";
  115. import Call from "@/pages/common/call/call";
  116. import {
  117. setLike,
  118. setUnLike
  119. } from "@/api/community";
  120. import {
  121. getMyLikeMoments,
  122. getMyMoments
  123. } from "@/api/my";
  124. import tools from "@/service/tools";
  125. export default {
  126. name: "my-praise",
  127. components: {
  128. Call,
  129. DynamicTag,
  130. ImgThree,
  131. ImgTwo,
  132. ImgOne
  133. },
  134. props: {
  135. tagNum: {},
  136. },
  137. data() {
  138. return {
  139. tagBg: '#F2F2F2',
  140. tagColor: '#999999',
  141. operateColor: '#999999',
  142. list: [
  143. ],
  144. listTwo: [
  145. ],
  146. publishBoxOff: true,
  147. isAjax: false,
  148. total: undefined,
  149. page: 1,
  150. }
  151. },
  152. watch: {},
  153. mounted() {
  154. this.startList()
  155. },
  156. methods: {
  157. startList() {
  158. if (this.userId <= 0) {
  159. // return false
  160. }
  161. this.list = []
  162. this.isAjax = false
  163. this.total = undefined
  164. this.page = 1
  165. this.getMyLikeMoments()
  166. },
  167. getMyLikeMoments() {
  168. if (this.isAjax) {
  169. return
  170. }
  171. this.isAjax = true
  172. let that = this
  173. getMyLikeMoments({
  174. 'userId': this.userId,
  175. 'pageNo': this.page,
  176. 'pageSize': 20
  177. }).then((res) => {
  178. this.isAjax = false
  179. if (res.code === 0) {
  180. res.data.data.forEach((item) => {
  181. item.dateArr = tools.getDateArr(item.createdAt)
  182. that.list.push(item)
  183. })
  184. ++that.page
  185. that.total = res.data.total
  186. }
  187. })
  188. },
  189. setLike(index) {
  190. this.list[index].liked = !this.list[index].liked
  191. if (this.list[index].liked) {
  192. ++this.list[index].likeCount
  193. setLike(this.list[index].id).then((res) => {})
  194. } else {
  195. --this.list[index].likeCount
  196. setUnLike(this.list[index].id).then((res) => {})
  197. }
  198. },
  199. goToDetails() {
  200. uni.navigateTo({
  201. 'url': '/pages/circle/circle'
  202. })
  203. },
  204. goRecommended() {
  205. uni.navigateTo({
  206. 'url': '/pages/circle/recommended'
  207. })
  208. },
  209. publishOff() {
  210. this.publishBoxOff = false
  211. console.log(this.publishBoxOff);
  212. },
  213. }
  214. }
  215. </script>
  216. <style scoped lang="scss">
  217. .my-praise-box {
  218. .publish-box {
  219. width: 100%;
  220. // height: 100%;
  221. display: flex;
  222. border-top: 20rpx solid #FAFAFA;
  223. border-bottom: 20rpx solid #FAFAFA;
  224. padding: 32rpx;
  225. justify-content: space-between;
  226. position: relative;
  227. align-items: center;
  228. box-sizing: border-box;
  229. .publish-img {
  230. width: 120rpx;
  231. height: 120rpx;
  232. flex-shrink: 0;
  233. }
  234. .publish-text {
  235. .publish-title {
  236. margin: 0 0 8rpx 0;
  237. }
  238. }
  239. .publish-button {
  240. flex-shrink: 0;
  241. padding: 6rpx 32rpx;
  242. }
  243. .off-button {
  244. position: absolute;
  245. right: 0;
  246. top: 0;
  247. padding: 0rpx 2rpx 6rpx 12rpx;
  248. .off-img {
  249. width: 24rpx;
  250. height: 24rpx;
  251. }
  252. }
  253. }
  254. .recommended-box {
  255. box-sizing: border-box;
  256. width: 100%;
  257. padding: 0 24rpx;
  258. display: flex;
  259. align-items: center;
  260. white-space: nowrap;
  261. .recommended-list {
  262. display: inline-block;
  263. width: 320rpx;
  264. height: 160rpx;
  265. margin: 0 8rpx;
  266. padding: 16rpx 4rpx 16rpx 12rpx;
  267. box-sizing: border-box;
  268. position: relative;
  269. // flex-shrink: 0;
  270. .recommended-list-img {
  271. width: 100%;
  272. height: 100%;
  273. position: absolute;
  274. left: 0;
  275. top: 0;
  276. z-index: -1;
  277. }
  278. .recommended-list-name {
  279. display: flex;
  280. align-items: center;
  281. .list-name-img {
  282. width: 28rpx;
  283. height: 28rpx;
  284. margin: 0 10rpx 0 0;
  285. }
  286. }
  287. .recommended-list-text {
  288. width: 100%;
  289. padding: 0 4rpx 0 16rpx;
  290. box-sizing: border-box;
  291. position: absolute;
  292. bottom: 16rpx;
  293. left: 0;
  294. display: flex;
  295. align-items: center;
  296. justify-content: space-between;
  297. .recommended-list-text-left {
  298. display: flex;
  299. align-items: center;
  300. .list-text-left-img {
  301. width: 40rpx;
  302. height: 40rpx;
  303. margin: 0 4rpx 0 0;
  304. }
  305. }
  306. .recommended-list-text-right {
  307. display: flex;
  308. align-items: center;
  309. }
  310. }
  311. }
  312. }
  313. .praise-item {
  314. padding: 0 32rpx;
  315. margin: 40rpx 0 4rpx 0;
  316. border-bottom: 1rpx solid #F2F2F2;
  317. display: flex;
  318. justify-content: space-between;
  319. .praise-left {
  320. width: 80rpx;
  321. .praise-head {
  322. width: 80rpx;
  323. height: 80rpx;
  324. border-radius: 60rpx;
  325. }
  326. }
  327. .praise-right {
  328. width: calc(100% - 80rpx);
  329. padding-left: 22rpx;
  330. .praise-top-data {
  331. display: flex;
  332. justify-content: space-between;
  333. .praise-top-left {
  334. .praise-top-left-title {
  335. display: flex;
  336. justify-content: flex-start;
  337. align-items: center;
  338. .left-title-text {
  339. font-size: 32rpx;
  340. margin-right: 8rpx;
  341. flex-shrink: 0;
  342. }
  343. .left-title-vip-img {
  344. height: 28rpx;
  345. }
  346. }
  347. .left-title-time {
  348. margin-top: 8rpx;
  349. line-height: 34rpx;
  350. font-size: 24rpx;
  351. }
  352. }
  353. }
  354. .right-text {
  355. margin-top: 24rpx;
  356. font-size: 28rpx;
  357. height: 40rpx;
  358. line-height: 40rpx;
  359. }
  360. .right-img {
  361. margin-top: 16rpx;
  362. }
  363. .right-tag-list {
  364. margin-top: 8rpx;
  365. }
  366. .right-operation-list {
  367. margin-top: 44rpx;
  368. padding-bottom: 42rpx;
  369. display: flex;
  370. justify-content: space-between;
  371. .operation-share {
  372. .operation-item:first-child {
  373. .operation-icon {
  374. text {
  375. font-size: 30rpx;
  376. }
  377. }
  378. }
  379. }
  380. .operation-items {
  381. display: flex;
  382. justify-content: flex-start;
  383. .operation-item:first-child {
  384. .operation-text {
  385. width: 100rpx;
  386. }
  387. }
  388. .operation-item:last-child {
  389. .operation-text {
  390. width: 80rpx;
  391. }
  392. }
  393. }
  394. .operation-item {
  395. display: flex;
  396. justify-content: flex-start;
  397. .operation-icon {
  398. width: 40rpx;
  399. height: 40rpx;
  400. margin-right: 8rpx;
  401. text {
  402. font-size: 40rpx;
  403. line-height: 40rpx;
  404. }
  405. }
  406. .operation-text {
  407. height: 40rpx;
  408. line-height: 41rpx;
  409. font-size: 26rpx;
  410. }
  411. }
  412. }
  413. }
  414. }
  415. }
  416. </style>