hengmei-two/pagesB/mysharer/mysharer.vue

135 lines
4.2 KiB
Vue
Raw Normal View History

2021-08-19 06:40:59 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav>
<!-- 输入框 -->
<view class="bacf posiszy navHeight" :style="{paddingTop: statusHNH+'px'}">
<view class="disja pad-sx30">
<!-- <view @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{dataList[indexye].length}})</view> -->
<view @tap="chooseye(indexye)" :style="{color:flag==indexye?publicColor:''}" v-for="(itemye,indexye) in cateList" :key="indexye">{{itemye.title}}({{itemye.num}})</view>
</view>
</view>
<view :style="{paddingTop: navH+'px'}">
<view v-if="dataList[flag].length!=0">
<view class="disjbac bbot pad-sx40 mar-zy50" v-for="(iteml,indexl) in dataList[flag]" :key="indexl">
<view class="disac">
<!-- 头像 -->
<image class="radius20" :src="iteml.src" style="width: 100rpx;height: 100rpx;" mode="aspectFill"></image>
<view class="mar-z25">
<!-- 昵称 -->
<view class="fon32 bold">{{iteml.name}}</view>
<!-- 时间 -->
<view class="fon24 col80 mar-s10">{{iteml.time}}</view>
</view>
</view>
<view class="tright">
<!-- 方式 -->
<view class="fon24 col80">{{iteml.action}}</view>
<!-- 收益 -->
<view class="fon28 bold mar-s10" style="color: #EB5929;">+{{iteml.num}}</view>
</view>
</view>
</view>
<view v-else class="disjcac fc" style="margin-top: 40%;">
<image src="/static/public/nothing.png" style="width: 474rpx;height: 273rpx;" mode="aspectFill"></image>
<view class="fon24 col3">您还没有分享人快去分享吧</view>
</view>
</view>
<!-- 返回顶部 -->
<!-- <back-top :showTop="showTop" @backTop="backTop"></back-top> -->
</view>
</template>
<script>
export default {
data() {
return {
statusHNH:uni.getStorageSync('statusHNH'),
flag:0,
publicColor:uni.getStorageSync('publicColor'),//主题颜色
cateList:[
{title:'一级',num:0,grade:'first'},
{title:'二级',num:0,grade:'second'},
],
showTop:false,//是否显示返回顶部
dataList:[
[],
[],
],
navH:uni.getStorageSync('navHeight'),
page:1,
size:20,
total:'',//总数
isZanw:true,
}
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
if(this.total!=this.dataList.length){
this.page++
this.checkPeople()
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多分享人','none',1000)
this.isZanw = false
}
},
onLoad() {
if(uni.getStorageSync('navHeight')==''){
const query = wx.createSelectorQuery()
query.select('.navHeight').boundingClientRect((rect) => {
uni.setStorageSync('navHeight',rect.height)
this.navH = rect.height
}).exec()
}
this.checkShare()//查询一二级分享总人数
this.checkPeople()//查询分享一二级列表人数
},
methods: {
checkShare(){//查询一二级分享总人数
this.$requst.post('user/share-count').then(res=>{
// console.log('查询用户的分享统计记录:',res);
if(res.code==0){
this.cateList[0].num = res.data.user_count.first
this.cateList[1].num = res.data.user_count.second
}
},error=>{})
},
checkPeople(){//查询分享一二级列表人数
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
console.log('查询分享一二级列表人数列表:',res);
if(res.code==0){
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let obj = {
src:item.account.headimgurl,
name:item.account.nickname,
time:item.created_at,
action:item.invite_source,
num:item.score
}
this.dataList[this.flag].push(obj)
})
this.total = res.data.total
}
}
},error=>{})
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
chooseye(index){
this.flag = index
}
}
}
</script>
<style>
</style>