diff --git a/common/js/config.js b/common/js/config.js index 8c40c53..4279dca 100644 --- a/common/js/config.js +++ b/common/js/config.js @@ -16,7 +16,7 @@ export default { //https://demo-guojiang-ec-api.guojiang.club/ baseUrl: process.env.NODE_ENV === 'development' ? - 'http://192.168.3.29/' : 'https://v3-ec-admin-dev.guojiang.club/', // 运行时自动替换变量 + 'http://192.168.3.81/' : 'https://v3-ec-admin-dev.guojiang.club/', // 运行时自动替换变量 }, PACKAGES: { activity: false, diff --git a/pages/point/detail/detail.vue b/pages/point/detail/detail.vue index dc2028f..12690d8 100644 --- a/pages/point/detail/detail.vue +++ b/pages/point/detail/detail.vue @@ -8,7 +8,7 @@ - 78326478 + {{point_data.point}} 兑换礼品 @@ -31,15 +31,24 @@ - - - {{ index % 2 ? '-250' : '+80' }} - 2021-09-01 18:27:58 - - - 商城内消费 - - + + + + {{ index % 2 ? '-250' : '+80' }} + 2021-09-01 18:27:58 + + + 商城内消费 + + + + + {{ loadingText }} + + + @@ -48,15 +57,92 @@ export default { data(){ return { - date: '' + date: '', + point_data: '', + list: [], + page: 1, + isPage: true, + loadingClass: true, + loadingText: '正在加载中', + scrollH: 0, + nav_height: 0, + isRefresher: true, + pageSize: 10 + } + }, + computed: { + autoHeight(){ + return `calc(${this.scrollH}px - ${this.nav_height}px - 660rpx)`; } }, onLoad(){ - + let info = uni.getSystemInfoSync(); + this.scrollH = info.screenHeight; + this.getPointNum(); + this.getPointList(); }, methods: { dateChange(event){ this.date = event.detail.value; + }, + getPointNum(){ + this.$http.get({ + api: 'api/users/point', + header: { + Authorization: this.$cookieStorage.get('user_token') + } + }).then(res => { + this.point_data = res.data.data + console.log(this.point_data) + }) + }, + // 页面触底,加载下一页 + onScrolltolower(){ + if(this.isPage){ + this.page = this.page + 1; + this.getMyActivity(); + } + }, + // 下拉刷新处理 + refreshFn(options){ + this.page = 1; + this.isPage = true; + this.loadingClass = true; + this.list = [] + this.loadingText = '正在加载中'; + this.getPointList(options); + }, + // scroll-view 下拉刷新 + onRefresherrefresh(){ + this.isRefresher = true; + this.refreshFn({type: 'scrollRefresh'}); + }, + getPointList(options = {}){ + this.$http.get({ + api: 'api/users/point/list', + header: { + Authorization: this.$cookieStorage.get('user_token') + } + }).then(res => { + console.log("----", res); + let isPage = this.page < res.data.meta.pagination.total_pages?true:false; + this.isPage = isPage; + if(!isPage) { + this.loadingClass = false; + this.loadingText = '没有更多数据啦~'; + } + if(options.type == 'pageRefresh') { + uni.stopPullDownRefresh(); + }else if(options.type == 'scrollRefresh') { + this.isRefresher = false; + } + if(this.page == 1) { + this.list = res.data.data; + }else { + this.list.push(...res.data.data); + } + + }) } } } diff --git a/pages/shop/seckillList.vue b/pages/shop/seckillList.vue index db9c390..39747e2 100644 --- a/pages/shop/seckillList.vue +++ b/pages/shop/seckillList.vue @@ -1,29 +1,38 @@ @@ -32,19 +41,71 @@ export default { data(){ return { - list: [] + list: [], + page: 1, + isPage: true, + loadingClass: true, + loadingText: '正在加载中', + scrollH: 0, + nav_height: 0, + isRefresher: true, + pageSize: 10 + } + }, + computed: { + autoHeight(){ + return `calc(${this.scrollH}px - ${this.nav_height}px - 180rpx)`; } }, onLoad(){ + let info = uni.getSystemInfoSync(); + this.scrollH = info.screenHeight; this.getSeckillList(); }, methods: { - getSeckillList(){ + // 页面触底,加载下一页 + onScrolltolower(){ + if(this.isPage){ + this.page = this.page + 1; + this.getMyActivity(); + } + }, + // 下拉刷新处理 + refreshFn(options){ + this.page = 1; + this.isPage = true; + this.loadingClass = true; + this.list = [] + this.loadingText = '正在加载中'; + this.getSeckillList(options); + }, + // scroll-view 下拉刷新 + onRefresherrefresh(){ + this.isRefresher = true; + this.refreshFn({type: 'scrollRefresh'}); + }, + getSeckillList(options = {}){ this.$http.get({ api: 'api/seckill/all' }).then(res => { console.log("----", res); - this.list = res.data.data; + let isPage = this.page < res.data.meta.pagination.total_pages?true:false; + this.isPage = isPage; + if(!isPage) { + this.loadingClass = false; + this.loadingText = '没有更多数据啦~'; + } + if(options.type == 'pageRefresh') { + uni.stopPullDownRefresh(); + }else if(options.type == 'scrollRefresh') { + this.isRefresher = false; + } + if(this.page == 1) { + this.list = res.data.data; + }else { + this.list.push(...res.data.data); + } + }) } } @@ -112,7 +173,7 @@ } .desc{ width: 281rpx; - height: 35rpx; + height: max-content; border-radius: 3rpx; background-color: #E9F2F2; font-size: 24rpx; @@ -120,7 +181,6 @@ display: flex; justify-content: center; align-items: center; - margin-top: 10rpx; } .price>text:nth-child(1){ font-size: 36rpx;