my-product.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <view :style="vuex_skin">
  3. <mescroll-body 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. <image :src="userInfo.avatar" mode="" class="avatar"></image>
  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.stop="$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">
  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>
  56. </view>
  57. </template>
  58. <script>
  59. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  60. export default {
  61. mixins: [MescrollMixin],
  62. data() {
  63. return {
  64. downOption: {
  65. auto: false
  66. },
  67. cover: 'https://vote.guosen-fumao.cn/obsfile/a1f19f8ee28a4a39ad892a9908a85807-%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_20211119175930.jpg',
  68. userInfo: {},
  69. totalHeatValue:0,
  70. list: []
  71. }
  72. },
  73. onLoad(options) {
  74. this.fetchUserInfo()
  75. this.fetchCover()
  76. },
  77. methods: {
  78. async fetchCover() {
  79. let {
  80. ACTIVE_SETTING
  81. } = (await this.$api.platform.getPlatformParams({
  82. keys: 'ACTIVE_SETTING'
  83. })).data.data;
  84. this.cover = JSON.parse(ACTIVE_SETTING).myProductImage
  85. },
  86. fetchUserInfo() {
  87. if (this.$cache.get('userInfo')) {
  88. this.userInfo = this.$cache.get('userInfo')
  89. return
  90. }
  91. let params = {
  92. id: this.vuex_userId
  93. }
  94. this.$api.loginUser.detail(params).then(res => {
  95. this.userInfo = res.data.data
  96. })
  97. },
  98. fetchMyTotalHeatValue(){
  99. let params={
  100. phone: this.vuex_phone
  101. }
  102. this.$api.activity.getMyTotalHeat(params).then(res=>{
  103. this.totalHeatValue=res.data.data || 0
  104. })
  105. },
  106. downCallback() {
  107. setTimeout(() => {
  108. this.mescroll.resetUpScroll();
  109. }, 1000)
  110. },
  111. upCallback(mescroll) {
  112. console.log(mescroll.num);
  113. if (mescroll.num==1) {
  114. this.fetchMyTotalHeatValue()
  115. }
  116. try {
  117. let params = {
  118. current: mescroll.num,
  119. size: mescroll.size,
  120. phone: this.vuex_phone
  121. }
  122. this.$api.activity.list(params).then(res => {
  123. let data = res.data.data.records
  124. let total = res.data.data.total
  125. mescroll.endBySize(data.length, total);
  126. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  127. this.list = this.list.concat(data); //追加新数据
  128. })
  129. } catch (e) {
  130. console.error(e);
  131. this.mescroll.endErr()
  132. }
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .head {
  139. background-color: #ffffff;
  140. margin-top: -10upx;
  141. height: 220upx;
  142. border-radius: 26upx 26upx 0 0;
  143. }
  144. .avatar {
  145. border-radius: 50%;
  146. width: 120upx;
  147. height: 120upx;
  148. margin: -50upx 0 30upx 80upx;
  149. }
  150. .rank {
  151. display: flex;
  152. justify-content: center;
  153. background-color: #583be6;
  154. width: 40%;
  155. color: #ffffff;
  156. border-radius: 16upx;
  157. line-height: 60upx;
  158. }
  159. .music {
  160. .name {
  161. font-size: 28upx;
  162. font-family: PingFang SC;
  163. font-weight: 400;
  164. color: #333;
  165. padding-bottom: 20upx;
  166. }
  167. .author {
  168. font-size: 28upx;
  169. font-family: PingFang SC;
  170. font-weight: 400;
  171. color: #9A9A9A;
  172. }
  173. }
  174. .music-rank {
  175. display: flex;
  176. margin-top: 18upx;
  177. line-height: 40upx;
  178. justify-content: center;
  179. border: #9d9d9d 1px solid;
  180. color: #9d9d9d;
  181. border-radius: 50upx;
  182. font-style: italic;
  183. }
  184. </style>