Kudos.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="kudos">
  3. <!-- 点赞列表 -->
  4. <view class="msg-null" v-if="List.length == 0 ">
  5. <image src="https://t9.9026.com/imgs/dataNull.png" style="width: 394rpx;height: 396rpx;" mode=""></image>
  6. <view class="msg-null-text">
  7. <text>暂无数据</text>
  8. </view>
  9. </view>
  10. <view class="List" v-if="List.length > 0">
  11. <view class="ListItem" v-for="(item,index) in List" :key="index" @click="goVoteDetail(item.id)">
  12. <image :src="item.cover_img" style="width: 640rpx;height:420rpx;border-radius: 12rpx;"></image>
  13. <view class="kudosicon">
  14. <image src="/static/icon/Kudos.png" v-if="item.is_like!=1" @click.stop="clickKudos(item.id,index)"></image>
  15. <image src="/static/icon/Kudos(1).png" v-if="item.is_like==1" @click.stop="clickKudos(item.id,index)"></image>
  16. </view>
  17. <view class="nav">
  18. <view class="events">
  19. <text>{{item.title}}</text>
  20. </view>
  21. <view class="voteStatus" style="width: 100rpx;">
  22. <text style="font-size: 30rpx;color: #999;" v-if="item.activity_status==1">未开始</text>
  23. <text style="font-size: 30rpx;color: #FF6503;" v-if="item.activity_status==2">进行中</text>
  24. <text style="font-size: 30rpx;color: #999;" v-if="item.activity_status==3">已结束</text>
  25. </view>
  26. </view>
  27. <view class="foot">
  28. <image src="/static/icon/data.png"></image>
  29. <text>{{item.end_time}} 结束</text>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 已经到底啦 -->
  34. <uni-load-more v-if="List.length > 0" :status="status" color="#CCCCCC" :content-text="contentText"/>
  35. </view>
  36. </template>
  37. <script>
  38. export default{
  39. data(){
  40. return{
  41. //组件uni-load-more
  42. status: 'noMore',
  43. contentText: {
  44. contentdown: '查看更多',
  45. contentrefresh: '加载中',
  46. contentnomore: '—— 已经到底啦 ——'
  47. },
  48. // 点赞列表
  49. List:[],
  50. }
  51. },
  52. onLoad() {
  53. this.getList()
  54. },
  55. methods:{
  56. // 获取点赞列表
  57. getList(){
  58. this.$api.active.getActiveList({
  59. page:1,
  60. is_my_like:1
  61. }).then(res=>{
  62. console.log(res,"点赞列表")
  63. if(res.code==0){
  64. this.List=res.data.data
  65. }else{
  66. uni.showToast({
  67. title:res.msg,
  68. icon:'none'
  69. })
  70. }
  71. })
  72. },
  73. // 跳转投票详情
  74. goVoteDetail(id){
  75. uni.navigateTo({
  76. url:'/pages/index/active-detail/index?id='+id
  77. })
  78. },
  79. // 点赞
  80. clickKudos(id,index){
  81. let beforeLike=this.List[index].is_like
  82. this.$api.active.kudos({
  83. activity_id:id
  84. }).then(res=>{
  85. if(res.code==0){
  86. if(beforeLike==1){
  87. this.List[index].is_like=0
  88. this.getList()
  89. }else{
  90. this.List[index].is_like=1
  91. }
  92. }
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. $pageColor:#F9F9F9;
  100. $bgColor:#FFFFFF;
  101. @mixin flexlayout {
  102. display: flex;
  103. align-items: center;
  104. justify-content: center;
  105. }
  106. .kudos {
  107. height: 100%;
  108. background: $pageColor;
  109. }
  110. .msg-null{
  111. padding-top: 60rpx;
  112. display: flex;
  113. flex-direction: column;
  114. align-items: center;
  115. justify-content: center;
  116. .msg-null-text{
  117. margin-top: 40rpx;
  118. font-size: 28rpx;
  119. color: #333;
  120. }
  121. }
  122. .List {
  123. padding: 0 30rpx;
  124. box-sizing: border-box;
  125. padding-top: 24rpx;
  126. .ListItem {
  127. position: relative;
  128. margin-bottom: 24rpx;
  129. width: 690rpx;
  130. height: 562rpx;
  131. background: $bgColor;
  132. box-shadow: 0rpx 12rpx 40rpx 0rpx rgba(220, 222, 229, 0.4);
  133. border-radius: 24rpx;
  134. padding: 20rpx 26rpx 26rpx 24rpx;
  135. .kudosicon {
  136. width: 48rpx;
  137. position: absolute;
  138. top: 52rpx;
  139. right: 58rpx;
  140. border-radius: 50%;
  141. height: 48rpx;
  142. background: #FFFFFF;
  143. opacity: 0.84;
  144. @include flexlayout()
  145. image{
  146. width: 29rpx;
  147. height: 26rpx;
  148. }
  149. }
  150. .nav {
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. .events {
  155. text {
  156. font-size: 30rpx;
  157. font-family: PingFang-SC-Bold, PingFang-SC;
  158. font-weight: bold;
  159. color: #333333;
  160. }
  161. }
  162. .voteStatus {
  163. font-size: 30rpx;
  164. font-family: PingFang-SC-Medium, PingFang-SC;
  165. font-weight: 500;
  166. color: #999999;
  167. }
  168. }
  169. .foot {
  170. margin-top: 10rpx;
  171. display: flex;
  172. align-items: center;
  173. image {
  174. width: 28rpx;
  175. height: 28rpx;
  176. margin-right: 8rpx;
  177. }
  178. text {
  179. font-size: 24rpx;
  180. font-weight: 500;
  181. color: #999999;
  182. display: block;
  183. }
  184. }
  185. }
  186. }
  187. </style>