my-praise.vue 11 KB

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