columnDetail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="container column-detail">
  3. <view :class="[scrollTopNumber == 0 ? 'top-content' : 'scroll-top-content']">
  4. <view :class="['position-regular', scrollTopNumber != 0 && 'position-content-bg']">
  5. <view class="nav-bar-wrap" :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }">
  6. <view class="content-box" :style="{ color: scrollTopNumber == 0 ? '#fff' : '#333' }">
  7. <text v-if="scrollTopNumber != 0">专栏详情</text>
  8. <view class="arrow-left-icon">
  9. <van-icon name="arrow-left" size="20px" @click="goHandler" />
  10. </view>
  11. </view>
  12. </view>
  13. <view class="name-author">
  14. <view class="author-img">
  15. <view class="img-box">
  16. <image src="https://hzchart.oss-cn-shanghai.aliyuncs.com/T2ddwIIaULVdkGM6gVMuNxBSft8Y.png"></image>
  17. </view>
  18. <view class="set-btn"> + 关注</view>
  19. </view>
  20. <view class="name-box">
  21. <text>专栏名称专栏名称专栏名称</text>
  22. <text>作者昵称作者昵称</text>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="info-lable-card">
  27. <view class="info-card-lable">
  28. <text>专栏名称专1</text>
  29. <text>专栏名称专2</text>
  30. <text>专栏名称专3</text>
  31. <text>专栏名称专3</text>
  32. <text>专栏名称专3</text>
  33. <text>专栏名称专3</text>
  34. </view>
  35. <view class="info-card-fans">
  36. <text>12</text>
  37. <text>文章</text>
  38. <text>24</text>
  39. <text>被收藏</text>
  40. <text>36</text>
  41. <text>粉丝</text>
  42. </view>
  43. </view>
  44. </view>
  45. <view class="column-list-content">
  46. <column-list-content />
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import ColumnListContent from "../components/columnListContent.vue";
  52. import infoCard from "../components/infoCard.vue";
  53. export default {
  54. components: { infoCard, ColumnListContent },
  55. data() {
  56. return {
  57. navBarStyle: {
  58. height: 60 + "px",
  59. paddingTop: 40 + "px",
  60. paddingBottom: "4px",
  61. },
  62. scrollTopNumber: 0,
  63. };
  64. },
  65. methods: {
  66. initNavBar() {
  67. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  68. this.navBarStyle = {
  69. height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
  70. paddingTop: menuButtonInfo.top - 4 + "px",
  71. paddingBottom: "4px",
  72. };
  73. },
  74. },
  75. onLoad() {
  76. this.initNavBar();
  77. },
  78. onPageScroll(e) {
  79. console.log(e);
  80. this.scrollTopNumber = e.scrollTop;
  81. },
  82. };
  83. </script>
  84. <style lang="scss" scope>
  85. .column-detail {
  86. position: relative;
  87. background-color: #f3f5f9;
  88. .scroll-top-content,
  89. .position-content-bg {
  90. background-color: #fff;
  91. }
  92. .top-content {
  93. width: 100%;
  94. height: 625rpx;
  95. background-image: url(https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/Maskgroupbg.png);
  96. background-size: 100% 100%;
  97. background-repeat: no-repeat;
  98. }
  99. .position-regular {
  100. position: fixed;
  101. top: 0;
  102. left: 0;
  103. width: 100%;
  104. z-index: 99;
  105. .name-author {
  106. z-index: 99;
  107. display: flex;
  108. height: 178rpx;
  109. padding: 20rpx 40rpx;
  110. .author-img {
  111. position: relative;
  112. display: flex;
  113. justify-content: center;
  114. width: 126rpx;
  115. height: 138rpx;
  116. text-align: center;
  117. .img-box {
  118. width: 110rpx;
  119. height: 110rpx;
  120. border-radius: 50%;
  121. overflow: hidden;
  122. image {
  123. width: 110rpx;
  124. height: 110rpx;
  125. }
  126. }
  127. .set-btn {
  128. position: absolute;
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. left: 0;
  133. bottom: 0;
  134. width: 126rpx;
  135. height: 48rpx;
  136. border-radius: 150rpx;
  137. background-color: #376cbb;
  138. color: #fff;
  139. }
  140. }
  141. .name-box {
  142. margin-left: 20rpx;
  143. text:nth-child(1) {
  144. font-size: 36rpx;
  145. font-weight: 500;
  146. line-height: 50rpx;
  147. padding: 20rpx 0;
  148. }
  149. text:nth-child(2) {
  150. font-size: 28rpx;
  151. font-weight: 400;
  152. line-height: 39rpx;
  153. }
  154. }
  155. }
  156. }
  157. .nav-bar-wrap {
  158. width: 100%;
  159. display: flex;
  160. align-items: center;
  161. z-index: 99;
  162. .content-box {
  163. position: relative;
  164. display: flex;
  165. align-items: center;
  166. width: 100%;
  167. justify-content: center;
  168. color: #fff;
  169. font-size: 34rpx;
  170. .arrow-left-icon {
  171. position: absolute;
  172. display: flex;
  173. align-items: center;
  174. justify-content: center;
  175. width: 40rpx;
  176. height: 40rpx;
  177. left: 39rpx;
  178. top: 50%;
  179. transform: translateY(-50%);
  180. z-index: 99;
  181. }
  182. }
  183. }
  184. .column-list-content {
  185. position: absolute;
  186. width: 682rpx;
  187. border-radius: 12rpx 12rpx 0 0;
  188. top: 580rpx;
  189. right: 50%;
  190. transform: translateX(50%);
  191. z-index: 9;
  192. overflow: hidden;
  193. }
  194. .info-lable-card {
  195. position: absolute;
  196. top: 165px;
  197. left: 0;
  198. padding: 30rpx 35rpx;
  199. .info-card-lable {
  200. display: flex;
  201. flex-wrap: wrap;
  202. text {
  203. height: 45rpx;
  204. padding: 6rpx 12rpx 6rpx 12rpx;
  205. border-radius: 150rpx;
  206. background-color: #8994a1;
  207. margin: 20rpx 20rpx 0rpx 0;
  208. }
  209. }
  210. .info-card-fans {
  211. margin-top: 20rpx;
  212. display: flex;
  213. align-items: center;
  214. text:nth-child(2n + 1) {
  215. color: #ffe8a8;
  216. font-size: 38rpx;
  217. font-weight: 500;
  218. }
  219. text:nth-child(2n) {
  220. margin: 0 40rpx 0 5rpx;
  221. color: #fff;
  222. }
  223. }
  224. }
  225. }
  226. </style>