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

503 lines
12 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
9 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
10 months ago
10 months ago
9 months ago
10 months ago
9 months ago
10 months ago
10 months ago
9 months ago
10 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. @click="$refs.popup.open()">
  9. <image class="address-img" src="@/static/image/home/address-icon.png" mode="widthFix"></image>
  10. <view>{{ selectArea.city }}</view>
  11. <image class="sjx-img" src="@/static/image/home/sjx-icon.png" mode="widthFix"></image>
  12. </view>
  13. <view class="search-box-r">
  14. <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>
  15. </view>
  16. </view>
  17. <view class="swipe-box">
  18. <uv-swiper :list="list" keyName="image" height="336rpx" radius="30rpx" bgColor="transparent" indicator indicatorMode="dot"></uv-swiper>
  19. </view>
  20. <view class="ydsk-box">
  21. <view class="ydsk-box-title">悦动时刻</view>
  22. <view class="ydsk-box-gird">
  23. <view class="gird-l" @click="skip('')">
  24. <view class="left-box">
  25. <view class="title-box">
  26. <view>活动签到</view>
  27. <view>签到有好礼</view>
  28. </view>
  29. <view class="btn-box">立即查看</view>
  30. </view>
  31. <image class="hdqd-img" :src="configList.index_sign" mode="widthFix"></image>
  32. <!-- <image class="hdqd-img" src="@/static/image/home/hdqd-img.png" mode="widthFix"></image> -->
  33. </view>
  34. <view class="gird-r">
  35. <view class="hd-box" @click="skip('activeList')">
  36. <view class="left-box">
  37. <view class="title-box">
  38. 活动
  39. </view>
  40. <view class="btn-box">立即查看</view>
  41. </view>
  42. <image class="hdqd-img" :src="configList.index_huodong" mode="widthFix"></image>
  43. <!-- <image class="hdqd-img" src="@/static/image/home/hd-img.png" mode="widthFix"></image> -->
  44. </view>
  45. <view class="hd-box lx-box" @click="skip('travelList')">
  46. <view class="left-box">
  47. <view class="title-box">
  48. 旅行
  49. </view>
  50. <view class="btn-box">立即查看</view>
  51. </view>
  52. <image class="hdqd-img" :src="configList.index_lvxing" mode="widthFix"></image>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="hd-list">
  58. <uv-tabs
  59. @click= "tabs"
  60. :list="hdList"
  61. lineWidth="50rpx"
  62. :lineColor="`url(${lineBg}) 100% 100%`"
  63. :activeStyle="{
  64. color: '#fff',
  65. fontWeight: 'bold',
  66. transform: 'scale(1.05)'
  67. }"
  68. :inactiveStyle="{
  69. color: '#999',
  70. transform: 'scale(1)'
  71. }"
  72. itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"
  73. ></uv-tabs>
  74. <active-item :cardListData="cardListData"/>
  75. <uv-load-more :status="status" fontSize="24rpx" dashed line />
  76. </view>
  77. </view>
  78. <uv-popup ref="popup" mode="bottom" bgColor="">
  79. <view class="popup-cont">
  80. <view class="popup-title">
  81. <view></view>
  82. <view>选择地区</view>
  83. <uv-icon name="close" color="#fff" @click="$refs.popup.close();"></uv-icon>
  84. </view>
  85. <view class="popup-list">
  86. <scroll-view
  87. style="height: 100%;"
  88. scroll-y="true">
  89. <view class="list-item"
  90. v-for="(item,i) in areaList"
  91. :key="i"
  92. @click="$store.commit('setArea', i)">
  93. <view class="item-l" :class="selectArea.id == item.id ? 'chooose-class' : ''">
  94. <view>{{item.city}}</view>
  95. <!-- <view class="item-l-val">{{item.price}}</view> -->
  96. </view>
  97. <uv-icon name="checkmark" color="#FF5858" v-if="selectArea.id == item.id"></uv-icon>
  98. </view>
  99. </scroll-view>
  100. </view>
  101. <view class="confirm-box">
  102. <uv-button @click="clickArea"
  103. text="确定" color="#381615"
  104. shape="circle"
  105. :customStyle="{
  106. color:'#FF5858'
  107. }"></uv-button>
  108. </view>
  109. </view>
  110. </uv-popup>
  111. <tabber select="home" />
  112. </view>
  113. </template>
  114. <script>
  115. // import Position from '@/utils/position.js'
  116. import tabber from '@/components/base/tabbar.vue'
  117. import activeItem from '@/components/active/active-item.vue'
  118. import { mapState } from 'vuex'
  119. export default {
  120. components:{
  121. tabber,
  122. activeItem
  123. },
  124. data() {
  125. return {
  126. status:"loading",
  127. params:{
  128. title:'',
  129. state:0,
  130. pageNo:1,
  131. pageSize:10
  132. },
  133. totalPage:0,
  134. bgColor:'transparent',
  135. navTitle:'',
  136. keyword:'',
  137. list: [],
  138. hdList: [
  139. { id: 0, name: '近期活动' },
  140. { id: 1, name: '往期活动' },
  141. ],
  142. lineBg: require('@/static/image/cart/tabIcon.png'),
  143. cardListData: [],
  144. city : '定位中',
  145. }
  146. },
  147. onPageScroll(e) {
  148. if(e.scrollTop > 50) {
  149. this.bgColor = '#49070c'
  150. this.navTitle = '首页'
  151. }else{
  152. this.bgColor = 'transparent'
  153. this.navTitle = ''
  154. }
  155. },
  156. onReachBottom() {
  157. if(this.params.pageNo >= this.totalPage) return
  158. this.params.pageNo ++
  159. this.getActivityPageList()
  160. },
  161. computed : {
  162. ...mapState(['areaList']),
  163. },
  164. onLoad() {
  165. this.getBanner()
  166. // this.getLocationDetail()
  167. this.$store.commit('getArea', list => {
  168. if(!this.selectArea.id){
  169. this.$store.commit('setArea', 0)
  170. this.$nextTick(() => {
  171. this.getActivityPageList()
  172. })
  173. }
  174. })
  175. if(this.selectArea.id){
  176. this.getActivityPageList()
  177. }
  178. },
  179. onPullDownRefresh() {
  180. this.params.pageNo = 1
  181. this.cardListData = []
  182. this.getActivityPageList()
  183. },
  184. methods:{
  185. getLocationDetail(){
  186. Position.getLocationDetail()
  187. .then(res => {
  188. this.city = res.addressDetail.city
  189. })
  190. },
  191. search() {
  192. this.params.pageNo = 1
  193. this.cardListData = []
  194. this.getActivityPageList()
  195. },
  196. getActivityPageList() {
  197. this.$api('activityPageList', {
  198. ...this.params,
  199. cityId : this.selectArea.id
  200. }, res=>{
  201. uni.stopPullDownRefresh()
  202. if(res.code == 200) {
  203. this.totalPage = res.result.pages
  204. this.cardListData = [...this.cardListData,...res.result.records]
  205. if(this.params.pageNo >= this.totalPage) {
  206. this.status = "nomore"
  207. }else {
  208. this.status = "loadmore"
  209. }
  210. }
  211. })
  212. },
  213. getBanner() {
  214. this.$api('banner',res=>{
  215. if(res.code == 200) {
  216. this.list = res.result
  217. }
  218. })
  219. },
  220. tabs(val) {
  221. this.params.pageNo = 1
  222. this.cardListData = []
  223. this.params.state = val.id
  224. this.getActivityPageList()
  225. },
  226. skip(val) {
  227. if(!val) {
  228. if(!uni.getStorageSync('token')){
  229. return this.$utils.toLogin()
  230. }
  231. uni.setStorageSync('currentState',1)
  232. uni.switchTab({
  233. url:'/pages/index/cart'
  234. })
  235. }else{
  236. uni.navigateTo({
  237. url: `/pages_my/${val}`
  238. })
  239. }
  240. },
  241. clickArea(){
  242. this.tabs({id : 0})
  243. this.$refs.popup.close()
  244. },
  245. }
  246. }
  247. </script>
  248. <style lang="scss">
  249. page {
  250. background-color: #060504;
  251. }
  252. </style>
  253. <style scoped lang="scss">
  254. .page {
  255. .head-box {
  256. background: url('@/static/image/nav-bg.png') no-repeat;
  257. background-size: 100% 100%;
  258. width: 100%;
  259. height: 534rpx;
  260. position: absolute;
  261. top: 0;
  262. z-index: -1;
  263. }
  264. .content {
  265. margin-top: 40rpx;
  266. color: #fff;
  267. padding: 0 30rpx;
  268. padding-top: calc(var(--status-bar-height) + 110rpx);
  269. .search-box {
  270. display: flex;
  271. align-items: center;
  272. margin-bottom: 32rpx;
  273. &-l {
  274. display: flex;
  275. align-items: center;
  276. margin-right: 30rpx;
  277. position: relative;
  278. view {
  279. font-weight: 400;
  280. font-size: 27rpx;
  281. color: #FFFFFF;
  282. margin: 0 18rpx 0 15rpx;
  283. }
  284. .address-img {
  285. width: 26rpx;
  286. }
  287. .sjx-img {
  288. width: 13rpx;
  289. }
  290. }
  291. &-r {
  292. flex:1;
  293. }
  294. }
  295. .swipe-box {
  296. margin-bottom: 41rpx;
  297. }
  298. .ydsk-box {
  299. margin-bottom: 10rpx;
  300. &-title {
  301. width: 250rpx;
  302. background: url('@/static/image/home/title-bg.png') no-repeat;
  303. background-size: 100% 100%;
  304. text-align: center;
  305. height: 31rpx;
  306. line-height: 31rpx;
  307. font-weight: bold;
  308. font-size: 35rpx;
  309. color: #FFFFFF;
  310. margin: 0 auto 33rpx;
  311. }
  312. &-gird {
  313. display: flex;
  314. justify-content: space-between;
  315. .gird-l {
  316. box-sizing: border-box;
  317. width: 378rpx;
  318. height: 278rpx;
  319. padding: 36rpx 0 24rpx 26rpx;
  320. background: url('@/static/image/home/hdqd-bg.png') no-repeat;
  321. background-size: 100% 100%;
  322. position: relative;
  323. .hdqd-img {
  324. position: absolute;
  325. right: 34rpx;
  326. top: 48rpx;
  327. width: 200rpx;
  328. }
  329. .left-box {
  330. height: 100%;
  331. display: flex;
  332. flex-direction: column;
  333. justify-content: space-between;
  334. .title-box {
  335. view {
  336. font-weight: bold;
  337. font-size: 29rpx;
  338. color: #060504;
  339. &:nth-child(2) {
  340. font-weight: 400;
  341. font-size: 21rpx;
  342. color: #4C4C4C;
  343. margin-top: 20rpx;
  344. }
  345. }
  346. }
  347. .btn-box {
  348. width: 108rpx;
  349. height: 41rpx;
  350. background: url('@/static/image/home/hdqd-btn.png') no-repeat;
  351. background-size: 100% 100%;
  352. font-weight: 500;
  353. font-size: 17rpx;
  354. color: #FFFFFF;
  355. text-align: center;
  356. line-height: 41rpx;
  357. }
  358. }
  359. }
  360. .gird-r {
  361. .hd-box {
  362. width: 288rpx;
  363. height: 130rpx;
  364. padding: 25rpx 0 24rpx 26rpx;
  365. box-sizing: border-box;
  366. background: url('@/static/image/home/hd-bg.png') no-repeat;
  367. background-size: 100% 100%;
  368. position: relative;
  369. .left-box {
  370. height: 100%;
  371. display: flex;
  372. flex-direction: column;
  373. justify-content: space-between;
  374. .title-box {
  375. font-weight: bold;
  376. font-size: 28rpx;
  377. color: #57270F;
  378. }
  379. .btn-box {
  380. width: 98rpx;
  381. height: 35rpx;
  382. background: url('@/static/image/home/hd-btn.png') no-repeat;
  383. background-size: 100% 100%;
  384. font-weight: 500;
  385. font-size: 16rpx;
  386. color: #FFFFFF;
  387. text-align: center;
  388. line-height: 35rpx;
  389. }
  390. }
  391. .hdqd-img {
  392. position: absolute;
  393. right: 22rpx;
  394. top: 25rpx;
  395. width: 123rpx;
  396. height: 100rpx;
  397. }
  398. }
  399. .lx-box {
  400. width: 288rpx;
  401. height: 130rpx;
  402. padding: 25rpx 0 24rpx 26rpx;
  403. box-sizing: border-box;
  404. background: url('@/static/image/home/lx-bg.png') no-repeat;
  405. background-size: 100% 100%;
  406. position: relative;
  407. margin-top: 18rpx;
  408. .left-box {
  409. height: 100%;
  410. display: flex;
  411. flex-direction: column;
  412. justify-content: space-between;
  413. .title-box {
  414. font-weight: bold;
  415. font-size: 28rpx;
  416. color: #57270F;
  417. }
  418. .btn-box {
  419. width: 98rpx;
  420. height: 35rpx;
  421. background: url('@/static/image/home/lx-btn.png') no-repeat;
  422. background-size: 100% 100%;
  423. font-weight: 500;
  424. font-size: 16rpx;
  425. color: #FFFFFF;
  426. text-align: center;
  427. line-height: 35rpx;
  428. }
  429. }
  430. .hdqd-img {
  431. position: absolute;
  432. right: 22rpx;
  433. top: 25rpx;
  434. width: 123rpx;
  435. height: 100rpx;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. }
  442. .popup-cont {
  443. width: 95%;
  444. margin: 0 auto;
  445. background-image: linear-gradient(to top, #000000, #331212);
  446. height:662rpx;
  447. border-radius: 33rpx 33rpx 0 0;
  448. .popup-title {
  449. display: flex;
  450. align-items: center;
  451. justify-content: space-between;
  452. padding: 54rpx 52rpx;
  453. font-weight: 500;
  454. font-size: 29rpx;
  455. color: #999999;
  456. }
  457. .popup-list {
  458. padding: 0 50rpx;
  459. height: 400rpx;
  460. .list-item {
  461. display: flex;
  462. justify-content: space-between;
  463. align-items: center;
  464. height: 110rpx;
  465. border-bottom: 1px solid #3F3535;
  466. .item-l {
  467. font-weight: 500;
  468. font-size: 29rpx;
  469. color: #CCCCCC;
  470. display: flex;
  471. align-items: center;
  472. .item-l-val {
  473. margin-left: 40rpx;
  474. }
  475. }
  476. .chooose-class {
  477. color: #FF5858;
  478. }
  479. }
  480. }
  481. .confirm-box {
  482. padding: 0 50rpx;
  483. margin-top: 30rpx;
  484. .confirm-btn-box {
  485. }
  486. }
  487. }
  488. }
  489. </style>