care-top.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view class="top-box" :style="{ 'height': swiperHeight + 'rpx'}">
  3. <view class="nav-top" :style="navScrollStyle">
  4. <view class="status-bar" :style="{'height': statusBarHeight + 'px'}" />
  5. <view class="status-title">
  6. <u-icon name="arrow-left" class="left-icon" @click="home.init(1)"></u-icon>
  7. <text>关爱模式</text>
  8. <!-- <view class="convention_btn" v-if="scrollStyle">常规版</view> -->
  9. </view>
  10. </view>
  11. <view class="top-advertising" @click.stop="home.init(1)">
  12. <!-- <image :src="convention_Img" mode="aspectFill"></image> -->
  13. <text>常规版</text>
  14. </view>
  15. <view class="swiper-content" :style="{ 'height': swiperHeight + 'rpx'}">
  16. <zw-swiper :height="swiperHeight" :keyword="$keys.GA_BANNER" />
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import Mixin from "./Mixin.js";
  22. const convention_Img = require('../convention_btn.png');
  23. export default {
  24. props: {
  25. swiperHeight: {
  26. type: Number,
  27. default: 577
  28. },
  29. scrollTop: {
  30. type: Number,
  31. default: 0
  32. },
  33. },
  34. mixins: [Mixin],
  35. inject: ["home"],
  36. data() {
  37. return {
  38. navScrollStyle: {},
  39. scrollStyle: false,
  40. convention_Img: convention_Img
  41. }
  42. },
  43. watch: {
  44. scrollTop: {
  45. handler: function(newNum, oldNum) {
  46. const Num = Number(newNum) || 0
  47. this.scrollStyle = Num > 114 ? true : false;
  48. if (Num < 11) {
  49. this.navScrollStyle = {}
  50. }
  51. if (Num >= 11 && Num < 57) {
  52. const op = Num / 57;
  53. this.navScrollStyle = {
  54. opacity: 1 - op,
  55. }
  56. }
  57. if (Num >= 57 && Num < 114) {
  58. const op = (Num - 57) / 57;
  59. this.navScrollStyle = {
  60. backgroundColor: `rgba(255, 255, 255, ${op})`,
  61. opacity: op,
  62. }
  63. }
  64. if (Num >= 114) {
  65. this.navScrollStyle = {
  66. backgroundColor: `rgba(255, 255, 255 ,1)`,
  67. }
  68. }
  69. }
  70. },
  71. immediate: true
  72. },
  73. methods: {
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. .top-box {
  79. width: 100%;
  80. overflow: hidden;
  81. position: relative;
  82. .nav-top {
  83. position: fixed;
  84. z-index: 3;
  85. left: 0;
  86. top: 0;
  87. right: 0;
  88. padding: 0 $zw-padding;
  89. }
  90. .status-title {
  91. position: relative;
  92. width: 100%;
  93. height: 88rpx;
  94. text-align: center;
  95. line-height: 88rpx;
  96. color: #1A1A1A;
  97. font-size: 44rpx;
  98. .left-icon {
  99. float: left;
  100. height: 100%;
  101. font-size: 40rpx;
  102. }
  103. .convention_btn {
  104. position: absolute;
  105. top: 50%;
  106. right: 30rpx;
  107. transform: translateY(-50%);
  108. z-index: 2;
  109. }
  110. }
  111. .top-advertising {
  112. position: absolute;
  113. right: 12rpx;
  114. bottom: 146rpx;
  115. width: 238rpx;
  116. height: 130rpx;
  117. padding-top: 25rpx;
  118. text-align: center;
  119. font-size: 44rpx;
  120. color: #fff;
  121. background: url('../convention_btn.png') no-repeat;
  122. background-size: 100% 100%;
  123. z-index: 1;
  124. image {
  125. width: 100%;
  126. height: 100%;
  127. }
  128. }
  129. }
  130. </style>