my-product.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <template>
  2. <view :style="vuex_skin">
  3. <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
  4. @up="upCallback">
  5. <image :src="cover" style="width: 100vw;" mode="widthFix"></image>
  6. <view class="head">
  7. <view class="cu-avatar avatar round" :style="[{backgroundImage:'url('+ userInfo.avatar +')'}]"></view>
  8. <view style="margin: 0 30upx 30upx 70upx;">
  9. <view class="flex align-center">
  10. <view class="text-black text-bold text-xl padding-right">{{userInfo.nickName}}</view>
  11. </view>
  12. <view class="flex align-center margin-top-20">
  13. <view>
  14. <text class="text-sm">共获热力</text>
  15. <text class="cuIcon-hotfill padding-lr-xs text-base"></text>
  16. <text class="text-lg text-bold">{{totalHeatValue}}</text>
  17. </view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="margin-top bg-white">
  22. <view class="padding-30 flex justify-start align-center">
  23. <view class="margin-left-sm text-lg text-black text-bold">我的作品</view>
  24. </view>
  25. </view>
  26. <view @click="$jump('/pages/activity/activityDetail?id='+item.id+'&isCustomBack=false')" v-for="(item, index) in list" :key="index">
  27. <view class="flex bg-white" style="padding:10rpx 30rpx 30rpx" @click="detail(item.id)">
  28. <view class="">
  29. <image :src="item.imgUrl" style="width: 120upx;height: 120upx;margin-right: 20upx;" mode="aspectFill"></image>
  30. </view>
  31. <view style="width: 100%;">
  32. <view class="flex justify-between margin-bottom-10">
  33. <view class="music" style="width: 75%">
  34. <view class="name text-cut-1" style="height: 34rpx;">{{item.title}}</view>
  35. <view style="margin: 20rpx 20rpx 20rpx 0;">
  36. <rich-text class="desc text-cut-2 "
  37. style="font-size: 24rpx;font-weight: 400;color: #969696;"
  38. :nodes="decodeURIComponent(item.content)"></rich-text>
  39. </view>
  40. </view>
  41. <view class="" style="width: 20%;">
  42. <view class="text-base center">
  43. <text class="cuIcon-hotfill padding-right-xs"></text>
  44. <text class="text-lg text-bold">{{item.heatValue}}</text>
  45. </view>
  46. <view class="music-rank">NO.{{item.rank}}</view>
  47. </view>
  48. </view>
  49. <view class="">
  50. <u-line color="#cacaca"></u-line>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </mescroll-body-diy>
  56. </view>
  57. </template>
  58. <script>
  59. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  60. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  61. export default {
  62. mixins: [MescrollMixin],
  63. components: {
  64. MescrollBodyDiy,
  65. },
  66. data() {
  67. return {
  68. downOption: {
  69. auto: false
  70. },
  71. cover: 'https://gx.vote.activity.obs.cn-south-1.myhuaweicloud.com:443/a1f19f8ee28a4a39ad892a9908a85807-%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211119175930.jpg',
  72. userInfo: {},
  73. totalHeatValue:0,
  74. list: []
  75. }
  76. },
  77. onLoad(options) {
  78. this.fetchUserInfo()
  79. },
  80. methods: {
  81. fetchUserInfo() {
  82. if (this.$cache.get('userInfo')) {
  83. this.userInfo = this.$cache.get('userInfo')
  84. return
  85. }
  86. let params = {
  87. id: this.vuex_userId
  88. }
  89. this.$api.loginUser.detail(params).then(res => {
  90. this.userInfo = res.data.data
  91. })
  92. },
  93. fetchMyTotalHeatValue(){
  94. let params={
  95. phone: "13712703133"
  96. }
  97. this.$api.activity.getMyTotalHeat(params).then(res=>{
  98. this.totalHeatValue=res.data.data || 0
  99. })
  100. },
  101. downCallback() {
  102. setTimeout(() => {
  103. this.mescroll.resetUpScroll();
  104. }, 1000)
  105. },
  106. upCallback(mescroll) {
  107. console.log(mescroll.num);
  108. if (mescroll.num==1) {
  109. this.fetchMyTotalHeatValue()
  110. }
  111. try {
  112. let params = {
  113. current: mescroll.num,
  114. size: mescroll.size,
  115. phone: "13712703133"
  116. }
  117. this.$api.activity.list(params).then(res => {
  118. let data = res.data.data.records
  119. let total = res.data.data.total
  120. mescroll.endBySize(data.length, total);
  121. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  122. this.list = this.list.concat(data); //追加新数据
  123. })
  124. } catch (e) {
  125. console.error(e);
  126. this.mescroll.endErr()
  127. }
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .head {
  134. background-color: #ffffff;
  135. margin-top: -10upx;
  136. height: 220upx;
  137. border-radius: 26upx 26upx 0 0;
  138. }
  139. .avatar {
  140. width: 120upx;
  141. height: 120upx;
  142. margin: -50upx 0 30upx 80upx;
  143. }
  144. .rank {
  145. display: flex;
  146. justify-content: center;
  147. background-color: #583be6;
  148. width: 40%;
  149. color: #ffffff;
  150. border-radius: 16upx;
  151. line-height: 60upx;
  152. }
  153. .music {
  154. .name {
  155. font-size: 28upx;
  156. font-family: PingFang SC;
  157. font-weight: 400;
  158. color: #333;
  159. padding-bottom: 20upx;
  160. }
  161. .author {
  162. font-size: 28upx;
  163. font-family: PingFang SC;
  164. font-weight: 400;
  165. color: #9A9A9A;
  166. }
  167. }
  168. .music-rank {
  169. display: flex;
  170. margin-top: 18upx;
  171. line-height: 40upx;
  172. justify-content: center;
  173. border: #9d9d9d 1px solid;
  174. color: #9d9d9d;
  175. border-radius: 50upx;
  176. font-style: italic;
  177. }
  178. </style>