Banner.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template>
  2. <div class="banner">
  3. <div class="block">
  4. <el-carousel indicator-position="none" arrow="never">
  5. <el-carousel-item v-for="item in 3" :key="item">
  6. <div class="wrap">
  7. <button class="ask-for">申请经纪商</button>
  8. </div>
  9. </el-carousel-item>
  10. </el-carousel>
  11. <div class="wrap-block">
  12. <LoginWindow></LoginWindow>
  13. </div>
  14. <div :class="{'black-line':true,'fix-bottom':scrolled}">
  15. <button class="line-button">申请经纪商</button>
  16. <span class="phoneNum">热线电话:+86 173 5471 8363</span>
  17. </div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import LoginWindow from './LoginWindow'
  23. export default {
  24. name: 'Banner',
  25. components: {LoginWindow},
  26. data () {
  27. return {
  28. scrolled:false
  29. }
  30. },
  31. methods:{
  32. handleScroll () {
  33. if (window.scrollY > 900) {
  34. this.scrolled = true;
  35. }else{
  36. this.scrolled = false;
  37. }
  38. }
  39. },
  40. mounted () {
  41. window.addEventListener('scroll', this.handleScroll)
  42. }
  43. }
  44. </script>
  45. <style scoped>
  46. .banner{
  47. text-align: left;
  48. }
  49. .el-carousel__item{
  50. background-size: auto 100%;
  51. }
  52. .el-carousel__item:nth-of-type(1) {
  53. background: url("../../static/images/banner1/banner.png") no-repeat 50%;
  54. background-size: auto 100%;
  55. }
  56. .el-carousel__item:nth-of-type(2) {
  57. background: url("../../static/images/banner1/banner1.png") no-repeat 50%;
  58. background-size: auto 100%;
  59. }
  60. .el-carousel__item:nth-of-type(3) {
  61. background: url("../../static/images/banner1/banner2.png") no-repeat 50%;
  62. background-size: auto 100%;
  63. }
  64. button.ask-for{
  65. margin: 425px 0 0 8px;
  66. width: 150px;
  67. height: 40px;
  68. font-size: 16px;
  69. color: #1f52c9;
  70. background: #fede00;
  71. border: none;
  72. cursor: pointer;
  73. }
  74. .wrap-block{
  75. width: 1200px;
  76. margin: 0 auto;
  77. position: absolute;
  78. left: 50%;
  79. margin-left: -600px;
  80. top: 0;
  81. margin-top: 180px;
  82. }
  83. .black-line{
  84. height: 100px;
  85. background-color: rgba(0,0,0,.5);
  86. width: 100%;
  87. margin: 0 auto;
  88. line-height: 100px;
  89. position: absolute;
  90. top: 800px;
  91. z-index: 100;
  92. text-align: center;
  93. }
  94. .fix-bottom{
  95. position: fixed;
  96. bottom: 0;
  97. top: auto;
  98. }
  99. .line-button{
  100. width: 140px;
  101. height: 40px;
  102. border-radius: 20px;
  103. border: 0;
  104. font-size: 18px;
  105. font-weight: 700;
  106. margin-right: 60px;
  107. cursor: pointer;
  108. background-color: #1a6fa6;
  109. color: #fff;
  110. }
  111. .phoneNum{
  112. color: #fff;
  113. font-size: 25px;
  114. font-weight: 700;
  115. }
  116. </style>