hm-examples/pagesB/mysharer/mysharer.vue

144 lines
4.0 KiB
Vue
Raw Normal View History

2022-04-25 06:38:26 +00:00
<template>
<view>
<!-- 状态栏 -->
<status-nav :titleVal="'我的分享人'" :statusTitle="true"></status-nav>
<view class="bacf posiszy navHeight" :style="{paddingTop: statusHeight+'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}}({{itemye.num}})</view>
</view>
</view>
<view :style="{paddingTop: (statusHeight*1+53)+'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> -->
<!-- 底部客服 -->
<public-customer :nbottom="100"></public-customer>
</view>
</template>
<script>
export default {
data() {
return {
flag:0,
cateList:[
{title:'一级',num:0,grade:'first'},
{title:'二级',num:0,grade:'second'},
],
showTop:false,//是否显示返回顶部
dataList:[
[],
[],
],
page:1,
size:20,
total:'',//总数
isZanw:true,
}
},
computed: {
// 主题颜色
publicColor() {
return this.$store.state.publicColor
},
statusHeight() {
return this.$store.state.statusHeight
}
},
onPageScroll(e) {
e.scrollTop > 360 ? this.showTop = true : this.showTop = false
},
onReachBottom() {//触底事件
if(this.total!=this.dataList[this.flag].length){
this.page++
this.checkPeople()
} else {
if(this.isZanw) this.$toolAll.tools.showToast('暂无更多分享人','none',1000)
this.isZanw = false
}
},
onShow() {
// 禁用小程序分享
this.$toolAll.tools.disableShareEv();
},
onLoad(options) {
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
}
})
},
checkPeople(){//查询分享一二级列表人数
this.$requst.post('user/share-users',{grade:this.cateList[this.flag].grade,page:this.page,size:this.size}).then(res=>{
if(this.flag){
if(this.page==1) this.dataList[1] = [];
} else {
if(this.page==1) this.dataList[0] = [];
}
if(res.code==0){
if(res.data.list.length!=0){
res.data.list.forEach(item=>{
let obj = {
src:item.headimgurl,
name:item.nickname,
time:item.created_at,
action:item.invite_source,
num:item.score
}
this.dataList[this.flag].push(obj)
})
this.total = res.data.total
}
}
})
},
backTop(){//回到顶部事件
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
chooseye(index){
this.page = 1;
this.flag = index;
this.checkPeople();
}
}
}
</script>
<style>
</style>