推广小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

368 lines
8.9 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page">
  3. <view class="head-box"></view>
  4. <uv-navbar :title="navTitle" leftIcon=" " :titleStyle="{color:'#fff'}" :bgColor="bgColor" height="100rpx"></uv-navbar>
  5. <view class="content">
  6. <view class="search-box">
  7. <view class="search-box-l">
  8. <image class="address-img" src="@/static/image/home/address-icon.png" mode="widthFix"></image>
  9. <view>成都</view>
  10. <image class="sjx-img" src="@/static/image/home/sjx-icon.png" mode="widthFix"></image>
  11. </view>
  12. <view class="search-box-r">
  13. <uv-search @search="search" placeholder="搜索相关内容" v-model="params.title" shape="square" :showAction="false" color="#fff" placeholderColor="#BDABAC" :clearabled="false" searchIconColor="#fff" searchIconSize="50rpx" bgColor="#4A2A2B" height="63rpx"></uv-search>
  14. </view>
  15. </view>
  16. <view class="swipe-box">
  17. <uv-swiper :list="list" keyName="image" height="336rpx" radius="30rpx" bgColor="transparent" indicator indicatorMode="dot"></uv-swiper>
  18. </view>
  19. <view class="ydsk-box">
  20. <view class="ydsk-box-title">悦动时刻</view>
  21. <view class="ydsk-box-gird">
  22. <view class="gird-l" @click="skip('')">
  23. <view class="left-box">
  24. <view class="title-box">
  25. <view>活动签到</view>
  26. <view>签到有好礼</view>
  27. </view>
  28. <view class="btn-box">立即查看</view>
  29. </view>
  30. <image class="hdqd-img" src="@/static/image/home/hdqd-img.png" mode="widthFix"></image>
  31. </view>
  32. <view class="gird-r">
  33. <view class="hd-box" @click="skip('activeList')">
  34. <view class="left-box">
  35. <view class="title-box">
  36. 活动
  37. </view>
  38. <view class="btn-box">立即查看</view>
  39. </view>
  40. <image class="hdqd-img" src="@/static/image/home/hd-img.png" mode="widthFix"></image>
  41. </view>
  42. <view class="hd-box lx-box" @click="skip('travelList')">
  43. <view class="left-box">
  44. <view class="title-box">
  45. 旅行
  46. </view>
  47. <view class="btn-box">立即查看</view>
  48. </view>
  49. <image class="hdqd-img" src="@/static/image/home/lx-img.png" mode="widthFix"></image>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="hd-list">
  55. <uv-tabs
  56. @click= "tabs"
  57. :list="hdList"
  58. lineWidth="50rpx"
  59. :lineColor="`url(${lineBg}) 100% 100%`"
  60. :activeStyle="{
  61. color: '#fff',
  62. fontWeight: 'bold',
  63. transform: 'scale(1.05)'
  64. }"
  65. :inactiveStyle="{
  66. color: '#999',
  67. transform: 'scale(1)'
  68. }"
  69. itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"
  70. ></uv-tabs>
  71. <active-item :cardListData="cardListData"/>
  72. <uv-load-more :status="status" fontSize="24rpx" dashed line />
  73. </view>
  74. </view>
  75. <tabber select="home" />
  76. </view>
  77. </template>
  78. <script>
  79. import tabber from '@/components/base/tabbar.vue'
  80. import activeItem from '@/components/active/active-item.vue'
  81. export default {
  82. components:{
  83. tabber,
  84. activeItem
  85. },
  86. data() {
  87. return {
  88. status:"loading",
  89. params:{
  90. title:'',
  91. state:0,
  92. pageNo:1,
  93. pageSize:10
  94. },
  95. totalPage:0,
  96. bgColor:'transparent',
  97. navTitle:'',
  98. keyword:'',
  99. list: [],
  100. hdList: [
  101. { id: 0, name: '近期活动' },
  102. { id: 1, name: '往期活动' },
  103. ],
  104. lineBg: require('@/static/image/cart/tabIcon.png'),
  105. cardListData: []
  106. }
  107. },
  108. onPageScroll(e) {
  109. if(e.scrollTop > 50) {
  110. this.bgColor = '#49070c'
  111. this.navTitle = '首页'
  112. }else{
  113. this.bgColor = 'transparent'
  114. this.navTitle = ''
  115. }
  116. },
  117. onReachBottom() {
  118. if(this.params.pageNo >= this.totalPage) return
  119. this.params.pageNo ++
  120. this.getActivityPageList()
  121. },
  122. onLoad() {
  123. this.getBanner()
  124. this.getActivityPageList()
  125. this.$store.commit('initConfig')
  126. },
  127. methods:{
  128. search() {
  129. this.params.pageNo = 1
  130. this.cardListData = []
  131. this.getActivityPageList()
  132. },
  133. getActivityPageList() {
  134. this.$api('activityPageList',this.params,res=>{
  135. if(res.code == 200) {
  136. this.totalPage = res.result.pages
  137. this.cardListData = [...this.cardListData,...res.result.records]
  138. if(this.params.pageNo >= this.totalPage) {
  139. this.status = "nomore"
  140. }else {
  141. this.status = "loadmore"
  142. }
  143. }
  144. })
  145. },
  146. getBanner() {
  147. this.$api('banner',res=>{
  148. if(res.code == 200) {
  149. this.list = res.result
  150. }
  151. })
  152. },
  153. tabs(val) {
  154. this.params.pageNo = 1
  155. this.cardListData = []
  156. this.params.state = val.id
  157. this.getActivityPageList()
  158. },
  159. skip(val) {
  160. uni.navigateTo({
  161. url: `/pages_my/${val}`
  162. })
  163. },
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. page {
  169. background-color: #060504;
  170. }
  171. </style>
  172. <style scoped lang="scss">
  173. .page {
  174. .head-box {
  175. background: url('@/static/image/nav-bg.png') no-repeat;
  176. background-size: 100% 100%;
  177. width: 100%;
  178. height: 534rpx;
  179. position: absolute;
  180. }
  181. .content {
  182. color: #fff;
  183. padding: 0 30rpx;
  184. padding-top: calc(var(--status-bar-height) + 110rpx);
  185. .search-box {
  186. display: flex;
  187. align-items: center;
  188. margin-bottom: 32rpx;
  189. &-l {
  190. display: flex;
  191. align-items: center;
  192. margin-right: 30rpx;
  193. view {
  194. font-weight: 400;
  195. font-size: 27rpx;
  196. color: #FFFFFF;
  197. margin: 0 18rpx 0 15rpx;
  198. }
  199. .address-img {
  200. width: 26rpx;
  201. }
  202. .sjx-img {
  203. width: 13rpx;
  204. }
  205. }
  206. &-r {
  207. flex:1;
  208. }
  209. }
  210. .swipe-box {
  211. margin-bottom: 41rpx;
  212. }
  213. .ydsk-box {
  214. margin-bottom: 10rpx;
  215. &-title {
  216. width: 250rpx;
  217. background: url('@/static/image/home/title-bg.png') no-repeat;
  218. background-size: 100% 100%;
  219. text-align: center;
  220. height: 31rpx;
  221. line-height: 31rpx;
  222. font-weight: bold;
  223. font-size: 35rpx;
  224. color: #FFFFFF;
  225. margin: 0 auto 33rpx;
  226. }
  227. &-gird {
  228. display: flex;
  229. justify-content: space-between;
  230. .gird-l {
  231. box-sizing: border-box;
  232. width: 378rpx;
  233. height: 278rpx;
  234. padding: 36rpx 0 24rpx 26rpx;
  235. background: url('@/static/image/home/hdqd-bg.png') no-repeat;
  236. background-size: 100% 100%;
  237. position: relative;
  238. .hdqd-img {
  239. position: absolute;
  240. right: 34rpx;
  241. top: 48rpx;
  242. width: 200rpx;
  243. }
  244. .left-box {
  245. height: 100%;
  246. display: flex;
  247. flex-direction: column;
  248. justify-content: space-between;
  249. .title-box {
  250. view {
  251. font-weight: bold;
  252. font-size: 29rpx;
  253. color: #060504;
  254. &:nth-child(2) {
  255. font-weight: 400;
  256. font-size: 21rpx;
  257. color: #4C4C4C;
  258. margin-top: 20rpx;
  259. }
  260. }
  261. }
  262. .btn-box {
  263. width: 108rpx;
  264. height: 41rpx;
  265. background: url('@/static/image/home/hdqd-btn.png') no-repeat;
  266. background-size: 100% 100%;
  267. font-weight: 500;
  268. font-size: 17rpx;
  269. color: #FFFFFF;
  270. text-align: center;
  271. line-height: 41rpx;
  272. }
  273. }
  274. }
  275. .gird-r {
  276. .hd-box {
  277. width: 288rpx;
  278. height: 130rpx;
  279. padding: 25rpx 0 24rpx 26rpx;
  280. box-sizing: border-box;
  281. background: url('@/static/image/home/hd-bg.png') no-repeat;
  282. background-size: 100% 100%;
  283. position: relative;
  284. .left-box {
  285. height: 100%;
  286. display: flex;
  287. flex-direction: column;
  288. justify-content: space-between;
  289. .title-box {
  290. font-weight: bold;
  291. font-size: 28rpx;
  292. color: #57270F;
  293. }
  294. .btn-box {
  295. width: 98rpx;
  296. height: 35rpx;
  297. background: url('@/static/image/home/hd-btn.png') no-repeat;
  298. background-size: 100% 100%;
  299. font-weight: 500;
  300. font-size: 16rpx;
  301. color: #FFFFFF;
  302. text-align: center;
  303. line-height: 35rpx;
  304. }
  305. }
  306. .hdqd-img {
  307. position: absolute;
  308. right: 22rpx;
  309. top: 25rpx;
  310. width: 123rpx;
  311. }
  312. }
  313. .lx-box {
  314. width: 288rpx;
  315. height: 130rpx;
  316. padding: 25rpx 0 24rpx 26rpx;
  317. box-sizing: border-box;
  318. background: url('@/static/image/home/lx-bg.png') no-repeat;
  319. background-size: 100% 100%;
  320. position: relative;
  321. margin-top: 18rpx;
  322. .left-box {
  323. height: 100%;
  324. display: flex;
  325. flex-direction: column;
  326. justify-content: space-between;
  327. .title-box {
  328. font-weight: bold;
  329. font-size: 28rpx;
  330. color: #57270F;
  331. }
  332. .btn-box {
  333. width: 98rpx;
  334. height: 35rpx;
  335. background: url('@/static/image/home/lx-btn.png') no-repeat;
  336. background-size: 100% 100%;
  337. font-weight: 500;
  338. font-size: 16rpx;
  339. color: #FFFFFF;
  340. text-align: center;
  341. line-height: 35rpx;
  342. }
  343. }
  344. .hdqd-img {
  345. position: absolute;
  346. right: 22rpx;
  347. top: 25rpx;
  348. width: 123rpx;
  349. }
  350. }
  351. }
  352. }
  353. }
  354. }
  355. }
  356. </style>