index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. <template>
  2. <view class="zs-banner">
  3. <view class="position-box" v-if="position" @click="jump">
  4. <view class="position">
  5. <image class="position-icon" src="../../static/position-white.png" mode=""></image>
  6. <text class="city">{{city}}</text>
  7. </view>
  8. <view class="topbar">
  9. 慧研学惠生活
  10. </view>
  11. </view>
  12. <view class="top-box" :style="{'--bg':theme}">
  13. <view class="search-box">
  14. <input class="search" type="text" placeholder="搜索" :value="search" />
  15. <image class="icon" src="../../static/search.png" mode=""></image>
  16. <button class="btn" type="default">搜索</button>
  17. </view>
  18. <swiper class="swiper" @change="swiperChange" :indicator-dots="true" circular :autoplay="true"
  19. :interval="3000" :duration="1000">
  20. <swiper-item v-for="(item,index) in bannerList" :key="index">
  21. <image class="swiper-item" mode="" :src="item.src">
  22. </image>
  23. </swiper-item>
  24. </swiper>
  25. </view>
  26. <u-notice-bar bgColor="none" icon="volume-fill" color="#6F4F23" direction="column" :fontSize='26' :text="textList"></u-notice-bar>
  27. </view>
  28. </template>
  29. <script>
  30. import {
  31. getNotification,
  32. } from '@/api/common.js'
  33. export default {
  34. options:{
  35. styleIsolation:'shared'
  36. },
  37. props: {
  38. position: {
  39. type: Boolean,
  40. default: false
  41. },
  42. city:{
  43. type: String,
  44. default: '定位中'
  45. }
  46. },
  47. data() {
  48. return {
  49. search:'',
  50. theme: '#FF4A39', //顶部颜色
  51. textList: [], //通知列表
  52. bannerList: [
  53. {
  54. src:require('../../static/home_banner.png'),
  55. theme: '#FF4A39'
  56. },
  57. {
  58. src:require('../../static/banner.png'),
  59. theme: '#893CF1'
  60. },
  61. {
  62. src: 'https://alipic.lanhuapp.com/XDSlicePNGMAX190c797263732d957a8b1678378cdfed7d1080d44f950646dd434fff84683bdd.png',
  63. theme: '#3C66F1'
  64. },
  65. {
  66. src: 'https://alipic.lanhuapp.com/XDSlicePNGMAX611bc009fa733cff73887ee29c1732ae75825ed9e0954b587c74a4c189a3cffb.png',
  67. theme: '#00C8CF'
  68. }
  69. ],
  70. };
  71. },
  72. methods: {
  73. // swiper变动
  74. swiperChange(val) {
  75. this.theme = this.bannerList[val.detail.current].theme
  76. },
  77. // 获取通知列表
  78. getNotification() {
  79. // this.loading = true
  80. getNotification({
  81. page: 1,
  82. pageSize: 10
  83. }).then(res => {
  84. // this.loading = false
  85. this.textList = []
  86. res.content.records.map(item => {
  87. this.textList.push(`用户${item.phoneNum}注册成功,本月累计节省${item.economizeTheMoney||0}元`)
  88. })
  89. })
  90. },
  91. jump(){
  92. uni.navigateTo({
  93. url:'../../pages/index/position'
  94. })
  95. }
  96. },
  97. created() {
  98. this.getNotification()
  99. }
  100. }
  101. </script>
  102. <style lang="scss" >
  103. // 通知喇叭样式
  104. .zs-banner ::v-deep .u-notice .u-icon__icon{
  105. font-size: 32rpx!important;
  106. }
  107. .zs-banner{
  108. position: relative;
  109. .position-box{
  110. position: absolute;
  111. width: 100%;
  112. top: 95rpx;
  113. left: 0;
  114. display: flex;
  115. align-items: center;
  116. justify-content: center;
  117. .position{
  118. position: absolute;
  119. top: 10rpx;
  120. left: 30rpx;
  121. color: #fff;
  122. display: flex;
  123. align-items: center;
  124. font-size: 24rpx;
  125. .position-icon{
  126. width: 21.65rpx;
  127. height: 24.3rpx;
  128. }
  129. .city{
  130. margin-left: 10rpx;
  131. }
  132. }
  133. .topbar{
  134. font-size: 36rpx;
  135. color: #FFFFFF;
  136. text-align: center;
  137. font-weight: bold;
  138. font-family: DOUYUFont;
  139. }
  140. }
  141. .top-box {
  142. background: linear-gradient(180deg, var(--bg) 0%, #FFF 100%);
  143. padding: 100rpx 32rpx 0;
  144. height: 536rpx;
  145. box-sizing: border-box;
  146. display: flex;
  147. flex-direction: column;
  148. justify-content: flex-end;
  149. .search-box {
  150. position: relative;
  151. height: 80rpx;
  152. background: #FFFFFF;
  153. border-radius: 40rpx 40rpx 40rpx 40rpx;
  154. margin-bottom: 24rpx;
  155. .icon {
  156. width: 37rpx;
  157. height: 37rpx;
  158. position: absolute;
  159. top: 50%;
  160. left: 36rpx;
  161. transform: translateY(-50%);
  162. }
  163. .search {
  164. line-height: 80rpx;
  165. height: 80rpx;
  166. padding-left: 100rpx;
  167. padding-right: 130rpx;
  168. }
  169. .btn {
  170. position: absolute;
  171. top: 8rpx;
  172. right: 10rpx;
  173. width: 108rpx;
  174. height: 64rpx;
  175. line-height: 64rpx;
  176. background: var(--bg);
  177. color: #fff;
  178. font-size: 28rpx;
  179. border-radius: 32rpx;
  180. padding: 0;
  181. }
  182. }
  183. .swiper {
  184. height: 244rpx;
  185. border-radius: 16rpx;
  186. .swiper-item {
  187. width: 100%;
  188. height: 100%;
  189. border-radius: 16rpx;
  190. object-fit: cover;
  191. }
  192. }
  193. }
  194. }
  195. </style>