projectUpdateDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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="openShare">
  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: '',
  43. shareDesc: '',
  44. shareImg: '',
  45. shareLink:"",
  46. };
  47. },
  48. computed: {
  49. navBgStyle() {
  50. return {
  51. id: 0,
  52. background: `rgba(255,255,255,${this.navBgOpacity})`,
  53. transition: "background 0.3s",
  54. };
  55. },
  56. },
  57. onLoad(options) {
  58. this.id = options.id
  59. this.getDetails()
  60. },
  61. methods: {
  62. openShare() {
  63. uni.$emit("check_login", () => {
  64. this.showShare = true;
  65. });
  66. },
  67. goBack() {
  68. uni.navigateBack();
  69. },
  70. getDetails() {
  71. uni.request({
  72. url: this.$apiHost + '/crowdfund/article/detail',
  73. method: 'GET',
  74. data: {
  75. id: this.id,
  76. uuid: getApp().globalData.uuid,
  77. skey: getApp().globalData.skey
  78. },
  79. success: (res) => {
  80. console.log('获取到详情数据', res.data.data);
  81. if (res.data && res.data.success === 'yes' && res.data.data) {
  82. this.datails = res.data.data
  83. }
  84. }
  85. });
  86. uni.request({
  87. url: this.$apiHost + '/crowdfund/detail',
  88. method: 'GET',
  89. data: {
  90. id: this.projectId,
  91. uuid: getApp().globalData.uuid,
  92. skey: getApp().globalData.skey
  93. },
  94. success: (res) => {
  95. if (res.data && res.data.success === 'yes' && res.data.data) {
  96. this.author = {
  97. "id": res.data.data.creator_id,
  98. "nickname": res.data.data.creator_nickname,
  99. "avator": res.data.data.creator_avatar,
  100. }
  101. // 可根据接口返回字段设置isFavorite等
  102. }
  103. }
  104. });
  105. }
  106. },
  107. onPageScroll(e) {
  108. const threshold = this.swiperHeight || uni.upx2px(400); // 优先用实际高度
  109. let opacity = 0;
  110. if (e.scrollTop > 0) {
  111. opacity = Math.min(e.scrollTop / threshold, 1);
  112. }
  113. this.navBgOpacity = opacity;
  114. },
  115. };
  116. </script>
  117. <style scoped lang="scss">
  118. .project-update-details {
  119. min-height: 100vh;
  120. padding-bottom: 20vh;
  121. /* 自定义导航栏样式 */
  122. .custom-navbar {
  123. display: flex;
  124. flex-direction: row;
  125. align-items: center;
  126. justify-content: space-between;
  127. width: 100%;
  128. height: calc(90rpx + var(--status-bar-height));
  129. padding: 0 20rpx;
  130. position: fixed;
  131. top: 0;
  132. z-index: 100;
  133. padding: 12rpx 24rpx;
  134. padding-top: calc(var(--status-bar-height) + 12rpx);
  135. background: transparent;
  136. transition: background 0.3s;
  137. image {
  138. width: 64rpx;
  139. height: 64rpx;
  140. }
  141. }
  142. .top-img {
  143. width: 100%;
  144. }
  145. .update-info {
  146. background: #fff;
  147. padding: 32rpx 32rpx 0 32rpx;
  148. .update-title-row {
  149. display: flex;
  150. justify-content: space-between;
  151. align-items: center;
  152. margin-bottom: 24rpx;
  153. .update-title {
  154. font-size: 26rpx;
  155. color: #222;
  156. }
  157. .update-time {
  158. font-size: 24rpx;
  159. color: #bdbdbd;
  160. }
  161. }
  162. .update-user-row {
  163. display: flex;
  164. align-items: center;
  165. .user-avatar {
  166. width: 48rpx;
  167. height: 48rpx;
  168. border-radius: 50%;
  169. margin-right: 16rpx;
  170. }
  171. .user-nickname {
  172. font-size: 26rpx;
  173. color: #222;
  174. font-weight: 500;
  175. }
  176. }
  177. }
  178. .content {
  179. padding: 42rpx 28rpx;
  180. }
  181. }
  182. </style>