推广小程序前端代码
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.

375 lines
9.0 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 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. if(!val) {
  161. uni.switchTab({
  162. url:'/pages/index/cart'
  163. })
  164. uni.setStorageSync('currentState',2)
  165. }else{
  166. uni.navigateTo({
  167. url: `/pages_my/${val}`
  168. })
  169. }
  170. },
  171. }
  172. }
  173. </script>
  174. <style lang="scss">
  175. page {
  176. background-color: #060504;
  177. }
  178. </style>
  179. <style scoped lang="scss">
  180. .page {
  181. .head-box {
  182. background: url('@/static/image/nav-bg.png') no-repeat;
  183. background-size: 100% 100%;
  184. width: 100%;
  185. height: 534rpx;
  186. position: absolute;
  187. }
  188. .content {
  189. color: #fff;
  190. padding: 0 30rpx;
  191. padding-top: calc(var(--status-bar-height) + 110rpx);
  192. .search-box {
  193. display: flex;
  194. align-items: center;
  195. margin-bottom: 32rpx;
  196. &-l {
  197. display: flex;
  198. align-items: center;
  199. margin-right: 30rpx;
  200. view {
  201. font-weight: 400;
  202. font-size: 27rpx;
  203. color: #FFFFFF;
  204. margin: 0 18rpx 0 15rpx;
  205. }
  206. .address-img {
  207. width: 26rpx;
  208. }
  209. .sjx-img {
  210. width: 13rpx;
  211. }
  212. }
  213. &-r {
  214. flex:1;
  215. }
  216. }
  217. .swipe-box {
  218. margin-bottom: 41rpx;
  219. }
  220. .ydsk-box {
  221. margin-bottom: 10rpx;
  222. &-title {
  223. width: 250rpx;
  224. background: url('@/static/image/home/title-bg.png') no-repeat;
  225. background-size: 100% 100%;
  226. text-align: center;
  227. height: 31rpx;
  228. line-height: 31rpx;
  229. font-weight: bold;
  230. font-size: 35rpx;
  231. color: #FFFFFF;
  232. margin: 0 auto 33rpx;
  233. }
  234. &-gird {
  235. display: flex;
  236. justify-content: space-between;
  237. .gird-l {
  238. box-sizing: border-box;
  239. width: 378rpx;
  240. height: 278rpx;
  241. padding: 36rpx 0 24rpx 26rpx;
  242. background: url('@/static/image/home/hdqd-bg.png') no-repeat;
  243. background-size: 100% 100%;
  244. position: relative;
  245. .hdqd-img {
  246. position: absolute;
  247. right: 34rpx;
  248. top: 48rpx;
  249. width: 200rpx;
  250. }
  251. .left-box {
  252. height: 100%;
  253. display: flex;
  254. flex-direction: column;
  255. justify-content: space-between;
  256. .title-box {
  257. view {
  258. font-weight: bold;
  259. font-size: 29rpx;
  260. color: #060504;
  261. &:nth-child(2) {
  262. font-weight: 400;
  263. font-size: 21rpx;
  264. color: #4C4C4C;
  265. margin-top: 20rpx;
  266. }
  267. }
  268. }
  269. .btn-box {
  270. width: 108rpx;
  271. height: 41rpx;
  272. background: url('@/static/image/home/hdqd-btn.png') no-repeat;
  273. background-size: 100% 100%;
  274. font-weight: 500;
  275. font-size: 17rpx;
  276. color: #FFFFFF;
  277. text-align: center;
  278. line-height: 41rpx;
  279. }
  280. }
  281. }
  282. .gird-r {
  283. .hd-box {
  284. width: 288rpx;
  285. height: 130rpx;
  286. padding: 25rpx 0 24rpx 26rpx;
  287. box-sizing: border-box;
  288. background: url('@/static/image/home/hd-bg.png') no-repeat;
  289. background-size: 100% 100%;
  290. position: relative;
  291. .left-box {
  292. height: 100%;
  293. display: flex;
  294. flex-direction: column;
  295. justify-content: space-between;
  296. .title-box {
  297. font-weight: bold;
  298. font-size: 28rpx;
  299. color: #57270F;
  300. }
  301. .btn-box {
  302. width: 98rpx;
  303. height: 35rpx;
  304. background: url('@/static/image/home/hd-btn.png') no-repeat;
  305. background-size: 100% 100%;
  306. font-weight: 500;
  307. font-size: 16rpx;
  308. color: #FFFFFF;
  309. text-align: center;
  310. line-height: 35rpx;
  311. }
  312. }
  313. .hdqd-img {
  314. position: absolute;
  315. right: 22rpx;
  316. top: 25rpx;
  317. width: 123rpx;
  318. }
  319. }
  320. .lx-box {
  321. width: 288rpx;
  322. height: 130rpx;
  323. padding: 25rpx 0 24rpx 26rpx;
  324. box-sizing: border-box;
  325. background: url('@/static/image/home/lx-bg.png') no-repeat;
  326. background-size: 100% 100%;
  327. position: relative;
  328. margin-top: 18rpx;
  329. .left-box {
  330. height: 100%;
  331. display: flex;
  332. flex-direction: column;
  333. justify-content: space-between;
  334. .title-box {
  335. font-weight: bold;
  336. font-size: 28rpx;
  337. color: #57270F;
  338. }
  339. .btn-box {
  340. width: 98rpx;
  341. height: 35rpx;
  342. background: url('@/static/image/home/lx-btn.png') no-repeat;
  343. background-size: 100% 100%;
  344. font-weight: 500;
  345. font-size: 16rpx;
  346. color: #FFFFFF;
  347. text-align: center;
  348. line-height: 35rpx;
  349. }
  350. }
  351. .hdqd-img {
  352. position: absolute;
  353. right: 22rpx;
  354. top: 25rpx;
  355. width: 123rpx;
  356. }
  357. }
  358. }
  359. }
  360. }
  361. }
  362. }
  363. </style>