projectUpdateDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <view class="project-update-details">
  3. <view class="custom-navbar" :style="navBgStyle">
  4. <view class="navbar-left scale-tap" @click="goBack">
  5. <image src="@/static/crowdFunding/back.png" mode="widthFix"></image>
  6. </view>
  7. <view class="navbar-center one-omit" style="max-width: 70vw" :style="{ opacity: navBgOpacity }">
  8. {{ datails.title }}
  9. </view>
  10. <view class="navbar-right scale-tap" @click="showShare = true">
  11. <image src="@/static/crowdFunding/share.png" mode="widthFix"></image>
  12. </view>
  13. </view>
  14. <image class="top-img" :src="datails.image" mode="widthFix"></image>
  15. <view class="update-info">
  16. <view class="update-title-row">
  17. <text class="update-title">· 第{{ datails.numb }}次更新</text>
  18. <text class="update-time">{{ datails.create_time }}</text>
  19. </view>
  20. <view class="update-user-row">
  21. <image class="user-avatar" :src="author.avator"></image>
  22. <text class="user-nickname">{{ author.nickname }}</text>
  23. </view>
  24. </view>
  25. <view class="content">
  26. <uv-parse :content="datails.content" :selectable="true"></uv-parse>
  27. </view>
  28. <!-- 分享弹窗 -->
  29. <SharePopup :visible="showShare" :userId="0" :share-title="shareTitle" :share-desc="shareDesc" :share-img="shareImg"
  30. view="crowdfundingDetails" @close="showShare = false" :isReportContent="true" />
  31. </view>
  32. </template>
  33. <script>
  34. export default {
  35. data() {
  36. return {
  37. navBgOpacity: 0,
  38. content: ` `,
  39. datails: {},
  40. author: {},
  41. showShare: false,
  42. shareTitle: '【Woh】灯塔 塔罗牌 治愈风泛传特系',
  43. shareDesc: '快来支持这个有趣的众筹项目吧!',
  44. shareImg: require('@/static/crowdFunding/top-img.png'),
  45. };
  46. },
  47. computed: {
  48. navBgStyle() {
  49. return {
  50. id: 0,
  51. background: `rgba(255,255,255,${this.navBgOpacity})`,
  52. transition: "background 0.3s",
  53. };
  54. },
  55. },
  56. onLoad(options) {
  57. this.id = options.id
  58. this.getDetails()
  59. },
  60. methods: {
  61. goBack() {
  62. uni.navigateBack();
  63. },
  64. getDetails() {
  65. uni.request({
  66. url: this.$apiHost + '/crowdfund/article/detail',
  67. method: 'GET',
  68. data: {
  69. id: this.id,
  70. uuid: getApp().globalData.uuid,
  71. skey: getApp().globalData.skey
  72. },
  73. success: (res) => {
  74. console.log('获取到详情数据', res.data.data);
  75. if (res.data && res.data.success === 'yes' && res.data.data) {
  76. this.datails = res.data.data
  77. }
  78. }
  79. });
  80. uni.request({
  81. url: this.$apiHost + '/crowdfund/detail',
  82. method: 'GET',
  83. data: {
  84. id: this.projectId,
  85. uuid: getApp().globalData.uuid,
  86. skey: getApp().globalData.skey
  87. },
  88. success: (res) => {
  89. if (res.data && res.data.success === 'yes' && res.data.data) {
  90. this.author = {
  91. "id": res.data.data.creator_id,
  92. "nickname": res.data.data.creator_nickname,
  93. "avator": res.data.data.creator_avatar,
  94. }
  95. // 可根据接口返回字段设置isFavorite等
  96. }
  97. }
  98. });
  99. }
  100. },
  101. onPageScroll(e) {
  102. const threshold = this.swiperHeight || uni.upx2px(400); // 优先用实际高度
  103. let opacity = 0;
  104. if (e.scrollTop > 0) {
  105. opacity = Math.min(e.scrollTop / threshold, 1);
  106. }
  107. this.navBgOpacity = opacity;
  108. },
  109. };
  110. </script>
  111. <style scoped lang="scss">
  112. .project-update-details {
  113. min-height: 100vh;
  114. padding-bottom: 20vh;
  115. /* 自定义导航栏样式 */
  116. .custom-navbar {
  117. display: flex;
  118. flex-direction: row;
  119. align-items: center;
  120. justify-content: space-between;
  121. width: 100%;
  122. height: calc(90rpx + var(--status-bar-height));
  123. padding: 0 20rpx;
  124. position: fixed;
  125. top: 0;
  126. z-index: 100;
  127. padding: 12rpx 24rpx;
  128. padding-top: calc(var(--status-bar-height) + 12rpx);
  129. background: transparent;
  130. transition: background 0.3s;
  131. image {
  132. width: 64rpx;
  133. height: 64rpx;
  134. }
  135. }
  136. .top-img {
  137. width: 100%;
  138. }
  139. .update-info {
  140. background: #fff;
  141. padding: 32rpx 32rpx 0 32rpx;
  142. .update-title-row {
  143. display: flex;
  144. justify-content: space-between;
  145. align-items: center;
  146. margin-bottom: 24rpx;
  147. .update-title {
  148. font-size: 26rpx;
  149. color: #222;
  150. }
  151. .update-time {
  152. font-size: 24rpx;
  153. color: #bdbdbd;
  154. }
  155. }
  156. .update-user-row {
  157. display: flex;
  158. align-items: center;
  159. .user-avatar {
  160. width: 48rpx;
  161. height: 48rpx;
  162. border-radius: 50%;
  163. margin-right: 16rpx;
  164. }
  165. .user-nickname {
  166. font-size: 26rpx;
  167. color: #222;
  168. font-weight: 500;
  169. }
  170. }
  171. }
  172. .content {
  173. padding: 42rpx 28rpx;
  174. }
  175. }
  176. </style>