diff --git a/pages-userInfo/extends/extends.vue b/pages-userInfo/extends/extends.vue index f040fd0..6963b32 100644 --- a/pages-userInfo/extends/extends.vue +++ b/pages-userInfo/extends/extends.vue @@ -15,9 +15,12 @@ 已邀请 - - - -----已经到底啦----- + + + + + + @@ -34,7 +37,9 @@ pageSize: 10, pageNum: 1, userInfo: {}, - flag: false + flag: false, + loadStatus:'noMore', //加载样式:more - 加载前样式,loading - 加载中样式,noMore - 没有数据样式 + isLoadMore:false, //是否加载中 } }, created() { @@ -65,14 +70,14 @@ uni.stopPullDownRefresh() }, // 上划加载更多 - onReachBottom() { - if (this.inviteLogList.length > this.pageSize*this.pageNum-1) { - this.flag = false; - this.pageNum += 1 - this.getInviteLog(); - }else{ - this.flag = true; - } + onReachBottom() {//上拉触底函数 + if(!this.isLoadMore) { //此处判断,上锁,防止重复请求 + this.isLoadMore=true + if (this.loadStatus === "more") { + this.pageNum += 1 //每次上拉请求新的一页 + this.getInviteLog(); + } + } }, onShareAppMessage(res) { if (res.from === 'button') {// 来自页面内分享按钮 @@ -87,6 +92,7 @@ // 获取邀请记录 async getInviteLog() { let that = this; + that.loadStatus = 'loading'; const res = await getInviteLog({ pageSize: that.pageSize, pageNum: that.pageNum, @@ -95,12 +101,22 @@ console.log('res', res) if (res.data.code === 200) { that.inviteLogList.push(...res.data.rows) - console.log('inviteLogList', that.inviteLogList) + if(res.data.rows.length < that.pageSize){ //判断接口返回数据量小于请求数据量,则表示此为最后一页 + that.isLoadMore = true + that.loadStatus = 'noMore' + }else{ + this.loadStatus = 'more'; + that.isLoadMore = false + } } else { uni.showModal({ content: '邀请记录加载失败!', showCancel: false }); + that.isLoadMore = false + if(that.page > 1){ + that.page -= 1 + } } }, } diff --git a/pages-userInfo/withdraw/withdrawDetail.vue b/pages-userInfo/withdraw/withdrawDetail.vue index ff48b7f..d1f9d8d 100644 --- a/pages-userInfo/withdraw/withdrawDetail.vue +++ b/pages-userInfo/withdraw/withdrawDetail.vue @@ -17,7 +17,7 @@ 提现金额: - + 渠道: diff --git a/pages-userInfo/withdraw/withdrawLog.vue b/pages-userInfo/withdraw/withdrawLog.vue index fa9a99f..c037f8d 100644 --- a/pages-userInfo/withdraw/withdrawLog.vue +++ b/pages-userInfo/withdraw/withdrawLog.vue @@ -28,7 +28,10 @@ - -----已经到底啦----- + + + + @@ -43,13 +46,14 @@ pageSize: 10, pageNum: 1, userInfo: {}, - flag: false + flag: false, + loadStatus:'noMore', //加载样式:more - 加载前样式,loading - 加载中样式,noMore - 没有数据样式 + isLoadMore:false, //是否加载中 } }, created() { const userInfo = uni.getStorageSync('userInfo') if (!userInfo) { - console.log('havent userInfo') uni.showModal({ content: '艺术家账户过期,请重新登录!', showCancel: false, @@ -62,7 +66,6 @@ }); } else { this.userInfo = userInfo; - console.log('have userInfo') } this.getWithdrawList(); }, @@ -74,37 +77,47 @@ uni.stopPullDownRefresh() }, // 上划加载更多 - onReachBottom() { - if (this.withdrawList.length > this.pageSize*this.pageNum-1) { - this.flag = false; - this.pageNum += 1 - this.getWithdrawList(); - }else{ - this.flag = true; - } + onReachBottom() {//上拉触底函数 + if(!this.isLoadMore) { //此处判断,上锁,防止重复请求 + this.isLoadMore=true + if (this.loadStatus === "more") { + this.pageNum += 1 //每次上拉请求新的一页 + this.getWithdrawList(); + } + } }, methods: { // 查询提现记录列表 async getWithdrawList() { let that = this; + that.loadStatus = 'loading'; const res = await getWithdrawList({ pageSize: that.pageSize, pageNum: that.pageNum, creatorId: that.userInfo.id }) - console.log('res', res) if (res.data.code === 200) { that.withdrawList.push(...res.data.rows) + if(res.data.rows.length < that.pageSize){ //判断接口返回数据量小于请求数据量,则表示此为最后一页 + that.isLoadMore = true + that.loadStatus = 'noMore' + }else{ + this.loadStatus = 'more'; + that.isLoadMore = false + } } else { uni.showModal({ content: '提现记录列表数据加载失败!', showCancel: false }); + that.isLoadMore = false + if(that.page > 1){ + that.page -= 1 + } } }, targetToDetail(orderId) { - console.log('orderId', orderId) if (orderId) { uni.navigateTo({ url: 'withdrawDetail?orderId=' + orderId, diff --git a/pages.json b/pages.json index 07ef679..440f284 100644 --- a/pages.json +++ b/pages.json @@ -4,7 +4,7 @@ "path": "pages/index/index", "style": { "navigationBarTitleText": "次元Hub", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "navigationBarBackgroundColor": "#141b29", "navigationStyle": "custom" } @@ -13,7 +13,7 @@ "path": "pages/profit/profit", "style": { "navigationBarTitleText": "收益", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "navigationStyle": "custom" } }, @@ -99,7 +99,7 @@ "path": "pages/userInfo/userInfo", "style": { "navigationBarTitleText": "", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "navigationStyle": "custom" } } @@ -132,7 +132,7 @@ "path": "setting/setting", "style": { "navigationBarTitleText": "系统设置", - "enablePullDownRefresh": true + "enablePullDownRefresh": false } }, { "path": "notice/notice", diff --git a/pages/index/index.vue b/pages/index/index.vue index 2322915..750dfdf 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -182,11 +182,11 @@ }, // 跳转banner详情页 linkTo(item) { - if (item.id) { + /*if (item.id) { uni.navigateTo({ url: '../index/banner' }); - } + }*/ }, // 获取banner列表 diff --git a/pages/index/material/imgDetail.vue b/pages/index/material/imgDetail.vue index 5c64511..e9cee03 100644 --- a/pages/index/material/imgDetail.vue +++ b/pages/index/material/imgDetail.vue @@ -1,7 +1,13 @@ @@ -40,7 +47,6 @@ data() { return { statusCurrent: 0, - activeColor: '#007aff', styleType: 'text', statusList: ['待审核','审核拒绝','已上架','已下架'], typeList:[], @@ -49,12 +55,14 @@ typeId: 1, status: 0, pageNum: 1, - pageSize: 10, + pageSize: 18, creatorImgList: [], userInfo: {}, imgWidth: 0, // 图片宽 imgHeight: 0, // 图片高 - flag: false + flag: false, + loadStatus:'noMore', //加载样式:more - 加载前样式,loading - 加载中样式,noMore - 没有数据样式 + isLoadMore:false, //是否加载中 } }, onLoad(option) { @@ -89,8 +97,7 @@ console.log('have userInfo') } this.queryListType(); - this.imgWidth = 750/3-20 + 'rpx' - this.imgHeight = 750/3-20 + 'rpx' + }, // 下拉刷新 onPullDownRefresh(){ @@ -100,16 +107,16 @@ this.flag = false; uni.stopPullDownRefresh(); }, - // 上划加载更多 - onReachBottom() { - if (this.creatorImgList.length > this.pageSize*this.pageNum-1) { - this.flag = false; - this.pageNum += 1 - this.listTiktokImgIn() - }else{ - this.flag = true; - } - }, + // 上划加载更多 + onReachBottom(e) {//上拉触底函数 + if(!this.isLoadMore) { //此处判断,上锁,防止重复请求 + this.isLoadMore=true + if (this.loadStatus === "more") { + this.pageNum += 1 //每次上拉请求新的一页 + this.listTiktokImgIn(); + } + } + }, methods: { // 前往详情页 targetDetail(item) { @@ -120,14 +127,13 @@ key: 'detailId', data: item.id, success() { - console.log(111111) uni.navigateTo({ url: `/pages/index/material/imgDetail?categoryId=${that.typeId}&categoryIndex=${that.typeCurrent}&status=${that.status}`, success:function(){ - console.log('跳转成功!') + // console.log('跳转成功!') }, fail:function(){ - console.log('跳转失败!') + // console.log('跳转失败!') } }) } @@ -144,31 +150,15 @@ // that.typeCurrent = 0; // that.typeId = that.typeIdList[0]; // console.log('status',that.status) + that.pageNum = 1; + that.loadStatus = 'loading'; + that.isLoadMore = false; uni.showLoading({ title: "加载中", mask: true, success() { // 查询指定艺术家图片集合 - const param = { - creatorId: that.userInfo.id, - typeId: that.typeId, - pageSize: that.pageSize, - pageNum: that.pageNum, - status: that.status - }; - listTiktokImgIn(param).then(res => { - console.log('that.typeId',that.typeId); - console.log('that.status',that.status); - if(res.data.code === 200){ - that.creatorImgList.push(...res.data.rows) - //console.log('调用成功1!', that.creatorImgList); - }else { - uni.showModal({ - content: "艺术家图片列表数据加载失败!", - showCancel: false, - }); - } - }); + that.listTiktokImgIn(); }, complete() { uni.hideLoading(); @@ -181,52 +171,16 @@ that.creatorImgList = []; that.typeId = that.typeIdList[e2.currentIndex]; that.typeCurrent = e2.currentIndex; + that.pageNum = 1; + that.loadStatus = 'loading'; + that.isLoadMore = false; //console.log('typeId',that.typeId) uni.showLoading({ title: "加载中", mask: true, success() { // 查询指定艺术家图片集合 - const param = { - creatorId: that.userInfo.id, - typeId: that.typeId, - pageSize: that.pageSize, - pageNum: that.pageNum, - status: that.status - }; - listTiktokImgIn(param).then(res => { - // console.log('that.typeId',that.typeId); - // console.log('that.status',that.status); - if(res.data.code === 200){ - that.creatorImgList.push(...res.data.rows) - // console.log(that.creatorImgList) - //console.log('调用成功2!', that.creatorImgList); - if(that.typeId === 1){ - that.imgWidth = 750/3-20 + 'rpx' - that.imgHeight = 750/3-20 + 'rpx' - }else if(that.typeId === 2){ - that.imgWidth = 750/3-30 + 'rpx' - that.imgHeight = 750/3+60 + 'rpx' - }else if(that.typeId === 3){ - that.imgWidth = 750/3-30 + 'rpx' - that.imgHeight = 750/3+60 + 'rpx' - }else if(that.typeId === 4){ - that.imgWidth = 750/3+100 + 'rpx' - that.imgHeight = 750/3 + 'rpx' - }else if(that.typeId === 5){ - that.imgWidth = 750/3-20 + 'rpx' - that.imgHeight = 750/3-20 + 'rpx' - }else if(that.typeId === 6){ - that.imgWidth = 750/3-20 + 'rpx' - that.imgHeight = 750/3-20 + 'rpx' - } - }else { - uni.showModal({ - content: "艺术家图片列表数据加载失败!", - showCancel: false, - }); - } - }); + that.listTiktokImgIn(); }, complete() { uni.hideLoading(); @@ -256,6 +210,7 @@ //查询指定艺术家图片集合 async listTiktokImgIn() { let that = this; + that.loadStatus = 'loading'; const res = await listTiktokImgIn({ pageNum: that.pageNum, pageSize: that.pageSize, @@ -264,20 +219,32 @@ creatorId: that.userInfo.id }) if (res.data.code === 200) { + uni.hideLoading(); that.creatorImgList.push(...res.data.rows) - console.log('creatorImgList',that.creatorImgList); + // console.log('creatorImgList',that.creatorImgList); + if(res.data.rows.length < that.pageSize){ //判断接口返回数据量小于请求数据量,则表示此为最后一页 + that.isLoadMore = true + that.loadStatus = 'noMore' + }else{ + this.loadStatus = 'more'; + that.isLoadMore = false + } } else { uni.showModal({ content: '艺术家图片列表加载失败!', showCancel: false }); + that.isLoadMore = false + if(that.page > 1){ + that.page -= 1 + } } } } } -